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:
org.apache.directory.server.protocol.shared.ProtocolService

public class LdapServer
extends org.apache.directory.server.protocol.shared.DirectoryBackedService

An LDAP protocol provider implementation which dynamically associates handlers.

Author:
Apache Directory Project

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 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)
          Registers the specified ExtendedOperationHandler to this protocol provider to provide a specific LDAP extended operation.
 MechanismHandler addSaslMechanismHandler(String mechanism, MechanismHandler handler)
           
 org.apache.mina.handler.demux.MessageHandler<org.apache.directory.shared.ldap.model.message.AbandonRequest> getAbandonHandler()
           
 LdapRequestHandler<org.apache.directory.shared.ldap.model.message.AddRequest> getAddHandler()
           
 LdapRequestHandler<org.apache.directory.shared.ldap.model.message.BindRequest> getBindHandler()
           
 String getCertificatePassword()
           
 LdapRequestHandler<org.apache.directory.shared.ldap.model.message.CompareRequest> getCompareHandler()
           
 LdapRequestHandler<org.apache.directory.shared.ldap.model.message.DeleteRequest> getDeleteHandler()
           
 LdapRequestHandler<org.apache.directory.shared.ldap.model.message.ExtendedRequest<org.apache.directory.shared.ldap.model.message.ExtendedResponse>> getExtendedHandler()
           
 ExtendedOperationHandler<org.apache.directory.shared.ldap.model.message.ExtendedRequest<org.apache.directory.shared.ldap.model.message.ExtendedResponse>,org.apache.directory.shared.ldap.model.message.ExtendedResponse> getExtendedOperationHandler(String oid)
          Returns an ExtendedOperationHandler with the specified oid which is registered to this protocol provider.
 Collection<ExtendedOperationHandler> getExtendedOperationHandlers()
          Gets the ExtendedOperationHandlers.
 org.apache.mina.core.service.IoHandler getHandler()
           
 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(String mechanism)
           
 LdapRequestHandler<org.apache.directory.shared.ldap.model.message.ModifyDnRequest> getModifyDnHandler()
           
 LdapRequestHandler<org.apache.directory.shared.ldap.model.message.ModifyRequest> getModifyHandler()
           
 String getName()
           
 int getPort()
           
 int getPortSSL()
           
 org.apache.mina.filter.codec.ProtocolCodecFactory getProtocolCodecFactory()
           
 String getSaslHost()
          Returns the FQDN of this SASL host, validated during SASL negotiation.
 Map<String,MechanismHandler> getSaslMechanismHandlers()
           
 String getSaslPrincipal()
          Returns the Kerberos principal name for this LDAP service, used by GSSAPI.
 Set<String> getSaslQop()
          Returns the Set of quality-of-protection, used by DIGEST-MD5 and GSSAPI.
 String getSaslQopString()
          Returns the quality-of-protection, used by DIGEST-MD5 and GSSAPI.
 List<String> getSaslRealms()
          Returns the realms serviced by this SASL host, used by DIGEST-MD5 and GSSAPI.
 LdapRequestHandler<org.apache.directory.shared.ldap.model.message.SearchRequest> getSearchHandler()
           
 Set<String> getSupportedControls()
           
 Set<String> getSupportedMechanisms()
           
 LdapRequestHandler<org.apache.directory.shared.ldap.model.message.UnbindRequest> getUnbindHandler()
           
 boolean isConfidentialityRequired()
          Gets whether or not TLS secured connections are required to perform operations on this LdapServer.
 boolean isEnableLdaps(org.apache.directory.server.protocol.shared.transport.Transport transport)
          Returns true if LDAPS is enabled.
 boolean isStarted()
           
 void reloadSslContext()
          reloads the SSL context by replacing the existing SslFilter with a new SslFilter after reloading the keystore.
 void removeExtendedOperationHandler(String oid)
          Deregisteres an ExtendedOperationHandler with the specified oid from this protocol provider.
 MechanismHandler removeSaslMechanismHandler(String mechanism)
           
 void setAbandonHandler(LdapRequestHandler<org.apache.directory.shared.ldap.model.message.AbandonRequest> abandonHandler)
           
 void setAddHandler(LdapRequestHandler<org.apache.directory.shared.ldap.model.message.AddRequest> addHandler)
           
 void setBindHandler(LdapRequestHandler<org.apache.directory.shared.ldap.model.message.BindRequest> bindHandler)
           
 void setCertificatePassword(String certificatePassword)
          Set the certificate passord.
 void setCompareHandler(LdapRequestHandler<org.apache.directory.shared.ldap.model.message.CompareRequest> 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.model.message.DeleteRequest> deleteHandler)
           
 void setDirectoryService(org.apache.directory.server.core.api.DirectoryService directoryService)
           
 void setExtendedHandler(ExtendedHandler extendedHandler)
           
 void setExtendedOperationHandlers(Collection<ExtendedOperationHandler> handlers)
          Sets the ExtendedOperationHandlers.
 void setKeystoreFile(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.model.message.ModifyDnRequest> modifyDnHandler)
           
 void setModifyHandler(LdapRequestHandler<org.apache.directory.shared.ldap.model.message.ModifyRequest> modifyHandler)
           
 void setReplConsumers(List<ReplicationConsumer> replConsumers)
           
 void setReplicationReqHandler(ReplicationRequestHandler replicationProvider)
           
 void setSaslHost(String saslHost)
          Sets the FQDN of this SASL host, validated during SASL negotiation.
 void setSaslMechanismHandlers(Map<String,MechanismHandler> saslMechanismHandlers)
           
 void setSaslPrincipal(String saslPrincipal)
          Sets the Kerberos principal name for this LDAP service, used by GSSAPI.
 void setSaslRealms(List<String> saslRealms)
          Sets the realms serviced by this SASL host, used by DIGEST-MD5 and GSSAPI.
 void setSearchHandler(LdapRequestHandler<org.apache.directory.shared.ldap.model.message.SearchRequest> searchHandler)
           
 void setStarted(boolean started)
           
 void setSupportedControls(Set<String> supportedControls)
           
 void setUnbindHandler(LdapRequestHandler<org.apache.directory.shared.ldap.model.message.UnbindRequest> unbindHandler)
           
 void start()
           
 void startReplicationConsumers()
          starts the replication consumers
 void startReplicationProducer()
          Install the replication handler if we have one
 void stop()
          
 String toString()
           
 
Methods inherited from class org.apache.directory.server.protocol.shared.DirectoryBackedService
getDirectoryService, getSearchBaseDn, isCatelogBased, setCatelogBased, setSearchBaseDn
 
Methods inherited from class org.apache.directory.server.protocol.shared.AbstractProtocolService
addTransports, getDatagramAcceptor, 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 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 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:
Exception

start

public void start()
           throws Exception
Throws:
IOException - if we cannot bind to the specified port
Exception - if the LDAP server cannot be started

startReplicationProducer

public void startReplicationProducer()
Install the replication handler if we have one


stop

public void stop()


startReplicationConsumers

public void startReplicationConsumers()
                               throws Exception
starts the replication consumers

Throws:
Exception

getName

public 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 Exception
Registers the specified ExtendedOperationHandler to this protocol provider to provide a specific LDAP extended operation.

Parameters:
eoh - an extended operation handler
Throws:
Exception - on failure to add the handler

removeExtendedOperationHandler

public void removeExtendedOperationHandler(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<org.apache.directory.shared.ldap.model.message.ExtendedRequest<org.apache.directory.shared.ldap.model.message.ExtendedResponse>,org.apache.directory.shared.ldap.model.message.ExtendedResponse> getExtendedOperationHandler(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(org.apache.directory.server.protocol.shared.transport.Transport transport)
Returns true if LDAPS is enabled.

Returns:
True if LDAPS is enabled.

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 Collection<ExtendedOperationHandler> getExtendedOperationHandlers()
Gets the ExtendedOperationHandlers.

Returns:
A collection of ExtendedOperationHandlers.

setExtendedOperationHandlers

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

Parameters:
handlers - A collection of ExtendedOperationHandlers.

getSaslHost

public 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(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 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(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 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 Set<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 List<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(List<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.

getSaslMechanismHandlers

public Map<String,MechanismHandler> getSaslMechanismHandlers()

setSaslMechanismHandlers

public void setSaslMechanismHandlers(Map<String,MechanismHandler> saslMechanismHandlers)

addSaslMechanismHandler

public MechanismHandler addSaslMechanismHandler(String mechanism,
                                                MechanismHandler handler)

removeSaslMechanismHandler

public MechanismHandler removeSaslMechanismHandler(String mechanism)

getMechanismHandler

public MechanismHandler getMechanismHandler(String mechanism)

getSupportedMechanisms

public Set<String> getSupportedMechanisms()

setDirectoryService

public void setDirectoryService(org.apache.directory.server.core.api.DirectoryService directoryService)
Overrides:
setDirectoryService in class org.apache.directory.server.protocol.shared.DirectoryBackedService

getSupportedControls

public Set<String> getSupportedControls()

setSupportedControls

public void setSupportedControls(Set<String> supportedControls)

getAbandonHandler

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

setAbandonHandler

public void setAbandonHandler(LdapRequestHandler<org.apache.directory.shared.ldap.model.message.AbandonRequest> abandonHandler)
Parameters:
abandonHandler - The AbandonRequest handler

getAddHandler

public LdapRequestHandler<org.apache.directory.shared.ldap.model.message.AddRequest> getAddHandler()

setAddHandler

public void setAddHandler(LdapRequestHandler<org.apache.directory.shared.ldap.model.message.AddRequest> addHandler)
Parameters:
addHandler - The AddRequest handler

getBindHandler

public LdapRequestHandler<org.apache.directory.shared.ldap.model.message.BindRequest> getBindHandler()

setBindHandler

public void setBindHandler(LdapRequestHandler<org.apache.directory.shared.ldap.model.message.BindRequest> bindHandler)
Parameters:
bindHandler - The BindRequest handler

getCompareHandler

public LdapRequestHandler<org.apache.directory.shared.ldap.model.message.CompareRequest> getCompareHandler()

setCompareHandler

public void setCompareHandler(LdapRequestHandler<org.apache.directory.shared.ldap.model.message.CompareRequest> compareHandler)
Parameters:
compareHandler - The CompareRequest handler

getDeleteHandler

public LdapRequestHandler<org.apache.directory.shared.ldap.model.message.DeleteRequest> getDeleteHandler()

setDeleteHandler

public void setDeleteHandler(LdapRequestHandler<org.apache.directory.shared.ldap.model.message.DeleteRequest> deleteHandler)
Parameters:
deleteHandler - The DeleteRequest handler

getExtendedHandler

public LdapRequestHandler<org.apache.directory.shared.ldap.model.message.ExtendedRequest<org.apache.directory.shared.ldap.model.message.ExtendedResponse>> getExtendedHandler()

setExtendedHandler

public void setExtendedHandler(ExtendedHandler extendedHandler)
Parameters:
extendedHandler - The ExtendedRequest handler

getModifyHandler

public LdapRequestHandler<org.apache.directory.shared.ldap.model.message.ModifyRequest> getModifyHandler()

setModifyHandler

public void setModifyHandler(LdapRequestHandler<org.apache.directory.shared.ldap.model.message.ModifyRequest> modifyHandler)
Parameters:
modifyHandler - The ModifyRequest handler

getModifyDnHandler

public LdapRequestHandler<org.apache.directory.shared.ldap.model.message.ModifyDnRequest> getModifyDnHandler()

setModifyDnHandler

public void setModifyDnHandler(LdapRequestHandler<org.apache.directory.shared.ldap.model.message.ModifyDnRequest> modifyDnHandler)
Parameters:
modifyDnHandler - The ModifyDNRequest handler

getSearchHandler

public LdapRequestHandler<org.apache.directory.shared.ldap.model.message.SearchRequest> getSearchHandler()

setSearchHandler

public void setSearchHandler(LdapRequestHandler<org.apache.directory.shared.ldap.model.message.SearchRequest> searchHandler)
Parameters:
searchHandler - The SearchRequest handler

getUnbindHandler

public LdapRequestHandler<org.apache.directory.shared.ldap.model.message.UnbindRequest> 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.model.message.UnbindRequest> unbindHandler)
Parameters:
unbindHandler - The UnbindRequest handler

isStarted

public boolean isStarted()
Specified by:
isStarted in interface org.apache.directory.server.protocol.shared.ProtocolService
Overrides:
isStarted in class org.apache.directory.server.protocol.shared.AbstractProtocolService

setStarted

public void setStarted(boolean started)
Overrides:
setStarted in class org.apache.directory.server.protocol.shared.AbstractProtocolService

getKeystoreFile

public String getKeystoreFile()
Returns:
The keystore path

setKeystoreFile

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

Parameters:
keystoreFile - The external keystore path

getCertificatePassword

public String getCertificatePassword()
Returns:
The certificate passord

setCertificatePassword

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

Parameters:
certificatePassword - the certificate passord

setReplicationReqHandler

public void setReplicationReqHandler(ReplicationRequestHandler replicationProvider)

setReplConsumers

public void setReplConsumers(List<ReplicationConsumer> replConsumers)

toString

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


Copyright © 2003-2012 The Apache Software Foundation. All Rights Reserved.