001: // You can redistribute this software and/or modify it under the terms of
002: // the Ozone Core License version 1 published by ozone-db.org.
003: //
004: // The original code and portions created by SMB are
005: // Copyright (C) 1997-@year@ by SMB GmbH. All rights reserved.
006: //
007: // $Id: StoreManager.java,v 1.2 2002/06/08 00:49:38 mediumnet Exp $
008:
009: package org.ozoneDB.core;
010:
011: import java.io.*;
012: import org.ozoneDB.DxLib.*;
013: import org.ozoneDB.*;
014:
015: /**
016: * Together with the {@link ObjectContainer} interface this is the StoreManager
017: * back-end API.<p>
018: *
019: *
020: * @author <a href="http://www.softwarebuero.de/">SMB</a>
021: * @version $Revision: 1.2 $Date: 2002/06/08 00:49:38 $
022: */
023: public interface StoreManager {
024:
025: /**
026: * Aid constructor, because a store is instantiated with 'newInstance',
027: * where we've got no arguments.
028: */
029: public void init(Env env);
030:
031: public void startup() throws Exception;
032:
033: public void shutdown() throws Exception;
034:
035: public Object newTransactionData();
036:
037: /**
038: * Creates a new object container and initializes it with the specified
039: * target object. The new container is immediatly accessible from the calling
040: * transaction via containerByID but it is not joined to this transaction.
041: * It needs to be joined and commited afterwards.
042: *
043: * Iff this method returns normally, the returned container is pinned and thus has to be unpinned.
044: * Iff this method returns normally, the returned container is locked with the given lock level.
045: *
046: * @param ta
047: * @param target
048: * @param objID
049: * @param permission
050: * @param name
051: * @return An container-proxy for the created container.
052: */
053: public ObjectContainer newContainerAndPinAndLock(Transaction ta,
054: OzoneCompatible target, ObjectID objID,
055: Permissions permissions, int lockLevel) throws Exception;
056:
057: /**
058: * Update lock level of the given container according to the leve of the
059: * containers lock object.
060: */
061: public void updateLockLevel(Transaction ta,
062: ObjectContainer container) throws IOException;
063:
064: /**
065: * Prepare the specified transaction for commit. All operations that may
066: * fail during the commit process should be done here. However, this method
067: * must not change any global data structures such as the idTable that
068: * are used by other transactions too.<p>
069: *
070: * The {@link TransactionManager} let this method run exclusivly. However,
071: * {@link prepareCommitTransaction} and {@link commitTransaction} are not
072: * an atomar operation.
073: *
074: *
075: * @param ta Transaction that will be commited.
076: */
077: public void prepareCommitTransaction(Transaction ta)
078: throws IOException, ClassNotFoundException;
079:
080: public void commitTransaction(Transaction ta) throws IOException,
081: ClassNotFoundException;
082:
083: /**
084: * @param ta ID of the comitting transaction.
085: * @param created
086: * @param modified
087: */
088: public void abortTransaction(Transaction ta) throws IOException,
089: ClassNotFoundException;
090:
091: public ObjectContainer containerForIDAndPin(Transaction ta,
092: ObjectID id) throws ObjectNotFoundExc, IOException,
093: ClassNotFoundException;
094:
095: /**
096: * @param name The object name to search for.
097: * @param ta
098: * @return The object container for the name or null.
099: */
100: public ObjectContainer containerForNameAndPin(Transaction ta,
101: String name) throws Exception;
102:
103: /**
104: * @param ta
105: * @param container
106: * @param name
107: */
108: public void nameContainer(Transaction ta,
109: ObjectContainer container, String name)
110: throws PermissionDeniedExc;
111:
112: /**
113: * Force the Store to make a guess which objects are used together with the
114: * container with the specified id.
115: * @param id The ObjectID if the container.
116: */
117: public DxBag clusterOfID(ObjectID id) throws Exception;
118:
119: public DxIterator objectIDIterator();
120:
121: /**
122: Tells this StoreManager to report every named object to the garbage collector.
123: */
124: public void reportNamedObjectsToGarbageCollector();
125: }
|