ozone core API

org.ozoneDB.core.storage.gammaStore
Class GammaStore

java.lang.Object
  extended byorg.ozoneDB.core.ServerComponent
      extended byorg.ozoneDB.core.storage.gammaStore.GammaStore
All Implemented Interfaces:
StoreManager

public class GammaStore
extends ServerComponent
implements StoreManager

Version:
$Id: GammaStore.java,v 1.4 2004/03/21 21:05:51 leomekenkamp Exp $
Author:
Leo Mekenkamp (mind the anti sp@m)

Field Summary
private  Cache containerCache
           
private  java.util.Map containerNames
           
static PropertyInfo DIRECTORY
           
static java.lang.String GAMMASTORE_BASE
           
private  GarbageCollector garbageCollector
          The garbage collector.
private  IndexManager indexManager
           
private static java.util.logging.Logger log
           
static java.lang.String OZONE_BASE
           
private static java.lang.String PROP_CONTAINERCACHE
           
private static java.lang.String PROP_NUMCONFIGS
           
private static java.lang.String PROP_STORAGEFACTORY
           
private static java.lang.String PROP_STREAMFACTORY
           
private  java.util.Properties properties
           
private  StorageFactory[] storageFactories
           
private  StreamFactory[] streamFactories
           
private  StorageFactory txStorageFactory
           
static PropertyInfo TXSTORAGEFACTORY
           
 
Fields inherited from class org.ozoneDB.core.ServerComponent
env
 
Constructor Summary
GammaStore(Env env)
           
GammaStore(java.util.Properties properties)
          ozoneDB.gammaStore.numConfigs=1 ozoneDB.gammaStore.0.clusterFactory=org.ozoneDB.core.gammaStore.RandomAccessFileCluster.Factory ozoneDB.gammaStore.0.maxClusterSize=65536 ozoneDB.gammaStore.0.streamFactory=org.ozoneDB.core.gammaStore.GZIPStreamFactory ozoneDB.gammaStore.containerCache=org.ozoneDB.core.gammaStore.SoftReferenceCache While not yet supported there is a possiblility to have multiple configurations.
 
Method Summary
private  void abortObjectId(ObjectID objectId)
           
 void abortTransaction(Transaction ta)
           
 DxBag clusterOfID(ObjectID id)
          Force the Store to make a guess which objects are used together with the container with the specified id.
 void commitTransaction(Transaction ta)
           
 ObjectContainer containerForID(Transaction ta, ObjectID id)
           
 ObjectContainer containerForName(Transaction ta, java.lang.String name)
           
 Transaction createTransaction(Env env, User user)
          Factory method for creating a new Transaction.
 Cache getContainerCache()
           
private  java.util.Map getContainerNames()
           
private  GarbageCollector getGarbageCollector()
           
private  StorageFactory getTxStorageFactory()
           
 void init(Env env)
          Aid constructor, because a store is instantiated with 'newInstance', where we've got no arguments.
 void nameContainer(Transaction ta, ObjectContainer container, java.lang.String name)
           
 ObjectContainer newContainerAndLock(Transaction ta, org.ozoneDB.OzoneCompatible target, ObjectID objectId, Permissions permissions, int lockLevel)
          Creates a new object container and initializes it with the specified target object.
 java.lang.Object newTransactionData()
           
 DxIterator objectIDIterator()
           
 DxSet objectNames(Transaction ta)
           
 void prepareCommitTransaction(Transaction ta)
          Prepare the specified transaction for commit.
 void reportNamedObjectsToGarbageCollector()
          Tells this StoreManager to report every named object to the garbage collector.
 void save()
          Save the internal state in the state to the server state properties.
 void setContainerCache(Cache containerCache)
           
private  void setGarbageCollector(GarbageCollector garbageCollector)
           
 void shutdown()
           
 void startup()
          Start up and load the internal state from the server state properties.
 void updateLockLevel(Transaction ta, ObjectContainer container)
          Update lock level of the given container according to the leve of the containers lock object.
 
Methods inherited from class org.ozoneDB.core.ServerComponent
clearChanged, hasChanged, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final java.util.logging.Logger log

OZONE_BASE

public static final java.lang.String OZONE_BASE
See Also:
Constant Field Values

GAMMASTORE_BASE

public static final java.lang.String GAMMASTORE_BASE
See Also:
Constant Field Values

DIRECTORY

public static final PropertyInfo DIRECTORY

TXSTORAGEFACTORY

public static final PropertyInfo TXSTORAGEFACTORY

PROP_STORAGEFACTORY

private static final java.lang.String PROP_STORAGEFACTORY
See Also:
Constant Field Values

PROP_NUMCONFIGS

private static final java.lang.String PROP_NUMCONFIGS
See Also:
Constant Field Values

PROP_STREAMFACTORY

private static final java.lang.String PROP_STREAMFACTORY
See Also:
Constant Field Values

PROP_CONTAINERCACHE

private static final java.lang.String PROP_CONTAINERCACHE
See Also:
Constant Field Values

storageFactories

private StorageFactory[] storageFactories

streamFactories

private StreamFactory[] streamFactories

containerCache

private Cache containerCache

indexManager

private IndexManager indexManager

properties

private java.util.Properties properties

containerNames

private java.util.Map containerNames

garbageCollector

private GarbageCollector garbageCollector
The garbage collector. It should be notified in the event


txStorageFactory

private StorageFactory txStorageFactory
Constructor Detail

GammaStore

public GammaStore(java.util.Properties properties)
ozoneDB.gammaStore.numConfigs=1 ozoneDB.gammaStore.0.clusterFactory=org.ozoneDB.core.gammaStore.RandomAccessFileCluster.Factory ozoneDB.gammaStore.0.maxClusterSize=65536 ozoneDB.gammaStore.0.streamFactory=org.ozoneDB.core.gammaStore.GZIPStreamFactory ozoneDB.gammaStore.containerCache=org.ozoneDB.core.gammaStore.SoftReferenceCache While not yet supported there is a possiblility to have multiple configurations. These could be used to for instance save instances of a specific class to a different disk because of performance reasons Because different configurations allow for different streams to be used during (de)serialization, this could also be used to encrypt only certain objects.


GammaStore

public GammaStore(Env env)
Method Detail

getContainerCache

public Cache getContainerCache()

setContainerCache

public void setContainerCache(Cache containerCache)

abortObjectId

private void abortObjectId(ObjectID objectId)

abortTransaction

public void abortTransaction(Transaction ta)
                      throws java.io.IOException,
                             java.lang.ClassNotFoundException
Specified by:
abortTransaction in interface StoreManager
Parameters:
ta - ID of the comitting transaction.
Throws:
java.io.IOException
java.lang.ClassNotFoundException

clusterOfID

public DxBag clusterOfID(ObjectID id)
                  throws java.lang.Exception
Force the Store to make a guess which objects are used together with the container with the specified id.

Specified by:
clusterOfID in interface StoreManager
Parameters:
id - The ObjectID if the container.
Throws:
java.lang.Exception

commitTransaction

public void commitTransaction(Transaction ta)
                       throws java.io.IOException,
                              java.lang.ClassNotFoundException
Specified by:
commitTransaction in interface StoreManager
Throws:
java.io.IOException
java.lang.ClassNotFoundException

containerForID

public ObjectContainer containerForID(Transaction ta,
                                      ObjectID id)
                               throws org.ozoneDB.ObjectNotFoundException,
                                      java.io.IOException,
                                      java.lang.ClassNotFoundException
Specified by:
containerForID in interface StoreManager
Throws:
org.ozoneDB.ObjectNotFoundException
java.io.IOException
java.lang.ClassNotFoundException

containerForName

public ObjectContainer containerForName(Transaction ta,
                                        java.lang.String name)
                                 throws java.lang.Exception
Specified by:
containerForName in interface StoreManager
Parameters:
name - The object name to search for.
ta -
Returns:
The object container for the name or null.
Throws:
java.lang.Exception

init

public void init(Env env)
Aid constructor, because a store is instantiated with 'newInstance', where we've got no arguments.

Specified by:
init in interface StoreManager

nameContainer

public void nameContainer(Transaction ta,
                          ObjectContainer container,
                          java.lang.String name)
                   throws org.ozoneDB.PermissionDeniedException
Specified by:
nameContainer in interface StoreManager
Parameters:
ta -
container -
name -
Throws:
org.ozoneDB.PermissionDeniedException

newContainerAndLock

public ObjectContainer newContainerAndLock(Transaction ta,
                                           org.ozoneDB.OzoneCompatible target,
                                           ObjectID objectId,
                                           Permissions permissions,
                                           int lockLevel)
                                    throws java.lang.Exception
Creates a new object container and initializes it with the specified target object. The new container is immediatly accessible from the calling transaction via containerByID but it is not joined to this transaction. It needs to be joined and commited afterwards. Iff this method returns normally, the returned container is pinned and thus has to be unpinned. Iff this method returns normally, the returned container is locked with the given lock level.

Specified by:
newContainerAndLock in interface StoreManager
Parameters:
ta -
target -
objectId -
permissions -
lockLevel -
Returns:
An container-proxy for the created container.
Throws:
java.lang.Exception

newTransactionData

public java.lang.Object newTransactionData()

objectIDIterator

public DxIterator objectIDIterator()
Specified by:
objectIDIterator in interface StoreManager

objectNames

public DxSet objectNames(Transaction ta)
Specified by:
objectNames in interface StoreManager
Parameters:
ta - the running transaction
Returns:
a String array of the all object names defined

prepareCommitTransaction

public void prepareCommitTransaction(Transaction ta)
                              throws java.io.IOException,
                                     java.lang.ClassNotFoundException
Prepare the specified transaction for commit. All operations that may fail during the commit process should be done here. However, this method must not change any global data structures such as the idTable that are used by other transactions too.

The TransactionManager let this method run exclusivly. However, prepareCommitTransaction(org.ozoneDB.core.Transaction) and commitTransaction(org.ozoneDB.core.Transaction) are not an atomar operation.

Specified by:
prepareCommitTransaction in interface StoreManager
Parameters:
ta - Transaction that will be commited.
Throws:
java.io.IOException
java.lang.ClassNotFoundException

reportNamedObjectsToGarbageCollector

public void reportNamedObjectsToGarbageCollector()
Tells this StoreManager to report every named object to the garbage collector.

Specified by:
reportNamedObjectsToGarbageCollector in interface StoreManager

shutdown

public void shutdown()
              throws java.lang.Exception
Specified by:
shutdown in interface StoreManager
Specified by:
shutdown in class ServerComponent
Throws:
java.lang.Exception

startup

public void startup()
             throws java.lang.Exception
Description copied from class: ServerComponent
Start up and load the internal state from the server state properties.

Specified by:
startup in interface StoreManager
Specified by:
startup in class ServerComponent
Throws:
java.lang.Exception

updateLockLevel

public void updateLockLevel(Transaction ta,
                            ObjectContainer container)
                     throws java.io.IOException
Update lock level of the given container according to the leve of the containers lock object. TODO: is this right?

Specified by:
updateLockLevel in interface StoreManager
Throws:
java.io.IOException

createTransaction

public Transaction createTransaction(Env env,
                                     User user)
Description copied from interface: StoreManager
Factory method for creating a new Transaction.

Specified by:
createTransaction in interface StoreManager

getTxStorageFactory

private StorageFactory getTxStorageFactory()

getContainerNames

private java.util.Map getContainerNames()

getGarbageCollector

private GarbageCollector getGarbageCollector()

setGarbageCollector

private void setGarbageCollector(GarbageCollector garbageCollector)

save

public void save()
          throws java.lang.Exception
Description copied from class: ServerComponent
Save the internal state in the state to the server state properties.

Specified by:
save in class ServerComponent
Throws:
java.lang.Exception

ozone core API

Copyright (C) The Ozone Database Project - www.ozone-db.org. All rights reserved.