
public class ODatabaseDocumentTx extends OListenerManger<ODatabaseListener> implements ODatabaseDocumentInternal
| Modifier and Type | Class and Description |
|---|---|
static class |
ODatabaseDocumentTx.LatestVersionRecordReader |
static interface |
ODatabaseDocumentTx.RecordReader |
static class |
ODatabaseDocumentTx.SimpleRecordReader |
ODatabase.ATTRIBUTES, ODatabase.OPERATION_MODE, ODatabase.OPTIONS, ODatabase.STATUS| Modifier and Type | Field and Description |
|---|---|
protected static ORecordSerializer |
defaultSerializer |
protected ORecordSerializer |
serializer |
protected ODatabaseSessionMetadata |
sessionMetadata |
TYPE| Constructor and Description |
|---|
ODatabaseDocumentTx(String iURL)
Creates a new connection to the database.
|
ODatabaseDocumentTx(String iURL,
boolean keepStorageOpen) |
| Modifier and Type | Method and Description |
|---|---|
ODatabaseDocumentTx |
activateOnCurrentThread()
Activates current database instance on current thread.
|
int |
addBlobCluster(String iClusterName,
Object... iParameters)
Add a cluster for blob records.
|
int |
addCluster(String iClusterName,
int iRequestedId,
Object... iParameters)
Adds a new cluster.
|
int |
addCluster(String iClusterName,
Object... iParameters)
Adds a new cluster.
|
Object |
alterCluster(int iClusterId,
OCluster.ATTRIBUTES attribute,
Object value)
Alters a cluster.
|
Object |
alterCluster(String iClusterName,
OCluster.ATTRIBUTES attribute,
Object value)
Alters a cluster.
|
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.
|
ODatabaseDocumentTx |
begin()
Begins a new transaction.
|
ODatabaseDocumentTx |
begin(OTransaction.TXTYPE iType)
Begins a new transaction specifying the transaction type.
|
ODatabaseDocument |
begin(OTransaction iTx)
Attaches a transaction as current.
|
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.
|
ORecordHook.RESULT |
callbackHooks(ORecordHook.TYPE type,
OIdentifiable id)
Callback the registered hooks if any.
|
<V> V |
callInLock(Callable<V> iCallable,
boolean iExclusiveLock) |
void |
callOnCloseListeners() |
void |
callOnDropListeners() |
void |
callOnOpenListeners() |
void |
checkIfActive() |
protected void |
checkOpeness() |
<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.
|
ODatabase<ORecord> |
cleanOutRecord(ORID iRecord,
int iVersion) |
void |
close()
Closes an opened database.
|
OCommandRequest |
command(OCommandRequest iCommand)
Execute a command against the database.
|
ODatabase<ORecord> |
commit()
Commits the current transaction.
|
ODatabaseDocument |
commit(boolean force) |
ODatabaseDocumentTx |
copy()
Returns a copy of current database if it's open.
|
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.
|
<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.
|
boolean |
declareIntent(OIntent iIntent)
Declares an intent to the database.
|
ODatabaseDocumentTx |
delete(ORecord record)
Deletes a document.
|
ODatabaseDocument |
delete(ORecord iRecord,
ODatabase.OPERATION_MODE iMode) |
ODatabaseDocument |
delete(ORID iRecord)
Deletes the record without checking the version.
|
ODatabase<ORecord> |
delete(ORID iRecord,
int iVersion)
Deletes the record checking the version.
|
ODatabaseDocument |
delete(ORID iRecord,
ODatabase.OPERATION_MODE iMode)
Deletes the record without checking the version.
|
void |
drop()
Drops a database.
|
boolean |
dropCluster(int iClusterId,
boolean iTruncate)
Drops a cluster by its id.
|
boolean |
dropCluster(String iClusterName,
boolean iTruncate)
Drops a cluster by its name.
|
void |
executeDeleteRecord(OIdentifiable record,
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.
|
boolean |
executeHideRecord(OIdentifiable record,
ODatabase.OPERATION_MODE iMode)
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,
ODatabaseDocumentTx.RecordReader recordReader)
This method is internal, it can be subject to signature change or be removed, do not use.
|
Set<ORecord> |
executeReadRecords(Set<ORecordId> iRids,
boolean ignoreCache)
This method is internal, it can be subject to signature change or be removed, do not use.
|
void |
executeRecycleRecord(ORecord record)
This method is internal, it can be subject to signature change or be removed, do not use.
|
<RET extends ORecord> |
executeSaveEmptyRecord(ORecord record,
String clusterName) |
<RET extends ORecord> |
executeSaveRecord(ORecord record,
String clusterName,
int ver,
ODatabase.OPERATION_MODE mode,
boolean forceCreate,
ORecordCallback<? extends Number> recordCreatedCallback,
ORecordCallback<Integer> recordUpdatedCallback)
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 |
exists()
Checks if the database exists.
|
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()
Return the active intent.
|
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.
|
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()
Returns the Dictionary manual index.
|
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.
|
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() |
long |
getSize()
Returns the total size of database as the real used space.
|
ODatabase.STATUS |
getStatus()
Returns the current status of database.
|
OStorage |
getStorage()
This method is internal, it can be subject to signature change or be removed, do not use.
|
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.
|
boolean |
hide(ORID rid)
Hides records content by putting tombstone on the records position but does not delete record itself.
|
String |
incrementalBackup(String path)
Performs incremental backup of database content to the selected folder.
|
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 |
isFrozen()
Returns true if the database is frozen (
ODatabase.freeze() operation), otherwise false. |
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 |
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(ORecord iRecord,
String iFetchPlan,
boolean iIgnoreCache,
boolean iUpdateCache,
boolean loadTombstone,
OStorage.LOCKING_STRATEGY iLockingStrategy)
Deprecated.
|
<RET extends ORecord> |
load(ORecord iRecord,
String iFetchPlan,
boolean iIgnoreCache,
boolean loadTombstone,
OStorage.LOCKING_STRATEGY iLockingStrategy)
Deprecated.
|
<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> |
load(ORID iRecordId,
String iFetchPlan,
boolean iIgnoreCache,
boolean iUpdateCache,
boolean loadTombstone,
OStorage.LOCKING_STRATEGY iLockingStrategy)
Deprecated.
|
<RET extends ORecord> |
load(ORID iRecordId,
String iFetchPlan,
boolean iIgnoreCache,
boolean loadTombstone,
OStorage.LOCKING_STRATEGY iLockingStrategy)
Deprecated.
|
<RET extends ORecord> |
loadIfVersionIsNotLatest(ORID rid,
int recordVersion,
String fetchPlan,
boolean ignoreCache) |
ODocument |
newInstance()
Creates a new ODocument.
|
ODocument |
newInstance(String iClassName)
Creates a document with specific class.
|
<DB extends ODatabase> |
open(OToken iToken)
Opens a database using an authentication token received as an argument.
|
<DB extends ODatabase> |
open(String iUserName,
String iUserPassword)
Opens connection to the storage with given user and password.
|
<RET extends List<?>> |
query(OQuery<?> iCommand,
Object... iArgs)
Execute a query against the database.
|
void |
recycle(ORecord record) |
<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 |
replaceStorage(OStorage iNewStorage)
This method is internal, it can be subject to signature change or be removed, do not use.
|
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.
|
<DB extends ODatabase> |
set(ODatabase.ATTRIBUTES iAttribute,
Object iValue)
Sets a database attribute value
|
ODatabaseDocumentTx |
setConflictStrategy(ORecordConflictStrategy iResolver)
Overrides record conflict strategy.
|
ODatabaseDocumentTx |
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() |
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)
Returns the current status of database.
|
void |
setStatusInternal(ODatabase.STATUS status) |
void |
setUser(OSecurityUser user)
Set user for current database instance.
|
<DB extends ODatabaseDocument> |
setValidationEnabled(boolean iEnabled)
Enables or disables the record validation.
|
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, waitregisterListener, unregisterListenerprotected static ORecordSerializer defaultSerializer
protected ORecordSerializer serializer
protected ODatabaseSessionMetadata sessionMetadata
public ODatabaseDocumentTx(String iURL)
iURL - of the databasepublic ODatabaseDocumentTx(String iURL, boolean keepStorageOpen)
public static ORecordSerializer getDefaultSerializer()
public static void setDefaultSerializer(ORecordSerializer iDefaultSerializer)
iDefaultSerializer - new default serializer valuepublic <DB extends ODatabase> DB open(String iUserName, String iUserPassword)
OPartitionedDatabasePool.acquire() instead. It will make work
faster even with embedded database.public boolean isPrefetchRecords()
isPrefetchRecords in interface ODatabaseDocumentInternalpublic void setPrefetchRecords(boolean prefetchRecords)
setPrefetchRecords in interface ODatabaseDocumentInternalpublic <DB extends ODatabase> DB open(OToken iToken)
open in interface ODatabaseInternal<ORecord>iToken - Authentication tokenpublic void callOnOpenListeners()
public <DB extends ODatabase> DB create()
public <DB extends ODatabase> DB create(String incrementalBackupPath)
public <DB extends ODatabase> DB create(Map<OGlobalConfiguration,Object> iInitialSettings)
ODatabasepublic ODatabaseDocumentTx copy()
copy in interface ODatabaseDocumentInternalpublic void callOnCloseListeners()
public void callOnDropListeners()
public <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 ODatabase<ORecord> cleanOutRecord(ORID iRecord, int iVersion)
cleanOutRecord in interface ODatabase<ORecord>public ODatabaseDocument delete(ORID iRecord, ODatabase.OPERATION_MODE iMode)
public ODatabaseDocument delete(ORecord iRecord, ODatabase.OPERATION_MODE iMode)
public <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 <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.public 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()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)
setValidationEnabled in interface ODatabaseDocumentiEnabled - True to enable, false to disablepublic ORecordConflictStrategy getConflictStrategy()
ODatabasegetConflictStrategy in interface ODatabase<ORecord>public ODatabaseDocumentTx setConflictStrategy(String iStrategyName)
ODatabasesetConflictStrategy in interface ODatabase<ORecord>iStrategyName - ORecordConflictStrategy strategy namepublic ODatabaseDocumentTx 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 boolean exists()
ODatabasepublic 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, Object... iParameters)
ODatabaseaddCluster in interface ODatabase<ORecord>iClusterName - Cluster nameiRequestedId - requested id of the clusteriParameters - Additional parameters to pass to the factoriespublic Object alterCluster(String iClusterName, OCluster.ATTRIBUTES attribute, Object value)
ODatabasealterCluster in interface ODatabase<ORecord>iClusterName - The name of the cluster to alterattribute - The cluster attribute to be modifiedpublic Object alterCluster(int iClusterId, OCluster.ATTRIBUTES attribute, Object value)
ODatabasealterCluster in interface ODatabase<ORecord>iClusterId - The id of the cluster to alterattribute - The cluster attribute to be modifiedpublic boolean dropCluster(String iClusterName, boolean iTruncate)
ODatabasedropCluster in interface ODatabase<ORecord>iClusterName - the name of the clusterpublic boolean dropCluster(int iClusterId,
boolean iTruncate)
ODatabasedropCluster in interface ODatabase<ORecord>iClusterId - id of cluster to deletepublic 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 <DB extends ODatabase> DB set(ODatabase.ATTRIBUTES iAttribute, Object iValue)
ODatabasepublic ORecordMetadata getRecordMetadata(ORID rid)
getRecordMetadata in interface ODatabase<ORecord>public OTransaction getTransaction()
ODatabasegetTransaction in interface ODatabase<ORecord>public <RET extends ORecord> RET load(ORecord iRecord, String iFetchPlan)
ODatabase@Deprecated public <RET extends ORecord> RET load(ORecord iRecord, String iFetchPlan, boolean iIgnoreCache, boolean loadTombstone, OStorage.LOCKING_STRATEGY iLockingStrategy)
ODatabase@Deprecated public <RET extends ORecord> RET load(ORecord iRecord, String iFetchPlan, boolean iIgnoreCache, boolean iUpdateCache, boolean loadTombstone, OStorage.LOCKING_STRATEGY iLockingStrategy)
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 ODatabaseDocumentInternalORecordNotFoundException@Deprecated public <RET extends ORecord> RET load(ORID iRecordId, String iFetchPlan, boolean iIgnoreCache, boolean loadTombstone, OStorage.LOCKING_STRATEGY iLockingStrategy)
@Deprecated public <RET extends ORecord> RET load(ORID iRecordId, String iFetchPlan, boolean iIgnoreCache, boolean iUpdateCache, boolean loadTombstone, OStorage.LOCKING_STRATEGY iLockingStrategy)
public <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 void recycle(ORecord record)
recycle in interface ODatabaseDocumentInternalpublic boolean hide(ORID rid)
ODatabaseThis method is used in case of record content itself is broken and cannot be read or deleted. So it is emergence method. This method can be used only if there is no active transaction in database.
public OBinarySerializerFactory getSerializerFactory()
getSerializerFactory in interface ODatabaseDocumentInternalpublic ODatabaseDocument begin(OTransaction iTx)
ODatabasepublic <RET extends ORecord> RET load(ORecord iRecord, String iFetchPlan, boolean iIgnoreCache)
public Set<ORecord> executeReadRecords(Set<ORecordId> iRids, boolean ignoreCache)
public <RET extends ORecord> RET executeReadRecord(ORecordId rid, ORecord iRecord, int recordVersion, String fetchPlan, boolean ignoreCache, boolean iUpdateCache, boolean loadTombstones, OStorage.LOCKING_STRATEGY lockingStrategy, ODatabaseDocumentTx.RecordReader recordReader)
public int assignAndCheckCluster(ORecord record, String iClusterName)
assignAndCheckCluster in interface ODatabaseDocumentInternalpublic <RET extends ORecord> RET executeSaveEmptyRecord(ORecord record, String clusterName)
public <RET extends ORecord> RET executeSaveRecord(ORecord record, String clusterName, int ver, ODatabase.OPERATION_MODE mode, boolean forceCreate, ORecordCallback<? extends Number> recordCreatedCallback, ORecordCallback<Integer> recordUpdatedCallback)
public void executeDeleteRecord(OIdentifiable record, int iVersion, boolean iRequired, ODatabase.OPERATION_MODE iMode, boolean prohibitTombstones)
public void executeRecycleRecord(ORecord record)
public boolean executeHideRecord(OIdentifiable record, ODatabase.OPERATION_MODE iMode)
public ODatabaseDocumentTx begin()
ODatabaseODatabase.commit() or
ODatabase.rollback().public ODatabaseDocumentTx begin(OTransaction.TXTYPE iType)
ODatabaseODatabase.commit() or
ODatabase.rollback().public void setDefaultTransactionMode()
public void freeze(boolean throwException)
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 boolean isFrozen()
ODatabaseODatabase.freeze() operation), otherwise false.public void freeze()
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 ODocument newInstance(String iClassName)
newInstance in interface ODatabaseSchemaAware<ORecord>iClassName - the name of class that should be used as a class of created document.public 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)
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)
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)
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)
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 ODatabaseDocumentTx delete(ORecord record)
OConcurrentModificationException exception is thrown.public long countClass(String iClassName)
countClass in interface ODatabaseSchemaAware<ORecord>iClassName - Class namepublic long countClass(String iClassName, boolean iPolymorphic)
countClass in interface ODatabaseSchemaAware<ORecord>iClassName - Class nameiPolymorphic - True if consider also the sub classes, otherwise falsepublic ODatabase<ORecord> commit()
public ODatabaseDocument commit(boolean force) throws OTransactionException
commit in interface ODatabase<ORecord>OTransactionExceptionpublic 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 OStorage getStorage()
getStorage in interface ODatabaseInternal<ORecord>OStoragepublic void replaceStorage(OStorage iNewStorage)
replaceStorage in interface ODatabaseInternal<ORecord>iNewStorage - The new storage to use. Usually it's a wrapped instance of the current cluster.public <V> V callInLock(Callable<V> iCallable, boolean iExclusiveLock)
callInLock 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)
serializer - the serializer to set.public void resetInitialization()
resetInitialization in interface ODatabaseInternal<ORecord>public String incrementalBackup(String path)
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.@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 isPooled()
isPooled in interface ODatabaseDocumenttrue if database is obtained from the pool and false otherwise.@Deprecated public void setCurrentDatabaseInThreadLocal()
public ODatabaseDocumentTx activateOnCurrentThread()
activateOnCurrentThread in interface ODatabase<ORecord>public boolean isActiveOnCurrentThread()
ODatabaseisActiveOnCurrentThread in interface ODatabase<ORecord>protected void checkOpeness()
public void checkIfActive()
public int addBlobCluster(String iClusterName, Object... iParameters)
ODatabaseDocumentaddBlobCluster in interface ODatabaseDocumentaddBlobCluster in interface ODatabase<ORecord>iClusterName - Cluster nameiParameters - Additional parameters to pass to the factoriespublic Set<Integer> getBlobClusterIds()
ODatabasegetBlobClusterIds in interface ODatabase<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 OIntent getActiveIntent()
ODatabaseDocumentgetActiveIntent in interface ODatabaseDocumentCopyright © 2009–2025 OrientDB. All rights reserved.