org.apache.directory.server.core.partition.impl.btree.jdbm
Class JdbmMasterTable<E>

java.lang.Object
  extended by org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmTable<java.lang.Long,E>
      extended by org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmMasterTable<E>
All Implemented Interfaces:
MasterTable<E>, Table<java.lang.Long,E>

public class JdbmMasterTable<E>
extends JdbmTable<java.lang.Long,E>
implements MasterTable<E>

The master table used to store the Attributes of entries.

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

Field Summary
protected  JdbmTable<java.lang.String,java.lang.String> adminTbl
           
 
Fields inherited from interface org.apache.directory.server.xdbm.MasterTable
DBF, SEQPROP_KEY
 
Constructor Summary
  JdbmMasterTable(RecordManager recMan, org.apache.directory.shared.ldap.schema.SchemaManager schemaManager)
          Creates the master table using JDBM B+Trees for the backing store.
protected JdbmMasterTable(RecordManager recMan, org.apache.directory.shared.ldap.schema.SchemaManager schemaManager, java.lang.String dbName, Serializer serializer)
           
 
Method Summary
 void delete(java.lang.Long id)
          Deletes a ServerEntry from the master table at an index specified by id.
 E get(java.lang.Long id)
          Gets the ServerEntry from this MasterTable.
 java.lang.Long getCurrentId()
          Gets the value of the id sequence from this MasterTable's sequence without affecting the value.
 java.lang.Long getNextId()
          Get's the next value from this SequenceBDb.
 java.lang.String getProperty(java.lang.String property)
          Gets a persistent property stored in the admin table of this MasterTable.
 void put(java.lang.Long id, E entry)
          Puts the ServerEntry into this master table at an index specified by id.
 void setProperty(java.lang.String property, java.lang.String value)
          Sets a persistent property stored in the admin table of this MasterTable.
 
Methods inherited from class org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmTable
close, count, count, cursor, cursor, getKeyComparator, getKeySerializer, getMarshaller, getName, getValueComparator, getValueSerializer, greaterThanCount, has, has, hasGreaterOrEqual, hasGreaterOrEqual, hasLessOrEqual, hasLessOrEqual, isCountExact, isDupsEnabled, lessThanCount, remove, remove, sync, valueCursor
 
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.xdbm.Table
close, count, count, cursor, cursor, getKeyComparator, getName, getValueComparator, greaterThanCount, has, has, hasGreaterOrEqual, hasGreaterOrEqual, hasLessOrEqual, hasLessOrEqual, isCountExact, isDupsEnabled, lessThanCount, remove, remove, valueCursor
 

Field Detail

adminTbl

protected final JdbmTable<java.lang.String,java.lang.String> adminTbl
Constructor Detail

JdbmMasterTable

public JdbmMasterTable(RecordManager recMan,
                       org.apache.directory.shared.ldap.schema.SchemaManager schemaManager)
                throws java.lang.Exception
Creates the master table using JDBM B+Trees for the backing store.

Parameters:
recMan - the JDBM record manager
schemaManager - the schema mamanger
Throws:
java.lang.Exception - if there is an error opening the Db file.

JdbmMasterTable

protected JdbmMasterTable(RecordManager recMan,
                          org.apache.directory.shared.ldap.schema.SchemaManager schemaManager,
                          java.lang.String dbName,
                          Serializer serializer)
                   throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

get

public E get(java.lang.Long id)
      throws java.lang.Exception
Gets the ServerEntry from this MasterTable.

Specified by:
get in interface MasterTable<E>
Specified by:
get in interface Table<java.lang.Long,E>
Overrides:
get in class JdbmTable<java.lang.Long,E>
Parameters:
id - the Long id of the entry to retrieve.
Returns:
the ServerEntry with operational attributes and all.
Throws:
java.lang.Exception - if there is a read error on the underlying Db.

put

public void put(java.lang.Long id,
                E entry)
         throws java.lang.Exception
Puts the ServerEntry into this master table at an index specified by id. Used both to create new entries and update existing ones.

Specified by:
put in interface MasterTable<E>
Specified by:
put in interface Table<java.lang.Long,E>
Overrides:
put in class JdbmTable<java.lang.Long,E>
Parameters:
entry - the ServerEntry w/ operational attributes
id - the Long id of the entry to put
Throws:
java.lang.Exception - if there is a write error on the underlying Db.
See Also:
Table.put(java.lang.Object, java.lang.Object)

delete

public void delete(java.lang.Long id)
            throws java.lang.Exception
Deletes a ServerEntry from the master table at an index specified by id.

Specified by:
delete in interface MasterTable<E>
Parameters:
id - the Long id of the entry to delete
Throws:
java.lang.Exception - if there is a write error on the underlying Db

getCurrentId

public java.lang.Long getCurrentId()
                            throws java.lang.Exception
Description copied from interface: MasterTable
Gets the value of the id sequence from this MasterTable's sequence without affecting the value.

Specified by:
getCurrentId in interface MasterTable<E>
Throws:
java.lang.Exception - if the admin table storing sequences cannot be read

getNextId

public java.lang.Long getNextId()
                         throws java.lang.Exception
Get's the next value from this SequenceBDb. This has the side-effect of changing the current sequence values permanently in memory and on disk. Master table sequence begins at BigInteger.ONE. The BigInteger.ZERO is used for the fictitious parent of the suffix root entry.

Specified by:
getNextId in interface MasterTable<E>
Returns:
the current value incremented by one.
Throws:
java.lang.Exception - if the admin table storing sequences cannot be read and written to.

getProperty

public java.lang.String getProperty(java.lang.String property)
                             throws java.lang.Exception
Gets a persistent property stored in the admin table of this MasterTable.

Specified by:
getProperty in interface MasterTable<E>
Parameters:
property - the key of the property to get the value of
Returns:
the value of the property
Throws:
java.lang.Exception - when the underlying admin table cannot be read

setProperty

public void setProperty(java.lang.String property,
                        java.lang.String value)
                 throws java.lang.Exception
Sets a persistent property stored in the admin table of this MasterTable.

Specified by:
setProperty in interface MasterTable<E>
Parameters:
property - the key of the property to set the value of
value - the value of the property
Throws:
java.lang.Exception - when the underlying admin table cannot be writen


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