org.opends.server.backends.jeb
Class JECompressedSchema

java.lang.Object
  extended by org.opends.server.api.CompressedSchema
      extended by org.opends.server.backends.jeb.JECompressedSchema

public final class JECompressedSchema
extends CompressedSchema

This class provides a compressed schema implementation whose definitions are stored in a Berkeley DB JE database.


Field Summary
static java.lang.String DB_NAME_AD
          The name of the database used to store compressed attribute description definitions.
static java.lang.String DB_NAME_OC
          The name of the database used to store compressed object class set definitions.
 
Constructor Summary
JECompressedSchema(com.sleepycat.je.Environment environment)
          Creates a new instance of this JE compressed schema manager.
 
Method Summary
 void close()
          Closes the databases and releases any resources held by this compressed schema manager.
 Attribute decodeAttribute(byte[] encodedEntry, int startPos, int length)
          Decodes the contents of the provided array as an attribute.
 java.util.Map<ObjectClass,java.lang.String> decodeObjectClasses(byte[] encodedObjectClasses)
          Decodes an object class set from the provided byte array.
 byte[] encodeAttribute(Attribute attribute)
          Encodes the information in the provided attribute to a byte array.
 byte[] encodeObjectClasses(java.util.Map<ObjectClass,java.lang.String> objectClasses)
          Encodes the provided set of object classes to a byte array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DB_NAME_AD

public static final java.lang.String DB_NAME_AD
The name of the database used to store compressed attribute description definitions.

See Also:
Constant Field Values

DB_NAME_OC

public static final java.lang.String DB_NAME_OC
The name of the database used to store compressed object class set definitions.

See Also:
Constant Field Values
Constructor Detail

JECompressedSchema

public JECompressedSchema(com.sleepycat.je.Environment environment)
                   throws com.sleepycat.je.DatabaseException
Creates a new instance of this JE compressed schema manager.

Parameters:
environment - A reference to the database environment in which the databases will be held.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while loading the compressed schema definitions from the database.
Method Detail

close

public void close()
Closes the databases and releases any resources held by this compressed schema manager.


encodeObjectClasses

public byte[] encodeObjectClasses(java.util.Map<ObjectClass,java.lang.String> objectClasses)
                           throws DirectoryException
Encodes the provided set of object classes to a byte array. If the same set had been previously encoded, then the cached value will be used. Otherwise, a new value will be created.

Specified by:
encodeObjectClasses in class CompressedSchema
Parameters:
objectClasses - The set of object classes for which to retrieve the corresponding byte array token.
Returns:
A byte array containing the identifier assigned to the object class set.
Throws:
DirectoryException - If a problem occurs while attempting to determine the appropriate identifier.

decodeObjectClasses

public java.util.Map<ObjectClass,java.lang.String> decodeObjectClasses(byte[] encodedObjectClasses)
                                                                throws DirectoryException
Decodes an object class set from the provided byte array.

Specified by:
decodeObjectClasses in class CompressedSchema
Parameters:
encodedObjectClasses - The byte array containing the object class set identifier.
Returns:
The decoded object class set.
Throws:
DirectoryException - If the provided byte array cannot be decoded as an object class set.

encodeAttribute

public byte[] encodeAttribute(Attribute attribute)
                       throws DirectoryException
Encodes the information in the provided attribute to a byte array.

Specified by:
encodeAttribute in class CompressedSchema
Parameters:
attribute - The attribute to be encoded.
Returns:
An encoded representation of the provided attribute.
Throws:
DirectoryException - If a problem occurs while attempting to determine the appropriate identifier.

decodeAttribute

public Attribute decodeAttribute(byte[] encodedEntry,
                                 int startPos,
                                 int length)
                          throws DirectoryException
Decodes the contents of the provided array as an attribute.

Specified by:
decodeAttribute in class CompressedSchema
Parameters:
encodedEntry - The byte array containing the encoded entry.
startPos - The position within the array of the first byte for the attribute to decode.
length - The number of bytes contained in the encoded attribute.
Returns:
The decoded attribute.
Throws:
DirectoryException - If the attribute could not be decoded properly for some reason.