Package org.opends.server.snmp
Class SNMPConnectionHandler
- java.lang.Object
-
- java.lang.Thread
-
- org.opends.server.api.DirectoryThread
-
- org.opends.server.api.ConnectionHandler<SNMPConnectionHandlerCfg>
-
- org.opends.server.snmp.SNMPConnectionHandler
-
- All Implemented Interfaces:
Runnable,ConfigurationChangeListener<SNMPConnectionHandlerCfg>,AlertGenerator
public final class SNMPConnectionHandler extends ConnectionHandler<SNMPConnectionHandlerCfg> implements ConfigurationChangeListener<SNMPConnectionHandlerCfg>, AlertGenerator
This class defines an SNMP connection handler, which can be used to answer SNMP Requests on MIB 2605. The MIB 2605 exposes a set of information on Directory Server instances, protocol handlers. The information regarding peer Directory Servers are not supported yet.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.opends.server.api.DirectoryThread
DirectoryThread.Factory
-
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
-
Field Summary
-
Fields inherited from class org.opends.server.api.ConnectionHandler
LISTEN_TIMEOUT_MS
-
Fields inherited from class org.opends.server.api.DirectoryThread
DIRECTORY_THREAD_GROUP
-
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description SNMPConnectionHandler()Creates a new instance of this connection handler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConfigChangeResultapplyConfigurationChange(SNMPConnectionHandlerCfg configuration)Applies the configuration changes to this change listener.voidfinalizeConnectionHandler(org.forgerock.i18n.LocalizableMessage finalizeReason)Closes this connection handler so that it will no longer accept new client connections.LinkedHashMap<String,String>getAlerts()Retrieves information about the set of alerts that this generator may produce.StringgetClassName()Retrieves the fully-qualified name of the Java class for this alert generator implementation.Collection<ClientConnection>getClientConnections()Retrieves the set of active client connections that have been established through this connection handler.DNgetComponentEntryDN()Retrieves the DN of the configuration entry with which this alert generator is associated.StringgetConnectionHandlerName()Retrieves a name that may be used to refer to this connection handler.Collection<HostPort>getListeners()Retrieves information about the listener(s) that will be used to accept client connections.StringgetProtocol()Retrieves the name of the protocol used to communicate with clients.voidinitializeConnectionHandler(ServerContext serverContext, SNMPConnectionHandlerCfg configuration)Initializes this connection handler provider based on the information in the provided connection handler configuration.booleanisConfigurationChangeAcceptable(SNMPConnectionHandlerCfg configuration, List<org.forgerock.i18n.LocalizableMessage> unacceptableReasons)Indicates whether the proposed change to the configuration is acceptable to this change listener.booleanisOperational()Indicate if operational.booleanisOperational(File file)Indicate if operational.voidrun()Operates in a loop, accepting new connections and ensuring that requests on those connections are handled properly.voidtoString(StringBuilder buffer)Appends a string representation of this connection handler to the provided buffer.-
Methods inherited from class org.opends.server.api.ConnectionHandler
getConnectionHandlerMonitor, getEnabledSSLCipherSuites, getEnabledSSLProtocols, getNumRequestHandlers, isAdminConnectionHandler, isConfigurationAcceptable, setAdminConnectionHandler, setConnectionHandlerMonitor, toString
-
Methods inherited from class org.opends.server.api.DirectoryThread
getAssociatedTask, getCreationStackTrace, getDebugProperties, getParentThread, initiateShutdown, isShutdownInitiated, setAssociatedTask, startWork, stopWork
-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, yield
-
-
-
-
Method Detail
-
initializeConnectionHandler
public void initializeConnectionHandler(ServerContext serverContext, SNMPConnectionHandlerCfg configuration) throws ConfigException, InitializationException
Initializes this connection handler provider based on the information in the provided connection handler configuration.- Specified by:
initializeConnectionHandlerin classConnectionHandler<SNMPConnectionHandlerCfg>- Parameters:
serverContext- The server context.configuration- The connection handler configuration that contains the information to use to initialize this connection handler.- Throws:
ConfigException- If an unrecoverable problem arises in the process of performing the initialization as a result of the server configuration.InitializationException- If a problem occurs during initialization that is not related to the server configuration.
-
getConnectionHandlerName
public String getConnectionHandlerName()
Retrieves a name that may be used to refer to this connection handler. Every connection handler instance (even handlers of the same type) must have a unique name.- Specified by:
getConnectionHandlerNamein classConnectionHandler<SNMPConnectionHandlerCfg>- Returns:
- A unique name that may be used to refer to this connection handler.
-
getProtocol
public String getProtocol()
Retrieves the name of the protocol used to communicate with clients. It should take into account any special naming that may be needed to express any security mechanisms or other constraints in place (e.g., "LDAPS" for LDAP over SSL).- Specified by:
getProtocolin classConnectionHandler<SNMPConnectionHandlerCfg>- Returns:
- The name of the protocol used to communicate with clients.
-
getListeners
public Collection<HostPort> getListeners()
Retrieves information about the listener(s) that will be used to accept client connections.- Specified by:
getListenersin classConnectionHandler<SNMPConnectionHandlerCfg>- Returns:
- Information about the listener(s) that will be used to accept client connections, or an empty list if this connection handler does not accept connections from network clients.
-
getClientConnections
public Collection<ClientConnection> getClientConnections()
Retrieves the set of active client connections that have been established through this connection handler.- Specified by:
getClientConnectionsin classConnectionHandler<SNMPConnectionHandlerCfg>- Returns:
- The set of active client connections that have been established through this connection handler.
-
run
public void run()
Operates in a loop, accepting new connections and ensuring that requests on those connections are handled properly.- Specified by:
runin interfaceRunnable- Specified by:
runin classConnectionHandler<SNMPConnectionHandlerCfg>
-
toString
public void toString(StringBuilder buffer)
Appends a string representation of this connection handler to the provided buffer.- Specified by:
toStringin classConnectionHandler<SNMPConnectionHandlerCfg>- Parameters:
buffer- The buffer to which the information should be appended.
-
isConfigurationChangeAcceptable
public boolean isConfigurationChangeAcceptable(SNMPConnectionHandlerCfg configuration, List<org.forgerock.i18n.LocalizableMessage> unacceptableReasons)
Indicates whether the proposed change to the configuration is acceptable to this change listener.- Specified by:
isConfigurationChangeAcceptablein interfaceConfigurationChangeListener<SNMPConnectionHandlerCfg>- Parameters:
configuration- The new configuration containing the changes.unacceptableReasons- A list that can be used to hold messages about why the provided configuration is not acceptable.- Returns:
- Returns
trueif the proposed change is acceptable, orfalseif it is not.
-
applyConfigurationChange
public ConfigChangeResult applyConfigurationChange(SNMPConnectionHandlerCfg configuration)
Applies the configuration changes to this change listener.- Specified by:
applyConfigurationChangein interfaceConfigurationChangeListener<SNMPConnectionHandlerCfg>- Parameters:
configuration- The new configuration containing the changes.- Returns:
- Returns information about the result of changing the configuration.
-
getComponentEntryDN
public DN getComponentEntryDN()
Retrieves the DN of the configuration entry with which this alert generator is associated.- Specified by:
getComponentEntryDNin interfaceAlertGenerator- Specified by:
getComponentEntryDNin classConnectionHandler<SNMPConnectionHandlerCfg>- Returns:
- The DN of the configuration entry with which this alert generator is associated.
-
getClassName
public String getClassName()
Retrieves the fully-qualified name of the Java class for this alert generator implementation.- Specified by:
getClassNamein interfaceAlertGenerator- Returns:
- The fully-qualified name of the Java class for this alert generator implementation.
-
getAlerts
public LinkedHashMap<String,String> getAlerts()
Retrieves information about the set of alerts that this generator may produce. The map returned should be between the notification type for a particular notification and the human-readable description for that notification. This alert generator must not generate any alerts with types that are not contained in this list.- Specified by:
getAlertsin interfaceAlertGenerator- Returns:
- Information about the set of alerts that this generator may produce.
-
isOperational
public boolean isOperational(File file)
Indicate if operational.- Parameters:
file- The file- Returns:
- true is operational
-
isOperational
public boolean isOperational()
Indicate if operational.- Returns:
- true is operational
-
finalizeConnectionHandler
public void finalizeConnectionHandler(org.forgerock.i18n.LocalizableMessage finalizeReason)
Closes this connection handler so that it will no longer accept new client connections. Implementations should disconnect any existing connections.- Specified by:
finalizeConnectionHandlerin classConnectionHandler<SNMPConnectionHandlerCfg>- Parameters:
finalizeReason- The reason that this connection handler should be finalized.
-
-