public abstract class BTreePartition<ID> extends AbstractPartition
Partition
that uses general BTree operations.Modifier and Type | Field and Description |
---|---|
protected int |
cacheSize |
protected org.apache.directory.shared.ldap.entry.ServerEntry |
contextEntry
The rootDSE context
|
protected String |
id |
protected Optimizer |
optimizer |
protected org.apache.directory.shared.ldap.schema.SchemaManager |
schemaManager |
protected SearchEngine<org.apache.directory.shared.ldap.entry.ServerEntry,ID> |
searchEngine
the search engine used to search the database
|
protected org.apache.directory.shared.ldap.name.DN |
suffix |
protected static Set<String> |
SYS_INDEX_OIDS |
initialized
Modifier | Constructor and Description |
---|---|
protected |
BTreePartition()
Creates a B-tree based context partition.
|
Modifier and Type | Method and Description |
---|---|
abstract void |
add(AddOperationContext opContext)
Adds an entry to this ContextPartition.
|
void |
addIndexedAttributes(Index<? extends Object,org.apache.directory.shared.ldap.entry.ServerEntry,ID>... indexes) |
abstract void |
addIndexOn(Index<? extends Object,org.apache.directory.shared.ldap.entry.ServerEntry,ID> index) |
abstract int |
count()
Gets the count of the total number of entries in the database.
|
void |
delete(DeleteOperationContext opContext)
Deletes a leaf entry from this ContextPartition: non-leaf entries cannot be
deleted until this operation has been applied to their children.
|
abstract void |
delete(ID id) |
abstract Index<String,org.apache.directory.shared.ldap.entry.ServerEntry,ID> |
getAliasIndex()
Gets the system index defined on the ALIAS_ATTRIBUTE which for LDAP would
be the aliasedObjectName and for X.500 would be aliasedEntryName.
|
int |
getCacheSize()
Gets the entry cache size for this BTreePartition.
|
abstract int |
getChildCount(ID id) |
abstract String |
getEntryDn(ID id) |
abstract ID |
getEntryId(String dn) |
abstract String |
getEntryUpdn(ID id)
Gets the user provided distinguished name.
|
abstract String |
getEntryUpdn(String dn)
Gets the user provided distinguished name.
|
String |
getId()
Gets the unique identifier for this partition.
|
Set<Index<? extends Object,org.apache.directory.shared.ldap.entry.ServerEntry,ID>> |
getIndexedAttributes() |
abstract Index<String,org.apache.directory.shared.ldap.entry.ServerEntry,ID> |
getNdnIndex()
Gets the Index mapping the normalized distinguished names of entries as
Strings to the BigInteger primary keys of entries.
|
abstract Index<ID,org.apache.directory.shared.ldap.entry.ServerEntry,ID> |
getOneAliasIndex()
Gets the alias index mapping parent entries with scope expanding aliases
children one level below them; this system index is used to dereference
aliases on one/single level scoped searches.
|
abstract Index<ID,org.apache.directory.shared.ldap.entry.ServerEntry,ID> |
getOneLevelIndex()
Gets the Index mapping the primary keys of parents to the
primary keys of their children.
|
abstract ID |
getParentId(ID childId) |
abstract ID |
getParentId(String dn) |
File |
getPartitionDir()
Gets the directory in which this Partition stores files.
|
abstract Index<String,org.apache.directory.shared.ldap.entry.ServerEntry,ID> |
getPresenceIndex() |
abstract String |
getProperty(String key) |
org.apache.directory.shared.ldap.schema.SchemaManager |
getSchemaManager()
Gets the schema manager assigned to this Partition.
|
SearchEngine<org.apache.directory.shared.ldap.entry.ServerEntry,ID> |
getSearchEngine()
Gets the DefaultSearchEngine used by this ContextPartition to search the
Database.
|
abstract Index<ID,org.apache.directory.shared.ldap.entry.ServerEntry,ID> |
getSubAliasIndex()
Gets the alias index mapping relative entries with scope expanding
alias descendents; this system index is used to dereference aliases on
subtree scoped searches.
|
abstract Index<ID,org.apache.directory.shared.ldap.entry.ServerEntry,ID> |
getSubLevelIndex()
Gets the Index mapping the primary keys of ancestors to the
primary keys of their descendants.
|
String |
getSuffix()
Gets the user provided suffix for this Partition as a String.
|
org.apache.directory.shared.ldap.name.DN |
getSuffixDn()
Gets the normalized suffix as an DN for this Partition after it has
been initialized.
|
abstract Index<? extends Object,org.apache.directory.shared.ldap.entry.ServerEntry,ID> |
getSystemIndex(String attribute) |
abstract Iterator<String> |
getSystemIndices() |
abstract Index<String,org.apache.directory.shared.ldap.entry.ServerEntry,ID> |
getUpdnIndex()
Gets the Index mapping user provided distinguished names of entries as
Strings to the BigInteger primary keys of entries.
|
abstract Index<? extends Object,org.apache.directory.shared.ldap.entry.ServerEntry,ID> |
getUserIndex(String attribute) |
abstract Iterator<String> |
getUserIndices() |
boolean |
hasEntry(EntryOperationContext opContext)
This method calls
Partition.lookup(LookupOperationContext) and return true
if it returns an entry by default. |
abstract boolean |
hasSystemIndexOn(String attribute) |
abstract boolean |
hasUserIndexOn(String attribute) |
abstract IndexCursor<ID,org.apache.directory.shared.ldap.entry.ServerEntry,ID> |
list(ID id) |
EntryFilteringCursor |
list(ListOperationContext opContext)
A specialized form of one level search used to return a minimal set of
information regarding child entries under a base.
|
abstract ClonedServerEntry |
lookup(ID id) |
ClonedServerEntry |
lookup(LookupOperationContext opContext)
This method calls
Partition.lookup(LookupOperationContext)
with null attributeIds by default. |
abstract void |
modify(ModifyOperationContext opContext)
Modifies an entry by adding, removing or replacing a set of attributes.
|
abstract void |
move(MoveOperationContext opContext)
Transplants a child entry, to a position in the namespace under a new
parent entry.
|
abstract void |
moveAndRename(MoveAndRenameOperationContext opContext)
Transplants a child entry, to a position in the namespace under a new
parent entry and changes the RN of the child entry which can optionally
have its old RN attributes removed.
|
abstract void |
rename(RenameOperationContext opContext)
Modifies an entry by changing its relative name.
|
EntryFilteringCursor |
search(SearchOperationContext opContext)
Conducts a search against this ContextPartition.
|
abstract void |
setAliasIndexOn(Index<String,org.apache.directory.shared.ldap.entry.ServerEntry,ID> index)
Sets the system index defined on the ALIAS_ATTRIBUTE which for LDAP would
be the aliasedObjectName and for X.500 would be aliasedEntryName.
|
void |
setCacheSize(int cacheSize)
Used to specify the entry cache size for a Partition.
|
void |
setId(String id)
Sets the unique identifier for this partition.
|
void |
setIndexedAttributes(Set<Index<? extends Object,org.apache.directory.shared.ldap.entry.ServerEntry,ID>> indexedAttributes) |
abstract void |
setNdnIndexOn(Index<String,org.apache.directory.shared.ldap.entry.ServerEntry,ID> index)
Sets the normalized distinguished name Index.
|
abstract void |
setOneAliasIndexOn(Index<ID,org.apache.directory.shared.ldap.entry.ServerEntry,ID> index)
Sets the alias index mapping parent entries with scope expanding aliases
children one level below them; this system index is used to dereference
aliases on one/single level scoped searches.
|
abstract void |
setOneLevelIndexOn(Index<ID,org.apache.directory.shared.ldap.entry.ServerEntry,ID> index)
Sets the one level Index.
|
void |
setPartitionDir(File partitionDir)
Sets the directory in which this Partition stores files.
|
abstract void |
setPresenceIndexOn(Index<String,org.apache.directory.shared.ldap.entry.ServerEntry,ID> index)
Sets the attribute existence Index.
|
abstract void |
setProperty(String key,
String value) |
void |
setSchemaManager(org.apache.directory.shared.ldap.schema.SchemaManager schemaManager)
Sets the schema manager assigned to this Partition.
|
abstract void |
setSubAliasIndexOn(Index<ID,org.apache.directory.shared.ldap.entry.ServerEntry,ID> index)
Sets the alias index mapping relative entries with scope expanding
alias descendents; this system index is used to dereference aliases on
subtree scoped searches.
|
void |
setSuffix(String suffix)
Sets the user provided suffix for this Partition as a String.
|
abstract void |
setUpdnIndexOn(Index<String,org.apache.directory.shared.ldap.entry.ServerEntry,ID> index)
Sets the user provided distinguished name Index.
|
abstract void |
sync()
This method does nothing by default.
|
destroy, doDestroy, doInit, initialize, isInitialized
protected SearchEngine<org.apache.directory.shared.ldap.entry.ServerEntry,ID> searchEngine
protected Optimizer optimizer
protected org.apache.directory.shared.ldap.schema.SchemaManager schemaManager
protected String id
protected int cacheSize
protected org.apache.directory.shared.ldap.name.DN suffix
protected org.apache.directory.shared.ldap.entry.ServerEntry contextEntry
protected BTreePartition()
public void setSchemaManager(org.apache.directory.shared.ldap.schema.SchemaManager schemaManager)
public org.apache.directory.shared.ldap.schema.SchemaManager getSchemaManager()
public File getPartitionDir()
public void setPartitionDir(File partitionDir)
partitionDir
- the directory in which this Partition stores files.public void setIndexedAttributes(Set<Index<? extends Object,org.apache.directory.shared.ldap.entry.ServerEntry,ID>> indexedAttributes)
public void addIndexedAttributes(Index<? extends Object,org.apache.directory.shared.ldap.entry.ServerEntry,ID>... indexes)
public Set<Index<? extends Object,org.apache.directory.shared.ldap.entry.ServerEntry,ID>> getIndexedAttributes()
public void setCacheSize(int cacheSize)
cacheSize
- the maximum size of the cache in the number of entriespublic int getCacheSize()
public String getId()
public void setId(String id)
id
- the unique identifier for this partitionpublic SearchEngine<org.apache.directory.shared.ldap.entry.ServerEntry,ID> getSearchEngine()
public void delete(DeleteOperationContext opContext) throws Exception
opContext
- the context of the entry to
delete from this ContextPartition.Exception
- if there are any problemspublic abstract void add(AddOperationContext opContext) throws Exception
Partition
opContext
- the context used to add and entry to this ContextPartitionException
- if there are any problemspublic abstract void modify(ModifyOperationContext opContext) throws Exception
Partition
opContext
- The context containing the modification operation
to perform on the entry which is one of constants specified by the
DirContext interface:
ADD_ATTRIBUTE, REMOVE_ATTRIBUTE, REPLACE_ATTRIBUTE
.Exception
- if there are any problemsDirContext
,
DirContext.ADD_ATTRIBUTE
,
DirContext.REMOVE_ATTRIBUTE
,
DirContext.REPLACE_ATTRIBUTE
public EntryFilteringCursor list(ListOperationContext opContext) throws Exception
Partition
opContext
- the context containing the distinguished/absolute name for the search/listingServerSearchResult
Exception
- if there are any problemspublic EntryFilteringCursor search(SearchOperationContext opContext) throws Exception
Partition
opContext
- The context containing the information used by the operationException
- if there are any problemspublic ClonedServerEntry lookup(LookupOperationContext opContext) throws Exception
AbstractPartition
Partition.lookup(LookupOperationContext)
with null attributeIds by default. Please override
this method if there is more effective way for your implementation.lookup
in interface Partition
lookup
in class AbstractPartition
opContext
- The context containing the parametersException
- if there are any problemspublic boolean hasEntry(EntryOperationContext opContext) throws Exception
AbstractPartition
Partition.lookup(LookupOperationContext)
and return true
if it returns an entry by default. Please override this method if
there is more effective way for your implementation.hasEntry
in interface Partition
hasEntry
in class AbstractPartition
opContext
- The context used to pass informationsException
- if there are any problemspublic abstract void rename(RenameOperationContext opContext) throws Exception
Partition
opContext
- the modify DN contextException
- if there are any problemspublic abstract void move(MoveOperationContext opContext) throws Exception
Partition
opContext
- The context containing the DNs to moveException
- if there are any problemspublic abstract void moveAndRename(MoveAndRenameOperationContext opContext) throws Exception
Partition
opContext
- The context contain all the information about
the modifyDN operationException
- if there are any problemspublic abstract void sync() throws Exception
AbstractPartition
sync
in interface Partition
sync
in class AbstractPartition
Exception
- if buffers cannot be flushed to diskpublic abstract void addIndexOn(Index<? extends Object,org.apache.directory.shared.ldap.entry.ServerEntry,ID> index) throws Exception
Exception
public abstract boolean hasUserIndexOn(String attribute) throws Exception
Exception
public abstract boolean hasSystemIndexOn(String attribute) throws Exception
Exception
public abstract Index<String,org.apache.directory.shared.ldap.entry.ServerEntry,ID> getPresenceIndex()
public abstract Index<ID,org.apache.directory.shared.ldap.entry.ServerEntry,ID> getOneLevelIndex()
public abstract Index<ID,org.apache.directory.shared.ldap.entry.ServerEntry,ID> getSubLevelIndex()
public abstract Index<String,org.apache.directory.shared.ldap.entry.ServerEntry,ID> getUpdnIndex()
public abstract Index<String,org.apache.directory.shared.ldap.entry.ServerEntry,ID> getNdnIndex()
public abstract Index<ID,org.apache.directory.shared.ldap.entry.ServerEntry,ID> getOneAliasIndex()
public abstract Index<ID,org.apache.directory.shared.ldap.entry.ServerEntry,ID> getSubAliasIndex()
public abstract Index<String,org.apache.directory.shared.ldap.entry.ServerEntry,ID> getAliasIndex()
public abstract void setAliasIndexOn(Index<String,org.apache.directory.shared.ldap.entry.ServerEntry,ID> index) throws Exception
index
- the index on the ALIAS_ATTRIBUTEException
- if there is a problem setting up the indexpublic abstract void setPresenceIndexOn(Index<String,org.apache.directory.shared.ldap.entry.ServerEntry,ID> index) throws Exception
index
- the attribute existence IndexException
- if there is a problem setting up the indexpublic abstract void setOneLevelIndexOn(Index<ID,org.apache.directory.shared.ldap.entry.ServerEntry,ID> index) throws Exception
index
- the one level IndexException
- if there is a problem setting up the indexpublic abstract void setUpdnIndexOn(Index<String,org.apache.directory.shared.ldap.entry.ServerEntry,ID> index) throws Exception
index
- the updn IndexException
- if there is a problem setting up the indexpublic abstract void setNdnIndexOn(Index<String,org.apache.directory.shared.ldap.entry.ServerEntry,ID> index) throws Exception
index
- the ndn IndexException
- if there is a problem setting up the indexpublic abstract void setOneAliasIndexOn(Index<ID,org.apache.directory.shared.ldap.entry.ServerEntry,ID> index) throws Exception
index
- a one level alias indexException
- if there is a problem setting up the indexpublic abstract void setSubAliasIndexOn(Index<ID,org.apache.directory.shared.ldap.entry.ServerEntry,ID> index) throws Exception
index
- a subtree alias indexException
- if there is a problem setting up the indexpublic void setSuffix(String suffix) throws org.apache.directory.shared.ldap.exception.LdapInvalidDnException
suffix
- the suffix String for this Partition.org.apache.directory.shared.ldap.exception.LdapInvalidDnException
- if the suffix does not conform to LDAP DN syntaxpublic String getSuffix()
public org.apache.directory.shared.ldap.name.DN getSuffixDn()
public abstract Index<? extends Object,org.apache.directory.shared.ldap.entry.ServerEntry,ID> getUserIndex(String attribute) throws Exception
Exception
public abstract Index<? extends Object,org.apache.directory.shared.ldap.entry.ServerEntry,ID> getSystemIndex(String attribute) throws Exception
Exception
public abstract String getEntryUpdn(ID id) throws Exception
id
- the entry idException
- if the updn index cannot be accessedpublic abstract String getEntryUpdn(String dn) throws Exception
dn
- the normalized distinguished nameException
- if the updn and ndn indices cannot be accessedpublic abstract ClonedServerEntry lookup(ID id) throws Exception
Exception
public abstract IndexCursor<ID,org.apache.directory.shared.ldap.entry.ServerEntry,ID> list(ID id) throws Exception
Exception
public abstract void setProperty(String key, String value) throws Exception
Exception
Copyright © 2003-2012 Apache Software Foundation. All Rights Reserved.