Package org.opends.server.snmp
Class SNMPConnectionHandler
- java.lang.Object
-
- org.opends.server.api.ConnectionHandler<SnmpConnectionHandlerCfg>
-
- org.opends.server.snmp.SNMPConnectionHandler
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,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.
-
-
Field Summary
Fields Modifier and Type Field Description static Path
JDMKT_JAR_PATH
The relative path of the jdmkt jar from the server root.
-
Constructor Summary
Constructors Constructor Description SNMPConnectionHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConfigChangeResult
applyConfigurationChange(SnmpConnectionHandlerCfg configuration)
Applies the configuration changes to this change listener.void
bind()
Operates in a loop, accepting new connections and ensuring that requests on those connections are handled properly.void
doClose()
Closes this connection handler so that it will no longer accept new client connections.void
doInitializeConnectionHandler(ServerContext serverContext, SnmpConnectionHandlerCfg configuration)
Initializes this connection handler provider based on the information in the provided connection handler configuration.Map<String,String>
getAlerts()
Retrieves information about the set of alerts that this generator may produce.Collection<ClientConnection>
getClientConnections()
Retrieves the set of active client connections that have been established through this connection handler.Dn
getComponentEntryDN()
Retrieves the DN of the configuration entry with which this alert generator is associated.String
getConnectionHandlerName()
Retrieves a name that may be used to refer to this connection handler.String
getConnectionHandlerType()
Returns the type of this connection handler.Collection<com.forgerock.opendj.util.HostPort>
getListeners()
Retrieves information about the listener(s) that will be used to accept client connections.String
getProtocol()
Retrieves the name of the protocol used to communicate with clients.boolean
isConfigurationChangeAcceptable(SnmpConnectionHandlerCfg configuration, List<LocalizableMessage> unacceptableReasons)
Indicates whether the proposed change to the configuration is acceptable to this change listener.void
toString(StringBuilder buffer)
Appends a string representation of this connection handler to the provided buffer.-
Methods inherited from class org.opends.server.api.ConnectionHandler
addAdditionalMeters, addAdditionalMonitorObjectClassNames, close, getEnabledSSLCipherSuites, getEnabledSSLProtocols, getNumRequestHandlers, getServerContext, initializeConnectionHandler, isConfigurationAcceptable, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.opends.server.api.AlertGenerator
getClassName
-
-
-
-
Field Detail
-
JDMKT_JAR_PATH
public static final Path JDMKT_JAR_PATH
The relative path of the jdmkt jar from the server root.
-
-
Method Detail
-
doInitializeConnectionHandler
public void doInitializeConnectionHandler(ServerContext serverContext, SnmpConnectionHandlerCfg configuration)
Description copied from class:ConnectionHandler
Initializes this connection handler provider based on the information in the provided connection handler configuration.- Specified by:
doInitializeConnectionHandler
in classConnectionHandler<SnmpConnectionHandlerCfg>
- Parameters:
serverContext
- The server context.configuration
- The connection handler configuration that contains the information to use to initialize this connection handler.
-
getComponentEntryDN
public Dn getComponentEntryDN()
Description copied from class:ConnectionHandler
Retrieves the DN of the configuration entry with which this alert generator is associated.- Specified by:
getComponentEntryDN
in interfaceAlertGenerator
- Specified by:
getComponentEntryDN
in classConnectionHandler<SnmpConnectionHandlerCfg>
- Returns:
- The DN of the configuration entry with which this alert generator is associated.
-
getConnectionHandlerName
public String getConnectionHandlerName()
Description copied from class:ConnectionHandler
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:
getConnectionHandlerName
in classConnectionHandler<SnmpConnectionHandlerCfg>
- Returns:
- A unique name that may be used to refer to this connection handler.
-
getConnectionHandlerType
public String getConnectionHandlerType()
Description copied from class:ConnectionHandler
Returns the type of this connection handler. By default this returnsConnectionHandler.getProtocol()
. It should be returning the insecure protocol version.- Overrides:
getConnectionHandlerType
in classConnectionHandler<SnmpConnectionHandlerCfg>
- Returns:
- The type of this connection handler.
-
getProtocol
public String getProtocol()
Description copied from class:ConnectionHandler
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:
getProtocol
in classConnectionHandler<SnmpConnectionHandlerCfg>
- Returns:
- The name of the protocol used to communicate with clients.
-
getListeners
public Collection<com.forgerock.opendj.util.HostPort> getListeners()
Description copied from class:ConnectionHandler
Retrieves information about the listener(s) that will be used to accept client connections.- Specified by:
getListeners
in 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()
Description copied from class:ConnectionHandler
Retrieves the set of active client connections that have been established through this connection handler.- Specified by:
getClientConnections
in classConnectionHandler<SnmpConnectionHandlerCfg>
- Returns:
- The set of active client connections that have been established through this connection handler.
-
bind
public void bind()
Description copied from class:ConnectionHandler
Operates in a loop, accepting new connections and ensuring that requests on those connections are handled properly.- Specified by:
bind
in classConnectionHandler<SnmpConnectionHandlerCfg>
-
toString
public void toString(StringBuilder buffer)
Description copied from class:ConnectionHandler
Appends a string representation of this connection handler to the provided buffer.- Specified by:
toString
in classConnectionHandler<SnmpConnectionHandlerCfg>
- Parameters:
buffer
- The buffer to which the information should be appended.
-
isConfigurationChangeAcceptable
public boolean isConfigurationChangeAcceptable(SnmpConnectionHandlerCfg configuration, List<LocalizableMessage> unacceptableReasons)
Description copied from interface:ConfigurationChangeListener
Indicates whether the proposed change to the configuration is acceptable to this change listener.- Specified by:
isConfigurationChangeAcceptable
in 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
true
if the proposed change is acceptable, orfalse
if it is not.
-
applyConfigurationChange
public ConfigChangeResult applyConfigurationChange(SnmpConnectionHandlerCfg configuration)
Description copied from interface:ConfigurationChangeListener
Applies the configuration changes to this change listener.- Specified by:
applyConfigurationChange
in interfaceConfigurationChangeListener<SnmpConnectionHandlerCfg>
- Parameters:
configuration
- The new configuration containing the changes.- Returns:
- Returns information about the result of changing the configuration.
-
getAlerts
public Map<String,String> getAlerts()
Description copied from interface:AlertGenerator
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:
getAlerts
in interfaceAlertGenerator
- Returns:
- Information about the set of alerts that this generator may produce.
-
doClose
public void doClose()
Description copied from class:ConnectionHandler
Closes this connection handler so that it will no longer accept new client connections. Implementations should disconnect any existing connections and release any other resources associated with the connection handler.- Overrides:
doClose
in classConnectionHandler<SnmpConnectionHandlerCfg>
-
-