org.apache.directory.server.core
Class DefaultDirectoryService

java.lang.Object
  extended by org.apache.directory.server.core.DefaultDirectoryService
All Implemented Interfaces:
DirectoryService, ServerEntryFactory

public class DefaultDirectoryService
extends java.lang.Object
implements DirectoryService

Default implementation of DirectoryService.

Author:
Apache Directory Project
XBean

Field Summary
static int MAX_SIZE_LIMIT_DEFAULT
          The default timeLimit : 100 entries
static int MAX_TIME_LIMIT_DEFAULT
          The default timeLimit : 10 seconds
 
Fields inherited from interface org.apache.directory.server.core.DirectoryService
JNDI_KEY
 
Constructor Summary
DefaultDirectoryService()
          Creates a new instance of the directory service.
 
Method Summary
 void addPartition(Partition partition)
           
 CoreSession getAdminSession()
           
 ChangeLog getChangeLog()
          
 org.apache.directory.shared.ldap.csn.Csn getCSN()
          Get a new CSN
 EventService getEventService()
           
 java.lang.String getInstanceId()
           
 Interceptor getInterceptor(java.lang.String interceptorName)
          
 InterceptorChain getInterceptorChain()
           
 java.util.List<Interceptor> getInterceptors()
          Returns interceptors in the server.
 Journal getJournal()
          
 int getMaxPDUSize()
           
 OperationManager getOperationManager()
           
 DefaultPartitionNexus getPartitionNexus()
           
 java.util.Set<? extends Partition> getPartitions()
          Gets the Partitions used by this DirectoryService.
 ReferralManager getReferralManager()
           
 int getReplicaId()
           
 ReplicationConfiguration getReplicationConfiguration()
           
 org.apache.directory.shared.ldap.schema.SchemaManager getSchemaManager()
           
 SchemaService getSchemaService()
           
 CoreSession getSession()
           
 CoreSession getSession(org.apache.directory.shared.ldap.name.DN principalDn, byte[] credentials)
           
 CoreSession getSession(org.apache.directory.shared.ldap.name.DN principalDn, byte[] credentials, java.lang.String saslMechanism, java.lang.String saslAuthId)
           
 CoreSession getSession(LdapPrincipal principal)
           
 long getSyncPeriodMillis()
           
 Partition getSystemPartition()
           
 java.util.List<org.apache.directory.shared.ldap.ldif.LdifEntry> getTestEntries()
          Returns test directory entries(LdifEntry) to be loaded while bootstrapping.
 java.io.File getWorkingDirectory()
          Returns working directory (counterpart of var/lib) where partitions are stored by default.
 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()
          
 boolean isShutdownHookEnabled()
           
 boolean isStarted()
           
 org.apache.directory.shared.ldap.entry.ServerEntry newEntry(org.apache.directory.shared.ldap.name.DN dn)
           
 org.apache.directory.shared.ldap.entry.ServerEntry newEntry(java.lang.String ldif, java.lang.String dn)
          Create a new ServerEntry
 void removePartition(Partition partition)
           
 long revert()
           
 long revert(long 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)
          
 void setDenormalizeOpAttrsEnabled(boolean denormalizeOpAttrsEnabled)
          Sets whether the operational attributes are denormalized when returned
 void setEventService(EventService eventService)
           
 void setExitVmOnShutdown(boolean exitVmOnShutdown)
           
 void setInstanceId(java.lang.String instanceId)
           
 void setInterceptors(java.util.List<Interceptor> interceptors)
          Sets the interceptors in the server.
 void setJournal(Journal journal)
          
 void setMaxPDUSize(int maxPDUSize)
          Set the maximum allowed size for an incoming PDU
 void setPartitions(java.util.Set<? extends Partition> partitions)
          Sets Partitions used by this DirectoryService.
 void setPasswordHidden(boolean passwordHidden)
          
 void setReferralManager(ReferralManager referralManager)
          Set the referralManager
 void setReplicaId(int replicaId)
           
 void setReplicationConfiguration(ReplicationConfiguration replicationConfig)
           
 void setSchemaManager(org.apache.directory.shared.ldap.schema.SchemaManager schemaManager)
          Set the SchemaManager instance.
 void setSchemaService(SchemaService schemaService)
           
 void setShutdownHookEnabled(boolean shutdownHookEnabled)
           
 void setSyncPeriodMillis(long syncPeriodMillis)
           
 void setSystemPartition(Partition systemPartition)
           
 void setTestEntries(java.util.List<? extends org.apache.directory.shared.ldap.ldif.LdifEntry> testEntries)
          Sets test directory entries(Attributes) to be loaded while bootstrapping.
 void setWorkingDirectory(java.io.File workingDirectory)
          Sets working directory (counterpart of var/lib) where partitions are stored by default.
 void shutdown()
           
 void startup()
           
 void sync()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_SIZE_LIMIT_DEFAULT

public static final int MAX_SIZE_LIMIT_DEFAULT
The default timeLimit : 100 entries

See Also:
Constant Field Values

MAX_TIME_LIMIT_DEFAULT

public static final int MAX_TIME_LIMIT_DEFAULT
The default timeLimit : 10 seconds

See Also:
Constant Field Values
Constructor Detail

DefaultDirectoryService

public DefaultDirectoryService()
                        throws java.lang.Exception
Creates a new instance of the directory service.

Throws:
java.lang.Exception
Method Detail

setInstanceId

public void setInstanceId(java.lang.String instanceId)
Specified by:
setInstanceId in interface DirectoryService

getInstanceId

public java.lang.String getInstanceId()
Specified by:
getInstanceId in interface DirectoryService

getPartitions

public java.util.Set<? extends Partition> getPartitions()
Gets the Partitions used by this DirectoryService.

Specified by:
getPartitions in interface DirectoryService
Returns:
the set of partitions used

setPartitions

public void setPartitions(java.util.Set<? extends Partition> partitions)
Sets Partitions used by this DirectoryService.

Specified by:
setPartitions in interface DirectoryService
Parameters:
partitions - the partitions to used

isAccessControlEnabled

public boolean isAccessControlEnabled()
Returns true if access control checks are enabled.

Specified by:
isAccessControlEnabled in interface DirectoryService
Returns:
true if access control checks are enabled, false otherwise

setAccessControlEnabled

public void setAccessControlEnabled(boolean accessControlEnabled)
Sets whether to enable basic access control checks or not.

Specified by:
setAccessControlEnabled in interface DirectoryService
Parameters:
accessControlEnabled - true to enable access control checks, false otherwise

isAllowAnonymousAccess

public boolean isAllowAnonymousAccess()
Returns true if anonymous access is allowed on entries besides the RootDSE. If the access control subsystem is enabled then access to some entries may not be allowed even when full anonymous access is enabled.

Specified by:
isAllowAnonymousAccess in interface DirectoryService
Returns:
true if anonymous access is allowed on entries besides the RootDSE, false if anonymous access is allowed to all entries.

setAllowAnonymousAccess

public void setAllowAnonymousAccess(boolean enableAnonymousAccess)
Sets whether to allow anonymous access to entries other than the RootDSE. If the access control subsystem is enabled then access to some entries may not be allowed even when full anonymous access is enabled.

Specified by:
setAllowAnonymousAccess in interface DirectoryService
Parameters:
enableAnonymousAccess - true to enable anonymous access, false to disable it

getInterceptors

public java.util.List<Interceptor> getInterceptors()
Returns interceptors in the server.

Specified by:
getInterceptors in interface DirectoryService
Returns:
the interceptors in the server.

setInterceptors

public void setInterceptors(java.util.List<Interceptor> interceptors)
Sets the interceptors in the server.

Specified by:
setInterceptors in interface DirectoryService
Parameters:
interceptors - the interceptors to be used in the server.

getTestEntries

public java.util.List<org.apache.directory.shared.ldap.ldif.LdifEntry> getTestEntries()
Returns test directory entries(LdifEntry) to be loaded while bootstrapping.

Specified by:
getTestEntries in interface DirectoryService
Returns:
test entries to load during bootstrapping

setTestEntries

public void setTestEntries(java.util.List<? extends org.apache.directory.shared.ldap.ldif.LdifEntry> testEntries)
Sets test directory entries(Attributes) to be loaded while bootstrapping.

Specified by:
setTestEntries in interface DirectoryService
Parameters:
testEntries - the test entries to load while bootstrapping

getWorkingDirectory

public java.io.File getWorkingDirectory()
Returns working directory (counterpart of var/lib) where partitions are stored by default.

Specified by:
getWorkingDirectory in interface DirectoryService
Returns:
the directory where partition's are stored.

setWorkingDirectory

public void setWorkingDirectory(java.io.File workingDirectory)
Sets working directory (counterpart of var/lib) where partitions are stored by default.

Specified by:
setWorkingDirectory in interface DirectoryService
Parameters:
workingDirectory - the directory where the server's partitions are stored by default.

setShutdownHookEnabled

public void setShutdownHookEnabled(boolean shutdownHookEnabled)
Specified by:
setShutdownHookEnabled in interface DirectoryService

isShutdownHookEnabled

public boolean isShutdownHookEnabled()
Specified by:
isShutdownHookEnabled in interface DirectoryService

setExitVmOnShutdown

public void setExitVmOnShutdown(boolean exitVmOnShutdown)
Specified by:
setExitVmOnShutdown in interface DirectoryService

isExitVmOnShutdown

public boolean isExitVmOnShutdown()
Specified by:
isExitVmOnShutdown in interface DirectoryService

setSystemPartition

public void setSystemPartition(Partition systemPartition)
Specified by:
setSystemPartition in interface DirectoryService

getSystemPartition

public Partition getSystemPartition()
Specified by:
getSystemPartition in interface DirectoryService

isDenormalizeOpAttrsEnabled

public boolean isDenormalizeOpAttrsEnabled()
return true if the operational attributes must be normalized when returned

Specified by:
isDenormalizeOpAttrsEnabled in interface DirectoryService

setDenormalizeOpAttrsEnabled

public void setDenormalizeOpAttrsEnabled(boolean denormalizeOpAttrsEnabled)
Sets whether the operational attributes are denormalized when returned

Specified by:
setDenormalizeOpAttrsEnabled in interface DirectoryService
Parameters:
denormalizeOpAttrsEnabled - The flag value

getChangeLog

public ChangeLog getChangeLog()

Specified by:
getChangeLog in interface DirectoryService

getJournal

public Journal getJournal()

Specified by:
getJournal in interface DirectoryService

setChangeLog

public void setChangeLog(ChangeLog changeLog)

Specified by:
setChangeLog in interface DirectoryService

setJournal

public void setJournal(Journal journal)

Specified by:
setJournal in interface DirectoryService

addPartition

public void addPartition(Partition partition)
                  throws java.lang.Exception
Specified by:
addPartition in interface DirectoryService
Throws:
java.lang.Exception

removePartition

public void removePartition(Partition partition)
                     throws java.lang.Exception
Specified by:
removePartition in interface DirectoryService
Throws:
java.lang.Exception

getAdminSession

public CoreSession getAdminSession()
Specified by:
getAdminSession in interface DirectoryService

getSession

public CoreSession getSession()
Specified by:
getSession in interface DirectoryService

getSession

public CoreSession getSession(LdapPrincipal principal)
Specified by:
getSession in interface DirectoryService

getSession

public CoreSession getSession(org.apache.directory.shared.ldap.name.DN principalDn,
                              byte[] credentials)
                       throws java.lang.Exception
Specified by:
getSession in interface DirectoryService
Throws:
java.lang.Exception

getSession

public CoreSession getSession(org.apache.directory.shared.ldap.name.DN principalDn,
                              byte[] credentials,
                              java.lang.String saslMechanism,
                              java.lang.String saslAuthId)
                       throws java.lang.Exception
Specified by:
getSession in interface DirectoryService
Throws:
java.lang.Exception

revert

public long revert()
            throws java.lang.Exception
Specified by:
revert in interface DirectoryService
Throws:
java.lang.Exception

revert

public long revert(long revision)
            throws java.lang.Exception
Specified by:
revert in interface DirectoryService
Throws:
java.lang.Exception

getOperationManager

public OperationManager getOperationManager()
Specified by:
getOperationManager in interface DirectoryService

startup

public void startup()
             throws java.lang.Exception
Specified by:
startup in interface DirectoryService
Throws:
java.lang.Exception - if the LDAP server cannot be started

sync

public void sync()
          throws java.lang.Exception
Specified by:
sync in interface DirectoryService
Throws:
java.lang.Exception

shutdown

public void shutdown()
              throws java.lang.Exception
Specified by:
shutdown in interface DirectoryService
Throws:
java.lang.Exception

getReferralManager

public ReferralManager getReferralManager()
Specified by:
getReferralManager in interface DirectoryService
Returns:
The referral manager

setReferralManager

public void setReferralManager(ReferralManager referralManager)
Set the referralManager

Specified by:
setReferralManager in interface DirectoryService
Parameters:
referralManager - The initialized referralManager

getSchemaManager

public org.apache.directory.shared.ldap.schema.SchemaManager getSchemaManager()
Specified by:
getSchemaManager in interface DirectoryService
Returns:
the SchemaManager

setSchemaManager

public void setSchemaManager(org.apache.directory.shared.ldap.schema.SchemaManager schemaManager)
Set the SchemaManager instance.

Specified by:
setSchemaManager in interface DirectoryService
Parameters:
schemaManager - The schemaManager

getSchemaService

public SchemaService getSchemaService()
Specified by:
getSchemaService in interface DirectoryService

setSchemaService

public void setSchemaService(SchemaService schemaService)
Specified by:
setSchemaService in interface DirectoryService

getPartitionNexus

public DefaultPartitionNexus getPartitionNexus()
Specified by:
getPartitionNexus in interface DirectoryService

getInterceptorChain

public InterceptorChain getInterceptorChain()
Specified by:
getInterceptorChain in interface DirectoryService

isFirstStart

public boolean isFirstStart()

isStarted

public boolean isStarted()
Specified by:
isStarted in interface DirectoryService

newEntry

public org.apache.directory.shared.ldap.entry.ServerEntry newEntry(org.apache.directory.shared.ldap.name.DN dn)
Specified by:
newEntry in interface ServerEntryFactory

newEntry

public org.apache.directory.shared.ldap.entry.ServerEntry newEntry(java.lang.String ldif,
                                                                   java.lang.String dn)
Create a new ServerEntry

Specified by:
newEntry in interface DirectoryService
Parameters:
ldif - The String representing the attributes, as a LDIF file
dn - The DN for this new entry

getEventService

public EventService getEventService()
Specified by:
getEventService in interface DirectoryService

setEventService

public void setEventService(EventService eventService)
Specified by:
setEventService in interface DirectoryService

isPasswordHidden

public boolean isPasswordHidden()

Specified by:
isPasswordHidden in interface DirectoryService

setPasswordHidden

public void setPasswordHidden(boolean passwordHidden)

Specified by:
setPasswordHidden in interface DirectoryService

getMaxPDUSize

public int getMaxPDUSize()
Specified by:
getMaxPDUSize in interface DirectoryService
Returns:
The maximum allowed size for an incoming PDU

setMaxPDUSize

public void setMaxPDUSize(int maxPDUSize)
Set the maximum allowed size for an incoming PDU

Specified by:
setMaxPDUSize in interface DirectoryService
Parameters:
maxPDUSize - A positive number of bytes for the PDU. A negative or null value will be transformed to Integer.MAX_VALUE

getInterceptor

public Interceptor getInterceptor(java.lang.String interceptorName)

Specified by:
getInterceptor in interface DirectoryService

getCSN

public org.apache.directory.shared.ldap.csn.Csn getCSN()
Get a new CSN

Specified by:
getCSN in interface DirectoryService
Returns:
The CSN generated for this directory service

getReplicaId

public int getReplicaId()
Specified by:
getReplicaId in interface DirectoryService
Returns:
the replicaId

setReplicaId

public void setReplicaId(int replicaId)
Specified by:
setReplicaId in interface DirectoryService
Parameters:
replicaId - the replicaId to set

setReplicationConfiguration

public void setReplicationConfiguration(ReplicationConfiguration replicationConfig)
Specified by:
setReplicationConfiguration in interface DirectoryService

getReplicationConfiguration

public ReplicationConfiguration getReplicationConfiguration()
Specified by:
getReplicationConfiguration in interface DirectoryService
Returns:
the replication configuration for this DirectoryService

getSyncPeriodMillis

public long getSyncPeriodMillis()
Returns:
the syncPeriodMillis

setSyncPeriodMillis

public void setSyncPeriodMillis(long syncPeriodMillis)
Parameters:
syncPeriodMillis - the syncPeriodMillis to set


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