Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## context.arch.storage
Class StorageObject

    java.lang.Object
      |
      +--context.arch.storage.StorageObject

public class StorageObject
extends java.lang.Object

This class allows storage and retrieval of data in String, Integer, Long, Float, Double, or Short format. It uses a default storage class (context.arch.storage.VectorStorage), but can use any given storage class that implements the Storage interface.

See Also:
  `Storage`

Field Summary
`static java.lang.String` | `DEFAULT_STORAGE_CLASS` The default storage class is context.arch.storage.VectorStorage
`static java.lang.String` | `PASSWORD` The default password
`static java.lang.String` | `PROTOCOL` The default protocol to use is JDBC
`static java.lang.String` | `RETRIEVE_DATA` Tag for retrieving data
`static java.lang.String` | `RETRIEVE_DATA_REPLY` Tag for reply to retrieve data request
`static java.lang.String` | `SUBPROTOCOL` The default subprotocol to use is msql
`static java.lang.String` | `URL` The default url to use for storage
`static java.lang.String` | `USER` The default username

Constructor Summary
`StorageObject(java.lang.String table)` Basic constructor that uses the default storage class
`StorageObject(java.lang.String storeClass, java.lang.String table)` Constructor that sets the storage class to use and creates the storage class.
`StorageObject(java.lang.String storageClass, java.lang.String table, java.lang.Integer flushType, java.lang.Long flushCondition)` Constructor that sets the storage class to use

Method Summary
`void` | `flushStorage()` Flushes the locally stored data to persistent storage
`RetrievalResults` | `retrieveAttributes(Retrieval retrieval)` This method returns a vector containing AttributeNameValues objects that matches the given conditions in the Retrieval object
`RetrievalResults` | `retrieveAttributes(java.lang.String requestorId, Retrieval retrieval)` This method returns a vector containing AttributeNameValues objects that matches the given conditions in the Retrieval object, and that the given requestorId is allowed to have access to
`AttributeNameValues` | `retrieveLastAttributes()` Returns the last AttributeNameValues object stored
`void` | `setAttributes(Attributes attributes, java.util.Hashtable attributeTypes)` This method sets the attributes to use for storage.
`void` | `store(AttributeNameValues atts)` This method stores the given AttributeNameValues object and checks whether the locally stored data should be flushed to persistent storage.
`void` | `store(DataObject data)` This method stores the attributes in the given DataObject and checks whether the locally stored data should be flushed to persistent storage.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### RETRIEVE_DATA

    public static final java.lang.String RETRIEVE_DATA

  Tag for retrieving data

### RETRIEVE_DATA_REPLY

    public static final java.lang.String RETRIEVE_DATA_REPLY

  Tag for reply to retrieve data request

### PROTOCOL

    public static final java.lang.String PROTOCOL

  The default protocol to use is JDBC

### SUBPROTOCOL

    public static final java.lang.String SUBPROTOCOL

  The default subprotocol to use is msql

### URL

    public static final java.lang.String URL

  The default url to use for storage

### USER

    public static final java.lang.String USER

  The default username

### PASSWORD

    public static final java.lang.String PASSWORD

  The default password

### DEFAULT_STORAGE_CLASS

    public static final java.lang.String DEFAULT_STORAGE_CLASS

  The default storage class is context.arch.storage.VectorStorage

Constructor Detail

### StorageObject

    public StorageObject(java.lang.String table)
                  throws InvalidStorageException

  Basic constructor that uses the default storage class
  Parameters:
    `table` - Name of the table to use - should be the id of the calling object
  Throws:
    InvalidStorageException - when the default storage class can't be created
  See Also:
    `DEFAULT_STORAGE_CLASS`

### StorageObject

    public StorageObject(java.lang.String storeClass,
                         java.lang.String table)
                  throws InvalidStorageException

  Constructor that sets the storage class to use and creates the storage class. If the class is null, the default class is used. If the table is null, an exception is thrown.
  Parameters:
    `storageClass` - Class to use for storage
    `table` - Name of the table to use - should be the id of the calling object
  Throws:
    InvalidStorageException - thrown when there are any errors creating the storage class object or connecting to the persistent storage
    InvalidStorageException - when the given storage class can't be created
  See Also:
    `DEFAULT_STORAGE_CLASS`

### StorageObject

    public StorageObject(java.lang.String storageClass,
                         java.lang.String table,
                         java.lang.Integer flushType,
                         java.lang.Long flushCondition)
                  throws InvalidStorageException

  Constructor that sets the storage class to use
  Parameters:
    `storageClass` - Class to use for storage
    `table` - Name of the table to use - should be the id of the calling object
    `flushType` - Flush to database based on TIME or DATA
    `flushCondition` - Condition to flush local storage to database
  Throws:
    InvalidStorageException - when the given storage class can't be created

Method Detail

### store

    public void store(AttributeNameValues atts)

  This method stores the given AttributeNameValues object and checks whether the locally stored data should be flushed to persistent storage. It is a stub method that simply calls the store(), checkFlushCondition() and flushStorage() methods in the Storage interface.
  Parameters:
    `atts` - AttributeNameValues to store
  See Also:
    `Storage.store(context.arch.storage.AttributeNameValues)`, `Storage.flushStorage()`, `Storage.checkFlushCondition()`

### store

    public void store(DataObject data)

  This method stores the attributes in the given DataObject and checks whether the locally stored data should be flushed to persistent storage. It assumes that the DataObject has the starting tag . It is a stub method that converts the DataObject to an AttributeNameValues object and calls the store(AttributeNameValues) method in this class.
  Parameters:
    `data` - DataObject containing the attributes to store
  See Also:
    `store(context.arch.storage.AttributeNameValues)`

### retrieveLastAttributes

    public AttributeNameValues retrieveLastAttributes()

  Returns the last AttributeNameValues object stored
  Returns:
    the last AttributeNameValues object stored

### flushStorage

    public void flushStorage()

  Flushes the locally stored data to persistent storage

### retrieveAttributes

    public RetrievalResults retrieveAttributes(Retrieval retrieval)

  This method returns a vector containing AttributeNameValues objects that matches the given conditions in the Retrieval object
  Parameters:
    `retrieval` - Retrieval object that contains conditions for retrievalcompare Flag that dictates the type of comparison
  Returns:
    RetrievalResults containing AttributeNameValues objects that matches the given compare flag and value

### retrieveAttributes

    public RetrievalResults retrieveAttributes(java.lang.String requestorId,
                                               Retrieval retrieval)

  This method returns a vector containing AttributeNameValues objects that matches the given conditions in the Retrieval object, and that the given requestorId is allowed to have access to
  Parameters:
    `accessorId` - Id of the "user" trying to retrieve data
    `retrieval` - Retrieval object that contains conditions for retrievalcompare Flag that dictates the type of comparison
  Returns:
    RetrievalResults containing AttributeNameValues objects that matches the given compare flag and value

### setAttributes

    public void setAttributes(Attributes attributes,
                              java.util.Hashtable attributeTypes)

  This method sets the attributes to use for storage.
  Parameters:
    `attributes` - AttributeNameValues containing attribute info for this object
    `attributeTypes` - Hashtable containing attributes and type info

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD