
public class ODatabaseDocumentEmbedded extends ODatabaseDocumentAbstract implements OQueryLifecycleListener
| Modifier and Type | Class and Description |
|---|---|
protected class |
ODatabaseDocumentEmbedded.InterruptTimerTask |
ODatabase.ATTRIBUTES, ODatabase.OPERATION_MODE, ODatabase.STATUSactiveQueries, componentsFactory, currentIntent, currentTx, databaseOwner, hooks, hooksByScope, inHook, initialized, loadedRecordsCount, localCache, maxRecordLoadMs, maxRidbagPrefetchMs, metadata, microTransaction, minRecordLoadMs, minRidbagPrefetchMs, properties, recordType, retainRecords, ridbagPrefetchCount, serializer, sharedContext, status, totalRecordLoadMs, totalRidbagPrefetchMs, unmodifiableHooks, url, userTYPE| Constructor and Description |
|---|
ODatabaseDocumentEmbedded(OStorage storage) |
| Modifier and Type | Method and Description |
|---|---|
int |
addBlobCluster(String iClusterName,
Object... iParameters)
Adds a new cluster for store blobs.
|
void |
addRidbagPrefetchStats(long execTimeMs) |
protected void |
afterCommitOperations() |
void |
afterCreateOperations(OIdentifiable id) |
void |
afterDeleteOperations(OIdentifiable id) |
void |
afterReadOperations(OIdentifiable identifiable) |
protected void |
afterRollbackOperations() |
void |
afterUpdateOperations(OIdentifiable id) |
OIdentifiable |
beforeCreateOperations(OIdentifiable id,
String iClusterName) |
void |
beforeDeleteOperations(OIdentifiable id,
String iClusterName) |
boolean |
beforeReadOperations(OIdentifiable identifiable) |
OIdentifiable |
beforeUpdateOperations(OIdentifiable id,
String iClusterName) |
protected OMicroTransaction |
beginMicroTransaction() |
void |
callOnCreateListeners() |
<DB extends ODatabaseDocument> |
checkSecurity(ORule.ResourceGeneric iResourceGeneric,
int iOperation,
Object... iResourcesSpecific)
Checks if the operation against multiple resources is allowed for the current user.
|
<DB extends ODatabaseDocument> |
checkSecurity(ORule.ResourceGeneric iResourceGeneric,
int iOperation,
Object iResourceSpecific)
Checks if the operation on a resource is allowed for the current user.
|
<DB extends ODatabaseDocument> |
checkSecurity(ORule.ResourceGeneric resourceGeneric,
String resourceSpecific,
int iOperation)
Checks if the operation on a resource is allowed for the current user.
|
<DB extends ODatabaseDocument> |
checkSecurity(String iResource,
int iOperation)
Deprecated.
|
<DB extends ODatabaseDocument> |
checkSecurity(String iResourceGeneric,
int iOperation,
Object... iResourcesSpecific)
Deprecated.
|
<DB extends ODatabaseDocument> |
checkSecurity(String iResourceGeneric,
int iOperation,
Object iResourceSpecific)
Deprecated.
|
OResultSet |
command(String query,
Map args)
Executes a generic (idempotent or non idempotent) command.
|
OResultSet |
command(String query,
Object[] args)
Executes a generic (idempotent or non idempotent) command.
|
ODatabaseDocumentInternal |
copy()
Returns a copy of current database if it's open.
|
<DB extends ODatabase> |
create()
Creates a new database.
|
<DB extends ODatabase> |
create(Map<OGlobalConfiguration,Object> iInitialSettings)
Creates a new database passing initial settings.
|
<DB extends ODatabase> |
create(String incrementalBackupPath)
Creates new database from database backup.
|
TimerTask |
createInterruptTimerTask()
creates an interrupt timer task for this db instance (without scheduling it!)
|
protected void |
createMetadata(OSharedContext shared) |
ODatabaseDocumentAbstract |
delete(ORecord record)
Deletes a document.
|
void |
drop()
Drops a database.
|
OResultSet |
execute(String language,
String script,
Map<String,?> args)
Execute a script of a specified query language The result set has to be closed after usage
Sample usage: |
OResultSet |
execute(String language,
String script,
Object... args)
Execute a script in a specified query language.
|
void |
executeDeleteRecord(OIdentifiable identifiable,
int iVersion,
boolean iRequired,
ODatabase.OPERATION_MODE iMode,
boolean prohibitTombstones)
This method is internal, it can be subject to signature change or be removed, do not
use.
|
<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.
|
boolean |
exists()
Checks if the database exists.
|
String |
getClusterName(ORecord record) |
int |
getCommandInterruptionDepth() |
OrientDBConfig |
getConfig() |
ODatabaseStats |
getStats() |
OStorage |
getStorage()
Returns the underlying storage implementation.
|
OStorageInfo |
getStorageInfo() |
OView |
getViewFromCluster(int cluster) |
void |
init(OrientDBConfig config,
OSharedContext sharedContext) |
protected void |
installHooksEmbedded() |
void |
internalCreate(OrientDBConfig config,
OSharedContext ctx) |
void |
internalLockRecord(OIdentifiable iRecord,
OStorage.LOCKING_STRATEGY lockingStrategy) |
void |
internalLockRecord(OIdentifiable iRecord,
OStorage.LOCKING_STRATEGY lockingStrategy,
long timeout) |
void |
internalOpen(String iUserName,
String iUserPassword) |
void |
internalOpen(String iUserName,
String iUserPassword,
boolean checkPassword) |
void |
internalUnlockRecord(OIdentifiable iRecord) |
boolean |
isClosed()
Checks if the database is closed.
|
boolean |
isCommandInterrupted() |
OLiveQueryMonitor |
live(String query,
OLiveQueryResultListener listener,
Map<String,?> args)
Subscribe a query as a live query for future create/update event with the referred conditions
|
OLiveQueryMonitor |
live(String query,
OLiveQueryResultListener listener,
Object... args)
Subscribe a query as a live query for future create/update event with the referred conditions
|
protected void |
loadMetadata() |
protected void |
loadMetadata(OSharedContext shared) |
<RET extends ORecord> |
lock(ORID recordId)
Pessimistic lock a record.
|
<RET extends ORecord> |
lock(ORID recordId,
long timeout,
TimeUnit timeoutUnit)
Pessimistic lock a record.
|
<DB extends ODatabase> |
open(OToken iToken)
Deprecated.
|
<DB extends ODatabase> |
open(String iUserName,
String iUserPassword)
Opens a database using the user and password received as arguments.
|
OLocalResultSetLifecycleDecorator |
query(OExecutionPlan plan,
Map<Object,Object> params) |
OResultSet |
query(String query,
Map args)
Executes an SQL query (idempotent).
|
OResultSet |
query(String query,
Object[] args)
Executes an SQL query.
|
void |
rebuildIndexes() |
void |
recycle(ORecord record) |
void |
replaceStorage(OStorage iNewStorage)
Internal only: replace the storage with a new one.
|
void |
resetRecordLoadStats() |
ORecord |
saveAll(ORecord iRecord,
String iClusterName,
ODatabase.OPERATION_MODE iMode,
boolean iForceCreate,
ORecordCallback<? extends Number> iRecordCreatedCallback,
ORecordCallback<Integer> iRecordUpdatedCallback) |
<T> T |
sendSequenceAction(OSequenceAction action) |
<DB extends ODatabase> |
set(ODatabase.ATTRIBUTES iAttribute,
Object iValue)
Sets a database attribute value
|
void |
setCommandInterrupted(boolean commandInterrupted) |
void |
setCommandInterruptionDepth(int commandInterruptionDepth) |
<DB extends ODatabase> |
setCustom(String name,
Object iValue) |
void |
unlock(ORID recordId)
Pessimistic unlock
|
activateOnCurrentThread, addCluster, addCluster, assignAndCheckCluster, backup, beforeCommitOperations, beforeRollbackOperations, begin, begin, begin, browseClass, browseClass, browseCluster, browseCluster, browseCluster, browseCluster, browseCluster, callbackHookFailure, callbackHookFinalize, callbackHooks, callbackHookSuccess, callOnCloseListeners, callOnDropListeners, callOnOpenListeners, checkForClusterPermissions, checkIfActive, checkOpenness, checkRecordClass, checkSecurity, cleanOutRecord, clearDocumentTracking, close, closeActiveQueries, command, commit, commit, countClass, countClass, countClass, countClusterElements, countClusterElements, countClusterElements, countClusterElements, countClusterElements, countView, declareIntent, delete, delete, dropCluster, dropCluster, dropClusterInternal, dropClusterInternal, executeWithRetries, executeWithRetries, executeWithRetries, existsCluster, freeze, freeze, get, getActiveIntent, getActiveQueries, getActiveQuery, getBlobClusterIds, getClusterIdByName, getClusterNameById, getClusterNames, getClusterRecordSizeById, getClusterRecordSizeByName, getClusters, getCollectionsChanges, getConfiguration, getConflictStrategy, getDatabaseOwner, getDefaultClusterId, getDefaultSerializer, getDictionary, getHooks, getListeners, getLocalCache, getMetadata, getMicroOrRegularTransaction, getName, getProperties, getProperty, getRecord, getRecordMetadata, getRecordType, getSbTreeCollectionManager, getSerializer, getSerializerFactory, getSharedContext, getSize, getStatus, getStorageVersions, getTransaction, getType, getUnderlying, getURL, getUser, incrementalBackup, init, internalClose, internalCommit, isActiveOnCurrentThread, isClusterEdge, isClusterVertex, isClusterView, isMVCC, isPooled, isPrefetchRecords, isRetainRecords, isUseLightweightEdges, isValidationEnabled, load, load, load, load, load, load, loadIfVersionIsNotLatest, newBlob, newBlob, newEdge, newEdge, newElement, newElement, newElement, newEmbeddedElement, newEmbeddedElement, newInstance, newInstance, newLightweightEdge, newRegularEdge, newVertex, newVertex, pessimisticLockChecks, query, queryClosed, queryStarted, rawBegin, registerHook, registerHook, release, reload, reload, reload, reload, reload, reloadUser, resetInitialization, restore, rollback, rollback, save, save, save, save, setConflictStrategy, setConflictStrategy, setCurrentDatabaseInThreadLocal, setDatabaseOwner, setDefaultClusterIdInternal, setDefaultSerializer, setDefaultTransactionMode, setInternal, setMVCC, setPrefetchRecords, setProperty, setRetainRecords, setSerializer, setStatus, setStatusInternal, setUseLightweightEdges, setUser, setValidationEnabled, swapTx, truncateCluster, unregisterHookbrowseListeners, getListenersCopy, registerListener, resetListeners, unregisterListenerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitqueryClosed, queryStartedgetHaStatus, indexQuery, isDistributed, isRemote, queryOnNode, realClose, removeHaServer, reuse, sync, syncCommitcreateClassIfNotExist, createEdgeClass, createVertexClass, newEdge, newVertexcreateClass, executeWithRetry, getClass, registerListener, unregisterListenergetActiveClusterMap, getActiveDataCenterMap, getEnterpriseEndpoint, getLocalNodeName, isShardedpublic ODatabaseDocumentEmbedded(OStorage storage)
public <DB extends ODatabase> DB open(String iUserName, String iUserPassword)
ODatabasepublic void init(OrientDBConfig config, OSharedContext sharedContext)
public void internalOpen(String iUserName, String iUserPassword, boolean checkPassword)
@Deprecated public <DB extends ODatabase> DB open(OToken iToken)
open in interface ODatabaseInternal<ORecord>iToken - Authentication tokenpublic <DB extends ODatabase> DB create()
ODatabasepublic void internalCreate(OrientDBConfig config, OSharedContext ctx)
public void callOnCreateListeners()
protected void createMetadata(OSharedContext shared)
protected void loadMetadata()
loadMetadata in class ODatabaseDocumentAbstractprotected void loadMetadata(OSharedContext shared)
loadMetadata in class ODatabaseDocumentAbstractpublic <DB extends ODatabase> DB set(ODatabase.ATTRIBUTES iAttribute, Object iValue)
ODatabasepublic <DB extends ODatabase> DB setCustom(String name, Object iValue)
setCustom in interface ODatabaseDocumentInternalpublic <DB extends ODatabase> DB create(String incrementalBackupPath)
public <DB extends ODatabase> DB create(Map<OGlobalConfiguration,Object> iInitialSettings)
ODatabasepublic ODatabaseDocumentInternal copy()
copy in interface ODatabaseDocumentInternalpublic boolean exists()
ODatabasepublic boolean isClosed()
ODatabaseisClosed in interface ODatabase<ORecord>isClosed in class ODatabaseDocumentAbstractpublic void rebuildIndexes()
protected void installHooksEmbedded()
public OStorage getStorage()
ODatabaseInternalgetStorage in interface ODatabaseInternal<ORecord>OStoragepublic OStorageInfo getStorageInfo()
getStorageInfo in interface ODatabaseInternal<ORecord>public void replaceStorage(OStorage iNewStorage)
ODatabaseInternalreplaceStorage in interface ODatabaseInternal<ORecord>iNewStorage - The new storage to use. Usually it's a wrapped instance of the current
cluster.public OResultSet query(String query, Object[] args)
ODatabase
OResultSet rs = db.query("SELECT FROM V where name = ?", "John"); while(rs.hasNext()){ OResult item = rs.next(); ... }
rs.close();
public OResultSet query(String query, Map args)
ODatabase
Map<String, Object> params = new HashMapMap<>(); params.put("name", "John"); OResultSet rs = db.query("SELECT
FROM V where name = :name", params); while(rs.hasNext()){ OResult item = rs.next(); ... } rs.close();
public OResultSet command(String query, Object[] args)
ODatabase
OResultSet rs = db.command("INSERT INTO Person SET name = ?", "John"); ... rs.close();
public OResultSet command(String query, Map args)
ODatabase
Map<String, Object> params = new HashMapMap<>(); params.put("name", "John"); OResultSet rs = db.query("INSERT
INTO Person SET name = :name", params); ... rs.close();
public OResultSet execute(String language, String script, Object... args)
ODatabase
OResultSet rs = db.execute("sql", script, "Surname1", "Surname2", "Surname3"); ... rs.close();
String script = "INSERT INTO Person SET name = 'foo', surname = ?;"+ "INSERT INTO Person SET name = 'bar', surname =
?;"+ "INSERT INTO Person SET name = 'baz', surname = ?;";
public OResultSet execute(String language, String script, Map<String,?> args)
ODatabase
String script = "INSERT INTO Person SET name = 'foo', surname = :surname1;"+ "INSERT INTO Person SET name = 'bar', surname =
:surname2;"+ "INSERT INTO Person SET name = 'baz', surname = :surname3;";
OResultSet rs = db.execute("sql", script, params); ... rs.close();
Map<String, Object> params = new HashMapMap<>(); params.put("surname1", "Jones"); params.put("surname2",
"May"); params.put("surname3", "Ali");
public OLocalResultSetLifecycleDecorator query(OExecutionPlan plan, Map<Object,Object> params)
public OrientDBConfig getConfig()
public OLiveQueryMonitor live(String query, OLiveQueryResultListener listener, Object... args)
ODatabasepublic OLiveQueryMonitor live(String query, OLiveQueryResultListener listener, Map<String,?> args)
ODatabasepublic void recycle(ORecord record)
recycle in interface ODatabaseDocumentInternalprotected OMicroTransaction beginMicroTransaction()
public int addBlobCluster(String iClusterName, Object... iParameters)
ODatabaseaddBlobCluster in interface ODatabaseDocumentaddBlobCluster in interface ODatabase<ORecord>iClusterName - Cluster nameiParameters - Additional parameters to pass to the factoriespublic void executeDeleteRecord(OIdentifiable identifiable, int iVersion, boolean iRequired, ODatabase.OPERATION_MODE iMode, boolean prohibitTombstones)
executeDeleteRecord in interface ODatabaseDocumentInternalpublic OIdentifiable beforeCreateOperations(OIdentifiable id, String iClusterName)
beforeCreateOperations in interface ODatabaseDocumentInternalpublic OIdentifiable beforeUpdateOperations(OIdentifiable id, String iClusterName)
beforeUpdateOperations in interface ODatabaseDocumentInternalpublic ODatabaseDocumentAbstract delete(ORecord record)
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.
public void beforeDeleteOperations(OIdentifiable id, String iClusterName)
beforeDeleteOperations in interface ODatabaseDocumentInternalpublic void afterCreateOperations(OIdentifiable id)
afterCreateOperations in interface ODatabaseDocumentInternalpublic void afterUpdateOperations(OIdentifiable id)
afterUpdateOperations in interface ODatabaseDocumentInternalpublic void afterDeleteOperations(OIdentifiable id)
afterDeleteOperations in interface ODatabaseDocumentInternalpublic void afterReadOperations(OIdentifiable identifiable)
afterReadOperations in interface ODatabaseDocumentInternalpublic boolean beforeReadOperations(OIdentifiable identifiable)
beforeReadOperations in interface ODatabaseDocumentInternalprotected void afterCommitOperations()
afterCommitOperations in class ODatabaseDocumentAbstractprotected void afterRollbackOperations()
afterRollbackOperations in class ODatabaseDocumentAbstractpublic ORecord saveAll(ORecord iRecord, String iClusterName, ODatabase.OPERATION_MODE iMode, boolean iForceCreate, ORecordCallback<? extends Number> iRecordCreatedCallback, ORecordCallback<Integer> iRecordUpdatedCallback)
saveAll in interface ODatabaseDocumentInternalpublic String getClusterName(ORecord record)
getClusterName in interface ODatabaseDocumentInternalpublic OView getViewFromCluster(int cluster)
getViewFromCluster in interface ODatabaseDocumentInternalgetViewFromCluster in class ODatabaseDocumentAbstractpublic <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 ODatabaseDocumentInternalexecuteReadRecord in class ODatabaseDocumentAbstractpublic void internalLockRecord(OIdentifiable iRecord, OStorage.LOCKING_STRATEGY lockingStrategy)
internalLockRecord in interface ODatabaseDocumentInternalpublic void internalLockRecord(OIdentifiable iRecord, OStorage.LOCKING_STRATEGY lockingStrategy, long timeout)
public void internalUnlockRecord(OIdentifiable iRecord)
internalUnlockRecord in interface ODatabaseDocumentInternalpublic <RET extends ORecord> RET lock(ORID recordId) throws OLockException
ODatabaseIn case of lock inside the transaction the lock will be release by the commit operation, In case of lock outside a transaction unlock need to be call manually.
lock in interface ODatabase<ORecord>recordId - the id of the record that need to be lockedOLockException - In case of deadlock detectedpublic <RET extends ORecord> RET lock(ORID recordId, long timeout, TimeUnit timeoutUnit) throws OLockException
ODatabaselock in interface ODatabase<ORecord>recordId - the id of the record that need to be lockedtimeout - for the record lockingtimeoutUnit - relative for the timeoutOLockException - In case of deadlock detectedpublic void unlock(ORID recordId) throws OLockException
ODatabaseunlock in interface ODatabase<ORecord>recordId - the id of the record to unlockOLockException - if the record is not locked.public <T> T sendSequenceAction(OSequenceAction action) throws ExecutionException, InterruptedException
sendSequenceAction in interface ODatabaseDocumentInternalExecutionExceptionInterruptedExceptionpublic <DB extends ODatabaseDocument> DB checkSecurity(ORule.ResourceGeneric resourceGeneric, String resourceSpecific, int iOperation)
checkSecurity in interface ODatabaseDocumentresourceGeneric - Generic Resource where to execute the operationiOperation - Operation to execute against the resourcepublic <DB extends ODatabaseDocument> DB checkSecurity(ORule.ResourceGeneric iResourceGeneric, int iOperation, Object... iResourcesSpecific)
checkSecurity in interface ODatabaseDocumentiResourceGeneric - Resource where to execute the operation, i.e.: database.clustersiOperation - Operation to execute against the resourceiResourcesSpecific - Target resources as an array of Objects, i.e.: ["employee", 2] to
specify cluster name and id.public <DB extends ODatabaseDocument> DB checkSecurity(ORule.ResourceGeneric iResourceGeneric, int iOperation, Object iResourceSpecific)
checkSecurity in interface ODatabaseDocumentiResourceGeneric - Resource where to execute the operation, i.e.: database.clustersiOperation - Operation to execute against the resourceiResourceSpecific - Target resource, i.e.: "employee" to specify the cluster name.@Deprecated public <DB extends ODatabaseDocument> DB checkSecurity(String iResource, int iOperation)
ODatabaseDocumentcheckSecurity in interface ODatabaseDocumentiResource - Resource where to execute the operationiOperation - Operation to execute against the resource@Deprecated public <DB extends ODatabaseDocument> DB checkSecurity(String iResourceGeneric, int iOperation, Object iResourceSpecific)
ODatabaseDocumentcheckSecurity in interface ODatabaseDocumentiResourceGeneric - Resource where to execute the operation, i.e.: database.clustersiOperation - Operation to execute against the resourceiResourceSpecific - Target resource, i.e.: "employee" to specify the cluster name.@Deprecated public <DB extends ODatabaseDocument> DB checkSecurity(String iResourceGeneric, int iOperation, Object... iResourcesSpecific)
ODatabaseDocumentcheckSecurity in interface ODatabaseDocumentiResourceGeneric - Resource where to execute the operation, i.e.: database.clustersiOperation - Operation to execute against the resourceiResourcesSpecific - Target resources as an array of Objects, i.e.: ["employee", 2] to
specify cluster name and id.public boolean isCommandInterrupted()
isCommandInterrupted in interface ODatabaseDocumentInternalpublic void setCommandInterrupted(boolean commandInterrupted)
setCommandInterrupted in interface ODatabaseDocumentInternalpublic int getCommandInterruptionDepth()
getCommandInterruptionDepth in interface ODatabaseDocumentInternalpublic void setCommandInterruptionDepth(int commandInterruptionDepth)
setCommandInterruptionDepth in interface ODatabaseDocumentInternalpublic ODatabaseStats getStats()
getStats in interface ODatabaseInternal<ORecord>public void addRidbagPrefetchStats(long execTimeMs)
addRidbagPrefetchStats in interface ODatabaseInternal<ORecord>public void resetRecordLoadStats()
resetRecordLoadStats in interface ODatabaseInternal<ORecord>public TimerTask createInterruptTimerTask()
ODatabaseInternalcreateInterruptTimerTask in interface ODatabaseInternal<ORecord>Copyright © 2009–2025 OrientDB. All rights reserved.