Package org.opends.server.protocols.jmx
Class JmxClientConnection
- java.lang.Object
-
- org.opends.server.api.ClientConnection
-
- org.opends.server.protocols.jmx.JmxClientConnection
-
- All Implemented Interfaces:
EventListener,NotificationListener,RequestHandler
public class JmxClientConnection extends ClientConnection implements NotificationListener
This class defines the set of methods and structures that must be implemented by a Directory Server client connection.
-
-
Field Summary
Fields Modifier and Type Field Description protected StringjmxConnectionIDThe JMX connection ID for this client connection.-
Fields inherited from class org.opends.server.api.ClientConnection
authenticationInfo, bindInProgress, saslBindInProgress, startTLSInProgress
-
-
Constructor Summary
Constructors Constructor Description JmxClientConnection(JmxConnectionHandler jmxConnectionHandler, AuthenticationInfo authInfo, ServerContext serverContext)Creates a new Jmx client connection that will be authenticated as as the specified user.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddisconnect(DisconnectReason disconnectReason, boolean sendNotification, LocalizableMessage message)Closes the connection to the client, optionally sending it a message indicating the reason for the closure.voiddisconnectWithoutUnbind(DisconnectReason disconnectReason, LocalizableMessage message)Closes the connection to the client, optionally sending it a message indicating the reason for the closure.protected voidfinalize()Called by the Gc when the object is garbage collected Release the cursor in case the iterator was badly used and releaseCursor was never called.StringgetClientAddress()Retrieves a string representation of the address of the client.intgetClientPort()Retrieves the port number for this connection on the client system if available.ConnectionHandler<?>getConnectionHandler()Retrieves the connection handler that accepted this client connection.longgetConnectionID()Retrieves the unique identifier that has been assigned to this connection.JsonValuegetMonitorSummary()Returns a summary of this client connection in JSON (format that is both human readable and machine parseable).OperationgetOperationInProgress(int messageID)Retrieves the operation in progress with the specified message ID.StringgetProtocol()Retrieves the protocol that the client is using to communicate with the Directory Server.InetAddressgetRemoteAddress()Retrieves theInetAddressassociated with the remote client system.StringgetServerAddress()Retrieves a string representation of the address on the server to which the client connected.intgetServerPort()Retrieves the port number for this connection on the server system if available.intgetSSF()Return the Security Strength Factor of a client connection.Flowable<Response>handle(org.forgerock.services.context.Context context, Request request)Processes the provided request in a reactive way, which should be either aBindRequestor aSearchRequest.voidhandleNotification(Notification notif, Object handback)booleanisConnectionValid()Returns whether the Directory Server believes this connection to be valid and available for communication.booleanisSecure()Indicates whether this client connection is currently using a secure mechanism to communicate with the server.voidprocessBind(BindRequest request)Processes a bind request.ResultprocessSearch(SearchRequest request)Processes an JMX search operation with the provided information.voidremoveOperationInProgress(int messageID)Removes the provided operation from the set of operations in progress for this client connection.protected booleansendIntermediateResponseMessage(Operation operation, IntermediateResponse intermediateResponse)Sends the provided intermediate response message to the client.voidsendSearchEntry(SearchOperation searchOperation, SearchResultEntry searchEntry)Sends the provided search result entry to the client.booleansendSearchReference(SearchOperation searchOperation, SearchResultReference searchReference)Sends the provided search result reference to the client.voidtoString(StringBuilder buffer)Appends a string representation of this client connection to the provided buffer.-
Methods inherited from class org.opends.server.api.ClientConnection
deregisterPersistentSearch, finalizeConnectionInternal, finishBind, finishSaslBind, finishStartTLS, getAuthenticationInfo, getClientHostPort, getConnectTimeString, getIdleTime, getIdleTimeLimit, getKeyManagerProviderDN, getMaxBlockedWriteTimeLimit, getMaxCandidateSetSize, getPersistentSearches, getSASLAuthStateInfo, getServerContext, getServerHostPort, getSizeLimit, getTimeLimit, hasAllPrivileges, hasPrivilege, hasPrivilege, isInnerConnection, mustChangePassword, registerPersistentSearch, sendResponse, sendResponse, setAuthenticationInfo, setIdleTimeLimit, setMaxCandidateSetSize, setMustChangePassword, setResourceLimits, setSASLAuthStateInfo, setSizeLimit, setTimeLimit, setUnauthenticated, toString, updateAuthenticationInfo, updatePrivileges, writeTimeLimitExceeded
-
-
-
-
Field Detail
-
jmxConnectionID
protected String jmxConnectionID
The JMX connection ID for this client connection.
-
-
Constructor Detail
-
JmxClientConnection
public JmxClientConnection(JmxConnectionHandler jmxConnectionHandler, AuthenticationInfo authInfo, ServerContext serverContext)
Creates a new Jmx client connection that will be authenticated as as the specified user.- Parameters:
jmxConnectionHandler- The connection handler on which we should be registeredauthInfo- the User authentication infoserverContext- the server context
-
-
Method Detail
-
handle
public Flowable<Response> handle(org.forgerock.services.context.Context context, Request request)
Processes the provided request in a reactive way, which should be either aBindRequestor aSearchRequest.- Specified by:
handlein interfaceRequestHandler- Parameters:
context- The context to process the request, which is expected to contain aRequestDJContextrequest- The request to process. OnlyBindRequestandSearchRequestare handled, other requests will return aLdapException- Returns:
- a stream of responses
-
handleNotification
public void handleNotification(Notification notif, Object handback)
- Specified by:
handleNotificationin interfaceNotificationListener
-
getConnectionID
public long getConnectionID()
Description copied from class:ClientConnectionRetrieves the unique identifier that has been assigned to this connection.- Specified by:
getConnectionIDin classClientConnection- Returns:
- The unique identifier that has been assigned to this connection.
-
getConnectionHandler
public ConnectionHandler<?> getConnectionHandler()
Description copied from class:ClientConnectionRetrieves the connection handler that accepted this client connection.- Specified by:
getConnectionHandlerin classClientConnection- Returns:
- The connection handler that accepted this client connection.
-
getProtocol
public String getProtocol()
Description copied from class:ClientConnectionRetrieves the protocol that the client is using to communicate with the Directory Server.- Specified by:
getProtocolin classClientConnection- Returns:
- The protocol that the client is using to communicate with the Directory Server.
-
getClientAddress
public String getClientAddress()
Description copied from class:ClientConnectionRetrieves a string representation of the address of the client.- Specified by:
getClientAddressin classClientConnection- Returns:
- A string representation of the address of the client.
-
getClientPort
public int getClientPort()
Description copied from class:ClientConnectionRetrieves the port number for this connection on the client system if available.- Specified by:
getClientPortin classClientConnection- Returns:
- The port number for this connection on the client system or -1 if there is no client port associated with this connection (e.g. internal client).
-
getServerAddress
public String getServerAddress()
Description copied from class:ClientConnectionRetrieves a string representation of the address on the server to which the client connected.- Specified by:
getServerAddressin classClientConnection- Returns:
- A string representation of the address on the server to which the client connected.
-
getServerPort
public int getServerPort()
Description copied from class:ClientConnectionRetrieves the port number for this connection on the server system if available.- Specified by:
getServerPortin classClientConnection- Returns:
- The port number for this connection on the server system or -1 if there is no server port associated with this connection (e.g. internal client).
-
getRemoteAddress
public InetAddress getRemoteAddress()
Description copied from class:ClientConnectionRetrieves theInetAddressassociated with the remote client system.- Specified by:
getRemoteAddressin classClientConnection- Returns:
- The
InetAddressassociated with the remote client system. It may benullif the client is not connected over an IP-based connection.
-
isConnectionValid
public boolean isConnectionValid()
Description copied from class:ClientConnectionReturns whether the Directory Server believes this connection to be valid and available for communication.- Specified by:
isConnectionValidin classClientConnection- Returns:
- true if the connection is valid, false otherwise
-
isSecure
public boolean isSecure()
Description copied from class:ClientConnectionIndicates whether this client connection is currently using a secure mechanism to communicate with the server. Note that this may change over time based on operations performed by the client or server (e.g., it may go fromfalsetotrueif the client uses the StartTLS extended operation).- Specified by:
isSecurein classClientConnection- Returns:
trueif the client connection is currently using a secure mechanism to communicate with the server, orfalseif not.
-
processSearch
public Result processSearch(SearchRequest request)
Processes an JMX search operation with the provided information.- Parameters:
request- The search request.- Returns:
- A result
-
processBind
public void processBind(BindRequest request) throws LdapException
Processes a bind request.- Parameters:
request- The bind request.- Throws:
LdapException- If result is not SUCCESS or an error occurs
-
sendSearchEntry
public void sendSearchEntry(SearchOperation searchOperation, SearchResultEntry searchEntry)
Description copied from class:ClientConnectionSends the provided search result entry to the client.- Specified by:
sendSearchEntryin classClientConnection- Parameters:
searchOperation- The search operation with which the entry is associated.searchEntry- The search result entry to be sent to the client.
-
sendSearchReference
public boolean sendSearchReference(SearchOperation searchOperation, SearchResultReference searchReference)
Description copied from class:ClientConnectionSends the provided search result reference to the client.- Specified by:
sendSearchReferencein classClientConnection- Parameters:
searchOperation- The search operation with which the reference is associated.searchReference- The search result reference to be sent to the client.- Returns:
trueif the client is able to accept referrals, orfalseif the client cannot handle referrals and no more attempts should be made to send them for the associated search operation.
-
sendIntermediateResponseMessage
protected boolean sendIntermediateResponseMessage(Operation operation, IntermediateResponse intermediateResponse)
Description copied from class:ClientConnectionSends the provided intermediate response message to the client.- Specified by:
sendIntermediateResponseMessagein classClientConnection- Parameters:
operation- The operation with which the intermediate response is associated.intermediateResponse- The intermediate response message to be sent.- Returns:
trueif processing on the associated operation should continue, orfalseif not.
-
disconnect
public void disconnect(DisconnectReason disconnectReason, boolean sendNotification, LocalizableMessage message)
Description copied from class:ClientConnectionCloses the connection to the client, optionally sending it a message indicating the reason for the closure. Note that the ability to send a notice of disconnection may not be available for all protocols or under all circumstances. Also note that when attempting to disconnect a client connection as a part of operation processing (e.g., within a plugin or other extension), thedisconnectClientmethod within that operation should be called rather than invoking this method directly.All subclasses must invoke the
finalizeConnectionInternalmethod during the course of processing this method.- Specified by:
disconnectin classClientConnection- Parameters:
disconnectReason- The disconnect reason that provides the generic cause for the disconnect.sendNotification- Indicates whether to try to provide notification to the client that the connection will be closed.message- The message to send to the client. It may benullif no notification is to be sent.
-
disconnectWithoutUnbind
public void disconnectWithoutUnbind(DisconnectReason disconnectReason, LocalizableMessage message)
Closes the connection to the client, optionally sending it a message indicating the reason for the closure. Note that the ability to send a notice of disconnection may not be available for all protocols or under all circumstances.Contrary to
disconnect(DisconnectReason, boolean, LocalizableMessage)this method does not attempt to perform an UNBIND operation on the connection.- Parameters:
disconnectReason- The disconnect reason that provides the generic cause for the disconnect.message- The message to send to the client. It may benullif no notification is to be sent.
-
getOperationInProgress
public Operation getOperationInProgress(int messageID)
Description copied from class:ClientConnectionRetrieves the operation in progress with the specified message ID.- Specified by:
getOperationInProgressin classClientConnection- Parameters:
messageID- The message ID of the operation to retrieve.- Returns:
- The operation in progress with the specified message ID, or
nullif no such operation could be found.
-
removeOperationInProgress
public void removeOperationInProgress(int messageID)
Description copied from class:ClientConnectionRemoves the provided operation from the set of operations in progress for this client connection. Note that this does not make any attempt to cancel any processing that may already be in progress for the operation.- Specified by:
removeOperationInProgressin classClientConnection- Parameters:
messageID- The message ID of the operation to remove from the set of operations in progress.
-
getMonitorSummary
public JsonValue getMonitorSummary()
Description copied from class:ClientConnectionReturns a summary of this client connection in JSON (format that is both human readable and machine parseable).- Specified by:
getMonitorSummaryin classClientConnection- Returns:
- A summary of this client connection in JSON.
-
toString
public void toString(StringBuilder buffer)
Description copied from class:ClientConnectionAppends a string representation of this client connection to the provided buffer.- Specified by:
toStringin classClientConnection- Parameters:
buffer- The buffer to which the information should be appended.
-
finalize
protected void finalize()
Called by the Gc when the object is garbage collected Release the cursor in case the iterator was badly used and releaseCursor was never called.
-
getSSF
public int getSSF()
Description copied from class:ClientConnectionReturn the Security Strength Factor of a client connection.- Specified by:
getSSFin classClientConnection- Returns:
- An integer representing the SSF value of a connection.
-
-