public class StandardChronoSphere extends java.lang.Object implements ChronoSphere, ChronoSphereInternal
FACTORY| Constructor and Description |
|---|
StandardChronoSphere(org.chronos.chronograph.api.structure.ChronoGraph graph,
org.apache.commons.configuration.Configuration configuration) |
| Modifier and Type | Method and Description |
|---|---|
void |
batchInsertModelData(java.lang.String branch,
java.util.Iterator<org.eclipse.emf.ecore.EObject> model)
Batch-inserts the given
EObject model data into the given branch of this repository. |
void |
close()
Closes this
ChronoSphere instance. |
int |
countCommitTimestamps(java.lang.String branch)
Counts the total number of commit timestamps in the graph.
|
int |
countCommitTimestampsBetween(java.lang.String branch,
long from,
long to)
Counts the number of commit timestamps between
from (inclusive) and to (inclusive). |
ChronoSphereBranchManager |
getBranchManager()
Returns the branch manager associated with this
ChronoSphere
instance. |
java.lang.Object |
getCommitMetadata(java.lang.String branch,
long timestamp)
Returns the metadata for the commit on the given branch at the given timestamp.
|
java.util.Iterator<java.util.Map.Entry<java.lang.Long,java.lang.Object>> |
getCommitMetadataBetween(java.lang.String branch,
long from,
long to,
org.chronos.chronodb.api.Order order)
Returns an iterator over the entries of commit timestamp and associated metadata, bounded between
from and to. |
java.util.Iterator<java.util.Map.Entry<java.lang.Long,java.lang.Object>> |
getCommitMetadataPaged(java.lang.String branch,
long minTimestamp,
long maxTimestamp,
int pageSize,
int pageIndex,
org.chronos.chronodb.api.Order order)
Returns an iterator over commit timestamps and associated metadata in a paged fashion.
|
java.util.Iterator<java.lang.Long> |
getCommitTimestampsBetween(java.lang.String branch,
long from,
long to,
org.chronos.chronodb.api.Order order)
Returns an iterator over all timestamps where commits have occurred, bounded between
from and
to. |
java.util.Iterator<java.lang.Long> |
getCommitTimestampsPaged(java.lang.String branch,
long minTimestamp,
long maxTimestamp,
int pageSize,
int pageIndex,
org.chronos.chronodb.api.Order order)
Returns an iterator over commit timestamps in a paged fashion.
|
ChronoSphereConfiguration |
getConfiguration()
Returns the configuration of this
ChronoSphere instance. |
EObjectToGraphMapper |
getEObjectToGraphMapper() |
ChronoSphereEPackageManager |
getEPackageManager()
Returns the EPackage manager associated with this
ChronoSphere
instance. |
EPackageToGraphMapper |
getEPackageToGraphMapper() |
ChronoSphereIndexManager |
getIndexManager(java.lang.String branchName)
Returns the index manager associated with the given branch.
|
long |
getNow(java.lang.String branchName)
Returns the "now" timestamp, i.e. the timestamp of the latest commit on the repository, on the given branch.
|
org.chronos.chronograph.api.structure.ChronoGraph |
getRootGraph() |
boolean |
isClosed()
Checks if this
ChronoSphere instance is closed or not. |
ChronoSphereTransaction |
tx()
Produces and returns a new instance of
ChronoSphereTransaction on the master branch head
version. |
ChronoSphereTransaction |
tx(java.util.Date date)
Produces and returns a new instance of
ChronoSphereTransaction on the master branch at the given
date. |
ChronoSphereTransaction |
tx(long timestamp)
Produces and returns a new instance of
ChronoSphereTransaction on the master branch at the given
timestamp. |
ChronoSphereTransaction |
tx(java.lang.String branchName)
Produces and returns a new instance of
ChronoSphereTransaction on the head version of the given
branch. |
ChronoSphereTransaction |
tx(java.lang.String branchName,
java.util.Date date)
Produces and returns a new instance of
ChronoSphereTransaction at the given date on the given branch. |
ChronoSphereTransaction |
tx(java.lang.String branchName,
long timestamp)
Produces and returns a new instance of
ChronoSphereTransaction at the given timestamp on the given
branch. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbatchInsertModelData, batchInsertModelData, batchInsertModelData, batchInsertModelData, batchInsertModelData, batchInsertModelData, batchInsertModelData, batchInsertModelData, batchInsertModelData, countCommitTimestamps, countCommitTimestampsBetween, getCommitMetadata, getCommitMetadataBetween, getCommitMetadataBetween, getCommitMetadataBetween, getCommitMetadataPaged, getCommitTimestampsBetween, getCommitTimestampsBetween, getCommitTimestampsBetween, getCommitTimestampsBewteen, getCommitTimestampsPaged, getIndexManager, getNow, isOpenpublic StandardChronoSphere(org.chronos.chronograph.api.structure.ChronoGraph graph,
org.apache.commons.configuration.Configuration configuration)
public ChronoSphereConfiguration getConfiguration()
ChronoSphereChronoSphere instance.getConfiguration in interface ChronoSpherenull.public void close()
ChronoSphereChronoSphere instance.
Any further attempt to work with this instance will give rise to an appropriate exception, unless noted explicitly in the method documentation.
This method is safe to use on closed instances. When called on an already closed instance, this method is a no-op and returns immediately.
close in interface java.lang.AutoCloseableclose in interface ChronoSpherepublic boolean isClosed()
ChronoSphereChronoSphere instance is closed or not.
This method is safe to use on closed instances.
isClosed in interface ChronoSpheretrue if this instance is closed, or false if it is still open.ChronoSphere.close(),
ChronoSphere.isOpen()public ChronoSphereBranchManager getBranchManager()
ChronoSphereChronoSphere
instance.getBranchManager in interface ChronoSpherenull.public ChronoSphereEPackageManager getEPackageManager()
ChronoSphereChronoSphere
instance.getEPackageManager in interface ChronoSpherenull.public ChronoSphereIndexManager getIndexManager(java.lang.String branchName)
ChronoSpheregetIndexManager in interface ChronoSpherebranchName - The name of the branch to get the index manager for. Must not be null, must refer to an
existing branch.null.public ChronoSphereTransaction tx()
ChronoSphereChronoSphereTransaction on the master branch head
version.
Note that transactions are in general not thread-safe and must not be shared among threads.
tx in interface ChronoSpherenull.public ChronoSphereTransaction tx(long timestamp)
ChronoSphereChronoSphereTransaction on the master branch at the given
timestamp.
Please note that implementations may choose to refuse opening a transaction on certain timestamps, e.g. when the
desired timestamp is in the future. In such cases, an InvalidTransactionTimestampException is thrown.
Note that transactions are in general not thread-safe and must not be shared among threads.
tx in interface ChronoSpheretimestamp - The timestamp to use. Must not be negative.null.public ChronoSphereTransaction tx(java.util.Date date)
ChronoSphereChronoSphereTransaction on the master branch at the given
date.
Please note that implementations may choose to refuse opening a transaction on certain dates, e.g. when the
desired date is in the future. In such cases, an InvalidTransactionTimestampException is thrown.
Note that transactions are in general not thread-safe and must not be shared among threads.
tx in interface ChronoSpheredate - The date to use. Must not be negative.null.public ChronoSphereTransaction tx(java.lang.String branchName)
ChronoSphereChronoSphereTransaction on the head version of the given
branch.
Note that transactions are in general not thread-safe and must not be shared among threads.
tx in interface ChronoSpherebranchName - The name of the branch to start a transaction on. Must not be null. Must be the name of
an existing branch.null.public ChronoSphereTransaction tx(java.lang.String branchName, long timestamp)
ChronoSphereChronoSphereTransaction at the given timestamp on the given
branch.
Please note that implementations may choose to refuse opening a transaction on certain timestamps, e.g. when the
desired timestamp is in the future. In such cases, an InvalidTransactionTimestampException is thrown.
Note that transactions are in general not thread-safe and must not be shared among threads.
tx in interface ChronoSpherebranchName - The name of the branch to start a transaction on. Must not be null. Must be the name of
an existing branch.timestamp - The timestamp to use. Must not be negative.null.public ChronoSphereTransaction tx(java.lang.String branchName, java.util.Date date)
ChronoSphereChronoSphereTransaction at the given date on the given branch.
Please note that implementations may choose to refuse opening a transaction on certain dates, e.g. when the
desired date is in the future. In such cases, an InvalidTransactionTimestampException is thrown.
Note that transactions are in general not thread-safe and must not be shared among threads.
tx in interface ChronoSpherebranchName - The name of the branch to start a transaction on. Must not be null. Must be the name of
an existing branch.date - The date to use. Must not be negative.null.public void batchInsertModelData(java.lang.String branch,
java.util.Iterator<org.eclipse.emf.ecore.EObject> model)
ChronoSphereEObject model data into the given branch of this repository.
Please remember to register your
EPackages before calling this method.
Only one batch insert process can be active at any point in time. Any other write transactions will be denied while this process is running.
batchInsertModelData in interface ChronoSpherebranch - The branch to load the model elements into. Must not be null, must refer to an existing
branch.model - The EObject model to insert into the repository. Must not be null. All elements
must be an instance of ChronoEObjectImpl. All contained
EObjects will be batch-loaded, recursively.public long getNow(java.lang.String branchName)
ChronoSphereRequesting a transaction on this timestamp will always deliver a transaction on the "head" revision.
getNow in interface ChronoSpherebranchName - The name of the branch to retrieve the "now" timestamp for. Must refer to an existing branch. Must not
be null.public java.lang.Object getCommitMetadata(java.lang.String branch,
long timestamp)
ChronoSphereThis search will include origin branches (recursively), if the timestamp is after the branching timestamp.
getCommitMetadata in interface ChronoSpherebranch - The branch to search for the commit metadata in. Must not be null.timestamp - The timestamp to get the commit metadata for. Must match the commit timestamp exactly. Must not be
negative.null if there was no metadata for the commit, or there has not
been a commit at the specified branch and timestamp.public java.util.Iterator<java.lang.Long> getCommitTimestampsBetween(java.lang.String branch,
long from,
long to,
org.chronos.chronodb.api.Order order)
ChronoSpherefrom and
to.
If the from value is greater than the to value, this method always returns an empty
iterator.
getCommitTimestampsBetween in interface ChronoSpherebranch - The name of the branch to consider. Must not be null, must refer to an existing branch.from - The lower bound of the time range to look for commits in (inclusive). Must not be negative. Must be
less than or equal to the timestamp of this transaction.to - The upper bound of the time range to look for commits in (inclusive). Must not be negative. Must be
less than or equal to the timestamp of this transaction.order - The order of the returned timestamps. Must not be null.null.public java.util.Iterator<java.util.Map.Entry<java.lang.Long,java.lang.Object>> getCommitMetadataBetween(java.lang.String branch,
long from,
long to,
org.chronos.chronodb.api.Order order)
ChronoSpherefrom and to.
If the from value is greater than the to value, this method always returns an empty
iterator.
Please keep in mind that some commits may not have any metadata attached. In this case, the
value component of the Map.Entry will be set to null.
getCommitMetadataBetween in interface ChronoSpherebranch - The name of the branch to consider. Must not be null, must refer to an existing branch.from - The lower bound of the time range to look for commits in (inclusive). Must not be negative. Must be
less than or equal to the timestamp of this transaction.to - The upper bound of the time range to look for commits in (inclusive). Must not be negative. Must be
less than or equal to the timestamp of this transaction.order - The order of the returned commits. Must not be null.null). May be empty, but never
null.public java.util.Iterator<java.lang.Long> getCommitTimestampsPaged(java.lang.String branch,
long minTimestamp,
long maxTimestamp,
int pageSize,
int pageIndex,
org.chronos.chronodb.api.Order order)
ChronoSphere
For example, calling getCommitTimestampsPaged(10000, 100, 0, Order.DESCENDING) will give the latest 100
commit timestamps that have occurred before timestamp 10000. Calling
getCommitTimestampsPaged(123456, 200, 2, Order.DESCENDING will return 200 commit timestamps, skipping the
400 latest commit timestamps, which are smaller than 123456.
getCommitTimestampsPaged in interface ChronoSpherebranch - The name of the branch to consider. Must not be null, must refer to an existing branch.minTimestamp - The minimum timestamp to consider (inclusive). All lower timestamps will be excluded from the
pagination. Must be less than or equal to the timestamp of this transaction.maxTimestamp - The highest timestamp to consider (inclusive). All higher timestamps will be excluded from the
pagination. Must be less than or equal to the timestamp of this transaction.pageSize - The size of the page, i.e. the maximum number of elements allowed to be contained in the resulting
iterator. Must be greater than zero.pageIndex - The index of the page to retrieve. Must not be negative.order - The desired ordering for the commit timestampsnull, may be
empty. If the requested page does not exist, this iterator will always be empty.public java.util.Iterator<java.util.Map.Entry<java.lang.Long,java.lang.Object>> getCommitMetadataPaged(java.lang.String branch,
long minTimestamp,
long maxTimestamp,
int pageSize,
int pageIndex,
org.chronos.chronodb.api.Order order)
ChronoSphere
For example, calling getCommitTimestampsPaged(10000, 100, 0, Order.DESCENDING) will give the latest 100
commit timestamps that have occurred before timestamp 10000. Calling
getCommitTimestampsPaged(123456, 200, 2, Order.DESCENDING will return 200 commit timestamps, skipping the
400 latest commit timestamps, which are smaller than 123456.
The Entries returned by the iterator always have the commit timestamp as their first component and
the metadata associated with this commit as their second component. The second component can be null
if the commit was executed without providing metadata.
getCommitMetadataPaged in interface ChronoSpherebranch - The name of the branch to consider. Must not be null, must refer to an existing branch.minTimestamp - The minimum timestamp to consider (inclusive). All lower timestamps will be excluded from the
pagination. Must be less than or equal to the timestamp of this transaction.maxTimestamp - The highest timestamp to consider. All higher timestamps will be excluded from the pagination. Must be
less than or equal to the timestamp of this transaction.pageSize - The size of the page, i.e. the maximum number of elements allowed to be contained in the resulting
iterator. Must be greater than zero.pageIndex - The index of the page to retrieve. Must not be negative.order - The desired ordering for the commit timestampsnull, may be empty. If
the requested page does not exist, this iterator will always be empty.public int countCommitTimestampsBetween(java.lang.String branch,
long from,
long to)
ChronoSpherefrom (inclusive) and to (inclusive).
If from is greater than to, this method will always return zero.
countCommitTimestampsBetween in interface ChronoSpherebranch - The name of the branch to consider. Must not be null, must refer to an existing branch.from - The minimum timestamp to include in the search (inclusive). Must not be negative. Must be less than or
equal to the timestamp of this transaction.to - The maximum timestamp to include in the search (inclusive). Must not be negative. Must be less than or
equal to the timestamp of this transaction.public int countCommitTimestamps(java.lang.String branch)
ChronoSpherecountCommitTimestamps in interface ChronoSpherebranch - The name of the branch to consider. Must not be null, must refer to an existing branch.public org.chronos.chronograph.api.structure.ChronoGraph getRootGraph()
getRootGraph in interface ChronoSphereInternalpublic EObjectToGraphMapper getEObjectToGraphMapper()
getEObjectToGraphMapper in interface ChronoSphereInternalpublic EPackageToGraphMapper getEPackageToGraphMapper()
getEPackageToGraphMapper in interface ChronoSphereInternal