com.metamatrix.common.buffer
Interface StorageManager

All Known Implementing Classes:
FileStorageManager, MemoryStorageManager

public interface StorageManager

Basic interface for a storage manager. The storage manager deals in terms of TupleBatch objects. The basic contract assumed here is that batches are requested (#getBatch(TupleSourceID, int) or removed (removeBatch(TupleSourceID, int)) only with the same beginning row that they were added with. For instance, if batches from row 1-100 and row 101-200 were added to the storage manager, it would be fine to get batch with begin row 1 and 101 but getting a batch with beginning row 50 would fail. This contract was created to minimize the amount of batch manipulation required by a storage manager.


Field Summary
static int TYPE_DATABASE
          Constant for a StorageManager for database storage
static int TYPE_FILE
          Constant for a StorageManager for file storage
static int TYPE_MEMORY
          Constant for a StorageManager for in-memory storage
static int TYPE_REMOTE
          Constant for a StorageManager for remote app storage
 
Method Summary
 void addBatch(TupleSourceID sourceID, TupleBatch batch, java.lang.String[] types)
          Add a batch to the storage manager.
 TupleBatch getBatch(TupleSourceID sourceID, int beginRow, java.lang.String[] types)
          Returns a batch of tuples, starting at row beginRow.
 int getStorageType()
          Get the type of storage as defined by constants.
 void initialize(java.util.Properties props)
          Initialize the storage manager given the specified properties.
 void removeBatch(TupleSourceID sourceID, int beginRow)
          Remove a batch from this storage as specified.
 void removeBatches(TupleSourceID sourceID)
          Remove all batches for the specified tuple source.
 void shutdown()
          Shut down the Storage Manager.
 

Field Detail

TYPE_MEMORY

static final int TYPE_MEMORY
Constant for a StorageManager for in-memory storage

See Also:
Constant Field Values

TYPE_DATABASE

static final int TYPE_DATABASE
Constant for a StorageManager for database storage

See Also:
Constant Field Values

TYPE_FILE

static final int TYPE_FILE
Constant for a StorageManager for file storage

See Also:
Constant Field Values

TYPE_REMOTE

static final int TYPE_REMOTE
Constant for a StorageManager for remote app storage

See Also:
Constant Field Values
Method Detail

initialize

void initialize(java.util.Properties props)
                throws MetaMatrixComponentException
Initialize the storage manager given the specified properties. Properties are typically specific to the particular storage manager.

Throws:
MetaMatrixComponentException - indicating a non-business-related exception (such as a communication exception)

getStorageType

int getStorageType()
Get the type of storage as defined by constants.

Returns:
Storage type
See Also:
TYPE_MEMORY, TYPE_DATABASE, TYPE_FILE, TYPE_REMOTE

addBatch

void addBatch(TupleSourceID sourceID,
              TupleBatch batch,
              java.lang.String[] types)
              throws MetaMatrixComponentException
Add a batch to the storage manager.

Parameters:
types - a hint to the StorageManager about the types of data in the batch
Throws:
MetaMatrixComponentException - indicating a non-business-related exception (such as a communication exception)

getBatch

TupleBatch getBatch(TupleSourceID sourceID,
                    int beginRow,
                    java.lang.String[] types)
                    throws TupleSourceNotFoundException,
                           MetaMatrixComponentException
Returns a batch of tuples, starting at row beginRow. The batch will only be found if the batch that was added begins at beginRow.

Parameters:
types - a hint to the StorageManager about the types of data in the batch
Returns:
batch of tuples starting at row beginRow
Throws:
TupleSourceNotFoundException - indicating the sourceID is unknown
MetaMatrixComponentException - indicating a non-business-related exception (such as a communication exception)

removeBatch

void removeBatch(TupleSourceID sourceID,
                 int beginRow)
                 throws TupleSourceNotFoundException,
                        MetaMatrixComponentException
Remove a batch from this storage as specified. If the tuple source is unknown or the batch is unknown, a TupleSourceNotFoundException is thrown.

Throws:
TupleSourceNotFoundException - indicating the sourceID is unknown
MetaMatrixComponentException - indicating a non-business-related exception (such as a communication exception)

removeBatches

void removeBatches(TupleSourceID sourceID)
                   throws MetaMatrixComponentException
Remove all batches for the specified tuple source. If no batches exist, no exception is thrown.

Throws:
MetaMatrixComponentException - indicating a non-business-related exception (such as a communication exception)

shutdown

void shutdown()
Shut down the Storage Manager.



Copyright © 2009. All Rights Reserved.