org.aselect.system.storagemanager
Interface IStorageHandler

All Known Implementing Classes:
JDBCStorageHandler, MemoryStorageHandler

public interface IStorageHandler

An interface for storage handlers.

Description:
The IStorageHandler interface defines a generic interface for all StorageHandlers in the StorageManager. A IStorageHandler handles the physical access to the storage.

Concurrency issues:
-

Author:
Alfa & Ariss

Method Summary
 void cleanup(java.lang.Long lTimestamp)
          Removes expired objects from the storage.
 boolean containsKey(java.lang.Object oKey)
          Checks if the the supplied key object exists in the physical storage.
 void destroy()
          Clean up all used recourses.
 java.lang.Object get(java.lang.Object oKey)
          Get a object from storage.
 java.util.Hashtable getAll()
          Return stored objects.
 long getCount()
          Return stored object count.
 long getTimestamp(java.lang.Object oKey)
          Retrieve an object its timestamp from storage.
 void init(java.lang.Object oConfigSection, ConfigManager oConfigManager, SystemLogger systemLogger, SAMAgent oSAMAgent)
          Initialize the handler.
 boolean isMaximum(long lItemCount)
          Checks if the maximum available storage items is reached.
 void put(java.lang.Object oKey, java.lang.Object oValue, java.lang.Long lTimestamp)
          insert object into storage.
 void remove(java.lang.Object oKey)
          Removes object from storage.
 void removeAll()
          Removes all objects from storage.
 

Method Detail

init

void init(java.lang.Object oConfigSection,
          ConfigManager oConfigManager,
          SystemLogger systemLogger,
          SAMAgent oSAMAgent)
          throws ASelectStorageException
Initialize the handler.

Description:
This function should perform all one-time initialisation proceedings.

Concurrency issues:
-
Preconditions:
Postconditions:
The storage handler is initialised.

Parameters:
oConfigSection - The section within the configuration file in which the parameters for the IStorageHandler can be found.
oConfigManager - The configuration.
systemLogger - The logger for system entries.
oSAMAgent - The SAM agant to use.
Throws:
ASelectStorageException - If initialisation fails.

get

java.lang.Object get(java.lang.Object oKey)
                     throws ASelectStorageException
Get a object from storage.

Description:
Returns a particular object from the physical storage.

Concurrency issues:
-

Preconditions:
oKey != null

Postconditions:
-

Parameters:
oKey - The identifier of the object that needs to be stored.
Returns:
The stored object.
Throws:
ASelectStorageException - If retrieving fails.

getTimestamp

long getTimestamp(java.lang.Object oKey)
                  throws ASelectStorageException
Retrieve an object its timestamp from storage.

Description:
Returns the storage timestamp of a particular object from the storage.

Concurrency issues:
-

Preconditions:
oKey != null

Postconditions:
-

Parameters:
oKey - The identifier of the object that needs to be obtained from the storage.
Returns:
The timestamp of the stored object.
Throws:
ASelectStorageException - If retrieving fails.
See Also:
getTimestamp(Object)

getAll

java.util.Hashtable getAll()
                           throws ASelectStorageException
Return stored objects.

Description:
Returns all the stored objects.

Concurrency issues:
-

Preconditions:
-

Postconditions:
-

Returns:
A Hashtable containing all stored object as key/value.
Throws:
ASelectStorageException - If retrieving fails.

getCount

long getCount()
              throws ASelectStorageException
Return stored object count.

Description:
Returns the number of stored objects.

Concurrency issues:
-

Preconditions:
-

Postconditions:
-

Returns:
The number of all stored object.
Throws:
ASelectStorageException - If retrieving fails.

put

void put(java.lang.Object oKey,
         java.lang.Object oValue,
         java.lang.Long lTimestamp)
         throws ASelectStorageException
insert object into storage.

Description:
Inserts a particular object into the physical storage.

Concurrency issues:
-

Preconditions:
Postconditions:
The object is stored.

Parameters:
oKey - The identifier of the object that needs to be stored.
oValue - The object that needs to be stored.
lTimestamp - The time at which the object is stored.
Throws:
ASelectStorageException - If storing fails.

remove

void remove(java.lang.Object oKey)
            throws ASelectStorageException
Removes object from storage.

Description:
Removes a particular object from the physical storage.

Concurrency issues:
-

Preconditions:
oKey != null

Postconditions:
The object is removed from storage.

Parameters:
oKey - The identifier of the object that needs to be removed.
Throws:
ASelectStorageException - If removal fails.

removeAll

void removeAll()
               throws ASelectStorageException
Removes all objects from storage.

Description:
Removes all the stored objects from the physical storage.

Concurrency issues:
-

Preconditions:
-

Postconditions:
All stored objects are removed from the storage.

Throws:
ASelectStorageException - if removal fails.

cleanup

void cleanup(java.lang.Long lTimestamp)
             throws ASelectStorageException
Removes expired objects from the storage.

Description:
Removes the objects from the physical storage that have expired.

Concurrency issues:
-

Preconditions:
lTimestamp != null

Postconditions:
All object which expire before or at the given time are removed.

Parameters:
lTimestamp - The expiration time.
Throws:
ASelectStorageException - If cleaning fails.

destroy

void destroy()
Clean up all used recourses.


isMaximum

boolean isMaximum(long lItemCount)
                  throws ASelectStorageException
Checks if the maximum available storage items is reached.

Parameters:
lItemCount - number of items that will be checked if it is the maximum
Returns:
TRUE if storage maximum is reached
Throws:
ASelectStorageException - if io error occurred with physical storage

containsKey

boolean containsKey(java.lang.Object oKey)
                    throws ASelectStorageException
Checks if the the supplied key object exists in the physical storage.

Parameters:
oKey - The unique key that will be checked for existance
Returns:
TRUE if the key exists
Throws:
ASelectStorageException - if IO error occurred with physical storage


Copyright © 2008 SURFnet BV. All Rights Reserved.