public abstract class AbstractPartition extends Object implements Partition
Partition
that helps users to implement their own partition.
Most methods are implemented by default. Please look at the description of
each methods for the detail of implementations.Modifier and Type | Field and Description |
---|---|
protected CacheService |
cacheService
the cache service
|
protected org.apache.directory.api.ldap.model.entry.Entry |
contextEntry
The partition ContextEntry
|
protected boolean |
ctxCsnChanged
a flag to detect the change in context CSN
|
protected DnFactory |
dnFactory
The DnFactory to use to create DN
|
protected String |
id
The partition ID
|
protected boolean |
initialized
true if and only if this partition is initialized.
|
protected org.apache.directory.api.ldap.model.schema.SchemaManager |
schemaManager
The SchemaManager instance
|
protected org.apache.directory.api.ldap.model.name.Dn |
suffixDn
The root Dn for this partition
|
DEFAULT_ID, ROOT_ID
Constructor and Description |
---|
AbstractPartition() |
Modifier and Type | Method and Description |
---|---|
protected void |
checkInitialized(String property)
Check that the operation is done on an initialized store
|
void |
destroy()
Calls
doDestroy() where you have to put your destroy code in,
and clears default properties. |
protected abstract void |
doDestroy()
Override this method to put your initialization code.
|
protected abstract void |
doInit()
Override this method to put your initialization code.
|
void |
dumpIndex(OutputStream stream,
String name)
Dump the requested index to a given stream
|
String |
getContextCsn() |
org.apache.directory.api.ldap.model.entry.Entry |
getContextEntry() |
String |
getId()
Gets the unique identifier for this partition.
|
org.apache.directory.api.ldap.model.schema.SchemaManager |
getSchemaManager()
Gets the schema manager assigned to this Partition.
|
org.apache.directory.api.ldap.model.name.Dn |
getSuffixDn()
Gets the normalized suffix as an Dn for this Partition after it has
been initialized.
|
void |
initialize()
Initializes this partition.
|
boolean |
isInitialized()
Checks to see if this partition is initialized or not.
|
void |
setCacheService(CacheService cacheService)
set the Cache service
|
protected void |
setContextCsn(String csn)
Replaces the current context CSN with the given CSN value if they are not same and
sets the ctxCsnChanged flag to true.
|
void |
setContextEntry(org.apache.directory.api.ldap.model.entry.Entry contextEntry) |
void |
setId(String id)
Sets the unique identifier for this partition.
|
void |
setSchemaManager(org.apache.directory.api.ldap.model.schema.SchemaManager schemaManager)
Sets the schema manager assigned to this Partition.
|
void |
setSuffixDn(org.apache.directory.api.ldap.model.name.Dn suffixDn)
Sets the suffix Dn, must be normalized.
|
protected boolean initialized
protected org.apache.directory.api.ldap.model.entry.Entry contextEntry
protected org.apache.directory.api.ldap.model.schema.SchemaManager schemaManager
protected DnFactory dnFactory
protected String id
protected org.apache.directory.api.ldap.model.name.Dn suffixDn
protected CacheService cacheService
protected volatile boolean ctxCsnChanged
public void initialize() throws org.apache.directory.api.ldap.model.exception.LdapException
Partition.isInitialized()
will return true if
#doInit()
returns without any errors. Partition.destroy()
is called automatically
as a clean-up process if #doInit()
throws an exception.initialize
in interface Partition
org.apache.directory.api.ldap.model.exception.LdapException
protected abstract void doDestroy() throws Exception
Exception
protected abstract void doInit() throws InvalidNameException, Exception
Exception
InvalidNameException
public final void destroy() throws Exception
doDestroy()
where you have to put your destroy code in,
and clears default properties. Once this method is invoked, isInitialized()
will return false.public final boolean isInitialized()
isInitialized
in interface Partition
public void setSchemaManager(org.apache.directory.api.ldap.model.schema.SchemaManager schemaManager)
setSchemaManager
in interface Partition
public final org.apache.directory.api.ldap.model.schema.SchemaManager getSchemaManager()
getSchemaManager
in interface Partition
public final String getId()
public void setId(String id)
public final org.apache.directory.api.ldap.model.name.Dn getSuffixDn()
getSuffixDn
in interface Partition
public void setSuffixDn(org.apache.directory.api.ldap.model.name.Dn suffixDn) throws org.apache.directory.api.ldap.model.exception.LdapInvalidDnException
setSuffixDn
in interface Partition
suffixDn
- the new suffix Dnorg.apache.directory.api.ldap.model.exception.LdapInvalidDnException
public void dumpIndex(OutputStream stream, String name) throws IOException
dumpIndex
in interface Partition
name
- The index to dump to stdoutIOException
- if we can't write the dataprotected void checkInitialized(String property)
property
- public org.apache.directory.api.ldap.model.entry.Entry getContextEntry()
public void setContextEntry(org.apache.directory.api.ldap.model.entry.Entry contextEntry)
contextEntry
- the contextEntry to setpublic void setCacheService(CacheService cacheService)
setCacheService
in interface Partition
public String getContextCsn()
getContextCsn
in interface Partition
protected void setContextCsn(String csn)
csn
- the CSN valueCopyright © 2017. All rights reserved.