public class MockDirectoryService extends Object implements DirectoryService
JNDI_KEY
Constructor and Description |
---|
MockDirectoryService(int count) |
Modifier and Type | Method and Description |
---|---|
void |
addPartition(Partition partition) |
CoreSession |
getAdminSession() |
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.shared.ldap.csn.Csn |
getCSN()
Get a new CSN
|
DirectoryService |
getDirectoryService() |
Hashtable<String,Object> |
getEnvironment() |
EventService |
getEventService() |
String |
getInstanceId() |
Interceptor |
getInterceptor(String interceptorName)
Get an Interceptor instance from its name
|
InterceptorChain |
getInterceptorChain() |
List<Interceptor> |
getInterceptors()
Returns interceptors in the server.
|
LdapContext |
getJndiContext() |
Journal |
getJournal()
Gets the Journal service for this DirectoryService used for tracking
changes to the server.
|
int |
getMaxPDUSize() |
long |
getMaxSizeLimit() |
int |
getMaxTimeLimit() |
OperationManager |
getOperationManager()
Gets the operation manager.
|
PartitionNexus |
getPartitionNexus() |
Set<? extends Partition> |
getPartitions()
Gets the
Partition s used by this DirectoryService. |
ReferralManager |
getReferralManager() |
int |
getReplicaId() |
ReplicationConfiguration |
getReplicationConfiguration() |
org.apache.directory.shared.ldap.schema.SchemaManager |
getSchemaManager() |
SchemaService |
getSchemaService() |
CoreSession |
getSession()
Gets a logical session to perform operations on this DirectoryService
as the anonymous user.
|
CoreSession |
getSession(org.apache.directory.shared.ldap.name.DN principalDn,
byte[] credentials)
Gets a logical session to perform operations on this DirectoryService
as a specific user with a separate authorization principal.
|
CoreSession |
getSession(org.apache.directory.shared.ldap.name.DN principalDn,
byte[] credentials,
String saslMechanism,
String saslAuthId)
Gets a logical session to perform operations on this DirectoryService
as a specific user with a separate authorization principal.
|
CoreSession |
getSession(LdapPrincipal principal)
Gets a logical session to perform operations on this DirectoryService
as a specific user.
|
Partition |
getSystemPartition() |
List<org.apache.directory.shared.ldap.ldif.LdifEntry> |
getTestEntries()
Returns test directory entries(
LdifEntry ) to be loaded while
bootstrapping. |
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() |
boolean |
isExitVmOnShutdown() |
boolean |
isPasswordHidden()
Returns true if the service requires the userPassword attribute
to be masked.
|
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.shared.ldap.entry.ServerEntry |
newEntry(org.apache.directory.shared.ldap.name.DN dn)
Creates a new ServerEntry which has not yet been added to the
directory.
|
org.apache.directory.shared.ldap.entry.ServerEntry |
newEntry(String ldif,
String dn)
Create a new ServerEntry.
|
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) |
void |
setEnvironment(Hashtable<String,Object> environment) |
void |
setEventService(EventService eventService) |
void |
setExitVmOnShutdown(boolean exitVmOnShutdown) |
void |
setInstanceId(String instanceId) |
void |
setInterceptors(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 |
setMaxSizeLimit(long maxSizeLimit) |
void |
setMaxTimeLimit(int maxTimeLimit) |
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 |
setReplicationConfiguration(ReplicationConfiguration replicationConfig)
Sets the replication configuration in the server.
|
void |
setSchemaManager(org.apache.directory.shared.ldap.schema.SchemaManager schemaManager)
Associates a SchemaManager to the service
|
void |
setSchemaService(SchemaService schemaService) |
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 |
setSystemPartition(Partition systemPartition) |
void |
setTestEntries(List<? extends org.apache.directory.shared.ldap.ldif.LdifEntry> testEntries)
Sets test directory entries(
Attributes ) to be loaded while
bootstrapping. |
void |
setWorkingDirectory(File workingDirectory)
Sets working directory (counterpart of var/lib) where partitions are stored
by default.
|
void |
shutdown()
Shuts down this service.
|
void |
startup()
Starts up this service.
|
void |
sync()
Calls
Partition.sync() for all registered Partition s. |
void |
validate() |
public long revert(long revision) throws NamingException
DirectoryService
revert
in interface DirectoryService
revision
- the revision number to revert toNamingException
public long revert() throws NamingException
DirectoryService
revert
in interface DirectoryService
NamingException
public PartitionNexus getPartitionNexus()
getPartitionNexus
in interface DirectoryService
public InterceptorChain getInterceptorChain()
getInterceptorChain
in interface DirectoryService
public void addPartition(Partition partition) throws NamingException
addPartition
in interface DirectoryService
NamingException
public void removePartition(Partition partition) throws NamingException
removePartition
in interface DirectoryService
NamingException
public org.apache.directory.shared.ldap.schema.SchemaManager getSchemaManager()
getSchemaManager
in interface DirectoryService
public ReferralManager getReferralManager()
getReferralManager
in interface DirectoryService
public void setReferralManager(ReferralManager referralManager)
DirectoryService
setReferralManager
in interface DirectoryService
referralManager
- The initialized referralManagerpublic void setSchemaManager(org.apache.directory.shared.ldap.schema.SchemaManager schemaManager)
DirectoryService
setSchemaManager
in interface DirectoryService
schemaManager
- The SchemaManager to associatepublic SchemaService getSchemaService()
getSchemaService
in interface DirectoryService
public void setSchemaService(SchemaService schemaService)
setSchemaService
in interface DirectoryService
public void startup() throws NamingException
DirectoryService
startup
in interface DirectoryService
NamingException
public void shutdown() throws NamingException
DirectoryService
shutdown
in interface DirectoryService
NamingException
public void sync() throws NamingException
DirectoryService
Partition.sync()
for all registered Partition
s.sync
in interface DirectoryService
NamingException
public boolean isStarted()
DirectoryService
isStarted
in interface DirectoryService
public LdapContext getJndiContext() throws NamingException
NamingException
public DirectoryService getDirectoryService()
public void setInstanceId(String instanceId)
setInstanceId
in interface DirectoryService
public String getInstanceId()
getInstanceId
in interface DirectoryService
public Set<? extends Partition> getPartitions()
DirectoryService
Partition
s used by this DirectoryService.getPartitions
in interface DirectoryService
public void setPartitions(Set<? extends Partition> partitions)
DirectoryService
Partition
s used by this DirectoryService.setPartitions
in interface DirectoryService
partitions
- the partitions to usedpublic boolean isAccessControlEnabled()
DirectoryService
isAccessControlEnabled
in interface DirectoryService
public void setAccessControlEnabled(boolean accessControlEnabled)
DirectoryService
setAccessControlEnabled
in interface DirectoryService
accessControlEnabled
- true to enable access control checks, false otherwisepublic boolean isAllowAnonymousAccess()
DirectoryService
isAllowAnonymousAccess
in interface DirectoryService
public void setAllowAnonymousAccess(boolean enableAnonymousAccess)
DirectoryService
setAllowAnonymousAccess
in interface DirectoryService
enableAnonymousAccess
- true to enable anonymous access, false to disable itpublic List<Interceptor> getInterceptors()
DirectoryService
getInterceptors
in interface DirectoryService
public void setInterceptors(List<Interceptor> interceptors)
DirectoryService
setInterceptors
in interface DirectoryService
interceptors
- the interceptors to be used in the server.public List<org.apache.directory.shared.ldap.ldif.LdifEntry> getTestEntries()
DirectoryService
LdifEntry
) to be loaded while
bootstrapping.getTestEntries
in interface DirectoryService
public void setTestEntries(List<? extends org.apache.directory.shared.ldap.ldif.LdifEntry> testEntries)
DirectoryService
Attributes
) to be loaded while
bootstrapping.setTestEntries
in interface DirectoryService
testEntries
- the test entries to load while bootstrappingpublic File getWorkingDirectory()
DirectoryService
getWorkingDirectory
in interface DirectoryService
public void setWorkingDirectory(File workingDirectory)
DirectoryService
setWorkingDirectory
in interface DirectoryService
workingDirectory
- the directory where the server's partitions are stored by default.public void validate()
public 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 setMaxSizeLimit(long maxSizeLimit)
public long getMaxSizeLimit()
public void setMaxTimeLimit(int maxTimeLimit)
public int getMaxTimeLimit()
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
public void setChangeLog(ChangeLog changeLog)
DirectoryService
setChangeLog
in interface DirectoryService
changeLog
- the change log service to setpublic ChangeLog getChangeLog()
DirectoryService
getChangeLog
in interface DirectoryService
public Journal getJournal()
DirectoryService
getJournal
in interface DirectoryService
public org.apache.directory.shared.ldap.entry.ServerEntry newEntry(org.apache.directory.shared.ldap.name.DN dn) throws NamingException
ServerEntryFactory
newEntry
in interface ServerEntryFactory
NamingException
public org.apache.directory.shared.ldap.entry.ServerEntry newEntry(String ldif, String dn)
DirectoryService
newEntry
in interface DirectoryService
ldif
- the String representing the attributes, in LDIF formatdn
- the DN for this new entrypublic OperationManager getOperationManager()
DirectoryService
getOperationManager
in interface DirectoryService
public CoreSession getSession() throws Exception
DirectoryService
getSession
in interface DirectoryService
Exception
public CoreSession getSession(LdapPrincipal principal) throws Exception
DirectoryService
getSession
in interface DirectoryService
Exception
public CoreSession getSession(org.apache.directory.shared.ldap.name.DN principalDn, byte[] credentials) throws Exception
DirectoryService
getSession
in interface DirectoryService
Exception
public CoreSession getSession(org.apache.directory.shared.ldap.name.DN principalDn, byte[] credentials, String saslMechanism, String saslAuthId) throws Exception
DirectoryService
getSession
in interface DirectoryService
Exception
public CoreSession getAdminSession() throws Exception
getAdminSession
in interface DirectoryService
Exception
public EventService getEventService()
getEventService
in interface DirectoryService
public void setEventService(EventService eventService)
setEventService
in interface DirectoryService
public boolean isPasswordHidden()
DirectoryService
isPasswordHidden
in interface DirectoryService
public void setPasswordHidden(boolean passwordHidden)
DirectoryService
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)
DirectoryService
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)
DirectoryService
getInterceptor
in interface DirectoryService
interceptorName
- The interceptor's name for which we want the instancepublic org.apache.directory.shared.ldap.csn.Csn getCSN()
DirectoryService
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 void setJournal(Journal journal)
DirectoryService
setJournal
in interface DirectoryService
public void setReplicationConfiguration(ReplicationConfiguration replicationConfig)
DirectoryService
setReplicationConfiguration
in interface DirectoryService
public ReplicationConfiguration getReplicationConfiguration()
getReplicationConfiguration
in interface DirectoryService
Copyright © 2003-2013 Apache Software Foundation. All Rights Reserved.