| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS |
| | | * Portions copyright 2013-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.protocols.jmx; |
| | | |
| | | import java.io.IOException; |
| | | import java.net.InetSocketAddress; |
| | | import java.util.*; |
| | | import java.util.concurrent.CopyOnWriteArrayList; |
| | | |
| | | import org.opends.messages.Message; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.server.ConnectionHandlerCfg; |
| | | import org.opends.server.admin.std.server.JMXConnectionHandlerCfg; |
| | | import org.opends.server.api.AlertGenerator; |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.api.ConnectionHandler; |
| | | import org.opends.server.api.ServerShutdownListener; |
| | |
| | | */ |
| | | public final class JmxConnectionHandler extends |
| | | ConnectionHandler<JMXConnectionHandlerCfg> implements |
| | | ServerShutdownListener, AlertGenerator, |
| | | ServerShutdownListener, |
| | | ConfigurationChangeListener<JMXConnectionHandlerCfg> { |
| | | |
| | | /** |
| | | * Key that may be placed into a JMX connection environment map to |
| | | * provide a custom <code>javax.net.ssl.TrustManager</code> array |
| | | * provide a custom {@code javax.net.ssl.TrustManager} array |
| | | * for a connection. |
| | | */ |
| | | public static final String TRUST_MANAGER_ARRAY_KEY = |
| | |
| | | "org.opends.server.protocols.jmx.JMXConnectionHandler"; |
| | | |
| | | /** The list of active client connection. */ |
| | | private List<ClientConnection> connectionList; |
| | | private final List<ClientConnection> connectionList; |
| | | |
| | | /** The current configuration state. */ |
| | | private JMXConnectionHandlerCfg currentConfig; |
| | |
| | | private String protocol; |
| | | |
| | | /** The set of listeners for this connection handler. */ |
| | | private List<HostPort> listeners = new LinkedList<HostPort>(); |
| | | private final List<HostPort> listeners = new LinkedList<HostPort>(); |
| | | |
| | | /** |
| | | * Creates a new instance of this JMX connection handler. It must be |
| | |
| | | public JmxConnectionHandler() { |
| | | super("JMX Connection Handler Thread"); |
| | | |
| | | this.connectionList = new LinkedList<ClientConnection>(); |
| | | this.connectionList = new CopyOnWriteArrayList<ClientConnection>(); |
| | | } |
| | | |
| | | |
| | |
| | | JMXConnectionHandlerCfg config) { |
| | | // Create variables to include in the response. |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | List<Message> messages = new ArrayList<Message>(); |
| | | final List<Message> messages = new ArrayList<Message>(); |
| | | |
| | | // Determine whether or not the RMI connection needs restarting. |
| | | boolean rmiConnectorRestart = false; |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 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. |
| | | * |
| | | * @return Information about the set of alerts that this generator |
| | | * may produce. |
| | | */ |
| | | @Override |
| | | public Map<String, String> getAlerts() |
| | | { |
| | | return new LinkedHashMap<String, String>(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the fully-qualified name of the Java class for this |
| | | * alert generator implementation. |
| | | * |
| | | * @return The fully-qualified name of the Java class for this alert |
| | | * generator implementation. |
| | | */ |
| | | @Override |
| | | public String getClassName() { |
| | | return CLASS_NAME; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the set of active client connections that have been |
| | | * established through this connection handler. |
| | |
| | | // Configuration is ok. |
| | | currentConfig = config; |
| | | |
| | | List<Message> reasons = new LinkedList<Message>(); |
| | | final List<Message> reasons = new LinkedList<Message>(); |
| | | if (!isPortConfigurationAcceptable(String.valueOf(config.dn()), |
| | | config.getListenPort(), reasons)) |
| | | { |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Unregisters a client connection from this JMX connection handler. |
| | | * |
| | | * @param connection |
| | | * The client connection. |
| | | */ |
| | | public void unregisterClientConnection(ClientConnection connection) { |
| | | connectionList.remove(connection); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |