| | |
| | | package org.opends.server.protocols.jmx; |
| | | |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.loggers.Debug.debugConstructor; |
| | | import static org.opends.server.loggers.Debug.debugEnter; |
| | | import static org.opends.server.loggers.Debug.debugException; |
| | | 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.logError; |
| | | import static org.opends.server.messages.ConfigMessages.*; |
| | | import static org.opends.server.messages.MessageHandler.*; |
| | |
| | | extends ConnectionHandler implements ConfigurableComponent, AlertGenerator |
| | | { |
| | | /** |
| | | * The fully-qualified name of this class for debugging purposes. |
| | | * The fully-qualified name of this class. |
| | | */ |
| | | private static final String CLASS_NAME = |
| | | "org.opends.server.protocols.jmx.JMXConnectionHandler"; |
| | |
| | | { |
| | | super("JMX Connection Handler Thread"); |
| | | |
| | | assert debugConstructor(CLASS_NAME); |
| | | |
| | | // No real implementation is required. Do all the work in the |
| | | // initializeConnectionHandler method. |
| | |
| | | public void initializeConnectionHandler(ConfigEntry configEntry) |
| | | throws ConfigException, InitializationException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "initializeConnectionHandler", String |
| | | .valueOf(configEntry)); |
| | | |
| | | // |
| | | // If the initializeConnectionHandler method is called, |
| | |
| | | public void finalizeConnectionHandler( |
| | | String finalizeReason, boolean closeConnections) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "finalizeConnectionHandler"); |
| | | |
| | | // We should also close the RMI registry. |
| | | rmiConnector.finalizeConnectionHandler(closeConnections, true); |
| | |
| | | */ |
| | | public String getConnectionHandlerName() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getConnectionHandlerName"); |
| | | |
| | | return connectionHandlerName; |
| | | } |
| | |
| | | */ |
| | | public String getProtocol() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getProtocol"); |
| | | |
| | | return protocol; |
| | | } |
| | |
| | | */ |
| | | public Collection<HostPort> getListeners() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getListeners"); |
| | | |
| | | return listeners; |
| | | } |
| | |
| | | */ |
| | | public Collection<ClientConnection> getClientConnections() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getClientConnections"); |
| | | return connectionList; |
| | | } |
| | | |
| | |
| | | */ |
| | | public String getShutdownListenerName() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getShutdownListenerName"); |
| | | |
| | | return handlerName; |
| | | } |
| | |
| | | */ |
| | | public void processServerShutdown(String reason) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "processServerShutdown"); |
| | | // We should also close the RMI registry. |
| | | rmiConnector.finalizeConnectionHandler(true, true); |
| | | |
| | |
| | | */ |
| | | public DN getConfigurableComponentEntryDN() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getConfigurableComponentEntryDN"); |
| | | |
| | | return configEntryDN; |
| | | } |
| | |
| | | */ |
| | | public List<ConfigAttribute> getConfigurationAttributes() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getConfigurationAttributes"); |
| | | |
| | | return configAttrs; |
| | | |
| | |
| | | public boolean hasAcceptableConfiguration( |
| | | ConfigEntry configEntry, List<String> unacceptableReasons) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "hasAcceptableConfiguration", String |
| | | .valueOf(configEntry), "java.util.List<String>"); |
| | | |
| | | boolean configValid = true; |
| | | |
| | |
| | | catch (Exception e) |
| | | { |
| | | configValid = false; |
| | | assert debugException(CLASS_NAME, "hasAcceptableConfiguration", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | int msgID = MSGID_JMX_CONNHANDLER_CANNOT_DETERMINE_SSL_CERT_NICKNAME; |
| | | unacceptableReasons.add(getMessage( |
| | | msgID, |
| | |
| | | public ConfigChangeResult applyNewConfiguration( |
| | | ConfigEntry configEntry, boolean detailedResults) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "applyNewConfiguration", String |
| | | .valueOf(configEntry), String.valueOf(detailedResults)); |
| | | |
| | | // |
| | | // Create variables to include in the response. |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "applyNewConfiguration", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | int msgID = MSGID_JMX_CONNHANDLER_CANNOT_DETERMINE_SSL_CERT_NICKNAME; |
| | | messages.add(getMessage( |
| | | msgID, |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "applyNewConfiguration", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | int msgID = MSGID_JMX_CONNHANDLER_CANNOT_DETERMINE_KEYMANAGER_DN; |
| | | messages.add(getMessage( |
| | | msgID, |
| | |
| | | */ |
| | | public void toString(StringBuilder buffer) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "toString", "java.lang.StringBuilder"); |
| | | |
| | | buffer.append(handlerName); |
| | | } |
| | |
| | | */ |
| | | public DN getComponentEntryDN() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getComponentEntryDN"); |
| | | |
| | | return configEntryDN; |
| | | } |
| | |
| | | */ |
| | | public String getClassName() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getClassName"); |
| | | |
| | | return CLASS_NAME; |
| | | } |
| | |
| | | */ |
| | | public LinkedHashMap<String, String> getAlerts() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getAlerts"); |
| | | |
| | | LinkedHashMap<String, String> alerts = new LinkedHashMap<String, String>(); |
| | | |
| | |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | assert debugException(CLASS_NAME, "initializeConnectionHandler", ce); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, ce); |
| | | } |
| | | |
| | | throw ce; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "initializeConnectionHandler", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | msgID = MSGID_CONFIG_CONNHANDLER_NO_ENABLED_ATTR; |
| | | String message = getMessage( |
| | |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | assert debugException(CLASS_NAME, "initializeConnectionHandler", ce); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, ce); |
| | | } |
| | | |
| | | throw ce; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "initializeConnectionHandler", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | msgID = MSGID_JMX_CONNHANDLER_CANNOT_DETERMINE_LISTEN_PORT; |
| | | String message = getMessage( |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "initializeConnectionHandler", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | msgID = MSGID_JMX_CONNHANDLER_CANNOT_DETERMINE_USE_SSL; |
| | | String message = getMessage( |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "initializeConnectionHandler", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | msgID = MSGID_JMX_CONNHANDLER_CANNOT_DETERMINE_SSL_CERT_NICKNAME; |
| | | String message = getMessage( |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "initializeConnectionHandler", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | msgID = MSGID_JMX_CONNHANDLER_CANNOT_DETERMINE_KEYMANAGER_DN; |
| | | String message = getMessage( |