org.apache.directory.server.core.partition
Class AbstractPartition

java.lang.Object
  extended by org.apache.directory.server.core.partition.AbstractPartition
All Implemented Interfaces:
Partition
Direct Known Subclasses:
BTreePartition, DefaultPartitionNexus, NullPartition, SchemaPartition

public abstract class AbstractPartition
extends java.lang.Object
implements Partition

A 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.

Version:
$Rev: 925506 $, $Date: 2010-03-20 01:50:21 +0100 (Sat, 20 Mar 2010) $
Author:
Apache Directory Project

Field Summary
protected  boolean initialized
          true if and only if this partition is initialized.
 
Constructor Summary
protected AbstractPartition()
           
 
Method Summary
 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.
 boolean hasEntry(EntryOperationContext entryContext)
          This method calls Partition.lookup(LookupOperationContext) and return true if it returns an entry by default.
 void initialize()
          Sets up (directoryService and calls doInit() where you have to put your initialization code in.
 boolean isInitialized()
          Returns true if this context partition is initialized successfully.
abstract  ClonedServerEntry lookup(LookupOperationContext lookupContext)
          This method calls Partition.lookup(LookupOperationContext) with null attributeIds by default.
abstract  void sync()
          This method does nothing by default.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.directory.server.core.partition.Partition
add, bind, delete, getId, getSchemaManager, getSuffix, getSuffixDn, list, modify, move, moveAndRename, rename, search, setId, setSchemaManager, setSuffix, unbind
 

Field Detail

initialized

protected boolean initialized
true if and only if this partition is initialized.

Constructor Detail

AbstractPartition

protected AbstractPartition()
Method Detail

initialize

public final void initialize()
                      throws java.lang.Exception
Sets up (directoryService and calls doInit() where you have to put your initialization code in. isInitialized() will return true if doInit() returns without any errors. destroy() is called automatically as a clean-up process if doInit() throws an exception.

Specified by:
initialize in interface Partition
Throws:
java.lang.Exception - if initialization fails in any way

doInit

protected abstract void doInit()
                        throws javax.naming.InvalidNameException,
                               java.lang.Exception
Override this method to put your initialization code.

Throws:
java.lang.Exception
javax.naming.InvalidNameException

destroy

public final void destroy()
                   throws java.lang.Exception
Calls doDestroy() where you have to put your destroy code in, and clears default properties. Once this method is invoked, isInitialized() will return false.

Specified by:
destroy in interface Partition
Throws:
java.lang.Exception

doDestroy

protected abstract void doDestroy()
                           throws java.lang.Exception
Override this method to put your initialization code.

Throws:
java.lang.Exception

isInitialized

public boolean isInitialized()
Returns true if this context partition is initialized successfully.

Specified by:
isInitialized in interface Partition
Returns:
true if the partition is initialized, false otherwise

sync

public abstract void sync()
                   throws java.lang.Exception
This method does nothing by default.

Specified by:
sync in interface Partition
Throws:
java.lang.Exception - if buffers cannot be flushed to disk

hasEntry

public boolean hasEntry(EntryOperationContext entryContext)
                 throws java.lang.Exception
This method calls 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.

Specified by:
hasEntry in interface Partition
Parameters:
entryContext - The context used to pass informations
Returns:
true if the entry exists, false if it does not
Throws:
java.lang.Exception - if there are any problems

lookup

public abstract ClonedServerEntry lookup(LookupOperationContext lookupContext)
                                  throws java.lang.Exception
This method calls Partition.lookup(LookupOperationContext) with null attributeIds by default. Please override this method if there is more effective way for your implementation.

Specified by:
lookup in interface Partition
Parameters:
lookupContext - The context containing the parameters
Returns:
an Attributes object representing the entry
Throws:
java.lang.Exception - if there are any problems


Copyright © 2003-2011 Apache Software Foundation. All Rights Reserved.