1 package org.apache.archiva.redback.users.ldap.service; 2 3 /* 4 * Licensed to the Apache Software Foundation (ASF) under one 5 * or more contributor license agreements. See the NOTICE file 6 * distributed with this work for additional information 7 * regarding copyright ownership. The ASF licenses this file 8 * to you under the Apache License, Version 2.0 (the 9 * "License"); you may not use this file except in compliance 10 * with the License. You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, 15 * software distributed under the License is distributed on an 16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 * KIND, either express or implied. See the License for the 18 * specific language governing permissions and limitations 19 * under the License. 20 */ 21 22 import org.apache.archiva.redback.common.ldap.user.LdapUser; 23 24 /** 25 * LdapCacheService 26 * 27 * Service that manages the LDAP caches: LDAP connections and LDAP users 28 * 29 * @author: Maria Odea Ching <oching@apache.org> 30 * @version 31 */ 32 public interface LdapCacheService 33 { 34 /** 35 * Retrieve LDAP user with the given username from the cache. 36 * Returns null if user is not found. 37 * 38 * @param username 39 * @return 40 */ 41 LdapUser getUser( String username ); 42 43 /** 44 * Remove LDAP user with the given username from the cache. 45 * Returns the removed object if it was in the cache. Otherwise, returns null. 46 * 47 * @param username 48 * @return 49 */ 50 boolean removeUser( String username ); 51 52 /** 53 * Remove all LDAP users in the cache. In short, it flushes the cache. 54 * 55 */ 56 void removeAllUsers(); 57 58 /** 59 * Adds the user to the LDAP users cache. 60 * 61 * @param user 62 */ 63 void addUser( LdapUser user ); 64 65 /** 66 * Retrieve the cached LDAP userDn for the given user. 67 * 68 * @param username 69 * @return 70 */ 71 String getLdapUserDn( String username ); 72 73 /** 74 * Remove the cached LDAP userDn for the given user. 75 * 76 * @param username 77 * @return 78 */ 79 boolean removeLdapUserDn( String username ); 80 81 /** 82 * Remove all cached LDAP userDn 83 */ 84 void removeAllLdapUserDn(); 85 86 /** 87 * All the LDAP userDn for the given user to the cache 88 * 89 * @param username 90 * @param userDn 91 */ 92 void addLdapUserDn( String username, String userDn ); 93 }