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 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(PartitionTxn partitionTxn)
Calls
doDestroy() where you have to put your destroy code in,
and clears default properties. |
protected abstract void |
doDestroy(PartitionTxn partitionTxn)
Override this method to put your initialization code.
|
protected abstract void |
doInit()
Override this method to put your initialization code.
|
protected abstract void |
doRepair()
Override this method to implement a repair method
|
void |
dumpIndex(PartitionTxn partitionTxn,
OutputStream stream,
String name)
Dump the requested index to a given stream
|
String |
getContextCsn(PartitionTxn partitionTxn)
Get the contextCSN
|
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 |
repair()
Repair this partition.
|
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.
|
void |
sync()
Flushes any changes made to this partition now.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
add, beginReadTransaction, beginWriteTransaction, delete, getSubordinates, hasEntry, lookup, modify, move, moveAndRename, rename, saveContextCsn, search, unbind
protected boolean initialized
protected org.apache.directory.api.ldap.model.entry.Entry contextEntry
protected org.apache.directory.api.ldap.model.schema.SchemaManager schemaManager
protected org.apache.directory.api.ldap.model.name.Dn suffixDn
protected volatile boolean ctxCsnChanged
public AbstractPartition()
public void initialize() throws org.apache.directory.api.ldap.model.exception.LdapException
isInitialized()
will return true if
doInit()
returns without any errors. 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
- if initialization fails in any waypublic void repair() throws org.apache.directory.api.ldap.model.exception.LdapException
protected abstract void doDestroy(PartitionTxn partitionTxn) throws org.apache.directory.api.ldap.model.exception.LdapException
partitionTxn
- The transaction to useorg.apache.directory.api.ldap.model.exception.LdapException
- If the destroy call failedprotected abstract void doInit() throws InvalidNameException, org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapException
- If the initialization failedInvalidNameException
- If the initialization failedprotected abstract void doRepair() throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapException
- If the repair failedpublic final void destroy(PartitionTxn partitionTxn) throws org.apache.directory.api.ldap.model.exception.LdapException
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
schemaManager
- The SchemaManager instancepublic final org.apache.directory.api.ldap.model.schema.SchemaManager getSchemaManager()
getSchemaManager
in interface Partition
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
- If the Dn is invalidpublic void dumpIndex(PartitionTxn partitionTxn, OutputStream stream, String name) throws IOException
dumpIndex
in interface Partition
partitionTxn
- The transaction to usestream
- The Stream used to dump the indexname
- The index to dump to stdoutIOException
- if we can't write the dataprotected void checkInitialized(String property)
property
- The property that was initializedpublic 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 String getContextCsn(PartitionTxn partitionTxn)
getContextCsn
in interface Partition
partitionTxn
- The transaction to useprotected void setContextCsn(String csn)
csn
- the CSN valueCopyright © 2003–2023 The Apache Software Foundation. All rights reserved.