ozone core API

org.ozoneDB.core.storage.classicStore
Class ClassicStore

java.lang.Object
  extended byorg.ozoneDB.core.ServerComponent
      extended byorg.ozoneDB.core.storage.classicStore.ClassicStore
All Implemented Interfaces:
StoreManager

public final class ClassicStore
extends ServerComponent
implements StoreManager

ClassicStore acts as the mediator (director) of the classicStore module especially for ClusterSpace, ObjectSpace, PersistentSpace. Currently it serves only as container for the references but this should change in the future to decouple class implementations.

Author:
SMB

Field Summary
protected  Env env
           
protected  ObjectSpace objectSpace
           
 
Fields inherited from class org.ozoneDB.core.ServerComponent
 
Constructor Summary
ClassicStore(Env env)
           
 
Method Summary
 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.
 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 objID, 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 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 level of the containers lock object.
 void upgradeLockLevel(Transaction ta, ObjectContainer container, int lockLevel)
           
 
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

env

protected Env env

objectSpace

protected ObjectSpace objectSpace
Constructor Detail

ClassicStore

public ClassicStore(Env env)
Method Detail

init

public void init(Env _env)
Description copied from interface: StoreManager
Aid constructor, because a store is instantiated with 'newInstance', where we've got no arguments.

Specified by:
init in interface StoreManager

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

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

shutdown

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

newContainerAndLock

public ObjectContainer newContainerAndLock(Transaction ta,
                                           org.ozoneDB.OzoneCompatible target,
                                           ObjectID objID,
                                           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 -
objID -
permissions -
lockLevel -
Returns:
An container-proxy for the created container.
Throws:
java.lang.Exception

newTransactionData

public java.lang.Object newTransactionData()

updateLockLevel

public void updateLockLevel(Transaction ta,
                            ObjectContainer container)
                     throws java.io.IOException
Update lock level of the given container according to the level of the containers lock object.

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

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

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

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

objectIDIterator

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

reportNamedObjectsToGarbageCollector

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

Specified by:
reportNamedObjectsToGarbageCollector 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

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

prepareCommitTransaction

public void prepareCommitTransaction(Transaction ta)
Description copied from interface: StoreManager
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, StoreManager.prepareCommitTransaction(org.ozoneDB.core.Transaction) and StoreManager.commitTransaction(org.ozoneDB.core.Transaction) are not an atomar operation.

Specified by:
prepareCommitTransaction in interface StoreManager
Parameters:
ta - Transaction that will be commited.

commitTransaction

public void commitTransaction(Transaction ta)
Specified by:
commitTransaction in interface StoreManager

abortTransaction

public void abortTransaction(Transaction ta)
Specified by:
abortTransaction in interface StoreManager
Parameters:
ta - ID of the comitting transaction.

upgradeLockLevel

public void upgradeLockLevel(Transaction ta,
                             ObjectContainer container,
                             int lockLevel)
                      throws java.lang.Exception
Throws:
java.lang.Exception

ozone core API

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