| | |
| | | import org.opends.server.util.TimeThread; |
| | | |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.loggers.Debug.*; |
| | | import static |
| | | org.opends.server.loggers.debug.DebugLogger.debugCought; |
| | | import static |
| | | org.opends.server.loggers.debug.DebugLogger.debugEnabled; |
| | | import org.opends.server.types.DebugLogLevel; |
| | | import static org.opends.server.loggers.Error.*; |
| | | import static org.opends.server.messages.CoreMessages.*; |
| | | import static org.opends.server.messages.MessageHandler.*; |
| | |
| | | */ |
| | | public abstract class ClientConnection |
| | | { |
| | | /** |
| | | * The fully-qualified name of this class for debugging purposes. |
| | | */ |
| | | private static final String CLASS_NAME = |
| | | "org.opends.server.api.ClientConnection"; |
| | | |
| | | |
| | | |
| | |
| | | */ |
| | | protected ClientConnection() |
| | | { |
| | | assert debugConstructor(CLASS_NAME); |
| | | |
| | | connectTime = TimeThread.getTime(); |
| | | connectTimeString = TimeThread.getUTCTime(); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "finalizeConnectionInternal", |
| | | e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | public long getConnectTime() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getConnectTime"); |
| | | |
| | | return connectTime; |
| | | } |
| | |
| | | */ |
| | | public String getConnectTimeString() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getConnectTimeString"); |
| | | |
| | | return connectTimeString; |
| | | } |
| | |
| | | public final boolean sendIntermediateResponse( |
| | | IntermediateResponse intermediateResponse) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "sendIntermediateResponse", |
| | | String.valueOf(intermediateResponse)); |
| | | |
| | | |
| | | // Invoke the intermediate response plugins for the response |
| | |
| | | boolean sendNotification, |
| | | int messageID, Object... arguments) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "disconnect", |
| | | String.valueOf(disconnectReason), |
| | | String.valueOf(sendNotification), |
| | | String.valueOf(messageID), |
| | | String.valueOf(arguments)); |
| | | |
| | | String message = getMessage(messageID, arguments); |
| | | disconnect(disconnectReason, sendNotification, message, |
| | |
| | | */ |
| | | public boolean bindInProgress() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "bindInProgress"); |
| | | |
| | | return bindInProgress; |
| | | } |
| | |
| | | */ |
| | | public void setBindInProgress(boolean bindInProgress) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "setBindInProgress", |
| | | String.valueOf(bindInProgress)); |
| | | |
| | | this.bindInProgress = bindInProgress; |
| | | } |
| | |
| | | */ |
| | | public boolean mustChangePassword() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "mustChangePassword"); |
| | | |
| | | if (authenticationInfo == null) |
| | | { |
| | |
| | | */ |
| | | public void setMustChangePassword(boolean mustChangePassword) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "setMustChangePassword", |
| | | String.valueOf(mustChangePassword)); |
| | | |
| | | if (authenticationInfo == null) |
| | | { |
| | |
| | | public CopyOnWriteArrayList<PersistentSearch> |
| | | getPersistentSearches() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getPersistentSearches"); |
| | | |
| | | return persistentSearches; |
| | | } |
| | |
| | | public void registerPersistentSearch(PersistentSearch |
| | | persistentSearch) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "registerPersistentSearch", |
| | | String.valueOf(persistentSearch)); |
| | | |
| | | persistentSearches.add(persistentSearch); |
| | | } |
| | |
| | | public void deregisterPersistentSearch(PersistentSearch |
| | | persistentSearch) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "deregisterPersistentSearch", |
| | | String.valueOf(persistentSearch)); |
| | | |
| | | persistentSearches.remove(persistentSearch); |
| | | } |
| | |
| | | */ |
| | | public AuthenticationInfo getAuthenticationInfo() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getAuthenticationInfo"); |
| | | |
| | | return authenticationInfo; |
| | | } |
| | |
| | | public void setAuthenticationInfo(AuthenticationInfo |
| | | authenticationInfo) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "setAuthenticationInfo", |
| | | String.valueOf(authenticationInfo)); |
| | | |
| | | if (this.authenticationInfo != null) |
| | | { |
| | |
| | | */ |
| | | public void updateAuthenticationInfo(Entry oldEntry, Entry newEntry) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "updateAuthenticationInfo", |
| | | String.valueOf(oldEntry), |
| | | String.valueOf(newEntry)); |
| | | |
| | | Entry authNEntry = authenticationInfo.getAuthenticationEntry(); |
| | | Entry authZEntry = authenticationInfo.getAuthorizationEntry(); |
| | |
| | | */ |
| | | public void setUnauthenticated() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "setUnauthenticated"); |
| | | |
| | | this.authenticationInfo = new AuthenticationInfo(); |
| | | this.sizeLimit = DirectoryServer.getSizeLimit(); |
| | |
| | | public boolean hasPrivilege(Privilege privilege, |
| | | Operation operation) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "hasPrivilege", |
| | | String.valueOf(privilege), |
| | | String.valueOf(operation)); |
| | | |
| | | boolean result = privileges.contains(privilege); |
| | | if (operation == null) |
| | |
| | | public boolean hasAllPrivileges(Privilege[] privileges, |
| | | Operation operation) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "hasAllPrivileges", |
| | | String.valueOf(privileges), |
| | | String.valueOf(operation)); |
| | | |
| | | HashSet<Privilege> privSet = this.privileges; |
| | | boolean result = true; |
| | |
| | | */ |
| | | private void updatePrivileges(Entry entry, boolean isRoot) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "updatePrivileges", |
| | | String.valueOf(entry)); |
| | | |
| | | HashSet<Privilege> newPrivileges = new HashSet<Privilege>(); |
| | | HashSet<Privilege> removePrivileges = new HashSet<Privilege>(); |
| | |
| | | */ |
| | | public final Object getSASLAuthStateInfo() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getSASLAuthStateInfo"); |
| | | |
| | | return saslAuthState; |
| | | } |
| | |
| | | */ |
| | | public final void setSASLAuthStateInfo(Object saslAuthState) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "setSASLAuthStateInfo", |
| | | String.valueOf(saslAuthState)); |
| | | |
| | | this.saslAuthState = saslAuthState; |
| | | } |
| | |
| | | */ |
| | | public final int getSizeLimit() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getSizeLimit"); |
| | | |
| | | return sizeLimit; |
| | | } |
| | |
| | | */ |
| | | public final void setSizeLimit(int sizeLimit) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "setSizeLimit", |
| | | String.valueOf(sizeLimit)); |
| | | |
| | | this.sizeLimit = sizeLimit; |
| | | } |
| | |
| | | */ |
| | | public final int getLookthroughLimit() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getLookthroughLimit"); |
| | | |
| | | return lookthroughLimit; |
| | | } |
| | |
| | | */ |
| | | public final void setLookthroughLimit(int lookthroughLimit) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "setLookthroughLimit", |
| | | String.valueOf(lookthroughLimit)); |
| | | |
| | | this.lookthroughLimit = lookthroughLimit; |
| | | } |
| | |
| | | */ |
| | | public final int getTimeLimit() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getTimeLimit"); |
| | | |
| | | return timeLimit; |
| | | } |
| | |
| | | */ |
| | | public final void setTimeLimit(int timeLimit) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "setTimeLimit", |
| | | String.valueOf(timeLimit)); |
| | | |
| | | this.timeLimit = timeLimit; |
| | | } |
| | |
| | | public boolean isMemberOf(Group group, Operation operation) |
| | | throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "isMemberOf", String.valueOf(group), |
| | | String.valueOf(operation)); |
| | | |
| | | if (operation == null) |
| | | { |
| | |
| | | public Set<Group> getGroups(Operation operation) |
| | | throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getGroups", |
| | | String.valueOf(operation)); |
| | | |
| | | |
| | | // FIXME -- This probably isn't the most efficient implementation. |
| | |
| | | */ |
| | | public DN getKeyManagerProviderDN() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getKeyManagerProviderDN"); |
| | | |
| | | // In the default implementation, we'll return null. |
| | | return null; |
| | |
| | | */ |
| | | public DN getTrustManagerProviderDN() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getTrustManagerProviderDN"); |
| | | |
| | | // In the default implementation, we'll return null. |
| | | return null; |
| | |
| | | */ |
| | | public final String toString() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "toString"); |
| | | |
| | | StringBuilder buffer = new StringBuilder(); |
| | | toString(buffer); |