org.apache.ldap.server
Class AbstractContextPartition

java.lang.Object
  extended byorg.apache.ldap.server.AbstractContextPartition
All Implemented Interfaces:
BackingStore, ContextPartition
Direct Known Subclasses:
ApplicationPartition, SystemPartition

public abstract class AbstractContextPartition
extends java.lang.Object
implements ContextPartition

An Abstract BackingStore using a formal database and a search engine. All the common code between a SystemBackingStore and a DefaultBackingStore will be added to this super class.

Version:
$Rev: 164290 $
Author:
Apache Directory Project

Field Summary
static java.lang.String ALIAS_OID
          Private OID (1.2.6.1.4.1.18060.1.1.1.3.7) for _alias index
static java.lang.String EXISTANCE_OID
          Private OID (1.2.6.1.4.1.18060.1.1.1.3.3) for _existance op attrib
static java.lang.String HIERARCHY_OID
          Private OID (1.2.6.1.4.1.18060.1.1.1.3.4) for _hierarchy op attrib
static java.lang.String NDN_OID
          Private OID (1.2.6.1.4.1.18060.1.1.1.3.1) for _ndn op attrib
static java.lang.String ONEALIAS_OID
          Private OID (1.2.6.1.4.1.18060.1.1.1.3.5) for _oneAlias index
static java.lang.String SUBALIAS_OID
          Private OID (1.2.6.1.4.1.18060.1.1.1.3.6) for _subAlias index
static java.lang.String UPDN_OID
          Private OID (1.2.6.1.4.1.18060.1.1.1.3.2) for _updn op attrib
 
Constructor Summary
AbstractContextPartition(Database db, SearchEngine searchEngine, org.apache.ldap.common.schema.AttributeType[] indexAttributes)
          Creates a context partition with a new database and a search engine.
 
Method Summary
 void add(java.lang.String updn, javax.naming.Name dn, javax.naming.directory.Attributes entry)
          Adds an entry to this BackingStore.
 void close()
          Closes or shuts down this BackingStore.
 void delete(javax.naming.Name dn)
          Deletes a leaf entry from this BackingStore: non-leaf entries cannot be deleted until this operation has been applied to their children.
 Database getDb()
          Gets the Database used by this ContextPartition.
 SearchEngine getEngine()
          Gets the DefaultSearchEngine used by this ContextPartition to search the Database.
 boolean hasEntry(javax.naming.Name dn)
          Fast operation to check and see if a particular entry exists.
 void inspect()
           
 boolean isClosed()
          Checks to see if this BackingStore has been closed or shut down.
 javax.naming.NamingEnumeration list(javax.naming.Name base)
          A specialized form of one level search used to return a minimal set of information regarding child entries under a base.
 javax.naming.directory.Attributes lookup(javax.naming.Name dn)
          Looks up an entry by distinguished/absolute name.
 javax.naming.directory.Attributes lookup(javax.naming.Name dn, java.lang.String[] attrIds)
          Looks up an entry by distinguished name.
 void modify(javax.naming.Name dn, int modOp, javax.naming.directory.Attributes mods)
          Modifies an entry by adding, removing or replacing a set of attributes.
 void modify(javax.naming.Name dn, javax.naming.directory.ModificationItem[] mods)
          Modifies an entry by using a combination of adds, removes or replace operations using a set of ModificationItems.
 void modifyRn(javax.naming.Name dn, java.lang.String newRdn, boolean deleteOldRdn)
          Modifies an entry by changing its relative name.
 void move(javax.naming.Name oldChildDn, javax.naming.Name newParentDn)
          Transplants a child entry, to a position in the namespace under a new parent entry.
 void move(javax.naming.Name oldChildDn, javax.naming.Name newParentDn, java.lang.String newRdn, boolean deleteOldRdn)
          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.
 javax.naming.NamingEnumeration search(javax.naming.Name base, java.util.Map env, org.apache.ldap.common.filter.ExprNode filter, javax.naming.directory.SearchControls searchCtls)
          Conducts a search against this BackingStore.
 void sync()
          Cue to BackingStores with caches to flush entry and index changes to disk.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.ldap.server.ContextPartition
getSuffix
 
Methods inherited from interface org.apache.ldap.server.BackingStore
isSuffix
 

Field Detail

NDN_OID

public static final java.lang.String NDN_OID
Private OID (1.2.6.1.4.1.18060.1.1.1.3.1) for _ndn op attrib

See Also:
Constant Field Values

UPDN_OID

public static final java.lang.String UPDN_OID
Private OID (1.2.6.1.4.1.18060.1.1.1.3.2) for _updn op attrib

See Also:
Constant Field Values

EXISTANCE_OID

public static final java.lang.String EXISTANCE_OID
Private OID (1.2.6.1.4.1.18060.1.1.1.3.3) for _existance op attrib

See Also:
Constant Field Values

HIERARCHY_OID

public static final java.lang.String HIERARCHY_OID
Private OID (1.2.6.1.4.1.18060.1.1.1.3.4) for _hierarchy op attrib

See Also:
Constant Field Values

ONEALIAS_OID

public static final java.lang.String ONEALIAS_OID
Private OID (1.2.6.1.4.1.18060.1.1.1.3.5) for _oneAlias index

See Also:
Constant Field Values

SUBALIAS_OID

public static final java.lang.String SUBALIAS_OID
Private OID (1.2.6.1.4.1.18060.1.1.1.3.6) for _subAlias index

See Also:
Constant Field Values

ALIAS_OID

public static final java.lang.String ALIAS_OID
Private OID (1.2.6.1.4.1.18060.1.1.1.3.7) for _alias index

See Also:
Constant Field Values
Constructor Detail

AbstractContextPartition

public AbstractContextPartition(Database db,
                                SearchEngine searchEngine,
                                org.apache.ldap.common.schema.AttributeType[] indexAttributes)
                         throws javax.naming.NamingException
Creates a context partition with a new database and a search engine.

Parameters:
db - the dedicated database for this backing store
searchEngine - the search engine for this backing store
Method Detail

getDb

public Database getDb()
Gets the Database used by this ContextPartition.

Returns:
the database used

getEngine

public SearchEngine getEngine()
Gets the DefaultSearchEngine used by this ContextPartition to search the Database.

Returns:
the search engine

delete

public void delete(javax.naming.Name dn)
            throws javax.naming.NamingException
Description copied from interface: BackingStore
Deletes a leaf entry from this BackingStore: non-leaf entries cannot be deleted until this operation has been applied to their children.

Specified by:
delete in interface BackingStore
Parameters:
dn - the normalized distinguished/absolute name of the entry to delete from this BackingStore.
Throws:
javax.naming.NamingException - if there are any problems
See Also:
BackingStore.delete( Name )

add

public void add(java.lang.String updn,
                javax.naming.Name dn,
                javax.naming.directory.Attributes entry)
         throws javax.naming.NamingException
Description copied from interface: BackingStore
Adds an entry to this BackingStore.

Specified by:
add in interface BackingStore
Parameters:
updn - the user provided distinguished/absolute name of the entry
dn - the normalized distinguished/absolute name of the entry
entry - the entry to add to this BackingStore
Throws:
javax.naming.NamingException - if there are any problems
See Also:
BackingStore.add( String, Name, Attributes )

modify

public void modify(javax.naming.Name dn,
                   int modOp,
                   javax.naming.directory.Attributes mods)
            throws javax.naming.NamingException
Description copied from interface: BackingStore
Modifies an entry by adding, removing or replacing a set of attributes.

Specified by:
modify in interface BackingStore
Parameters:
dn - the normalized distinguished/absolute name of the entry to modify
modOp - the modification operation to perform on the entry which is one of constants specified by the DirContext interface: ADD_ATTRIBUTE, REMOVE_ATTRIBUTE, REPLACE_ATTRIBUTE.
mods - the attributes and their values used to affect the modification with.
Throws:
javax.naming.NamingException - if there are any problems
See Also:
BackingStore.modify( Name, int, Attributes )

modify

public void modify(javax.naming.Name dn,
                   javax.naming.directory.ModificationItem[] mods)
            throws javax.naming.NamingException
Description copied from interface: BackingStore
Modifies an entry by using a combination of adds, removes or replace operations using a set of ModificationItems.

Specified by:
modify in interface BackingStore
Parameters:
dn - the normalized distinguished/absolute name of the entry to modify
mods - the ModificationItems used to affect the modification with
Throws:
javax.naming.NamingException - if there are any problems
See Also:
BackingStore.modify( Name,ModificationItem[] )

list

public javax.naming.NamingEnumeration list(javax.naming.Name base)
                                    throws javax.naming.NamingException
Description copied from interface: BackingStore
A specialized form of one level search used to return a minimal set of information regarding child entries under a base. Convenience method used to optimize operations rather than conducting a full search with retrieval.

Specified by:
list in interface BackingStore
Parameters:
base - the base distinguished/absolute name for the search/listing
Returns:
a NamingEnumeration containing objects of type DbSearchResult
Throws:
javax.naming.NamingException - if there are any problems
See Also:
BackingStore.list( Name )

search

public javax.naming.NamingEnumeration search(javax.naming.Name base,
                                             java.util.Map env,
                                             org.apache.ldap.common.filter.ExprNode filter,
                                             javax.naming.directory.SearchControls searchCtls)
                                      throws javax.naming.NamingException
Description copied from interface: BackingStore
Conducts a search against this BackingStore. Namespace specific parameters for search are contained within the environment using namespace specific keys into the hash. For example in the LDAP namespace a BackingStore implementation may look for search Controls using a namespace specific or implementation specific key for the set of LDAP Controls.

Specified by:
search in interface BackingStore
Parameters:
base - the normalized distinguished/absolute name of the search base
env - the environment under which operation occurs
filter - the root node of the filter expression tree
searchCtls - the search controls
Returns:
a NamingEnumeration containing objects of type SearchResult.
Throws:
javax.naming.NamingException - if there are any problems
See Also:
BackingStore.search(Name, Map, ExprNode, SearchControls)

lookup

public javax.naming.directory.Attributes lookup(javax.naming.Name dn)
                                         throws javax.naming.NamingException
Description copied from interface: BackingStore
Looks up an entry by distinguished/absolute name. This is a simplified version of the search operation used to point read an entry used for convenience.

Specified by:
lookup in interface BackingStore
Parameters:
dn - the normalized distinguished name of the object to lookup
Returns:
an Attributes object representing the entry
Throws:
javax.naming.NamingException - if there are any problems
See Also:
BackingStore.lookup( Name )

lookup

public javax.naming.directory.Attributes lookup(javax.naming.Name dn,
                                                java.lang.String[] attrIds)
                                         throws javax.naming.NamingException
Description copied from interface: BackingStore
Looks up an entry by distinguished name. This is a simplified version of the search operation used to point read an entry used for convenience with a set of attributes to return. If the attributes are null or emty this defaults to the lookup opertion without the attributes.

Specified by:
lookup in interface BackingStore
Parameters:
dn - the normalized distinguished name of the object to lookup
attrIds - the set of attributes to return
Returns:
an Attributes object representing the entry
Throws:
javax.naming.NamingException - if there are any problems
See Also:
BackingStore.lookup(Name,String[])

hasEntry

public boolean hasEntry(javax.naming.Name dn)
                 throws javax.naming.NamingException
Description copied from interface: BackingStore
Fast operation to check and see if a particular entry exists.

Specified by:
hasEntry in interface BackingStore
Parameters:
dn - the normalized distinguished/absolute name of the object to check for existance
Returns:
true if the entry exists, false if it does not
Throws:
javax.naming.NamingException - if there are any problems
See Also:
BackingStore.hasEntry( Name )

modifyRn

public void modifyRn(javax.naming.Name dn,
                     java.lang.String newRdn,
                     boolean deleteOldRdn)
              throws javax.naming.NamingException
Description copied from interface: BackingStore
Modifies an entry by changing its relative name. Optionally attributes associated with the old relative name can be removed from the entry. This makes sense only in certain namespaces like LDAP and will be ignored if it is irrelavent.

Specified by:
modifyRn in interface BackingStore
Parameters:
dn - the normalized distinguished/absolute name of the entry to modify the RN of.
newRdn - the new RN of the entry specified by name
deleteOldRdn - boolean flag which removes the old RN attribute from the entry if set to true, and has no affect if set to false
Throws:
javax.naming.NamingException - if there are any problems
See Also:
BackingStore.modifyRn( Name, String, boolean )

move

public void move(javax.naming.Name oldChildDn,
                 javax.naming.Name newParentDn)
          throws javax.naming.NamingException
Description copied from interface: BackingStore
Transplants a child entry, to a position in the namespace under a new parent entry.

Specified by:
move in interface BackingStore
Parameters:
newParentDn - the normalized distinguished/absolute name of the new parent to move the target entry to
oldChildDn - the normalized distinguished/absolute name of the original child name representing the child entry to move
Throws:
javax.naming.NamingException - if there are any problems
See Also:
BackingStore.move( Name, Name )

move

public void move(javax.naming.Name oldChildDn,
                 javax.naming.Name newParentDn,
                 java.lang.String newRdn,
                 boolean deleteOldRdn)
          throws javax.naming.NamingException
Description copied from interface: BackingStore
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. The removal of old RN attributes may not make sense in all namespaces. If the concept is undefined in a namespace this parameters is ignored. An example of a namespace where this parameter is significant is the LDAP namespace.

Specified by:
move in interface BackingStore
Parameters:
oldChildDn - the normalized distinguished/absolute name of the original child name representing the child entry to move
newParentDn - the normalized distinguished/absolute name of the new parent to move the targeted entry to
newRdn - the new RN of the entry
deleteOldRdn - boolean flag which removes the old RN attribute from the entry if set to true, and has no affect if set to false
Throws:
javax.naming.NamingException - if there are any problems
See Also:
BackingStore.move( Name, Name, String, boolean )

sync

public void sync()
          throws javax.naming.NamingException
Description copied from interface: BackingStore
Cue to BackingStores with caches to flush entry and index changes to disk.

Specified by:
sync in interface BackingStore
Throws:
javax.naming.NamingException - if there are problems flushing caches

close

public void close()
           throws javax.naming.NamingException
Description copied from interface: BackingStore
Closes or shuts down this BackingStore. Operations against closed BackingStores will fail.

Specified by:
close in interface BackingStore
Throws:
javax.naming.NamingException - if there are problems shutting down

isClosed

public boolean isClosed()
Description copied from interface: BackingStore
Checks to see if this BackingStore has been closed or shut down. Operations against closed BackingStores will fail.

Specified by:
isClosed in interface BackingStore
Returns:
true if shut down, false otherwise

inspect

public void inspect()
             throws java.lang.Exception
Throws:
java.lang.Exception


Copyright © 2002-2005 . All Rights Reserved.