public class DefaultDirectoryService extends Object implements DirectoryService
DirectoryService
.Modifier and Type | Field and Description |
---|---|
static int |
MAX_SIZE_LIMIT_DEFAULT
The default timeLimit : 100 entries
|
static int |
MAX_TIME_LIMIT_DEFAULT
The default timeLimit : 10 seconds
|
JNDI_KEY
Constructor and Description |
---|
DefaultDirectoryService()
Creates a new instance of the directory service.
|
Modifier and Type | Method and Description |
---|---|
void |
addAfter(String interceptorName,
Interceptor interceptor)
Add an interceptor after a given interceptor in the interceptor list.
|
void |
addFirst(Interceptor interceptor)
Add an interceptor in the first position in the interceptor list.
|
void |
addLast(Interceptor interceptor)
Add an interceptor in the last position in the interceptor list.
|
void |
addPartition(Partition partition) |
org.apache.directory.api.ldap.util.tree.DnNode<AccessControlAdministrativePoint> |
getAccessControlAPCache() |
CoreSession |
getAdminSession() |
AttributeTypeProvider |
getAtProvider()
Gets the
AttributeTypeProvider . |
ChangeLog |
getChangeLog()
Gets the ChangeLog service for this DirectoryService used for tracking
changes (revisions) to the server and using them to revert the server
to earlier revisions.
|
org.apache.directory.api.ldap.util.tree.DnNode<CollectiveAttributeAdministrativePoint> |
getCollectiveAttributeAPCache() |
org.apache.directory.api.ldap.model.csn.Csn |
getCSN()
Get a new CSN
|
DnFactory |
getDnFactory()
Gets the Dn factory.
|
SubtreeEvaluator |
getEvaluator() |
EventService |
getEventService() |
String |
getInstanceId() |
InstanceLayout |
getInstanceLayout()
Returns the instance layout which contains the path for various directories
|
Interceptor |
getInterceptor(String interceptorName)
Get an Interceptor instance from its name
|
List<Interceptor> |
getInterceptors()
Returns interceptors in the server.
|
List<String> |
getInterceptors(OperationEnum operation)
Returns interceptors in the server for a given operation.
|
Journal |
getJournal()
Gets the Journal service for this DirectoryService used for tracking
changes to the server.
|
org.apache.directory.api.ldap.codec.api.LdapApiService |
getLdapCodecService() |
int |
getMaxPDUSize() |
ObjectClassProvider |
getOcProvider()
Gets the
ObjectClassProvider . |
OperationManager |
getOperationManager()
Gets the operation manager.
|
DefaultPartitionNexus |
getPartitionNexus() |
Set<? extends Partition> |
getPartitions()
Gets the
Partition s used by this DirectoryService. |
ReferralManager |
getReferralManager() |
int |
getReplicaId() |
org.apache.directory.api.ldap.model.schema.SchemaManager |
getSchemaManager() |
SchemaPartition |
getSchemaPartition() |
CoreSession |
getSession()
Get back an anonymous session
|
CoreSession |
getSession(org.apache.directory.api.ldap.model.name.Dn principalDn,
byte[] credentials)
Get back a session for the give user and credentials bound with Simple Bind
|
CoreSession |
getSession(org.apache.directory.api.ldap.model.name.Dn principalDn,
byte[] credentials,
String saslMechanism,
String saslAuthId)
Get back a session for a given user bound with SASL Bind
|
CoreSession |
getSession(LdapPrincipal principal)
Get back a session for a given principal
|
SubentryCache |
getSubentryCache() |
org.apache.directory.api.ldap.util.tree.DnNode<SubschemaAdministrativePoint> |
getSubschemaAPCache() |
long |
getSyncPeriodMillis() |
Partition |
getSystemPartition() |
List<org.apache.directory.api.ldap.model.ldif.LdifEntry> |
getTestEntries()
Returns test directory entries(
LdifEntry ) to be loaded while
bootstrapping. |
org.apache.directory.api.util.TimeProvider |
getTimeProvider()
Gets the time provider.
|
org.apache.directory.api.ldap.util.tree.DnNode<TriggerExecutionAdministrativePoint> |
getTriggerExecutionAPCache() |
boolean |
isAccessControlEnabled()
Returns true if access control checks are enabled.
|
boolean |
isAllowAnonymousAccess()
Returns true if anonymous access is allowed on entries besides the RootDSE.
|
boolean |
isDenormalizeOpAttrsEnabled()
return true if the operational attributes must be normalized when returned
|
boolean |
isExitVmOnShutdown() |
boolean |
isFirstStart() |
boolean |
isPasswordHidden()
Returns true if the service requires the userPassword attribute
to be masked.
|
boolean |
isPwdPolicyEnabled() |
boolean |
isShutdownHookEnabled()
Checks to see if this DirectoryService has registered a JVM shutdown hook
to flush caches and synchronize to disk safely.
|
boolean |
isStarted()
Returns true if this service is started.
|
org.apache.directory.api.ldap.model.entry.Entry |
newEntry(org.apache.directory.api.ldap.model.name.Dn dn)
Creates a new ServerEntry which has not yet been added to the
directory.
|
org.apache.directory.api.ldap.model.entry.Entry |
newEntry(String ldif,
String dn)
Create a new Entry
|
void |
remove(String interceptorName)
Remove an interceptor from the list of interceptors
|
void |
removePartition(Partition partition) |
long |
revert()
Reverts the server's state to the latest tagged snapshot if one was taken.
|
long |
revert(long revision)
Reverts the server's state to an earlier revision.
|
void |
setAccessControlEnabled(boolean accessControlEnabled)
Sets whether to enable basic access control checks or not.
|
void |
setAllowAnonymousAccess(boolean enableAnonymousAccess)
Sets whether to allow anonymous access to entries other than the RootDSE.
|
void |
setChangeLog(ChangeLog changeLog)
Sets the ChangeLog service for this DirectoryService used for tracking
changes (revisions) to the server and using them to revert the server
to earlier revisions.
|
void |
setDenormalizeOpAttrsEnabled(boolean denormalizeOpAttrsEnabled)
Sets whether the operational attributes are denormalized when returned
|
void |
setDnFactory(DnFactory dnFactory)
Sets the Dn factory.
|
void |
setEventService(EventService eventService) |
void |
setExitVmOnShutdown(boolean exitVmOnShutdown) |
void |
setInstanceId(String instanceId)
Set the instance Identifier
|
void |
setInstanceLayout(InstanceLayout instanceLayout)
Sets the InstanceLayout used by the DirectoryService to store the files
|
void |
setInterceptors(List<Interceptor> interceptors)
Sets the interceptors in the server.
|
void |
setJournal(Journal journal)
Sets the journal in the server.
|
void |
setMaxPDUSize(int maxPDUSize)
Set the maximum allowed size for an incoming PDU
|
void |
setPartitions(Set<? extends Partition> partitions)
Sets
Partition s used by this DirectoryService. |
void |
setPasswordHidden(boolean passwordHidden)
Sets whether the userPassword attribute is readable, or hidden.
|
void |
setReferralManager(ReferralManager referralManager)
Set the referralManager
|
void |
setReplicaId(int replicaId) |
void |
setSchemaManager(org.apache.directory.api.ldap.model.schema.SchemaManager schemaManager)
Set the SchemaManager instance.
|
void |
setSchemaPartition(SchemaPartition schemaPartition)
Set the SchemaPartition
|
void |
setShutdownHookEnabled(boolean shutdownHookEnabled)
Sets the shutdown hook flag which controls whether or not this DirectoryService
registers a JVM shutdown hook to flush caches and synchronize to disk safely.
|
void |
setSyncPeriodMillis(long syncPeriodMillis)
the time interval at which the DirectoryService's data is flushed to disk
|
void |
setSystemPartition(Partition systemPartition) |
void |
setTestEntries(List<? extends org.apache.directory.api.ldap.model.ldif.LdifEntry> testEntries)
Sets test directory entries to be loaded while bootstrapping.
|
void |
setTimeProvider(org.apache.directory.api.util.TimeProvider timeProvider)
Sets the time provider.
|
protected void |
showSecurityWarnings()
Displays security warning messages if any possible secutiry issue is found.
|
void |
shutdown()
Shuts down this service.
|
void |
startup()
Starts up this service.
|
void |
sync()
Calls
Partition.sync() for all registered Partition s. |
public static final int MAX_SIZE_LIMIT_DEFAULT
public static final int MAX_TIME_LIMIT_DEFAULT
public DefaultDirectoryService() throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapException
- If the instance cannot be createdpublic void setInstanceId(String instanceId)
DirectoryService
setInstanceId
in interface DirectoryService
instanceId
- The instance identifierpublic String getInstanceId()
getInstanceId
in interface DirectoryService
public Set<? extends Partition> getPartitions()
Partition
s used by this DirectoryService.getPartitions
in interface DirectoryService
public void setPartitions(Set<? extends Partition> partitions)
Partition
s used by this DirectoryService.setPartitions
in interface DirectoryService
partitions
- the partitions to usedpublic boolean isAccessControlEnabled()
isAccessControlEnabled
in interface DirectoryService
public void setAccessControlEnabled(boolean accessControlEnabled)
setAccessControlEnabled
in interface DirectoryService
accessControlEnabled
- true to enable access control checks, false otherwisepublic boolean isAllowAnonymousAccess()
isAllowAnonymousAccess
in interface DirectoryService
public void setAllowAnonymousAccess(boolean enableAnonymousAccess)
setAllowAnonymousAccess
in interface DirectoryService
enableAnonymousAccess
- true to enable anonymous access, false to disable itpublic List<Interceptor> getInterceptors()
getInterceptors
in interface DirectoryService
public List<String> getInterceptors(OperationEnum operation)
getInterceptors
in interface DirectoryService
operation
- The operation that the interceptors must implementpublic void setInterceptors(List<Interceptor> interceptors)
setInterceptors
in interface DirectoryService
interceptors
- the interceptors to be used in the server.public List<org.apache.directory.api.ldap.model.ldif.LdifEntry> getTestEntries()
LdifEntry
) to be loaded while
bootstrapping.getTestEntries
in interface DirectoryService
public void setTestEntries(List<? extends org.apache.directory.api.ldap.model.ldif.LdifEntry> testEntries)
setTestEntries
in interface DirectoryService
testEntries
- the test entries to load while bootstrappingpublic InstanceLayout getInstanceLayout()
getInstanceLayout
in interface DirectoryService
public void setInstanceLayout(InstanceLayout instanceLayout) throws IOException
setInstanceLayout
in interface DirectoryService
instanceLayout
- The InstanceLayout to setIOException
- If the layout could not be createdpublic void setShutdownHookEnabled(boolean shutdownHookEnabled)
DirectoryService
setShutdownHookEnabled
in interface DirectoryService
shutdownHookEnabled
- true to enable the shutdown hook, false to disablepublic boolean isShutdownHookEnabled()
DirectoryService
isShutdownHookEnabled
in interface DirectoryService
public void setExitVmOnShutdown(boolean exitVmOnShutdown)
setExitVmOnShutdown
in interface DirectoryService
public boolean isExitVmOnShutdown()
isExitVmOnShutdown
in interface DirectoryService
public void setSystemPartition(Partition systemPartition)
setSystemPartition
in interface DirectoryService
public Partition getSystemPartition()
getSystemPartition
in interface DirectoryService
public boolean isDenormalizeOpAttrsEnabled()
isDenormalizeOpAttrsEnabled
in interface DirectoryService
public void setDenormalizeOpAttrsEnabled(boolean denormalizeOpAttrsEnabled)
setDenormalizeOpAttrsEnabled
in interface DirectoryService
denormalizeOpAttrsEnabled
- The flag valuepublic ChangeLog getChangeLog()
getChangeLog
in interface DirectoryService
public Journal getJournal()
getJournal
in interface DirectoryService
public void setChangeLog(ChangeLog changeLog)
setChangeLog
in interface DirectoryService
changeLog
- the change log service to setpublic void setJournal(Journal journal)
setJournal
in interface DirectoryService
journal
- the journal to be used in the server.public void addPartition(Partition partition) throws org.apache.directory.api.ldap.model.exception.LdapException
addPartition
in interface DirectoryService
org.apache.directory.api.ldap.model.exception.LdapException
public void removePartition(Partition partition) throws org.apache.directory.api.ldap.model.exception.LdapException
removePartition
in interface DirectoryService
org.apache.directory.api.ldap.model.exception.LdapException
public CoreSession getAdminSession()
getAdminSession
in interface DirectoryService
public CoreSession getSession()
getSession
in interface DirectoryService
public CoreSession getSession(LdapPrincipal principal)
getSession
in interface DirectoryService
principal
- The Principalpublic CoreSession getSession(org.apache.directory.api.ldap.model.name.Dn principalDn, byte[] credentials) throws org.apache.directory.api.ldap.model.exception.LdapException
getSession
in interface DirectoryService
principalDn
- The principal Dncredentials
- The principal credentialsorg.apache.directory.api.ldap.model.exception.LdapException
- If we weren't able to get the sessionpublic CoreSession getSession(org.apache.directory.api.ldap.model.name.Dn principalDn, byte[] credentials, String saslMechanism, String saslAuthId) throws org.apache.directory.api.ldap.model.exception.LdapException
getSession
in interface DirectoryService
principalDn
- The principal Dncredentials
- The principal credentialssaslMechanism
- The SASL mechanismssaslAuthId
- The SASL authorization IDorg.apache.directory.api.ldap.model.exception.LdapException
- If we weren't able to get the sessionpublic long revert() throws org.apache.directory.api.ldap.model.exception.LdapException
DirectoryService
revert
in interface DirectoryService
org.apache.directory.api.ldap.model.exception.LdapException
- if there are problems reverting back to the earlier statepublic long revert(long revision) throws org.apache.directory.api.ldap.model.exception.LdapException
DirectoryService
revert
in interface DirectoryService
revision
- the revision number to revert toorg.apache.directory.api.ldap.model.exception.LdapException
- if there are problems reverting back to the earlier statepublic OperationManager getOperationManager()
DirectoryService
getOperationManager
in interface DirectoryService
public void startup() throws org.apache.directory.api.ldap.model.exception.LdapException
DirectoryService
startup
in interface DirectoryService
org.apache.directory.api.ldap.model.exception.LdapException
- if the LDAP server cannot be startedpublic void sync() throws org.apache.directory.api.ldap.model.exception.LdapException
DirectoryService
Partition.sync()
for all registered Partition
s.sync
in interface DirectoryService
org.apache.directory.api.ldap.model.exception.LdapException
- if synchronization failedpublic void shutdown() throws org.apache.directory.api.ldap.model.exception.LdapException
DirectoryService
shutdown
in interface DirectoryService
org.apache.directory.api.ldap.model.exception.LdapException
- if failed to shut downpublic ReferralManager getReferralManager()
getReferralManager
in interface DirectoryService
public void setReferralManager(ReferralManager referralManager)
setReferralManager
in interface DirectoryService
referralManager
- The initialized referralManagerpublic org.apache.directory.api.ldap.model.schema.SchemaManager getSchemaManager()
getSchemaManager
in interface DirectoryService
public void setSchemaManager(org.apache.directory.api.ldap.model.schema.SchemaManager schemaManager)
setSchemaManager
in interface DirectoryService
schemaManager
- The server schemaManagerpublic org.apache.directory.api.ldap.codec.api.LdapApiService getLdapCodecService()
getLdapCodecService
in interface DirectoryService
public SchemaPartition getSchemaPartition()
getSchemaPartition
in interface DirectoryService
public void setSchemaPartition(SchemaPartition schemaPartition)
setSchemaPartition
in interface DirectoryService
schemaPartition
- the SchemaPartition instancepublic DefaultPartitionNexus getPartitionNexus()
getPartitionNexus
in interface DirectoryService
public boolean isFirstStart()
public boolean isStarted()
DirectoryService
isStarted
in interface DirectoryService
public org.apache.directory.api.ldap.model.entry.Entry newEntry(org.apache.directory.api.ldap.model.name.Dn dn)
ServerEntryFactory
newEntry
in interface ServerEntryFactory
dn
- The entry Dnprotected void showSecurityWarnings() throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapException
- if there are failures parsing and accessing internal structurespublic org.apache.directory.api.ldap.model.entry.Entry newEntry(String ldif, String dn)
newEntry
in interface DirectoryService
ldif
- The String representing the attributes, as a LDIF filedn
- The Dn for this new entrypublic EventService getEventService()
getEventService
in interface DirectoryService
public void setEventService(EventService eventService)
setEventService
in interface DirectoryService
eventService
- The EventService
instancepublic boolean isPasswordHidden()
isPasswordHidden
in interface DirectoryService
public void setPasswordHidden(boolean passwordHidden)
setPasswordHidden
in interface DirectoryService
passwordHidden
- true to enable hide the userPassword attribute, false otherwisepublic int getMaxPDUSize()
getMaxPDUSize
in interface DirectoryService
public void setMaxPDUSize(int maxPDUSize)
setMaxPDUSize
in interface DirectoryService
maxPDUSize
- A positive number of bytes for the PDU. A negative or
null value will be transformed to Integer.MAX_VALUE
public Interceptor getInterceptor(String interceptorName)
getInterceptor
in interface DirectoryService
interceptorName
- The interceptor's name for which we want the instancepublic void addFirst(Interceptor interceptor) throws org.apache.directory.api.ldap.model.exception.LdapException
addFirst
in interface DirectoryService
interceptor
- The added interceptororg.apache.directory.api.ldap.model.exception.LdapException
- If the interceptor can't be addedpublic void addLast(Interceptor interceptor) throws org.apache.directory.api.ldap.model.exception.LdapException
addLast
in interface DirectoryService
interceptor
- The added interceptororg.apache.directory.api.ldap.model.exception.LdapException
- If the interceptor can't be addedpublic void addAfter(String interceptorName, Interceptor interceptor)
addAfter
in interface DirectoryService
interceptorName
- The interceptor name to findinterceptor
- The added interceptorpublic void remove(String interceptorName)
remove
in interface DirectoryService
interceptorName
- The interceptor to removepublic org.apache.directory.api.ldap.model.csn.Csn getCSN()
getCSN
in interface DirectoryService
public int getReplicaId()
getReplicaId
in interface DirectoryService
public void setReplicaId(int replicaId)
setReplicaId
in interface DirectoryService
replicaId
- the replicaId to setpublic long getSyncPeriodMillis()
getSyncPeriodMillis
in interface DirectoryService
public void setSyncPeriodMillis(long syncPeriodMillis)
setSyncPeriodMillis
in interface DirectoryService
syncPeriodMillis
- the syncPeriodMillis to setpublic org.apache.directory.api.ldap.util.tree.DnNode<AccessControlAdministrativePoint> getAccessControlAPCache()
getAccessControlAPCache
in interface DirectoryService
public org.apache.directory.api.ldap.util.tree.DnNode<CollectiveAttributeAdministrativePoint> getCollectiveAttributeAPCache()
getCollectiveAttributeAPCache
in interface DirectoryService
public org.apache.directory.api.ldap.util.tree.DnNode<SubschemaAdministrativePoint> getSubschemaAPCache()
getSubschemaAPCache
in interface DirectoryService
public org.apache.directory.api.ldap.util.tree.DnNode<TriggerExecutionAdministrativePoint> getTriggerExecutionAPCache()
getTriggerExecutionAPCache
in interface DirectoryService
public boolean isPwdPolicyEnabled()
isPwdPolicyEnabled
in interface DirectoryService
public DnFactory getDnFactory()
getDnFactory
in interface DirectoryService
public void setDnFactory(DnFactory dnFactory)
setDnFactory
in interface DirectoryService
dnFactory
- The Dn factory to usepublic SubentryCache getSubentryCache()
getSubentryCache
in interface DirectoryService
public SubtreeEvaluator getEvaluator()
getEvaluator
in interface DirectoryService
public AttributeTypeProvider getAtProvider()
AttributeTypeProvider
.getAtProvider
in interface DirectoryService
AttributeTypeProvider
public ObjectClassProvider getOcProvider()
ObjectClassProvider
.getOcProvider
in interface DirectoryService
ObjectClassProvider
public org.apache.directory.api.util.TimeProvider getTimeProvider()
getTimeProvider
in interface DirectoryService
public void setTimeProvider(org.apache.directory.api.util.TimeProvider timeProvider)
setTimeProvider
in interface DirectoryService
timeProvider
- the time providerCopyright © 2003–2020 The Apache Software Foundation. All rights reserved.