org.ov4j
Interface IContainer<T extends java.lang.Comparable<? super T> & java.lang.Cloneable & java.io.Serializable,C extends java.lang.Comparable<? super C>>

All Known Implementing Classes:
Container, Container, MemoryContainer

public interface IContainer<T extends java.lang.Comparable<? super T> & java.lang.Cloneable & java.io.Serializable,C extends java.lang.Comparable<? super C>>

Interface to implement to serve as data storage for controler.

Author:
smolloy

Method Summary
 void batchDelete(Item<T,C>[] items, boolean keepTrack)
          Delete an array of items all at once, items which are not found will simply be ignored.
 void batchMerge(C[] ids)
          Merge an array of items all at once, items which are not found will simply be ignored.
 void batchSave(Item<T,C>[] items, boolean abortOnDuplicate)
          Save array of items all at once.
 void clear()
          Clear all data in the container.
 void close()
          Close the container.
 void commit()
          Commit all changes.
 void delete(Item<T,C> it, boolean keepTrack)
          Delete the item.
 C[] deletedIds()
          Retrieve list of IDs that have been deleted.
 C[] deletedIdsSince(long timestamp)
          Retrieve a list of IDs that have been deleted since the given timestamp.
 void duplicate(IContainer<T,C> cont)
          Converts the given IContainer into an hessian implementation.
 boolean inUse(C id)
          Determine if the given id is in use.
 boolean isClosed()
          Determine if the container has already been closed.
 C[] listModifiedSince(long timestamp)
          List all items modified since the given timestamp.
 Item<T,C>[] load(C[] ids, boolean allVersions)
          Load multiple items at once, using the specified ids.
 Item<T,C> load(C id, boolean allVersions)
          Load an item using its id.
 Item<T,C>[] modifiedSince(long timestamp, boolean allVersions)
          Load all items modified since the given timestamp.
 void release(java.lang.Object obj)
          Release the object so it can be garbage collected immediately.
 void rollback()
          Rollback and discard all changes since last commit.
 void save(Item<T,C> it)
          Save the item.
 void waitForPendingSaves()
          Wait for all saves and deletes pending tasks to finish.
 void waitForPendingTasks()
          Wait for all tasks pending tasks to finish.
 

Method Detail

batchDelete

void batchDelete(Item<T,C>[] items,
                 boolean keepTrack)
                 throws java.io.IOException
Delete an array of items all at once, items which are not found will simply be ignored.

Type Parameters:
T - Type of object in the items, must extend VersionableObject.
Parameters:
items - Items to be deleted.
keepTrack - Whether or not the ID should be kept in history.
Throws:
java.io.IOException

batchMerge

void batchMerge(C[] ids)
                throws java.io.IOException
Merge an array of items all at once, items which are not found will simply be ignored.

Parameters:
ids - IDs to be merged.
Throws:
java.io.IOException

batchSave

void batchSave(Item<T,C>[] items,
               boolean abortOnDuplicate)
               throws java.io.IOException
Save array of items all at once. If abortOnDuplicate is set to true, data will not be saved if 1 or more item ids are in use.

Type Parameters:
T - Type of object in the items, must extend VersionableObject.
Parameters:
items - Array of items to be saved.
abortOnDuplicate - Whether or not saving should abort when an item has an ID already in use.
Throws:
java.io.IOException

clear

void clear()
Clear all data in the container.


close

void close()
           throws java.io.IOException
Close the container.

Throws:
java.io.IOException

commit

void commit()
Commit all changes.


delete

void delete(Item<T,C> it,
            boolean keepTrack)
            throws java.io.IOException
Delete the item.

Type Parameters:
T - Type of object in the item, must extend VersionableObject.
Parameters:
it - Item to be deleted.
keepTrack - Whether or not the ID should be kept in history.
Throws:
java.io.IOException

deletedIds

C[] deletedIds()
                                                       throws java.io.IOException
Retrieve list of IDs that have been deleted.

Returns:
All IDs deleted.
Throws:
java.io.IOException

deletedIdsSince

C[] deletedIdsSince(long timestamp)
                                                            throws java.io.IOException
Retrieve a list of IDs that have been deleted since the given timestamp.

Parameters:
timestamp - Timestamp to use.
Returns:
All IDS deleted since the given timestamp.
Throws:
java.io.IOException

duplicate

void duplicate(IContainer<T,C> cont)
               throws java.io.IOException
Converts the given IContainer into an hessian implementation.

Parameters:
cont - IContainer to convert.
Throws:
java.io.IOException

inUse

boolean inUse(C id)
              throws java.io.IOException
Determine if the given id is in use.

Parameters:
id - ID to check.
Returns:
True if the ID is already used in the system.
Throws:
java.io.IOException

isClosed

boolean isClosed()
Determine if the container has already been closed.

Returns:
True if the container has been closed.

listModifiedSince

C[] listModifiedSince(long timestamp)
                                                              throws java.io.IOException
List all items modified since the given timestamp.

Parameters:
timestamp - Timestamp to use.
Returns:
An array of IDs for items modified since specified timestamp.
Throws:
java.io.IOException

load

Item<T,C> load(C id,
               boolean allVersions)
                                                                                                                                          throws java.io.IOException
Load an item using its id.

Parameters:
id - ID to look for.
allVersions - Whether or not all versions should be loaded.
Returns:
The item with specified ID.
Throws:
java.io.IOException

load

Item<T,C>[] load(C[] ids,
                 boolean allVersions)
                                                                                                                                            throws java.io.IOException
Load multiple items at once, using the specified ids.

Parameters:
ids - Array of IDs to look for.
allVersions - Whether or not all versions should be loaded.
Returns:
An array of items with specified IDs, not necessarily in the same order.
Throws:
java.io.IOException

modifiedSince

Item<T,C>[] modifiedSince(long timestamp,
                          boolean allVersions)
                                                                                                                                                     throws java.io.IOException
Load all items modified since the given timestamp.

Parameters:
timestamp - Timestamp to use.
allVersions - Whether or not all versions should be loaded.
Returns:
An array of items modified since specified timestamp.
Throws:
java.io.IOException

release

void release(java.lang.Object obj)
Release the object so it can be garbage collected immediately.

Parameters:
obj - Object to release.

rollback

void rollback()
Rollback and discard all changes since last commit.


save

void save(Item<T,C> it)
          throws java.io.IOException
Save the item.

Type Parameters:
T - Type of object in the item, must extend VersionableObject.
Parameters:
it - Item to be saved.
Throws:
java.io.IOException

waitForPendingSaves

void waitForPendingSaves()
Wait for all saves and deletes pending tasks to finish.


waitForPendingTasks

void waitForPendingTasks()
Wait for all tasks pending tasks to finish.



Copyright © 2004-2007 Steve Molloy. All Rights Reserved.