SPT Object Database API

com.sptci.prevayler
Class PrimaryStorage

java.lang.Object
  extended by com.sptci.prevayler.PrimaryStorage
All Implemented Interfaces:
Serializable

public class PrimaryStorage
extends Object
implements Serializable

A class used as the primary storage mechanism for persisting prevalent objects in the prevalent system.

© Copyright 2008 Sans Pareil Technologies, Inc.

Version:
$Id: PrimaryStorage.java 4345 2008-06-30 21:22:03Z rakesh $
Author:
Rakesh Vidyadharan 2008-05-22
See Also:
Serialized Form

Field Summary
private static long serialVersionUID
           
private  Map<Object,PrevalentObject> storage
          The map used as the primary storage container.
 
Constructor Summary
PrimaryStorage()
           
 
Method Summary
 void add(PrevalentObject object)
          Add the specified prevalent object to the primary storage.
 Collection<PrevalentObject> get(long start, long end)
          Fetch the prevalent objects in the specified range of data.
 PrevalentObject get(Object oid)
          Return the prevalent object identified by its object id from the store.
 boolean isStored(PrevalentObject object)
          Check to see if the specified object exists in storage.
 void remove(PrevalentObject object)
          Remove the specified prevalent object from the primary storage.
 int size()
          Return the total number of prevalent objects in storage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

storage

private Map<Object,PrevalentObject> storage
The map used as the primary storage container.

Constructor Detail

PrimaryStorage

public PrimaryStorage()
Method Detail

add

public void add(PrevalentObject object)
Add the specified prevalent object to the primary storage.

Parameters:
object - The prevalent object to store in the system.

remove

public void remove(PrevalentObject object)
Remove the specified prevalent object from the primary storage.

Parameters:
object - The prevalent object to remove from the system.

isStored

public boolean isStored(PrevalentObject object)
Check to see if the specified object exists in storage. Note that the checking only checks based upon the object id and not on a deep equality check.

Parameters:
object - The prevalent object to check for.
Returns:
Returns true if the object exists in the store.

size

public int size()
Return the total number of prevalent objects in storage.

Returns:
The total number of objects stored.

get

public PrevalentObject get(Object oid)
Return the prevalent object identified by its object id from the store.

Parameters:
oid - The object id to use to retrieve the prevalent object.
Returns:
Returs the prevalent object. Returns null if no matching object exists in the store.

get

public Collection<PrevalentObject> get(long start,
                                       long end)
Fetch the prevalent objects in the specified range of data. This method supports display of paginated view of the prevalent objects. Note that the objects are returned in insertion order.

Parameters:
start - The starting index (inclusive) from which to fetch the prevalent objects.
end - The ending index (exclusive) to which to fetch the prevalent objects.
Returns:
The collection of prevalent objects. Returns an empty collection if there are no objects in the specified range.

SPT Object Database API