| | |
| | | ConfigurationChangeListener<LDAPConnectionHandlerCfg>, |
| | | ServerShutdownListener, AlertGenerator |
| | | { |
| | | |
| | | /** |
| | | * Task run periodically by the connection finalizer. |
| | | */ |
| | | /** Task run periodically by the connection finalizer. */ |
| | | private final class ConnectionFinalizerRunnable implements Runnable |
| | | { |
| | | @Override |
| | |
| | | connectionFinalizerActiveJobQueue = connectionFinalizerPendingJobQueue; |
| | | connectionFinalizerPendingJobQueue = tmp; |
| | | } |
| | | |
| | | } |
| | | } |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * Default friendly name for the LDAP connection handler. |
| | | */ |
| | | /** Default friendly name for the LDAP connection handler. */ |
| | | private static final String DEFAULT_FRIENDLY_NAME = "LDAP Connection Handler"; |
| | | |
| | | /** SSL instance name used in context creation. */ |
| | |
| | | /** Indicates whether to allow the reuse address socket option. */ |
| | | private boolean allowReuseAddress; |
| | | |
| | | /** |
| | | * The number of request handlers that should be used for this connection |
| | | * handler. |
| | | */ |
| | | /** The number of request handlers that should be used for this connection handler. */ |
| | | private int numRequestHandlers; |
| | | |
| | | /** |
| | | * Indicates whether the Directory Server is in the process of shutting down. |
| | | */ |
| | | /** Indicates whether the Directory Server is in the process of shutting down. */ |
| | | private volatile boolean shutdownRequested; |
| | | |
| | | /* Internal LDAP connection handler state */ |
| | |
| | | /** The set of clients that are explicitly allowed access to the server. */ |
| | | private Collection<AddressMask> allowedClients; |
| | | |
| | | /** |
| | | * The set of clients that have been explicitly denied access to the server. |
| | | */ |
| | | /** The set of clients that have been explicitly denied access to the server. */ |
| | | private Collection<AddressMask> deniedClients; |
| | | |
| | | /** |
| | |
| | | /** The set of listeners for this connection handler. */ |
| | | private List<HostPort> listeners; |
| | | |
| | | /** |
| | | * The set of request handlers that are associated with this connection |
| | | * handler. |
| | | */ |
| | | /** The set of request handlers that are associated with this connection handler. */ |
| | | private LDAPRequestHandler[] requestHandlers; |
| | | |
| | | /** The set of statistics collected for this connection handler. */ |
| | | private LDAPStatistics statTracker; |
| | | |
| | | /** |
| | | * The client connection monitor provider associated with this connection |
| | | * handler. |
| | | */ |
| | | /** The client connection monitor provider associated with this connection handler. */ |
| | | private ClientConnectionMonitorProvider connMonitor; |
| | | |
| | | /** |
| | |
| | | private List<Runnable> connectionFinalizerActiveJobQueue; |
| | | private List<Runnable> connectionFinalizerPendingJobQueue; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this LDAP connection handler. It must be |
| | | * initialized before it may be used. |
| | |
| | | this(new WorkQueueStrategy(), null); // Use name from configuration. |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this LDAP connection handler, using a queueing |
| | | * strategy. It must be initialized before it may be used. |
| | |
| | | // initializeConnectionHandler method. |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Indicates whether this connection handler should allow interaction with |
| | | * LDAPv2 clients. |
| | |
| | | return currentConfig.isAllowLDAPV2(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Indicates whether this connection handler should allow the use of the |
| | | * StartTLS extended operation. |
| | |
| | | return currentConfig.isAllowStartTLS() && !currentConfig.isUseSSL(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | LDAPConnectionHandlerCfg config) |
| | |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | // Note that the following properties cannot be modified: |
| | | // |
| | | // * listen port and addresses |
| | | // * use ssl |
| | | // * ssl policy |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void finalizeConnectionHandler(LocalizableMessage finalizeReason) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves information about the set of alerts that this generator may |
| | | * produce. The map returned should be between the notification type for a |
| | |
| | | return alerts; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the fully-qualified name of the Java class for this alert |
| | | * generator implementation. |
| | |
| | | return LDAPConnectionHandler.class.getName(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the set of active client connections that have been established |
| | | * through this connection handler. |
| | |
| | | return connectionList; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the DN of the configuration entry with which this alert generator |
| | | * is associated. |
| | |
| | | return currentConfig.dn(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getConnectionHandlerName() |
| | | { |
| | | return handlerName; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Collection<String> getEnabledSSLCipherSuites() |
| | | { |
| | |
| | | return super.getEnabledSSLCipherSuites(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Collection<String> getEnabledSSLProtocols() |
| | | { |
| | |
| | | return super.getEnabledSSLProtocols(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Collection<HostPort> getListeners() |
| | | { |
| | | return listeners; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the port on which this connection handler is listening for client |
| | | * connections. |
| | |
| | | return listenPort; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the maximum length of time in milliseconds that attempts to write |
| | | * to LDAP client connections should be allowed to block. |
| | |
| | | return currentConfig.getMaxBlockedWriteTimeLimit(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the maximum ASN.1 element value length that will be allowed by |
| | | * this connection handler. |
| | |
| | | return (int) currentConfig.getMaxRequestSize(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the size in bytes of the LDAP response message write buffer |
| | | * defined for this connection handler. |
| | |
| | | return (int) currentConfig.getBufferSize(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getProtocol() |
| | | { |
| | | return protocol; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getShutdownListenerName() |
| | | { |
| | | return handlerName; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the SSL client authentication policy for this connection handler. |
| | | * |
| | |
| | | return sslClientAuthPolicy; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the set of statistics maintained by this connection handler. |
| | | * |
| | |
| | | return statTracker; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeConnectionHandler(ServerContext serverContext, LDAPConnectionHandlerCfg config) |
| | | throws ConfigException, InitializationException |
| | |
| | | config.addLDAPChangeListener(this); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAcceptable(ConnectionHandlerCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | LDAPConnectionHandlerCfg config, List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return isConfigurationAcceptable(config, unacceptableReasons); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Indicates whether this connection handler should maintain usage statistics. |
| | | * |
| | |
| | | return currentConfig.isKeepStats(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void processServerShutdown(LocalizableMessage reason) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void start() |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Operates in a loop, accepting new connections and ensuring that requests on |
| | | * those connections are handled properly. |
| | |
| | | listening = false; |
| | | enabled = false; |
| | | } |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Serves the incoming connections. |
| | | * |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Open channels for each listen address and register them against this |
| | | * ConnectionHandler's {@link Selector}. |
| | |
| | | return numRegistered; |
| | | } |
| | | |
| | | |
| | | |
| | | private void acceptConnection(SocketChannel clientChannel) |
| | | throws DirectoryException |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Appends a string representation of this connection handler to the provided |
| | | * buffer. |
| | |
| | | buffer.append(handlerName); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Indicates whether this connection handler should use SSL to communicate |
| | | * with clients. |
| | |
| | | return currentConfig.isUseSSL(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Cleans up the contents of the selector, closing any server socket channels |
| | | * that might be associated with it. Any connections that might have been |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Get the queueing strategy. |
| | | * |
| | |
| | | return queueingStrategy; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a TLS Byte Channel instance using the specified socket channel. |
| | | * |
| | |
| | | return new TLSByteChannel(channel, sslEngine); |
| | | } |
| | | |
| | | |
| | | |
| | | private SSLEngine createSSLEngine(LDAPConnectionHandlerCfg config, |
| | | SSLContext sslContext) throws DirectoryException |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | private void disableAndWarnIfUseSSL(LDAPConnectionHandlerCfg config) |
| | | { |
| | | if (config.isUseSSL()) |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |