org.apache.jdo.impl.fostore
Class FOStoreBtreeStorage

java.lang.Object
  extended byorg.netbeans.mdr.persistence.btreeimpl.btreestorage.BtreeStorage
      extended byorg.apache.jdo.impl.fostore.FOStoreBtreeStorage
All Implemented Interfaces:
org.netbeans.mdr.persistence.Storage

public class FOStoreBtreeStorage
extends org.netbeans.mdr.persistence.btreeimpl.btreestorage.BtreeStorage

FOStore specific BtreeStorage subclass. This class manages MOFIDs for a FOStore datastore. A MOFID consists of two parts: a storageId of type String and a serial number of type long. When storing on disk the storageId is converted into a number and stored as 16-bit value. Only 48 bits of the serial number get represented on disk. FOStore uses the serial number to encode the uid part of an OID and the storageId for the class id of an OID. The btree class MOFIDInfo converts a MOFID into a byte array of 8 bytes that is stored on disk. The two high order bytes represent the storageId. Class MOFIDInfo calls method storageIdToNumber to convert a String storageId into a number. The remaining 6 bytes represent the serial number.

Since:
1.1
Version:
1.1
Author:
Michael Bouschen

Nested Class Summary
 
Nested classes inherited from class org.netbeans.mdr.persistence.Storage
org.netbeans.mdr.persistence.Storage.EntryType
 
Constructor Summary
FOStoreBtreeStorage(java.lang.String name, boolean isNew)
          Creates a new FOStoreBtreeStorage instance.
 
Method Summary
 org.netbeans.mdr.persistence.MOFID createMOFID(int clid, long uid)
          Returns Creates a MOFID based on the class id and uid taken from a FOStore OID.
 java.lang.String numberToStorageId(int number)
          Creates a storage id from an int.
 int storageIdToNumber(java.lang.String storageId)
          Converts a storageId to an int.
 
Methods inherited from class org.netbeans.mdr.persistence.btreeimpl.btreestorage.BtreeStorage
close, commitChanges, create, createMultivaluedIndex, createMultivaluedOrderedIndex, createSinglevaluedIndex, delete, dropIndex, exists, getIndex, getMOFIDData, getMofidGenerator, getMofidMap, getMultivaluedIndex, getMultivaluedOrderedIndex, getName, getPrimaryIndex, getSerialNumber, getSinglevaluedIndex, getStorageId, objectStateChanged, objectStateWillChange, open, readMOFID, readMOFIDData, resolveObject, rollBackChanges, shutDown, supportsMultipleStorableIndexes, writeMOFID, writeMOFIDData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FOStoreBtreeStorage

public FOStoreBtreeStorage(java.lang.String name,
                           boolean isNew)
                    throws org.netbeans.mdr.persistence.StorageException
Creates a new FOStoreBtreeStorage instance. The constructor creates or opens a storage based on the specified argument isNew.

Parameters:
name - the name of the storage.
isNew - true if the database is being created
Method Detail

createMOFID

public org.netbeans.mdr.persistence.MOFID createMOFID(int clid,
                                                      long uid)
Returns Creates a MOFID based on the class id and uid taken from a FOStore OID. The storageId of the returned MOFID represents the class id and the serial number represents the uid.

Parameters:
clid - the class id
uid - the unique id
Returns:
MOFID representing class id and uid taken from FOStore OID.

storageIdToNumber

public int storageIdToNumber(java.lang.String storageId)
                      throws org.netbeans.mdr.persistence.StorageException
Converts a storageId to an int. If the specified storageId starts with CLID_PREFIX, then the storageId represents a class id. In this case use the class id as the numeric reresentation.

Parameters:
storageId - the storageId as String
Returns:
the numeric representation of the storageId
Throws:
org.netbeans.mdr.persistence.StorageException

numberToStorageId

public java.lang.String numberToStorageId(int number)
                                   throws org.netbeans.mdr.persistence.StorageException
Creates a storage id from an int. It returns the FOStore specific String representation for a storageId representing a class id.

Parameters:
number - the numberic representation of the storageId
Returns:
the storageId as String
Throws:
org.netbeans.mdr.persistence.StorageException


Copyright © 2005 Apache Software Foundation. All Rights Reserved.