|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.ov4j.Controler<T,C>
public class Controler<T extends java.lang.Comparable<? super T> & java.lang.Cloneable & java.io.Serializable,C extends java.lang.Comparable<? super C>>
Main access to the versioning system.
| Constructor Summary | |
|---|---|
Controler(IContainer<T,C> db)
Instantiate a Controler using the specified container to store its data. |
|
| Method Summary | |
|---|---|
boolean |
addNCommit(C id,
Version<T> ver)
Directly add a version. |
boolean |
batchCommit(C[] ids,
Version<T>[] newVersions,
java.lang.Class<? extends ComparisonResult<T>> compResultClass,
boolean addNew)
Commit changes to the given objects using the specified class to determine if commit is needed. |
boolean |
batchDelete(C[] ids)
Removes all versions of the given ids. |
boolean |
batchDiscard(C[] ids)
Remove all version and do not keep IDs in history. |
boolean |
batchImport(C[] ids,
Version<T>[] vers,
boolean abortOnDuplicate)
Add all versions, will return a BiteSet containing information on which could be added. |
boolean |
batchMerge(C[] ids)
Merges all versions of the given ids. |
void |
clear()
Clear all data in the underlying container. |
void |
close()
Close this controler and its underlying container. |
boolean |
commit(C id,
Version<T> newVersion)
Commit changes to the given object. |
boolean |
commit(C id,
Version<T> newVersion,
java.lang.Class<? extends ComparisonResult<? super T>> compResultClass)
Commit changes to the given object. |
boolean |
commit(C id,
Version<T> newVersion,
java.lang.Class<? extends ComparisonResult<? super T>> compResultClass,
int rollover)
Commit changes to the given object using the specified class to determine if commit is needed. |
boolean |
commit(C id,
Version<T> newVersion,
int rollover)
Commit changes to the given object. |
ComparisonResult<T> |
compare(Version<T> newVersion,
Version<T> oldVersion,
boolean fast)
Compare 2 versions after determining which class to use. |
ComparisonResult<T> |
compare(Version<T> newVersion,
Version<T> oldVersion,
java.lang.Class<? extends ComparisonResult<? super T>> compResultClass,
boolean fast)
Compare 2 versions using the specified class. |
boolean |
delete(C id)
Removes all versions of the given id. |
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. |
ComparisonResult<T> |
diff(C id,
Version<T> newVersion)
Will perform a diff, trying to determine the class of the comparison result by appending ComparisonResult to the versionedObject classname. |
ComparisonResult<T> |
diff(C id,
Version<T> newVersion,
java.lang.Class<? extends ComparisonResult<? super T>> compResultClass)
Compares the new version to the latest version of object with the given id. |
boolean |
discard(C id)
Remove all version and do not keep ID in history. |
void |
discardChanges()
Discard all changes made since the last save. |
Version<T> |
fetch(C id,
int versionNum)
Fetch the given version of object with the given id. |
Version<T>[] |
fetch(C id,
int[] versionNums)
Fetch the given versions of object with the given id. |
java.lang.Class<? extends ComparisonResult<? super T>> |
findComparisonResultClass(Version<T> ver)
Find the Class to use for comparing this version, will replace "data" by "comp" in the package name and add "ComparisonResult" to the class of the versions's versioned object. |
int |
getVersionRollover()
Retrieve the number of versions kept for historical purposes. |
boolean |
inUse(C id)
Determine if the given id is already in use. |
boolean |
isClosed()
Determine if the underlying container has already been closed. |
Version<T> |
latest(C id)
Fetch the latest version of the object with given id. |
Version<T> |
latest(C id,
int tstamp)
Fetch the latest version of the object with given id before the given timestamp. |
Version<T>[] |
latests(C[] ids)
Fetch the latest versions of every id specified. |
Version<T>[] |
latests(C[] ids,
int tstamp)
Fetch the latest versions of every id specified before the given timestamp. |
C[] |
listModifiedSince(long timestamp)
List the latest versions modified since the given timestamp. |
Version<T>[] |
modifiedSince(long timestamp)
Fetch the latest versions modified since the given timestamp. |
void |
saveChanges()
Save all changes in the container. |
void |
setVersionRollover(int versionRollover)
Set the number of versions kept for historical purposes. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Controler(IContainer<T,C> db)
db - Container used for storing data.| Method Detail |
|---|
public boolean addNCommit(C id,
Version<T> ver)
throws java.io.IOException
T - Type of the object stored in version, must extend VersionableObject.id - ID to associate with the version.ver - Version to be added.
java.io.IOException
public boolean batchCommit(C[] ids,
Version<T>[] newVersions,
java.lang.Class<? extends ComparisonResult<T>> compResultClass,
boolean addNew)
throws java.lang.InstantiationException,
java.lang.IllegalAccessException,
java.io.IOException
ids - Array of IDs associated with the versions to commit, must be in the same order.newVersions - Array of versions to be committed, must be in the same order.compResultClass - Class to use for comparing objects in the versions.addNew - Whether or not to add versions associated with IDs not found in the system.
java.lang.InstantiationException
java.lang.IllegalAccessException
java.io.IOException
public boolean batchDelete(C[] ids)
throws java.io.IOException
ids - IDs to be deleted.
java.io.IOException
public boolean batchDiscard(C[] ids)
throws java.io.IOException
ids - IDs to be deleted.
java.io.IOException
public boolean batchImport(C[] ids,
Version<T>[] vers,
boolean abortOnDuplicate)
throws java.io.IOException
T - Type of the object stored in versions, must extend VersionableObject.ids - Array of IDs to associate with the versions, must be in the same order.vers - Array of versions to add, must be in the same order.abortOnDuplicate - Whether or not to abort import if one of the IDs specified is already in use.
java.io.IOException
public boolean batchMerge(C[] ids)
throws java.io.IOException
ids - IDs to be deleted.
java.io.IOExceptionpublic void clear()
public void close()
public boolean commit(C id,
Version<T> newVersion)
throws java.lang.InstantiationException,
java.lang.IllegalAccessException,
java.io.IOException
id - ID associated with the version to commit.newVersion - New version to be committed.
java.lang.IllegalAccessException
java.lang.InstantiationException
java.io.IOException
public boolean commit(C id,
Version<T> newVersion,
java.lang.Class<? extends ComparisonResult<? super T>> compResultClass)
throws java.lang.InstantiationException,
java.lang.IllegalAccessException,
java.io.IOException
id - ID associated with the version to commit.newVersion - New version to be committed.compResultClass - Class to use to compare objects in the version.
java.lang.IllegalAccessException
java.lang.InstantiationException
java.io.IOException
public boolean commit(C id,
Version<T> newVersion,
java.lang.Class<? extends ComparisonResult<? super T>> compResultClass,
int rollover)
throws java.lang.InstantiationException,
java.lang.IllegalAccessException,
java.io.IOException
id - ID associated with the version to commit.newVersion - New version to be committed.compResultClass - Class to use to compare objects in the version.rollover - Version rollover to use.
java.lang.InstantiationException
java.lang.IllegalAccessException
java.io.IOException
public boolean commit(C id,
Version<T> newVersion,
int rollover)
throws java.lang.InstantiationException,
java.lang.IllegalAccessException,
java.io.IOException
id - ID associated with the version to commit.newVersion - New version to be committed.rollover - Version rollover to use.
java.lang.IllegalAccessException
java.lang.InstantiationException
java.io.IOException
public ComparisonResult<T> compare(Version<T> newVersion,
Version<T> oldVersion,
boolean fast)
throws java.lang.InstantiationException,
java.lang.IllegalAccessException
newVersion - New version to be compared.oldVersion - Old version to compare to.fast - Whether or not to run in fast mode, only determining if versions are the same or not.
java.lang.InstantiationException
java.lang.IllegalAccessException
public ComparisonResult<T> compare(Version<T> newVersion,
Version<T> oldVersion,
java.lang.Class<? extends ComparisonResult<? super T>> compResultClass,
boolean fast)
throws java.lang.InstantiationException,
java.lang.IllegalAccessException
newVersion - New version to be compared.oldVersion - Old version to compare to.compResultClass - Class to use to compare objects in versions.fast - Whether or not to run in fast mode, only determining if versions are the same or not.
java.lang.IllegalAccessException
java.lang.InstantiationException
public boolean delete(C id)
throws java.io.IOException
id - ID to be deleted.
java.io.IOException
public C[] deletedIds()
throws java.io.IOException
java.io.IOException
public C[] deletedIdsSince(long timestamp)
throws java.io.IOException
timestamp - Timestamp to use.
java.io.IOException
public ComparisonResult<T> diff(C id,
Version<T> newVersion)
throws java.lang.InstantiationException,
java.lang.IllegalAccessException,
java.io.IOException
id - ID of the item to which the version should be compared.newVersion - Version to be compared.
java.lang.InstantiationException
java.lang.IllegalAccessException
java.io.IOException
public ComparisonResult<T> diff(C id,
Version<T> newVersion,
java.lang.Class<? extends ComparisonResult<? super T>> compResultClass)
throws java.lang.InstantiationException,
java.lang.IllegalAccessException,
java.io.IOException
id - ID of the item to which the version should be compared.newVersion - Version to be compared.compResultClass - Class to use for comparison.
java.lang.InstantiationException
java.lang.IllegalAccessException
java.io.IOException
public boolean discard(C id)
throws java.io.IOException
id - ID to be deleted.
java.io.IOExceptionpublic void discardChanges()
public Version<T> fetch(C id,
int versionNum)
throws java.io.IOException
id - ID to retrieve.versionNum - Version to retrieve.
java.io.IOException
public Version<T>[] fetch(C id,
int[] versionNums)
throws java.io.IOException
id - ID to retrieve.versionNums - Versions to retrieve.
java.io.IOExceptionpublic java.lang.Class<? extends ComparisonResult<? super T>> findComparisonResultClass(Version<T> ver)
ver - Version for which to find a ComparisonResult class.
public int getVersionRollover()
public boolean inUse(C id)
throws java.io.IOException
id - ID to verify.
java.io.IOExceptionpublic boolean isClosed()
public Version<T> latest(C id)
throws java.io.IOException
id - ID to retrieve.
java.io.IOException
public Version<T> latest(C id,
int tstamp)
throws java.io.IOException
id - ID to retrieve.tstamp - Timestamp to use.
java.io.IOException
public Version<T>[] latests(C[] ids)
throws java.io.IOException
ids - Array of IDs to retrieve.
java.io.IOException
public Version<T>[] latests(C[] ids,
int tstamp)
throws java.io.IOException
ids - Array of IDs to retrieve.tstamp - Timestamp to use.
java.io.IOException
public C[] listModifiedSince(long timestamp)
throws java.io.IOException
timestamp -
java.io.IOException
public Version<T>[] modifiedSince(long timestamp)
throws java.io.IOException
timestamp -
java.io.IOExceptionpublic void saveChanges()
public void setVersionRollover(int versionRollover)
versionRollover - The versionRollover to set.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||