org.apache.directory.server.ldap
Class LdapServer

java.lang.Object
  extended by org.apache.directory.server.protocol.shared.AbstractProtocolService
      extended by org.apache.directory.server.protocol.shared.DirectoryBackedService
          extended by org.apache.directory.server.ldap.LdapServer
All Implemented Interfaces:
ProtocolService

public class LdapServer
extends DirectoryBackedService

An LDAP protocol provider implementation which dynamically associates handlers.

Version:
$Rev: 688548 $
Author:
Apache Directory Project
XBean

Field Summary
static long NO_SIZE_LIMIT
          Value (0) for configuration where size limit is unlimited.
static int NO_TIME_LIMIT
          Value (0) for configuration where time limit is unlimited.
static java.lang.String SERVICE_NAME
          the constant service name of this ldap protocol provider
 
Fields inherited from class org.apache.directory.server.protocol.shared.AbstractProtocolService
transports
 
Constructor Summary
LdapServer()
          Creates an LDAP protocol provider.
 
Method Summary
 void addExtendedOperationHandler(ExtendedOperationHandler eoh)
          Registeres the specified ExtendedOperationHandler to this protocol provider to provide a specific LDAP extended operation.
 MechanismHandler addSaslMechanismHandler(java.lang.String mechanism, MechanismHandler handler)
           
 org.apache.mina.handler.demux.MessageHandler<org.apache.directory.shared.ldap.message.internal.InternalAbandonRequest> getAbandonHandler()
           
 LdapRequestHandler<org.apache.directory.shared.ldap.message.internal.InternalAddRequest> getAddHandler()
           
 LdapRequestHandler<org.apache.directory.shared.ldap.message.internal.InternalBindRequest> getBindHandler()
           
 java.lang.String getCertificatePassword()
           
 LdapRequestHandler<org.apache.directory.shared.ldap.message.internal.InternalCompareRequest> getCompareHandler()
           
 LdapRequestHandler<org.apache.directory.shared.ldap.message.internal.InternalDeleteRequest> getDeleteHandler()
           
 LdapRequestHandler<org.apache.directory.shared.ldap.message.internal.InternalExtendedRequest> getExtendedHandler()
           
 ExtendedOperationHandler getExtendedOperationHandler(java.lang.String oid)
          Returns an ExtendedOperationHandler with the specified oid which is registered to this protocol provider.
 java.util.Collection<ExtendedOperationHandler> getExtendedOperationHandlers()
          Gets the ExtendedOperationHandlers.
 org.apache.mina.core.service.IoHandler getHandler()
           
 java.lang.String getKeystoreFile()
           
 LdapSessionManager getLdapSessionManager()
           
 long getMaxSizeLimit()
          Returns the maximum size limit in number of entries to return for search.
 int getMaxTimeLimit()
          Returns the maximum time limit in milliseconds to conduct a search.
 MechanismHandler getMechanismHandler(java.lang.String mechanism)
           
 LdapRequestHandler<org.apache.directory.shared.ldap.message.internal.InternalModifyDnRequest> getModifyDnHandler()
           
 LdapRequestHandler<org.apache.directory.shared.ldap.message.internal.InternalModifyRequest> getModifyHandler()
           
 java.lang.String getName()
           
 int getPort()
           
 int getPortSSL()
           
 org.apache.mina.filter.codec.ProtocolCodecFactory getProtocolCodecFactory()
           
 ReplicationSystem getReplicationSystem()
           
 java.lang.String getSaslHost()
          Returns the FQDN of this SASL host, validated during SASL negotiation.
 java.util.Map<java.lang.String,MechanismHandler> getSaslMechanismHandlers()
           
 java.lang.String getSaslPrincipal()
          Returns the Kerberos principal name for this LDAP service, used by GSSAPI.
 java.util.Set<java.lang.String> getSaslQop()
          Returns the Set of quality-of-protection, used by DIGEST-MD5 and GSSAPI.
 java.lang.String getSaslQopString()
          Returns the quality-of-protection, used by DIGEST-MD5 and GSSAPI.
 java.util.List<java.lang.String> getSaslRealms()
          Returns the realms serviced by this SASL host, used by DIGEST-MD5 and GSSAPI.
 LdapRequestHandler<org.apache.directory.shared.ldap.message.internal.InternalSearchRequest> getSearchHandler()
           
 java.util.Set<java.lang.String> getSupportedControls()
           
 java.util.Set<java.lang.String> getSupportedMechanisms()
           
 LdapRequestHandler<org.apache.directory.shared.ldap.message.internal.InternalUnbindRequest> getUnbindHandler()
           
 boolean isAllowAnonymousAccess()
          Returns true if anonymous access is allowed.
 boolean isConfidentialityRequired()
          Gets whether or not TLS secured connections are required to perform operations on this LdapServer.
 boolean isEnableLdaps(Transport transport)
          Returns true if LDAPS is enabled.
 boolean isStarted()
          Gets whether or not this service has been started.
 void reloadSslContext()
          reloads the SSL context by replacing the existing SslFilter with a new SslFilter after reloading the keystore.
 void removeExtendedOperationHandler(java.lang.String oid)
          Deregisteres an ExtendedOperationHandler with the specified oid from this protocol provider.
 MechanismHandler removeSaslMechanismHandler(java.lang.String mechanism)
           
 void setAbandonHandler(LdapRequestHandler<org.apache.directory.shared.ldap.message.internal.InternalAbandonRequest> abandonHandler)
           
 void setAddHandler(LdapRequestHandler<org.apache.directory.shared.ldap.message.internal.InternalAddRequest> addHandler)
           
 void setAllowAnonymousAccess(boolean enableAnonymousAccess)
          Sets whether to allow anonymous access or not.
 void setBindHandler(LdapRequestHandler<org.apache.directory.shared.ldap.message.internal.InternalBindRequest> bindHandler)
           
 void setCertificatePassword(java.lang.String certificatePassword)
          Set the certificate passord.
 void setCompareHandler(LdapRequestHandler<org.apache.directory.shared.ldap.message.internal.InternalCompareRequest> compareHandler)
           
 void setConfidentialityRequired(boolean confidentialityRequired)
          Sets the mode for this LdapServer to accept requests with or without a TLS secured connection via either StartTLS extended operations or using LDAPS.
 void setDeleteHandler(LdapRequestHandler<org.apache.directory.shared.ldap.message.internal.InternalDeleteRequest> deleteHandler)
           
 void setDirectoryService(DirectoryService directoryService)
          Sets the DirectoryService assigned to this ProtocolService.
 void setExtendedHandler(LdapRequestHandler<org.apache.directory.shared.ldap.message.internal.InternalExtendedRequest> extendedHandler)
           
 void setExtendedOperationHandlers(java.util.Collection<ExtendedOperationHandler> handlers)
          Sets the ExtendedOperationHandlers.
 void setKeystoreFile(java.lang.String keystoreFile)
          Set the external keystore path
 void setMaxSizeLimit(long maxSizeLimit)
          Sets the maximum size limit in number of entries to return for search.
 void setMaxTimeLimit(int maxTimeLimit)
          Sets the maximum time limit in milliseconds to conduct a search.
 void setModifyDnHandler(LdapRequestHandler<org.apache.directory.shared.ldap.message.internal.InternalModifyDnRequest> modifyDnHandler)
           
 void setModifyHandler(LdapRequestHandler<org.apache.directory.shared.ldap.message.internal.InternalModifyRequest> modifyHandler)
           
 void setReplicationSystem(ReplicationSystem replicationSystem)
           
 void setSaslHost(java.lang.String saslHost)
          Sets the FQDN of this SASL host, validated during SASL negotiation.
 void setSaslMechanismHandlers(java.util.Map<java.lang.String,MechanismHandler> saslMechanismHandlers)
           
 void setSaslPrincipal(java.lang.String saslPrincipal)
          Sets the Kerberos principal name for this LDAP service, used by GSSAPI.
 void setSaslRealms(java.util.List<java.lang.String> saslRealms)
          Sets the realms serviced by this SASL host, used by DIGEST-MD5 and GSSAPI.
 void setSearchHandler(LdapRequestHandler<org.apache.directory.shared.ldap.message.internal.InternalSearchRequest> searchHandler)
           
 void setStarted(boolean started)
           
 void setSupportedControls(java.util.Set<java.lang.String> supportedControls)
           
 void setUnbindHandler(LdapRequestHandler<org.apache.directory.shared.ldap.message.internal.InternalUnbindRequest> unbindHandler)
           
 void start()
          Starts this ProtocolService which binds acceptors on the protocol port.
 void stop()
          Stops this ProtocolService which unbinds acceptors on the protocol port.
 java.lang.String toString()
           
 
Methods inherited from class org.apache.directory.server.protocol.shared.DirectoryBackedService
getSearchBaseDn, isCatelogBased, setCatelogBased, setSearchBaseDn
 
Methods inherited from class org.apache.directory.server.protocol.shared.AbstractProtocolService
addTransports, getDatagramAcceptor, getDirectoryService, getServiceId, getServiceName, getSocketAcceptor, getTransports, isEnabled, setEnabled, setServiceId, setServiceName, setTransports
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NO_SIZE_LIMIT

public static final long NO_SIZE_LIMIT
Value (0) for configuration where size limit is unlimited.

See Also:
Constant Field Values

NO_TIME_LIMIT

public static final int NO_TIME_LIMIT
Value (0) for configuration where time limit is unlimited.

See Also:
Constant Field Values

SERVICE_NAME

public static final java.lang.String SERVICE_NAME
the constant service name of this ldap protocol provider

See Also:
Constant Field Values
Constructor Detail

LdapServer

public LdapServer()
Creates an LDAP protocol provider.

Method Detail

reloadSslContext

public void reloadSslContext()
                      throws java.lang.Exception
reloads the SSL context by replacing the existing SslFilter with a new SslFilter after reloading the keystore. Note: should be called to reload the keystore after changing the digital certificate.

Throws:
java.lang.Exception

start

public void start()
           throws java.lang.Exception
Description copied from interface: ProtocolService
Starts this ProtocolService which binds acceptors on the protocol port.

Throws:
java.io.IOException - if we cannot bind to the specified port
javax.naming.NamingException - if the LDAP server cannot be started
java.lang.Exception - if there are problems starting this service

stop

public void stop()
Stops this ProtocolService which unbinds acceptors on the protocol port.


getName

public java.lang.String getName()

getHandler

public org.apache.mina.core.service.IoHandler getHandler()

getLdapSessionManager

public LdapSessionManager getLdapSessionManager()

getProtocolCodecFactory

public org.apache.mina.filter.codec.ProtocolCodecFactory getProtocolCodecFactory()

addExtendedOperationHandler

public void addExtendedOperationHandler(ExtendedOperationHandler eoh)
                                 throws java.lang.Exception
Registeres the specified ExtendedOperationHandler to this protocol provider to provide a specific LDAP extended operation.

Parameters:
eoh - an extended operation handler
Throws:
javax.naming.NamingException - on failure to add the handler
java.lang.Exception

removeExtendedOperationHandler

public void removeExtendedOperationHandler(java.lang.String oid)
Deregisteres an ExtendedOperationHandler with the specified oid from this protocol provider.

Parameters:
oid - the numeric identifier for the extended operation associated with the handler to remove

getExtendedOperationHandler

public ExtendedOperationHandler getExtendedOperationHandler(java.lang.String oid)
Returns an ExtendedOperationHandler with the specified oid which is registered to this protocol provider.

Parameters:
oid - the oid of the extended request of associated with the extended request handler
Returns:
the exnteded operation handler

setConfidentialityRequired

public void setConfidentialityRequired(boolean confidentialityRequired)
Sets the mode for this LdapServer to accept requests with or without a TLS secured connection via either StartTLS extended operations or using LDAPS.

Parameters:
confidentialityRequired - true to require confidentiality

isConfidentialityRequired

public boolean isConfidentialityRequired()
Gets whether or not TLS secured connections are required to perform operations on this LdapServer.

Returns:
true if TLS secured connections are required, false otherwise

isEnableLdaps

public boolean isEnableLdaps(Transport transport)
Returns true if LDAPS is enabled.

Returns:
True if LDAPS is enabled.

isAllowAnonymousAccess

public boolean isAllowAnonymousAccess()
Returns true if anonymous access is allowed.

Returns:
True if anonymous access is allowed.

setAllowAnonymousAccess

public void setAllowAnonymousAccess(boolean enableAnonymousAccess)
Sets whether to allow anonymous access or not.

Parameters:
enableAnonymousAccess - Set true to allow anonymous access.

setMaxSizeLimit

public void setMaxSizeLimit(long maxSizeLimit)
Sets the maximum size limit in number of entries to return for search.

Parameters:
maxSizeLimit - the maximum number of entries to return for search

getMaxSizeLimit

public long getMaxSizeLimit()
Returns the maximum size limit in number of entries to return for search.

Returns:
The maximum size limit.

setMaxTimeLimit

public void setMaxTimeLimit(int maxTimeLimit)
Sets the maximum time limit in milliseconds to conduct a search.

Parameters:
maxTimeLimit - the maximum length of time in milliseconds for search

getMaxTimeLimit

public int getMaxTimeLimit()
Returns the maximum time limit in milliseconds to conduct a search.

Returns:
The maximum time limit in milliseconds for search

getExtendedOperationHandlers

public java.util.Collection<ExtendedOperationHandler> getExtendedOperationHandlers()
Gets the ExtendedOperationHandlers.

Returns:
A collection of ExtendedOperationHandlers.

setExtendedOperationHandlers

public void setExtendedOperationHandlers(java.util.Collection<ExtendedOperationHandler> handlers)
Sets the ExtendedOperationHandlers.

Parameters:
handlers - A collection of ExtendedOperationHandlers.
XBean Property
nestedType="org.apache.directory.server.ldap.ExtendedOperationHandler"

getSaslHost

public java.lang.String getSaslHost()
Returns the FQDN of this SASL host, validated during SASL negotiation.

Returns:
The FQDN of this SASL host, validated during SASL negotiation.

setSaslHost

public void setSaslHost(java.lang.String saslHost)
Sets the FQDN of this SASL host, validated during SASL negotiation.

Parameters:
saslHost - The FQDN of this SASL host, validated during SASL negotiation.

getSaslPrincipal

public java.lang.String getSaslPrincipal()
Returns the Kerberos principal name for this LDAP service, used by GSSAPI.

Returns:
The Kerberos principal name for this LDAP service, used by GSSAPI.

setSaslPrincipal

public void setSaslPrincipal(java.lang.String saslPrincipal)
Sets the Kerberos principal name for this LDAP service, used by GSSAPI.

Parameters:
saslPrincipal - The Kerberos principal name for this LDAP service, used by GSSAPI.

getSaslQopString

public java.lang.String getSaslQopString()
Returns the quality-of-protection, used by DIGEST-MD5 and GSSAPI.

Returns:
The quality-of-protection, used by DIGEST-MD5 and GSSAPI.

getSaslQop

public java.util.Set<java.lang.String> getSaslQop()
Returns the Set of quality-of-protection, used by DIGEST-MD5 and GSSAPI.

Returns:
The quality-of-protection, used by DIGEST-MD5 and GSSAPI.

getSaslRealms

public java.util.List<java.lang.String> getSaslRealms()
Returns the realms serviced by this SASL host, used by DIGEST-MD5 and GSSAPI.

Returns:
The realms serviced by this SASL host, used by DIGEST-MD5 and GSSAPI.

setSaslRealms

public void setSaslRealms(java.util.List<java.lang.String> saslRealms)
Sets the realms serviced by this SASL host, used by DIGEST-MD5 and GSSAPI.

Parameters:
saslRealms - The realms serviced by this SASL host, used by DIGEST-MD5 and GSSAPI.
XBean Property
nestedType="java.lang.String"

getSaslMechanismHandlers

public java.util.Map<java.lang.String,MechanismHandler> getSaslMechanismHandlers()

setSaslMechanismHandlers

public void setSaslMechanismHandlers(java.util.Map<java.lang.String,MechanismHandler> saslMechanismHandlers)

addSaslMechanismHandler

public MechanismHandler addSaslMechanismHandler(java.lang.String mechanism,
                                                MechanismHandler handler)

removeSaslMechanismHandler

public MechanismHandler removeSaslMechanismHandler(java.lang.String mechanism)

getMechanismHandler

public MechanismHandler getMechanismHandler(java.lang.String mechanism)

getSupportedMechanisms

public java.util.Set<java.lang.String> getSupportedMechanisms()

setDirectoryService

public void setDirectoryService(DirectoryService directoryService)
Description copied from interface: ProtocolService
Sets the DirectoryService assigned to this ProtocolService.

Specified by:
setDirectoryService in interface ProtocolService
Overrides:
setDirectoryService in class AbstractProtocolService
Parameters:
directoryService - the directory service core assigned to this service

getSupportedControls

public java.util.Set<java.lang.String> getSupportedControls()

setSupportedControls

public void setSupportedControls(java.util.Set<java.lang.String> supportedControls)
XBean Property
hidden="true"

getAbandonHandler

public org.apache.mina.handler.demux.MessageHandler<org.apache.directory.shared.ldap.message.internal.InternalAbandonRequest> getAbandonHandler()

setAbandonHandler

public void setAbandonHandler(LdapRequestHandler<org.apache.directory.shared.ldap.message.internal.InternalAbandonRequest> abandonHandler)
Parameters:
abandonHandler - The AbandonRequest handler
XBean Property
hidden="true"

getAddHandler

public LdapRequestHandler<org.apache.directory.shared.ldap.message.internal.InternalAddRequest> getAddHandler()

setAddHandler

public void setAddHandler(LdapRequestHandler<org.apache.directory.shared.ldap.message.internal.InternalAddRequest> addHandler)
Parameters:
abandonHandler - The AddRequest handler
XBean Property
hidden="true"

getBindHandler

public LdapRequestHandler<org.apache.directory.shared.ldap.message.internal.InternalBindRequest> getBindHandler()

setBindHandler

public void setBindHandler(LdapRequestHandler<org.apache.directory.shared.ldap.message.internal.InternalBindRequest> bindHandler)
Parameters:
abandonHandler - The BindRequest handler
XBean Property
hidden="true"

getCompareHandler

public LdapRequestHandler<org.apache.directory.shared.ldap.message.internal.InternalCompareRequest> getCompareHandler()

setCompareHandler

public void setCompareHandler(LdapRequestHandler<org.apache.directory.shared.ldap.message.internal.InternalCompareRequest> compareHandler)
Parameters:
abandonHandler - The CompareRequest handler
XBean Property
hidden="true"

getDeleteHandler

public LdapRequestHandler<org.apache.directory.shared.ldap.message.internal.InternalDeleteRequest> getDeleteHandler()

setDeleteHandler

public void setDeleteHandler(LdapRequestHandler<org.apache.directory.shared.ldap.message.internal.InternalDeleteRequest> deleteHandler)
Parameters:
abandonHandler - The DeleteRequest handler
XBean Property
hidden="true"

getExtendedHandler

public LdapRequestHandler<org.apache.directory.shared.ldap.message.internal.InternalExtendedRequest> getExtendedHandler()

setExtendedHandler

public void setExtendedHandler(LdapRequestHandler<org.apache.directory.shared.ldap.message.internal.InternalExtendedRequest> extendedHandler)
Parameters:
abandonHandler - The ExtendedRequest handler
XBean Property
hidden="true"

getModifyHandler

public LdapRequestHandler<org.apache.directory.shared.ldap.message.internal.InternalModifyRequest> getModifyHandler()

setModifyHandler

public void setModifyHandler(LdapRequestHandler<org.apache.directory.shared.ldap.message.internal.InternalModifyRequest> modifyHandler)
Parameters:
abandonHandler - The ModifyRequest handler
XBean Property
hidden="true"

getModifyDnHandler

public LdapRequestHandler<org.apache.directory.shared.ldap.message.internal.InternalModifyDnRequest> getModifyDnHandler()

setModifyDnHandler

public void setModifyDnHandler(LdapRequestHandler<org.apache.directory.shared.ldap.message.internal.InternalModifyDnRequest> modifyDnHandler)
Parameters:
abandonHandler - The ModifyDNRequest handler
XBean Property
hidden="true"

getSearchHandler

public LdapRequestHandler<org.apache.directory.shared.ldap.message.internal.InternalSearchRequest> getSearchHandler()

setSearchHandler

public void setSearchHandler(LdapRequestHandler<org.apache.directory.shared.ldap.message.internal.InternalSearchRequest> searchHandler)
Parameters:
abandonHandler - The SearchRequest handler
XBean Property
hidden="true"

getUnbindHandler

public LdapRequestHandler<org.apache.directory.shared.ldap.message.internal.InternalUnbindRequest> getUnbindHandler()

getPort

public int getPort()
Returns:
The underlying TCP transport port, or -1 if no transport has been initialized

getPortSSL

public int getPortSSL()
Returns:
The underlying SSL enabled TCP transport port, or -1 if no transport has been initialized

setUnbindHandler

public void setUnbindHandler(LdapRequestHandler<org.apache.directory.shared.ldap.message.internal.InternalUnbindRequest> unbindHandler)
Parameters:
abandonHandler - The UnbindRequest handler
XBean Property
hidden="true"

isStarted

public boolean isStarted()
Description copied from interface: ProtocolService
Gets whether or not this service has been started.

Specified by:
isStarted in interface ProtocolService
Overrides:
isStarted in class AbstractProtocolService
Returns:
true if the service has started, false otherwise

setStarted

public void setStarted(boolean started)
Overrides:
setStarted in class AbstractProtocolService
Parameters:
started - The state of this server
XBean Property
hidden="true"

getKeystoreFile

public java.lang.String getKeystoreFile()
Returns:
The keystore path

setKeystoreFile

public void setKeystoreFile(java.lang.String keystoreFile)
Set the external keystore path

Parameters:
keystoreFile - The external keystore path

getCertificatePassword

public java.lang.String getCertificatePassword()
Returns:
The certificate passord

setCertificatePassword

public void setCertificatePassword(java.lang.String certificatePassword)
Set the certificate passord.

Parameters:
certificatePassword - the certificate passord

setReplicationSystem

public void setReplicationSystem(ReplicationSystem replicationSystem)
Parameters:
replicationSystem - the replicationSystem to set

getReplicationSystem

public ReplicationSystem getReplicationSystem()
Returns:
the replicationSystem

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()


Copyright © 2003-2011 Apache Software Foundation. All Rights Reserved.