
public abstract class ODatabaseDocumentAbstract extends OListenerManger<ODatabaseListener> implements ODatabaseDocumentInternal
ODatabase.ATTRIBUTES, ODatabase.OPERATION_MODE, ODatabase.STATUSTYPE| Modifier | Constructor and Description |
|---|---|
protected |
ODatabaseDocumentAbstract() |
| Modifier and Type | Method and Description |
|---|---|
ODatabaseDocumentAbstract |
activateOnCurrentThread()
Activates current database instance on current thread.
|
int |
addCluster(String iClusterName,
int iRequestedId)
Adds a new cluster.
|
int |
addCluster(String iClusterName,
Object... iParameters)
Adds a new cluster.
|
protected void |
afterCommitOperations() |
protected void |
afterRollbackOperations() |
int |
assignAndCheckCluster(ORecord record,
String iClusterName) |
List<String> |
backup(OutputStream out,
Map<String,Object> options,
Callable<Object> callable,
OCommandOutputListener iListener,
int compressionLevel,
int bufferSize)
Executes a backup of the database.
|
protected void |
beforeCommitOperations() |
protected void |
beforeRollbackOperations() |
ODatabaseDocumentAbstract |
begin()
Begins a new transaction.
|
ODatabaseDocumentAbstract |
begin(OTransaction.TXTYPE iType)
Begins a new transaction specifying the transaction type.
|
ODatabaseDocument |
begin(OTransaction iTx)
Deprecated.
|
ORecordIteratorClass<ODocument> |
browseClass(String iClassName)
Browses all the records of the specified class and also all the subclasses.
|
ORecordIteratorClass<ODocument> |
browseClass(String iClassName,
boolean iPolymorphic)
Browses all the records of the specified class and if iPolymorphic is true also all the
subclasses.
|
ORecordIteratorCluster<ODocument> |
browseCluster(String iClusterName)
Browses all the records of the specified cluster.
|
<REC extends ORecord> |
browseCluster(String iClusterName,
Class<REC> iClass)
Browses all the records of the specified cluster of the passed record type.
|
<REC extends ORecord> |
browseCluster(String iClusterName,
Class<REC> iRecordClass,
long startClusterPosition,
long endClusterPosition) |
<REC extends ORecord> |
browseCluster(String iClusterName,
Class<REC> iRecordClass,
long startClusterPosition,
long endClusterPosition,
boolean loadTombstones)
Deprecated.
|
ORecordIteratorCluster<ODocument> |
browseCluster(String iClusterName,
long startClusterPosition,
long endClusterPosition,
boolean loadTombstones)
Deprecated.
|
protected void |
callbackHookFailure(ORecord record,
boolean wasNew,
byte[] stream) |
protected void |
callbackHookFinalize(ORecord record,
boolean wasNew,
byte[] stream) |
ORecordHook.RESULT |
callbackHooks(ORecordHook.TYPE type,
OIdentifiable id)
Callback the registered hooks if any.
|
protected void |
callbackHookSuccess(ORecord record,
boolean wasNew,
byte[] stream,
OStorageOperationResult<Integer> operationResult) |
void |
callOnCloseListeners() |
void |
callOnDropListeners() |
void |
callOnOpenListeners() |
void |
checkForClusterPermissions(String iClusterName) |
void |
checkIfActive() |
protected void |
checkOpenness() |
protected void |
checkRecordClass(OClass recordClass,
String iClusterName,
ORecordId rid) |
void |
checkSecurity(int operation,
OIdentifiable record,
String cluster) |
ODatabaseDocumentInternal |
cleanOutRecord(ORID iRecord,
int iVersion) |
protected void |
clearDocumentTracking(ORecord record) |
void |
close()
Closes an opened database, if the database is already closed does nothing, if a transaction is
active will be rollback.
|
protected void |
closeActiveQueries() |
OCommandRequest |
command(OCommandRequest iCommand)
Creates a command request to run a command against the database (you have to invoke
.execute(parameters) to actually execute it).
|
ODatabase<ORecord> |
commit()
Commits the current transaction.
|
ODatabaseDocument |
commit(boolean force) |
protected long |
countClass(OClass cls,
boolean iPolymorphic) |
long |
countClass(String iClassName)
Returns the number of the records of the class iClassName.
|
long |
countClass(String iClassName,
boolean iPolymorphic)
Returns the number of the records of the class iClassName considering also sub classes if
polymorphic is true.
|
long |
countClusterElements(int iClusterId)
Counts all the entities in the specified cluster id.
|
long |
countClusterElements(int[] iClusterIds)
Counts all the entities in the specified cluster ids.
|
long |
countClusterElements(int[] iClusterIds,
boolean countTombstones) |
long |
countClusterElements(int iClusterId,
boolean countTombstones) |
long |
countClusterElements(String iClusterName)
Counts all the entities in the specified cluster name.
|
long |
countView(String viewName)
Returns the number of the records of the class iClassName.
|
boolean |
declareIntent(OIntent iIntent)
Declares an intent to the database.
|
ODatabaseDocument |
delete(ORID iRecord)
Deletes the record without checking the version.
|
ODatabase<ORecord> |
delete(ORID iRecord,
int iVersion)
Deletes the record checking the version.
|
boolean |
dropCluster(int clusterId)
Drops a cluster by its id.
|
boolean |
dropCluster(String iClusterName)
Drops a cluster by its name.
|
protected boolean |
dropClusterInternal(int clusterId) |
protected boolean |
dropClusterInternal(String iClusterName) |
abstract <RET extends ORecord> |
executeReadRecord(ORecordId rid,
ORecord iRecord,
int recordVersion,
String fetchPlan,
boolean ignoreCache,
boolean iUpdateCache,
boolean loadTombstones,
OStorage.LOCKING_STRATEGY lockingStrategy,
RecordReader recordReader)
This method is internal, it can be subject to signature change or be removed, do not
use.
|
static Object |
executeWithRetries(OCallable<Object,Integer> callback,
int maxRetry) |
static Object |
executeWithRetries(OCallable<Object,Integer> callback,
int maxRetry,
int waitBetweenRetry) |
static Object |
executeWithRetries(OCallable<Object,Integer> callback,
int maxRetry,
int waitBetweenRetry,
ORecord[] recordToReloadOnRetry) |
boolean |
existsCluster(String iClusterName)
Returns true if the cluster exists, otherwise false.
|
void |
freeze()
Flush all indexes and cached storage content to the disk.
|
void |
freeze(boolean throwException)
Flush all indexes and cached storage content to the disk.
|
Object |
get(ODatabase.ATTRIBUTES iAttribute)
Returns a database attribute value
|
OIntent |
getActiveIntent()
Get the active intent in the current session.
|
Map<String,OResultSet> |
getActiveQueries() |
OResultSet |
getActiveQuery(String id) |
Set<Integer> |
getBlobClusterIds()
Retrieve the set of defined blob cluster.
|
int |
getClusterIdByName(String iClusterName)
Returns the cluster id by name.
|
String |
getClusterNameById(int iClusterId)
Returns the cluster name by id.
|
Collection<String> |
getClusterNames()
Returns all the names of the clusters.
|
long |
getClusterRecordSizeById(int clusterId)
Returns the total size of records contained in the cluster defined by its id.
|
long |
getClusterRecordSizeByName(String clusterName)
Returns the total size of records contained in the cluster defined by its name.
|
int |
getClusters()
Returns the number of clusters.
|
Map<UUID,OBonsaiCollectionPointer> |
getCollectionsChanges() |
OContextConfiguration |
getConfiguration()
Returns the database configuration settings.
|
ORecordConflictStrategy |
getConflictStrategy()
Returns the current record conflict strategy.
|
ODatabaseInternal<?> |
getDatabaseOwner()
Returns the database owner.
|
int |
getDefaultClusterId()
Returns the default cluster id.
|
static ORecordSerializer |
getDefaultSerializer() |
ODictionary<ORecord> |
getDictionary()
Deprecated.
|
Map<ORecordHook,ORecordHook.HOOK_POSITION> |
getHooks()
Retrieves all the registered hooks.
|
Iterable<ODatabaseListener> |
getListeners()
Retrieves all the registered listeners.
|
OLocalRecordCache |
getLocalCache()
Returns the level1 cache.
|
OMetadataDefault |
getMetadata()
Return the OMetadata instance.
|
OBasicTransaction |
getMicroOrRegularTransaction()
The active implicit micro-transaction or active/inactive regular transaction.
|
String |
getName()
Returns the database name.
|
Iterator<Map.Entry<String,Object>> |
getProperties()
Returns an iterator of the property entries
|
Object |
getProperty(String iName)
Gets the property value.
|
<RET extends ORecord> |
getRecord(OIdentifiable iIdentifiable)
Returns the record for a OIdentifiable instance.
|
ORecordMetadata |
getRecordMetadata(ORID rid) |
byte |
getRecordType()
Returns the default record type for this kind of database.
|
OSBTreeCollectionManager |
getSbTreeCollectionManager()
Internal.
|
ORecordSerializer |
getSerializer() |
OBinarySerializerFactory |
getSerializerFactory() |
OSharedContext |
getSharedContext() |
long |
getSize()
Returns the total size of database as used space.
|
ODatabase.STATUS |
getStatus()
Returns the current status of database.
|
OCurrentStorageComponentsFactory |
getStorageVersions()
Internal.
|
OTransaction |
getTransaction()
Return active transaction.
|
String |
getType() |
<DB extends ODatabase> |
getUnderlying()
This method is internal, it can be subject to signature change or be removed, do not
use.
|
String |
getURL()
Returns the database URL.
|
OSecurityUser |
getUser()
Returns the current user logged into the database.
|
OView |
getViewFromCluster(int cluster) |
String |
incrementalBackup(String path)
Performs incremental backup of database content to the selected folder.
|
protected void |
init() |
void |
internalClose(boolean recycle) |
void |
internalCommit(OTransactionInternal transaction)
Executed the commit on the storage hiding away storage concepts from the transaction
|
boolean |
isActiveOnCurrentThread()
Returns true if the current database instance is active on current thread, otherwise false.
|
boolean |
isClosed()
Checks if the database is closed.
|
boolean |
isClusterEdge(int cluster) |
boolean |
isClusterVertex(int cluster) |
boolean |
isClusterView(int cluster) |
boolean |
isMVCC()
Returns if the Multi Version Concurrency Control is enabled or not.
|
boolean |
isPooled() |
boolean |
isPrefetchRecords() |
boolean |
isRetainRecords()
Returns true if current configuration retains objects, otherwise false
|
boolean |
isUseLightweightEdges() |
boolean |
isValidationEnabled()
Tells if validation of record is active.
|
<RET extends ORecord> |
load(ORecord iRecord)
Loads the entity and return it.
|
<RET extends ORecord> |
load(ORecord iRecord,
String iFetchPlan)
Loads a record using a fetch plan.
|
<RET extends ORecord> |
load(ORecord iRecord,
String iFetchPlan,
boolean iIgnoreCache)
Loads a record using a fetch plan.
|
<RET extends ORecord> |
load(ORID recordId)
Loads the entity by the Record ID.
|
<RET extends ORecord> |
load(ORID iRecordId,
String iFetchPlan)
Loads the entity by the Record ID using a fetch plan.
|
<RET extends ORecord> |
load(ORID iRecordId,
String iFetchPlan,
boolean iIgnoreCache)
Loads the entity by the Record ID using a fetch plan and specifying if the cache must be
ignored.
|
<RET extends ORecord> |
loadIfVersionIsNotLatest(ORID rid,
int recordVersion,
String fetchPlan,
boolean ignoreCache) |
protected abstract void |
loadMetadata() |
protected abstract void |
loadMetadata(OSharedContext ctx) |
OBlob |
newBlob()
Create a new empty instance of a blob.
|
OBlob |
newBlob(byte[] bytes)
Create a new instance of a blob containing the given bytes.
|
OEdge |
newEdge(OVertex from,
OVertex to,
OClass type)
Creates a new Edge
|
OEdge |
newEdge(OVertex from,
OVertex to,
String type)
Creates a new Edge
|
OElement |
newElement() |
OElement |
newElement(OClass clazz) |
OElement |
newElement(String className) |
OElement |
newEmbeddedElement() |
OElement |
newEmbeddedElement(String className) |
ODocument |
newInstance()
Creates a new ODocument.
|
ODocument |
newInstance(String iClassName)
Creates a document with specific class.
|
OEdge |
newLightweightEdge(String iClassName,
OVertex from,
OVertex to) |
OEdge |
newRegularEdge(String iClassName,
OVertex from,
OVertex to) |
OVertex |
newVertex(OClass type)
Creates a new Vertex
|
OVertex |
newVertex(String iClassName)
Creates a new Vertex
|
protected void |
pessimisticLockChecks(ORID recordId) |
<RET extends List<?>> |
query(OQuery<?> iCommand,
Object... iArgs)
Execute a query against the database.
|
void |
queryClosed(String id) |
void |
queryStarted(String id,
OResultSet rs) |
void |
rawBegin(OTransaction iTx) |
<DB extends ODatabase<?>> |
registerHook(ORecordHook iHookImpl)
Registers a hook to listen all events for Records.
|
<DB extends ODatabase<?>> |
registerHook(ORecordHook iHookImpl,
ORecordHook.HOOK_POSITION iPosition) |
void |
release()
Allows to execute write-related commands on DB.
|
void |
reload()
Reloads the database information like the cluster list.
|
<RET extends ORecord> |
reload(ORecord iRecord) |
<RET extends ORecord> |
reload(ORecord iRecord,
String iFetchPlan) |
<RET extends ORecord> |
reload(ORecord iRecord,
String iFetchPlan,
boolean iIgnoreCache)
Force the reloading of the entity.
|
<RET extends ORecord> |
reload(ORecord record,
String fetchPlan,
boolean ignoreCache,
boolean force)
Force the reloading of the entity.
|
void |
reloadUser() |
void |
resetInitialization() |
void |
restore(InputStream in,
Map<String,Object> options,
Callable<Object> callable,
OCommandOutputListener iListener)
Executes a restore of a database backup.
|
ODatabase<ORecord> |
rollback()
Aborts the current running transaction.
|
ODatabaseDocument |
rollback(boolean force) |
<RET extends ORecord> |
save(ORecord iRecord)
Saves a document to the database.
|
<RET extends ORecord> |
save(ORecord iRecord,
ODatabase.OPERATION_MODE iMode,
boolean iForceCreate,
ORecordCallback<? extends Number> iRecordCreatedCallback,
ORecordCallback<Integer> iRecordUpdatedCallback)
Saves a document to the database.
|
<RET extends ORecord> |
save(ORecord iRecord,
String iClusterName)
Saves a document specifying a cluster where to store the record.
|
<RET extends ORecord> |
save(ORecord iRecord,
String iClusterName,
ODatabase.OPERATION_MODE iMode,
boolean iForceCreate,
ORecordCallback<? extends Number> iRecordCreatedCallback,
ORecordCallback<Integer> iRecordUpdatedCallback)
Saves a document specifying a cluster where to store the record.
|
ODatabaseDocumentAbstract |
setConflictStrategy(ORecordConflictStrategy iResolver)
Overrides record conflict strategy.
|
ODatabaseDocumentAbstract |
setConflictStrategy(String iStrategyName)
Overrides record conflict strategy selecting the strategy by name.
|
void |
setCurrentDatabaseInThreadLocal()
Deprecated.
|
ODatabaseInternal<ORecord> |
setDatabaseOwner(ODatabaseInternal<?> iOwner)
Internal.
|
void |
setDefaultClusterIdInternal(int iDefClusterId)
Deprecated.
|
static void |
setDefaultSerializer(ORecordSerializer iDefaultSerializer)
Sets default serializer.
|
void |
setDefaultTransactionMode(Map<ORID,OTransactionAbstract.LockedRecordMetadata> noTxLocks) |
void |
setInternal(ODatabase.ATTRIBUTES iAttribute,
Object iValue)
Internal method.
|
<DB extends ODatabase<?>> |
setMVCC(boolean mvcc)
Enables or disables the Multi-Version Concurrency Control.
|
void |
setPrefetchRecords(boolean prefetchRecords) |
Object |
setProperty(String iName,
Object iValue)
Sets a property value
|
ODatabaseDocument |
setRetainRecords(boolean retainRecords)
Specifies if retain handled objects in memory or not.
|
void |
setSerializer(ORecordSerializer serializer)
Sets serializer for the database which will be used for document serialization.
|
<DB extends ODatabase> |
setStatus(ODatabase.STATUS status)
Set the current status of database.
|
void |
setStatusInternal(ODatabase.STATUS status) |
void |
setUseLightweightEdges(boolean b) |
void |
setUser(OSecurityUser user)
Set user for current database instance.
|
<DB extends ODatabaseDocument> |
setValidationEnabled(boolean iEnabled)
Enables or disables the record validation.
|
OTransaction |
swapTx(OTransaction newTx) |
void |
truncateCluster(String clusterName)
Removes all data in the cluster with given name.
|
<DB extends ODatabase<?>> |
unregisterHook(ORecordHook iHookImpl)
Unregisters a previously registered hook.
|
browseListeners, getListenersCopy, registerListener, resetListeners, unregisterListenerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitafterCreateOperations, afterDeleteOperations, afterReadOperations, afterUpdateOperations, beforeCreateOperations, beforeDeleteOperations, beforeReadOperations, beforeUpdateOperations, copy, executeDeleteRecord, getClusterName, getCommandInterruptionDepth, getHaStatus, indexQuery, internalLockRecord, internalUnlockRecord, isCommandInterrupted, isDistributed, isRemote, queryOnNode, realClose, recycle, removeHaServer, reuse, saveAll, sendSequenceAction, setCommandInterrupted, setCommandInterruptionDepth, setCustom, sync, syncCommitaddBlobCluster, checkSecurity, checkSecurity, checkSecurity, checkSecurity, checkSecurity, checkSecurity, createClassIfNotExist, createEdgeClass, createVertexClass, newEdge, newVertexcommand, command, create, create, create, createClass, delete, drop, execute, execute, executeWithRetry, exists, getClass, live, live, lock, lock, open, query, query, registerListener, set, unlock, unregisterListeneraddRidbagPrefetchStats, createInterruptTimerTask, getActiveClusterMap, getActiveDataCenterMap, getEnterpriseEndpoint, getLocalNodeName, getStats, getStorage, getStorageInfo, isSharded, open, replaceStorage, resetRecordLoadStatsprotected Map<ORecordHook,ORecordHook.HOOK_POSITION> unmodifiableHooks
protected final Set<OIdentifiable> inHook
protected ORecordSerializer serializer
protected String url
protected ODatabase.STATUS status
protected OIntent currentIntent
protected ODatabaseInternal<?> databaseOwner
protected OMetadataDefault metadata
protected OImmutableUser user
protected final byte recordType
protected final Map<ORecordHook,ORecordHook.HOOK_POSITION> hooks
protected boolean retainRecords
protected OLocalRecordCache localCache
protected OCurrentStorageComponentsFactory componentsFactory
protected boolean initialized
protected OTransaction currentTx
protected final ORecordHook[][] hooksByScope
protected OSharedContext sharedContext
protected OMicroTransaction microTransaction
protected Map<String,OResultSet> activeQueries
protected long loadedRecordsCount
protected long totalRecordLoadMs
protected long minRecordLoadMs
protected long maxRecordLoadMs
protected long ridbagPrefetchCount
protected long totalRidbagPrefetchMs
protected long minRidbagPrefetchMs
protected long maxRidbagPrefetchMs
public static ORecordSerializer getDefaultSerializer()
public static void setDefaultSerializer(ORecordSerializer iDefaultSerializer)
iDefaultSerializer - new default serializer valuepublic void callOnOpenListeners()
callOnOpenListeners in interface ODatabaseDocumentInternalprotected abstract void loadMetadata()
protected abstract void loadMetadata(OSharedContext ctx)
public void callOnCloseListeners()
callOnCloseListeners in interface ODatabaseDocumentInternalpublic void callOnDropListeners()
callOnDropListeners in interface ODatabaseDocumentInternalpublic <RET extends ORecord> RET getRecord(OIdentifiable iIdentifiable)
getRecord in interface ODatabaseDocumentpublic void reload()
ODatabasepublic <RET extends ORecord> RET load(ORID iRecordId, String iFetchPlan, boolean iIgnoreCache)
public ODatabase<ORecord> delete(ORID iRecord, int iVersion)
public ODatabaseDocumentInternal cleanOutRecord(ORID iRecord, int iVersion)
cleanOutRecord in interface ODatabaseDocumentInternalpublic <REC extends ORecord> ORecordIteratorCluster<REC> browseCluster(String iClusterName, Class<REC> iClass)
ODatabaseDocumentbrowseCluster in interface ODatabaseDocumentiClusterName - Cluster name to iterateiClass - The record class expected@Deprecated public <REC extends ORecord> ORecordIteratorCluster<REC> browseCluster(String iClusterName, Class<REC> iRecordClass, long startClusterPosition, long endClusterPosition, boolean loadTombstones)
browseCluster in interface ODatabaseDocumentpublic <REC extends ORecord> ORecordIteratorCluster<REC> browseCluster(String iClusterName, Class<REC> iRecordClass, long startClusterPosition, long endClusterPosition)
browseCluster in interface ODatabaseDocumentpublic OCommandRequest command(OCommandRequest iCommand)
public <RET extends List<?>> RET query(OQuery<?> iCommand, Object... iArgs)
public byte getRecordType()
getRecordType in interface ODatabaseDocumentpublic long countClusterElements(int[] iClusterIds)
countClusterElements in interface ODatabase<ORecord>iClusterIds - Array of cluster ids Cluster idpublic long countClusterElements(int iClusterId)
countClusterElements in interface ODatabase<ORecord>iClusterId - Cluster idpublic void truncateCluster(String clusterName)
truncateCluster in interface ODatabase<ORecord>clusterName - Name of cluster to be truncated.public long countClusterElements(int iClusterId,
boolean countTombstones)
countClusterElements in interface ODatabase<ORecord>public long countClusterElements(int[] iClusterIds,
boolean countTombstones)
countClusterElements in interface ODatabase<ORecord>public long countClusterElements(String iClusterName)
countClusterElements in interface ODatabase<ORecord>iClusterName - Cluster namepublic OMetadataDefault getMetadata()
getMetadata in interface ODatabase<ORecord>getMetadata in interface ODatabaseDocumentInternalpublic ODatabaseInternal<?> getDatabaseOwner()
getDatabaseOwner in interface ODatabaseInternal<ORecord>public ODatabaseInternal<ORecord> setDatabaseOwner(ODatabaseInternal<?> iOwner)
setDatabaseOwner in interface ODatabaseInternal<ORecord>public boolean isRetainRecords()
isRetainRecords in interface ODatabaseDocumentODatabaseDocument.setRetainRecords(boolean)public ODatabaseDocument setRetainRecords(boolean retainRecords)
setRetainRecords in interface ODatabaseDocumentretainRecords - True to enable, false to disable it.ODatabaseDocument.isRetainRecords()public <DB extends ODatabase> DB setStatus(ODatabase.STATUS status)
public void setStatusInternal(ODatabase.STATUS status)
@Deprecated public void setDefaultClusterIdInternal(int iDefClusterId)
public void setInternal(ODatabase.ATTRIBUTES iAttribute, Object iValue)
setInternal in interface ODatabaseInternal<ORecord>public OSecurityUser getUser()
public void setUser(OSecurityUser user)
setUser in interface ODatabaseInternal<ORecord>public void reloadUser()
reloadUser in interface ODatabaseDocumentInternalpublic boolean isMVCC()
isMVCC in interface ODatabase<ORecord>deprecated since 2.2public <DB extends ODatabase<?>> DB setMVCC(boolean mvcc)
setMVCC in interface ODatabase<ORecord>ODatabase.isMVCC()@Deprecated public ODictionary<ORecord> getDictionary()
getDictionary in interface ODatabase<ORecord>public <DB extends ODatabase<?>> DB registerHook(ORecordHook iHookImpl, ORecordHook.HOOK_POSITION iPosition)
registerHook in interface ODatabase<ORecord>public <DB extends ODatabase<?>> DB registerHook(ORecordHook iHookImpl)
registerHook in interface ODatabase<ORecord>iHookImpl - ORecordHook implementationpublic <DB extends ODatabase<?>> DB unregisterHook(ORecordHook iHookImpl)
unregisterHook in interface ODatabase<ORecord>iHookImpl - ORecordHook implementationpublic OLocalRecordCache getLocalCache()
getLocalCache in interface ODatabase<ORecord>public Map<ORecordHook,ORecordHook.HOOK_POSITION> getHooks()
public ORecordHook.RESULT callbackHooks(ORecordHook.TYPE type, OIdentifiable id)
callbackHooks in interface ODatabaseDocumentInternaltype - Hook type. Define when hook is called.id - Record received in the callbackpublic boolean isValidationEnabled()
isValidationEnabled in interface ODatabaseDocumentpublic <DB extends ODatabaseDocument> DB setValidationEnabled(boolean iEnabled)
Since 2.2 this setting is persistent.
setValidationEnabled in interface ODatabaseDocumentiEnabled - True to enable, false to disablepublic ORecordConflictStrategy getConflictStrategy()
ODatabasegetConflictStrategy in interface ODatabase<ORecord>public ODatabaseDocumentAbstract setConflictStrategy(String iStrategyName)
ODatabasesetConflictStrategy in interface ODatabase<ORecord>iStrategyName - ORecordConflictStrategy strategy namepublic ODatabaseDocumentAbstract setConflictStrategy(ORecordConflictStrategy iResolver)
ODatabasesetConflictStrategy in interface ODatabase<ORecord>iResolver - ORecordConflictStrategy implementationpublic OContextConfiguration getConfiguration()
ODatabasegetConfiguration in interface ODatabase<ORecord>public boolean declareIntent(OIntent iIntent)
ODatabasedeclareIntent in interface ODatabase<ORecord>iIntent - The intentpublic OIntent getActiveIntent()
ODatabasegetActiveIntent in interface ODatabase<ORecord>public void internalClose(boolean recycle)
internalClose in interface ODatabaseDocumentInternalpublic void close()
ODatabasepublic ODatabase.STATUS getStatus()
ODatabasepublic long getSize()
ODatabasepublic String getName()
ODatabasepublic String getURL()
ODatabasepublic int getDefaultClusterId()
ODatabasegetDefaultClusterId in interface ODatabase<ORecord>public int getClusters()
ODatabasegetClusters in interface ODatabase<ORecord>public boolean existsCluster(String iClusterName)
ODatabaseexistsCluster in interface ODatabase<ORecord>iClusterName - Cluster namepublic Collection<String> getClusterNames()
ODatabasegetClusterNames in interface ODatabase<ORecord>public int getClusterIdByName(String iClusterName)
ODatabasegetClusterIdByName in interface ODatabase<ORecord>iClusterName - Cluster namepublic String getClusterNameById(int iClusterId)
ODatabasegetClusterNameById in interface ODatabase<ORecord>iClusterId - Cluster idpublic long getClusterRecordSizeByName(String clusterName)
ODatabasegetClusterRecordSizeByName in interface ODatabase<ORecord>clusterName - Cluster namepublic long getClusterRecordSizeById(int clusterId)
ODatabasegetClusterRecordSizeById in interface ODatabase<ORecord>clusterId - Cluster idpublic boolean isClosed()
ODatabasepublic int addCluster(String iClusterName, Object... iParameters)
ODatabaseaddCluster in interface ODatabase<ORecord>iClusterName - Cluster nameiParameters - Additional parameters to pass to the factoriespublic int addCluster(String iClusterName, int iRequestedId)
ODatabaseaddCluster in interface ODatabase<ORecord>iClusterName - Cluster nameiRequestedId - requested id of the clusterpublic boolean dropCluster(String iClusterName)
ODatabasedropCluster in interface ODatabase<ORecord>iClusterName - the name of the clusterprotected boolean dropClusterInternal(String iClusterName)
public boolean dropCluster(int clusterId)
ODatabasedropCluster in interface ODatabase<ORecord>clusterId - id of cluster to deleteprotected boolean dropClusterInternal(int clusterId)
public void checkForClusterPermissions(String iClusterName)
checkForClusterPermissions in interface ODatabaseDocumentInternalpublic Object setProperty(String iName, Object iValue)
ODatabasesetProperty in interface ODatabase<ORecord>iName - Property nameiValue - new value to setpublic Object getProperty(String iName)
ODatabasegetProperty in interface ODatabase<ORecord>iName - Property namepublic Iterator<Map.Entry<String,Object>> getProperties()
ODatabasegetProperties in interface ODatabase<ORecord>public Object get(ODatabase.ATTRIBUTES iAttribute)
ODatabasepublic ORecordMetadata getRecordMetadata(ORID rid)
getRecordMetadata in interface ODatabase<ORecord>public OTransaction getTransaction()
ODatabasegetTransaction in interface ODatabase<ORecord>public OBasicTransaction getMicroOrRegularTransaction()
ODatabaseInternalgetMicroOrRegularTransaction in interface ODatabaseInternal<ORecord>public <RET extends ORecord> RET load(ORecord iRecord, String iFetchPlan)
ODatabasepublic <RET extends ORecord> RET load(ORecord iRecord)
ODatabasepublic <RET extends ORecord> RET load(ORID recordId)
ODatabasepublic <RET extends ORecord> RET load(ORID iRecordId, String iFetchPlan)
ODatabasepublic <RET extends ORecord> RET loadIfVersionIsNotLatest(ORID rid, int recordVersion, String fetchPlan, boolean ignoreCache) throws ORecordNotFoundException
loadIfVersionIsNotLatest in interface ODatabaseDocumentInternalORecordNotFoundExceptionpublic <RET extends ORecord> RET reload(ORecord iRecord, String iFetchPlan, boolean iIgnoreCache)
ODatabasepublic <RET extends ORecord> RET reload(ORecord record, String fetchPlan, boolean ignoreCache, boolean force)
ODatabasereload in interface ODatabase<ORecord>record - The entity to load. If the entity was already loaded it will be reloaded and all
the changes will be lost.fetchPlan - Fetch plan usedignoreCache - Ignore cache or use itforce - Force to reload record even if storage has the same record as reloaded record, it
is useful if fetch plan is not null and alongside with root record linked records will be
reloaded.public ODatabaseDocument delete(ORID iRecord)
public OBinarySerializerFactory getSerializerFactory()
getSerializerFactory in interface ODatabaseDocumentInternal@Deprecated public ODatabaseDocument begin(OTransaction iTx)
ODatabasepublic OTransaction swapTx(OTransaction newTx)
swapTx in interface ODatabaseDocumentInternalpublic void rawBegin(OTransaction iTx)
rawBegin in interface ODatabaseDocumentInternalpublic <RET extends ORecord> RET load(ORecord iRecord, String iFetchPlan, boolean iIgnoreCache)
public void setPrefetchRecords(boolean prefetchRecords)
setPrefetchRecords in interface ODatabaseDocumentInternalpublic boolean isPrefetchRecords()
isPrefetchRecords in interface ODatabaseDocumentInternalpublic abstract <RET extends ORecord> RET executeReadRecord(ORecordId rid, ORecord iRecord, int recordVersion, String fetchPlan, boolean ignoreCache, boolean iUpdateCache, boolean loadTombstones, OStorage.LOCKING_STRATEGY lockingStrategy, RecordReader recordReader)
executeReadRecord in interface ODatabaseDocumentInternalpublic int assignAndCheckCluster(ORecord record, String iClusterName)
assignAndCheckCluster in interface ODatabaseDocumentInternalpublic ODatabaseDocumentAbstract begin()
ODatabaseODatabase.commit() or ODatabase.rollback().public ODatabaseDocumentAbstract begin(OTransaction.TXTYPE iType)
ODatabaseODatabase.commit() or ODatabase.rollback().public void setDefaultTransactionMode(Map<ORID,OTransactionAbstract.LockedRecordMetadata> noTxLocks)
setDefaultTransactionMode in interface ODatabaseDocumentInternalpublic void freeze(boolean throwException)
After this call users can perform only select queries. All write-related commands will
queued till ODatabaseDocument.release() command will be called or exception will be thrown on attempt to
modify DB data. Concrete behaviour depends on throwException parameter.
IMPORTANT: This command is not reentrant.
freeze in interface ODatabaseDocumentfreeze in interface ODatabase<ORecord>throwException - If true OModificationOperationProhibitedException
exception will be thrown in case of write command will be performed.public void freeze()
After this call users can perform only select queries. All write-related commands will
queued till ODatabaseDocument.release() command will be called.
Given command waits till all on going modifications in indexes or DB will be finished.
IMPORTANT: This command is not reentrant.
freeze in interface ODatabaseDocumentfreeze in interface ODatabase<ORecord>ODatabase.release()public void release()
ODatabaseDocument.freeze() command.release in interface ODatabaseDocumentrelease in interface ODatabase<ORecord>ODatabase.freeze()public ODocument newInstance()
newInstance in interface ODatabase<ORecord>public OBlob newBlob(byte[] bytes)
ODatabaseDocumentnewBlob in interface ODatabaseDocumentbytes - content of the OBlobpublic OBlob newBlob()
ODatabaseDocumentnewBlob in interface ODatabaseDocumentpublic ODocument newInstance(String iClassName)
newInstance in interface ODatabaseDocumentiClassName - the name of class that should be used as a class of created document.public OElement newEmbeddedElement()
newEmbeddedElement in interface ODatabaseDocumentpublic OElement newEmbeddedElement(String className)
newEmbeddedElement in interface ODatabaseDocumentpublic OElement newElement()
newElement in interface ODatabaseDocumentpublic OElement newElement(String className)
newElement in interface ODatabaseDocumentpublic OVertex newVertex(String iClassName)
ODatabaseDocumentnewVertex in interface ODatabaseDocumentiClassName - the vertex type (class name)public OVertex newVertex(OClass type)
ODatabaseDocumentnewVertex in interface ODatabaseDocumenttype - the vertex typepublic OEdge newEdge(OVertex from, OVertex to, String type)
ODatabaseDocumentnewEdge in interface ODatabaseDocumentfrom - the starting point vertexto - the endpoint vertextype - the edge typepublic OEdge newEdge(OVertex from, OVertex to, OClass type)
ODatabaseDocumentnewEdge in interface ODatabaseDocumentfrom - the starting point vertexto - the endpoint vertextype - the edge typepublic ORecordIteratorClass<ODocument> browseClass(String iClassName)
browseClass in interface ODatabaseDocumentiClassName - Class name to iteratepublic ORecordIteratorClass<ODocument> browseClass(String iClassName, boolean iPolymorphic)
browseClass in interface ODatabaseDocumentiClassName - Class name to iterateiPolymorphic - Consider also the instances of the subclasses or notpublic ORecordIteratorCluster<ODocument> browseCluster(String iClusterName)
browseCluster in interface ODatabaseDocumentiClusterName - Cluster name to iteratepublic Iterable<ODatabaseListener> getListeners()
getListeners in interface ODatabase<ORecord>@Deprecated public ORecordIteratorCluster<ODocument> browseCluster(String iClusterName, long startClusterPosition, long endClusterPosition, boolean loadTombstones)
browseCluster in interface ODatabaseDocumentpublic <RET extends ORecord> RET save(ORecord iRecord)
If MVCC is enabled and the version of the document is different by the version stored in the
database, then a OConcurrentModificationException exception is thrown.Before to save
the document it must be valid following the constraints declared in the schema if any (can work
also in schema-less mode). To validate the document the ODocument.validate() is called.
save in interface ODatabase<ORecord>iRecord - Record to save.OConcurrentModificationException - if the version of the document is different by the
version contained in the database.OValidationException - if the document breaks some validation constraints defined in the
schema#setMVCC(boolean), {@link #isMVCC()}public <RET extends ORecord> RET save(ORecord iRecord, ODatabase.OPERATION_MODE iMode, boolean iForceCreate, ORecordCallback<? extends Number> iRecordCreatedCallback, ORecordCallback<Integer> iRecordUpdatedCallback)
If MVCC is enabled and the version of the document is different by the version stored in the
database, then a OConcurrentModificationException exception is thrown.Before to save
the document it must be valid following the constraints declared in the schema if any (can work
also in schema-less mode). To validate the document the ODocument.validate() is called.
save in interface ODatabase<ORecord>iRecord - Record to save.iForceCreate - Flag that indicates that record should be created. If record with current
rid already exists, exception is throwniRecordCreatedCallback - callback that is called after creation of new recordiRecordUpdatedCallback - callback that is called after record updateiMode - Mode of save: synchronous (default) or asynchronousOConcurrentModificationException - if the version of the document is different by the
version contained in the database.OValidationException - if the document breaks some validation constraints defined in the
schema#setMVCC(boolean), {@link #isMVCC()}public <RET extends ORecord> RET save(ORecord iRecord, String iClusterName)
If MVCC is enabled and the version of the document is different by the version stored in the
database, then a OConcurrentModificationException exception is thrown. Before to save
the document it must be valid following the constraints declared in the schema if any (can work
also in schema-less mode). To validate the document the ODocument.validate() is called.
save in interface ODatabase<ORecord>iRecord - Record to saveiClusterName - Cluster name where to save the recordOConcurrentModificationException - if the version of the document is different by the
version contained in the database.OValidationException - if the document breaks some validation constraints defined in the
schema#setMVCC(boolean), {@link #isMVCC()}, ODocument#validate()public <RET extends ORecord> RET save(ORecord iRecord, String iClusterName, ODatabase.OPERATION_MODE iMode, boolean iForceCreate, ORecordCallback<? extends Number> iRecordCreatedCallback, ORecordCallback<Integer> iRecordUpdatedCallback)
If MVCC is enabled and the version of the document is different by the version stored in the
database, then a OConcurrentModificationException exception is thrown. Before to save
the document it must be valid following the constraints declared in the schema if any (can work
also in schema-less mode). To validate the document the ODocument.validate() is called.
save in interface ODatabase<ORecord>iRecord - Record to saveiClusterName - Cluster name where to save the recordiMode - Mode of save: synchronous (default) or asynchronousiForceCreate - Flag that indicates that record should be created. If record with current
rid already exists, exception is throwniRecordCreatedCallback - callback that is called after creation of new recordiRecordUpdatedCallback - callback that is called after record updateOConcurrentModificationException - if the version of the document is different by the
version contained in the database.OValidationException - if the document breaks some validation constraints defined in the
schema#setMVCC(boolean), {@link #isMVCC()}, ODocument#validate()public long countView(String viewName)
countView in interface ODatabaseDocumentpublic long countClass(String iClassName)
countClass in interface ODatabaseDocumentiClassName - Class namepublic long countClass(String iClassName, boolean iPolymorphic)
countClass in interface ODatabaseDocumentiClassName - Class nameiPolymorphic - True if consider also the sub classes, otherwise falseprotected long countClass(OClass cls, boolean iPolymorphic)
public ODatabase<ORecord> commit()
public ODatabaseDocument commit(boolean force) throws OTransactionException
commit in interface ODatabase<ORecord>OTransactionExceptionprotected void beforeCommitOperations()
protected void afterCommitOperations()
protected void beforeRollbackOperations()
protected void afterRollbackOperations()
public ODatabase<ORecord> rollback()
public ODatabaseDocument rollback(boolean force) throws OTransactionException
rollback in interface ODatabase<ORecord>OTransactionExceptionpublic <DB extends ODatabase> DB getUnderlying()
getUnderlying in interface ODatabaseInternal<ORecord>public List<String> backup(OutputStream out, Map<String,Object> options, Callable<Object> callable, OCommandOutputListener iListener, int compressionLevel, int bufferSize) throws IOException
OBackupablebackup in interface OBackupableout - OutputStream used to write the backup content. Use a FileOutputStream to make the
backup persistent on diskoptions - Backup options as Mapcallable - Callback to execute when the database is lockediListener - Listener called for backup messagescompressionLevel - ZIP Compression level between 1 (the minimum) and 9 (maximum). The
bigger is the compression, the smaller will be the final backup content, but will consume
more CPU and time to executebufferSize - Buffer size in bytes, the bigger is the buffer, the more efficient will be
the compressionIOExceptionODatabaseExportpublic void restore(InputStream in, Map<String,Object> options, Callable<Object> callable, OCommandOutputListener iListener) throws IOException
OBackupablerestore in interface OBackupablein - InputStream used to read the backup content. Use a FileInputStream to read a backup
on a diskoptions - Backup options as Mapcallable - Callback to execute when the database is lockediListener - Listener called for backup messagesIOExceptionODatabaseImportpublic OSBTreeCollectionManager getSbTreeCollectionManager()
getSbTreeCollectionManager in interface ODatabaseDocumentInternalpublic OCurrentStorageComponentsFactory getStorageVersions()
ODatabaseDocumentInternalgetStorageVersions in interface ODatabaseDocumentInternalpublic ORecordSerializer getSerializer()
getSerializer in interface ODatabaseDocumentInternalpublic void setSerializer(ORecordSerializer serializer)
setSerializer in interface ODatabaseDocumentInternalserializer - the serializer to set.public void resetInitialization()
resetInitialization in interface ODatabaseInternal<ORecord>public String incrementalBackup(String path) throws UnsupportedOperationException
ODatabaseIf it will be first backup of data full content of database will be copied into folder otherwise only changes after last backup in the same folder will be copied.
incrementalBackup in interface ODatabase<ORecord>path - Path to backup folder.UnsupportedOperationExceptionpublic void checkSecurity(int operation,
OIdentifiable record,
String cluster)
public boolean isPooled()
isPooled in interface ODatabaseDocumenttrue if database is obtained from the pool and false
otherwise.@Deprecated public void setCurrentDatabaseInThreadLocal()
public ODatabaseDocumentAbstract activateOnCurrentThread()
activateOnCurrentThread in interface ODatabase<ORecord>public boolean isActiveOnCurrentThread()
ODatabaseisActiveOnCurrentThread in interface ODatabase<ORecord>protected void checkOpenness()
protected void callbackHookFailure(ORecord record, boolean wasNew, byte[] stream)
protected void callbackHookSuccess(ORecord record, boolean wasNew, byte[] stream, OStorageOperationResult<Integer> operationResult)
protected void callbackHookFinalize(ORecord record, boolean wasNew, byte[] stream)
protected void clearDocumentTracking(ORecord record)
protected void checkRecordClass(OClass recordClass, String iClusterName, ORecordId rid)
protected void init()
public void checkIfActive()
checkIfActive in interface ODatabaseDocumentInternalpublic Set<Integer> getBlobClusterIds()
ODatabasegetBlobClusterIds in interface ODatabase<ORecord>public OSharedContext getSharedContext()
getSharedContext in interface ODatabaseInternal<ORecord>public static Object executeWithRetries(OCallable<Object,Integer> callback, int maxRetry)
public static Object executeWithRetries(OCallable<Object,Integer> callback, int maxRetry, int waitBetweenRetry)
public static Object executeWithRetries(OCallable<Object,Integer> callback, int maxRetry, int waitBetweenRetry, ORecord[] recordToReloadOnRetry)
public boolean isUseLightweightEdges()
isUseLightweightEdges in interface ODatabaseDocumentInternalpublic void setUseLightweightEdges(boolean b)
setUseLightweightEdges in interface ODatabaseDocumentInternalpublic OEdge newLightweightEdge(String iClassName, OVertex from, OVertex to)
newLightweightEdge in interface ODatabaseDocumentInternalpublic OEdge newRegularEdge(String iClassName, OVertex from, OVertex to)
newRegularEdge in interface ODatabaseDocumentInternalpublic void queryStarted(String id, OResultSet rs)
public void queryClosed(String id)
protected void closeActiveQueries()
public Map<String,OResultSet> getActiveQueries()
getActiveQueries in interface ODatabaseDocumentInternalpublic OResultSet getActiveQuery(String id)
getActiveQuery in interface ODatabaseDocumentInternalpublic void internalCommit(OTransactionInternal transaction)
ODatabaseDocumentInternalinternalCommit in interface ODatabaseDocumentInternalpublic boolean isClusterEdge(int cluster)
isClusterEdge in interface ODatabaseDocumentInternalpublic boolean isClusterVertex(int cluster)
isClusterVertex in interface ODatabaseDocumentInternalpublic boolean isClusterView(int cluster)
isClusterView in interface ODatabaseDocumentInternalpublic OView getViewFromCluster(int cluster)
getViewFromCluster in interface ODatabaseDocumentInternalprotected void pessimisticLockChecks(ORID recordId)
public Map<UUID,OBonsaiCollectionPointer> getCollectionsChanges()
getCollectionsChanges in interface ODatabaseDocumentInternalCopyright © 2009–2025 OrientDB. All rights reserved.