org.ov4j.db4oImpl
Class MemoryContainer<T extends java.lang.Comparable<? super T> & java.lang.Cloneable & java.io.Serializable,C extends java.lang.Comparable<? super C>>

java.lang.Object
  extended by org.ov4j.db4oImpl.MemoryContainer<T,C>
All Implemented Interfaces:
com.db4o.replication.ReplicationConflictHandler, IContainer<T,C>

Deprecated. The MemoryContainer relied on the db4o replication mechanisms which is now external in dRS, the MemoryContainer will no longer be extended.

@Deprecated
public class MemoryContainer<T extends java.lang.Comparable<? super T> & java.lang.Cloneable & java.io.Serializable,C extends java.lang.Comparable<? super C>>
extends java.lang.Object
implements IContainer<T,C>, com.db4o.replication.ReplicationConflictHandler

Implementation of IContainer using DB4O memory databases.

Author:
smolloy

Field Summary
protected  com.db4o.ext.ExtObjectContainer db
          Deprecated. The data storing database.
protected  com.db4o.ext.ExtObjectContainer mapDB
          Deprecated. The ID map database.
protected  com.db4o.ext.ExtObjectContainer unmapDB
          Deprecated. Database storing map of deleted IDs.
 
Constructor Summary
MemoryContainer(java.lang.String dbName, long delay, long saveInterval)
          Deprecated. Constructor.
 
Method Summary
protected  void backup()
          Deprecated. Backup the data and ID map databases.
 void batchDelete(Item<T,C>[] items, boolean keepTrack)
          Deprecated. Delete an array of items all at once, items which are not found will simply be ignored.
 void batchMerge(C[] ids)
          Deprecated. 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)
          Deprecated. Save array of items all at once.
 void clear()
          Deprecated. Clear the database, will not clear the backups.
 void clearDeletedIDs()
          Deprecated.  
 void close()
          Deprecated. Close the container.
 void close(boolean removeHook)
          Deprecated. Close the container, possibly removing shutdown hook.
 void commit()
          Deprecated. Commit all changes.
protected  void configure()
          Deprecated. Configure database, subclasses should overload this method, but still call super.configure() so that everything is configured correctly.
 void delete(Item<T,C> it, boolean keepTrack)
          Deprecated. Delete the item.
 C[] deletedIds()
          Deprecated. Retrieve list of IDs that have been deleted.
 C[] deletedIdsSince(long timestamp)
          Deprecated. Retrieve a list of IDs that have been deleted since the given timestamp.
 void duplicate(IContainer<T,C> cont)
          Deprecated. Converts the given IContainer into an hessian implementation.
static int getBlockSize()
          Deprecated.  
 boolean inUse(C id)
          Deprecated. Determine if the given id is in use.
 boolean isClosed()
          Deprecated. Determine if the container has already been closed.
 C[] listModifiedSince(long timestamp)
          Deprecated. List all items modified since the given timestamp.
 Item<T,C>[] load(C[] ids, boolean allVersions)
          Deprecated. Load multiple items at once, using the specified ids.
 Item<T,C> load(C id, boolean allVersions)
          Deprecated. Load an item using its id.
 Item<T,C>[] modifiedSince(long timestamp, boolean allVersions)
          Deprecated. Load all items modified since the given timestamp.
 void release(java.lang.Object obj)
          Deprecated. Release the object so it can be garbage collected immediately.
 java.lang.Object resolveConflict(com.db4o.replication.ReplicationProcess proc, java.lang.Object objA, java.lang.Object objB)
          Deprecated. Always returns object A as replication is always used to backup in peer B.
 void rollback()
          Deprecated. Rollback and discard all changes since last commit.
 void save(Item<T,C> it)
          Deprecated. Save the item.
static void setBlockSize(int blockSize)
          Deprecated.  
 java.lang.String toString()
          Deprecated. Returns a string representation of this Container.
 void waitForPendingSaves()
          Deprecated. Wait for all saves and deletes pending tasks to finish.
 void waitForPendingTasks()
          Deprecated. Wait for all tasks pending tasks to finish.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

db

protected com.db4o.ext.ExtObjectContainer db
Deprecated. 
The data storing database.


mapDB

protected com.db4o.ext.ExtObjectContainer mapDB
Deprecated. 
The ID map database.


unmapDB

protected com.db4o.ext.ExtObjectContainer unmapDB
Deprecated. 
Database storing map of deleted IDs.

Constructor Detail

MemoryContainer

public MemoryContainer(java.lang.String dbName,
                       long delay,
                       long saveInterval)
Deprecated. 
Constructor.

Parameters:
dbName - Name of the database.
delay - Delay before the first save.
saveInterval - Interval (in ms) between periodic replication to backup database.
Method Detail

getBlockSize

public static int getBlockSize()
Deprecated. 
Returns:
the blockSize

setBlockSize

public static void setBlockSize(int blockSize)
Deprecated. 
Parameters:
blockSize - the blockSize to set

backup

protected void backup()
Deprecated. 
Backup the data and ID map databases.


batchDelete

public void batchDelete(Item<T,C>[] items,
                        boolean keepTrack)
Deprecated. 
Description copied from interface: IContainer
Delete an array of items all at once, items which are not found will simply be ignored.

Specified by:
batchDelete in interface IContainer<T extends java.lang.Comparable<? super T> & java.lang.Cloneable & java.io.Serializable,C extends java.lang.Comparable<? super C>>
Parameters:
items - Items to be deleted.
keepTrack - Whether or not the ID should be kept in history.
See Also:
org.ov4j.IContainer#batchDelete(org.ov4j.data.Item[])

batchMerge

public void batchMerge(C[] ids)
Deprecated. 
Description copied from interface: IContainer
Merge an array of items all at once, items which are not found will simply be ignored.

Specified by:
batchMerge in interface IContainer<T extends java.lang.Comparable<? super T> & java.lang.Cloneable & java.io.Serializable,C extends java.lang.Comparable<? super C>>
Parameters:
ids - IDs to be merged.
See Also:
IContainer.batchMerge(java.lang.Comparable[])

batchSave

public void batchSave(Item<T,C>[] items,
                      boolean abortOnDuplicate)
               throws java.io.IOException
Deprecated. 
Description copied from interface: IContainer
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.

Specified by:
batchSave in interface IContainer<T extends java.lang.Comparable<? super T> & java.lang.Cloneable & java.io.Serializable,C extends java.lang.Comparable<? super C>>
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
See Also:
org.ov4j.IContainer#batchSave(org.ov4j.data.Item[], boolean)

clear

public void clear()
Deprecated. 
Clear the database, will not clear the backups. WARNING: THIS OPERATION CAN BE VERY HARMFUL AS ALL DATA IN THE DB WILL BE LOST!!!

Specified by:
clear in interface IContainer<T extends java.lang.Comparable<? super T> & java.lang.Cloneable & java.io.Serializable,C extends java.lang.Comparable<? super C>>
See Also:
IContainer.clear()

clearDeletedIDs

public void clearDeletedIDs()
Deprecated. 
See Also:
org.ov4j.IContainer#clearDeletedIDs()

close

public void close()
Deprecated. 
Description copied from interface: IContainer
Close the container.

Specified by:
close in interface IContainer<T extends java.lang.Comparable<? super T> & java.lang.Cloneable & java.io.Serializable,C extends java.lang.Comparable<? super C>>
See Also:
IContainer.close()

close

public void close(boolean removeHook)
Deprecated. 
Close the container, possibly removing shutdown hook.

Parameters:
removeHook - Whether or not the shutdown hook should be removed first.

commit

public void commit()
Deprecated. 
Description copied from interface: IContainer
Commit all changes.

Specified by:
commit in interface IContainer<T extends java.lang.Comparable<? super T> & java.lang.Cloneable & java.io.Serializable,C extends java.lang.Comparable<? super C>>
See Also:
IContainer.commit()

configure

protected void configure()
Deprecated. 
Configure database, subclasses should overload this method, but still call super.configure() so that everything is configured correctly. This method will be called before any databases are opened or created.


delete

public void delete(Item<T,C> it,
                   boolean keepTrack)
Deprecated. 
Description copied from interface: IContainer
Delete the item.

Specified by:
delete in interface IContainer<T extends java.lang.Comparable<? super T> & java.lang.Cloneable & java.io.Serializable,C extends java.lang.Comparable<? super C>>
Parameters:
it - Item to be deleted.
keepTrack - Whether or not the ID should be kept in history.
See Also:
org.ov4j.IContainer#delete(org.ov4j.data.Item)

deletedIds

public C[] deletedIds()
Deprecated. 
Description copied from interface: IContainer
Retrieve list of IDs that have been deleted.

Specified by:
deletedIds in interface IContainer<T extends java.lang.Comparable<? super T> & java.lang.Cloneable & java.io.Serializable,C extends java.lang.Comparable<? super C>>
Returns:
All IDs deleted.
See Also:
IContainer.deletedIds()

deletedIdsSince

public C[] deletedIdsSince(long timestamp)
Deprecated. 
Description copied from interface: IContainer
Retrieve a list of IDs that have been deleted since the given timestamp.

Specified by:
deletedIdsSince in interface IContainer<T extends java.lang.Comparable<? super T> & java.lang.Cloneable & java.io.Serializable,C extends java.lang.Comparable<? super C>>
Parameters:
timestamp - Timestamp to use.
Returns:
All IDS deleted since the given timestamp.
See Also:
IContainer.deletedIdsSince(long)

duplicate

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

Specified by:
duplicate in interface IContainer<T extends java.lang.Comparable<? super T> & java.lang.Cloneable & java.io.Serializable,C extends java.lang.Comparable<? super C>>
Parameters:
cont - IContainer to convert.
Throws:
java.io.IOException

inUse

public boolean inUse(C id)
Deprecated. 
Description copied from interface: IContainer
Determine if the given id is in use.

Specified by:
inUse in interface IContainer<T extends java.lang.Comparable<? super T> & java.lang.Cloneable & java.io.Serializable,C extends java.lang.Comparable<? super C>>
Parameters:
id - ID to check.
Returns:
True if the ID is already used in the system.
See Also:
IContainer.inUse(java.lang.Comparable)

isClosed

public boolean isClosed()
Deprecated. 
Description copied from interface: IContainer
Determine if the container has already been closed.

Specified by:
isClosed in interface IContainer<T extends java.lang.Comparable<? super T> & java.lang.Cloneable & java.io.Serializable,C extends java.lang.Comparable<? super C>>
Returns:
True if the container has been closed.
See Also:
IContainer.isClosed()

listModifiedSince

public C[] listModifiedSince(long timestamp)
                                                              throws java.io.IOException
Deprecated. 
Description copied from interface: IContainer
List all items modified since the given timestamp.

Specified by:
listModifiedSince in interface IContainer<T extends java.lang.Comparable<? super T> & java.lang.Cloneable & java.io.Serializable,C extends java.lang.Comparable<? super C>>
Parameters:
timestamp - Timestamp to use.
Returns:
An array of IDs for items modified since specified timestamp.
Throws:
java.io.IOException
See Also:
IContainer.listModifiedSince(long)

load

public Item<T,C> load(C id,
                      boolean allVersions)
Deprecated. 
Description copied from interface: IContainer
Load an item using its id.

Specified by:
load in interface IContainer<T extends java.lang.Comparable<? super T> & java.lang.Cloneable & java.io.Serializable,C extends java.lang.Comparable<? super C>>
Parameters:
id - ID to look for.
allVersions - Whether or not all versions should be loaded.
Returns:
The item with specified ID.
See Also:
IContainer.load(java.lang.Comparable, boolean)

load

public Item<T,C>[] load(C[] ids,
                        boolean allVersions)
Deprecated. 
Description copied from interface: IContainer
Load multiple items at once, using the specified ids.

Specified by:
load in interface IContainer<T extends java.lang.Comparable<? super T> & java.lang.Cloneable & java.io.Serializable,C extends java.lang.Comparable<? super C>>
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.
See Also:
IContainer.load(java.lang.Comparable, boolean)

modifiedSince

public Item<T,C>[] modifiedSince(long timestamp,
                                 boolean allVersions)
Deprecated. 
Description copied from interface: IContainer
Load all items modified since the given timestamp.

Specified by:
modifiedSince in interface IContainer<T extends java.lang.Comparable<? super T> & java.lang.Cloneable & java.io.Serializable,C extends java.lang.Comparable<? super C>>
Parameters:
timestamp - Timestamp to use.
allVersions - Whether or not all versions should be loaded.
Returns:
An array of items modified since specified timestamp.
See Also:
IContainer.modifiedSince(long, boolean)

release

public void release(java.lang.Object obj)
Deprecated. 
Description copied from interface: IContainer
Release the object so it can be garbage collected immediately.

Specified by:
release in interface IContainer<T extends java.lang.Comparable<? super T> & java.lang.Cloneable & java.io.Serializable,C extends java.lang.Comparable<? super C>>
Parameters:
obj - Object to release.
See Also:
IContainer.release(java.lang.Object)

resolveConflict

public java.lang.Object resolveConflict(com.db4o.replication.ReplicationProcess proc,
                                        java.lang.Object objA,
                                        java.lang.Object objB)
Deprecated. 
Always returns object A as replication is always used to backup in peer B.

Specified by:
resolveConflict in interface com.db4o.replication.ReplicationConflictHandler
See Also:
ReplicationConflictHandler.resolveConflict(com.db4o.replication.ReplicationProcess, java.lang.Object, java.lang.Object)

rollback

public void rollback()
Deprecated. 
Description copied from interface: IContainer
Rollback and discard all changes since last commit.

Specified by:
rollback in interface IContainer<T extends java.lang.Comparable<? super T> & java.lang.Cloneable & java.io.Serializable,C extends java.lang.Comparable<? super C>>
See Also:
IContainer.rollback()

save

public void save(Item<T,C> it)
Deprecated. 
Description copied from interface: IContainer
Save the item.

Specified by:
save in interface IContainer<T extends java.lang.Comparable<? super T> & java.lang.Cloneable & java.io.Serializable,C extends java.lang.Comparable<? super C>>
Parameters:
it - Item to be saved.
See Also:
IContainer.save(org.ov4j.data.Item)

toString

public java.lang.String toString()
Deprecated. 
Returns a string representation of this Container.

Overrides:
toString in class java.lang.Object
Returns:
String representation of the Container.

waitForPendingSaves

public void waitForPendingSaves()
Deprecated. 
Description copied from interface: IContainer
Wait for all saves and deletes pending tasks to finish.

Specified by:
waitForPendingSaves in interface IContainer<T extends java.lang.Comparable<? super T> & java.lang.Cloneable & java.io.Serializable,C extends java.lang.Comparable<? super C>>

waitForPendingTasks

public void waitForPendingTasks()
Deprecated. 
Description copied from interface: IContainer
Wait for all tasks pending tasks to finish.

Specified by:
waitForPendingTasks in interface IContainer<T extends java.lang.Comparable<? super T> & java.lang.Cloneable & java.io.Serializable,C extends java.lang.Comparable<? super C>>


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