ozone core API

org.ozoneDB.core.storage.wizardStore
Class WizardStore

java.lang.Object
  extended byorg.ozoneDB.core.ServerComponent
      extended byorg.ozoneDB.core.storage.wizardStore.WizardStore
All Implemented Interfaces:
StoreManager

public final class WizardStore
extends ServerComponent
implements StoreManager

Version:
$Revision: 1.6 $Date: 2004/01/26 00:57:30 $
Author:
SMB, Medium.net

Field Summary
protected  ClusterStore clusterStore
           
protected static java.lang.String COMMIT_FLAG_NAME
           
protected  GarbageCollector garbageCollector
          The garbage collector.
protected static java.lang.String ID_TABLE_NAME
           
protected  DxMap idTable
          Maps ObjectIDs to ClusterIDs
protected static java.lang.String NAME_TABLE_NAME
           
protected  DxMap nameTable
          Maps names to ObjectIDs
 
Fields inherited from class org.ozoneDB.core.ServerComponent
env
 
Constructor Summary
WizardStore(Env env)
           
 
Method Summary
 void abortTransaction(Transaction ta)
           
protected  void beginCommit(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.
protected  void commitIDTable()
           
protected  void commitNameTable()
           
 void commitTransaction(Transaction ta)
           
 ObjectContainer containerForID(Transaction ta, ObjectID id)
          Returns the ObjectContainer for the given ObjectID or null if there is no such container.
 ObjectContainer containerForName(Transaction ta, java.lang.String name)
           
 Transaction createTransaction(Env env, User user)
          Factory method for creating a new Transaction.
protected  void endCommit(Transaction ta)
           
 void init(Env _env)
          Aid constructor, because a store is instantiated with 'newInstance', where we've got no arguments.
protected  boolean isCleanShutdown()
           
 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.
 DxIterator objectIDIterator()
           
 DxSet objectNames(Transaction ta)
           
 void prepareCommitTransaction(Transaction ta)
          Prepare the specified transaction for commit.
protected  void recover()
          Fill idTable and nameTable from the information that are stored in the clusters directly.
 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 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

ID_TABLE_NAME

protected static final java.lang.String ID_TABLE_NAME
See Also:
Constant Field Values

NAME_TABLE_NAME

protected static final java.lang.String NAME_TABLE_NAME
See Also:
Constant Field Values

COMMIT_FLAG_NAME

protected static final java.lang.String COMMIT_FLAG_NAME
See Also:
Constant Field Values

idTable

protected DxMap idTable
Maps ObjectIDs to ClusterIDs


nameTable

protected DxMap nameTable
Maps names to ObjectIDs


clusterStore

protected ClusterStore clusterStore

garbageCollector

protected GarbageCollector garbageCollector
The garbage collector. It should be notified in the event
Constructor Detail

WizardStore

public WizardStore(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

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

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

objectIDIterator

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

commitNameTable

protected void commitNameTable()
                        throws java.io.IOException
Throws:
java.io.IOException

commitIDTable

protected void commitIDTable()
                      throws java.io.IOException
Throws:
java.io.IOException

recover

protected void recover()
                throws java.lang.Exception
Fill idTable and nameTable from the information that are stored in the clusters directly.

Throws:
java.lang.Exception - If a cluster cannot be read.

newContainerAndLock

public ObjectContainer newContainerAndLock(Transaction ta,
                                           org.ozoneDB.OzoneCompatible target,
                                           ObjectID objID,
                                           Permissions permissions,
                                           int lockLevel)
                                    throws java.lang.Exception
Description copied from interface: StoreManager
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

updateLockLevel

public void updateLockLevel(Transaction _ta,
                            ObjectContainer _container)
                     throws java.io.IOException
Description copied from interface: StoreManager
Update lock level of the given container according to the leve of the containers lock object.

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

containerForID

public ObjectContainer containerForID(Transaction ta,
                                      ObjectID id)
                               throws org.ozoneDB.ObjectNotFoundException,
                                      java.io.IOException,
                                      java.lang.ClassNotFoundException
Returns the ObjectContainer for the given ObjectID or null if there is no such container.

If an ObjectContainer is returned, it is pinned once. Thus, the caller has to ensure that the ObjectContainer is unpinned as soon as it is not needed anymore.

Specified by:
containerForID in interface StoreManager
Parameters:
ta - the Transaction for within the container is requested or null. Impl. Note: For performance reasons this is the only method of this Store that is not synchronized. This will not cause problems because the only field that is updated inside the method (currentContainer) does not need to be stable while this method is running.
Throws:
org.ozoneDB.ObjectNotFoundException
java.io.IOException
java.lang.ClassNotFoundException

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

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

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

clusterOfID

public DxBag clusterOfID(ObjectID id)
                  throws java.lang.Exception
Description copied from interface: StoreManager
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

prepareCommitTransaction

public void prepareCommitTransaction(Transaction ta)
                              throws java.io.IOException,
                                     java.lang.ClassNotFoundException
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.
Throws:
java.io.IOException
java.lang.ClassNotFoundException

isCleanShutdown

protected boolean isCleanShutdown()

beginCommit

protected void beginCommit(Transaction ta)
                    throws java.io.IOException
Throws:
java.io.IOException

endCommit

protected void endCommit(Transaction ta)
                  throws java.io.IOException
Throws:
java.io.IOException

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

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

reportNamedObjectsToGarbageCollector

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

Specified by:
reportNamedObjectsToGarbageCollector in interface StoreManager

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

ozone core API

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