public abstract class ODatabaseWrapperAbstract<DB extends ODatabaseInternal,T> extends Object implements ODatabaseInternal<T>
ODatabase.ATTRIBUTES, ODatabase.OPERATION_MODE, ODatabase.STATUS| Modifier and Type | Field and Description |
|---|---|
protected ODatabaseInternal<?> |
databaseOwner |
protected DB |
underlying |
| Constructor and Description |
|---|
ODatabaseWrapperAbstract(DB iDatabase) |
| Modifier and Type | Method and Description |
|---|---|
ODatabase |
activateOnCurrentThread()
Activate 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.
|
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 |
checkOpenness() |
void |
close()
Closes an opened database, if the database is already closed does nothing, if a transaction is
active will be rollback.
|
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.
|
<THISDB extends ODatabase> |
create()
Creates a new database.
|
<THISDB extends ODatabase> |
create(Map<OGlobalConfiguration,Object> iInitialSettings)
Creates a new database passing initial settings.
|
<THISDB extends ODatabase> |
create(String incrementalBackupPath)
Creates new database from database backup.
|
boolean |
declareIntent(OIntent iIntent)
Declares an intent to the database.
|
void |
drop()
Drops a database.
|
boolean |
dropCluster(int iClusterId)
Drops a cluster by its id.
|
boolean |
dropCluster(String iClusterName)
Drops a cluster by its name.
|
boolean |
equals(Object iOther) |
boolean |
exists()
Checks if the database exists.
|
boolean |
existsCluster(String iClusterName)
Returns true if the cluster exists, otherwise false.
|
void |
freeze()
Flush cached storage content to the disk.
|
void |
freeze(boolean throwException)
Flush 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.
|
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 iClusterId)
Returns the total size of records contained in the cluster defined by its id.
|
long |
getClusterRecordSizeByName(String iClusterName)
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.
|
ODatabaseInternal<?> |
getDatabaseOwner()
Returns the database owner.
|
int |
getDefaultClusterId()
Returns the default cluster id.
|
OLocalRecordCache |
getLocalCache()
Returns the level1 cache.
|
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.
|
ORecordMetadata |
getRecordMetadata(ORID rid) |
long |
getSize()
Returns the total size of database as used space.
|
ODatabase.STATUS |
getStatus()
Returns the current status of database.
|
OStorage |
getStorage()
Returns the underlying storage implementation.
|
<DBTYPE extends ODatabase> |
getUnderlying()
Return the underlying database.
|
String |
getURL()
Returns the database URL.
|
boolean |
isActiveOnCurrentThread()
Returns true if the current database instance is active on current thread, otherwise false.
|
boolean |
isClosed()
Checks if the database is closed.
|
<THISDB extends ODatabase> |
open(OToken iToken)
Opens a database using an authentication token received as an argument.
|
<THISDB extends ODatabase> |
open(String iUserName,
String iUserPassword)
Opens a database using the user and password received as arguments.
|
void |
registerListener(ODatabaseListener iListener)
Registers a listener to the database events.
|
void |
release()
Allows to execute write-related commands on DB.
|
void |
reload()
Reloads the database information like the cluster list.
|
void |
replaceStorage(OStorage iNewStorage)
Internal only: replace the storage with a new one.
|
void |
restore(InputStream in,
Map<String,Object> options,
Callable<Object> callable,
OCommandOutputListener iListener)
Executes a restore of a database backup.
|
<THISDB extends ODatabase> |
set(ODatabase.ATTRIBUTES attribute,
Object iValue)
Sets a database attribute value
|
ODatabaseInternal<?> |
setDatabaseOwner(ODatabaseInternal<?> iOwner)
Internal.
|
Object |
setProperty(String iName,
Object iValue)
Sets a property value
|
<THISDB extends ODatabase> |
setStatus(ODatabase.STATUS iStatus)
Set the current status of database.
|
String |
toString() |
void |
truncateCluster(String clusterName)
Removes all data in the cluster with given name.
|
void |
unregisterListener(ODatabaseListener iListener)
Unregisters a listener to the database events.
|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddRidbagPrefetchStats, createInterruptTimerTask, getActiveClusterMap, getActiveDataCenterMap, getEnterpriseEndpoint, getLocalNodeName, getSharedContext, getStats, getStorageInfo, isSharded, resetInitialization, resetRecordLoadStats, setInternal, setUseraddBlobCluster, begin, begin, begin, command, command, command, commit, commit, createClass, delete, delete, delete, execute, execute, executeWithRetry, getBlobClusterIds, getClass, getConflictStrategy, getDictionary, getHooks, getListeners, getMetadata, getTransaction, getType, getUser, incrementalBackup, isMVCC, live, live, load, load, load, load, load, load, lock, lock, newInstance, query, query, query, registerHook, registerHook, reload, reload, rollback, rollback, save, save, save, save, setConflictStrategy, setConflictStrategy, setMVCC, unlock, unregisterHookprotected DB extends ODatabaseInternal underlying
protected ODatabaseInternal<?> databaseOwner
public ODatabaseWrapperAbstract(DB iDatabase)
public <THISDB extends ODatabase> THISDB open(String iUserName, String iUserPassword)
ODatabasepublic <THISDB extends ODatabase> THISDB open(OToken iToken)
ODatabaseInternalopen in interface ODatabaseInternal<T>iToken - Authentication tokenpublic ODatabase activateOnCurrentThread()
ODatabaseactivateOnCurrentThread in interface ODatabase<T>public boolean isActiveOnCurrentThread()
ODatabaseisActiveOnCurrentThread in interface ODatabase<T>public <THISDB extends ODatabase> THISDB create()
ODatabasepublic <THISDB extends ODatabase> THISDB create(String incrementalBackupPath)
ODatabasepublic <THISDB extends ODatabase> THISDB create(Map<OGlobalConfiguration,Object> iInitialSettings)
ODatabasepublic boolean exists()
ODatabasepublic void reload()
ODatabasepublic OContextConfiguration getConfiguration()
ODatabasegetConfiguration in interface ODatabase<T>public List<String> backup(OutputStream out, Map<String,Object> options, Callable<Object> callable, OCommandOutputListener iListener, int compressionLevel, int bufferSize) throws IOException
backup 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 0 (no compression) 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
restore 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 void close()
ODatabasepublic void replaceStorage(OStorage iNewStorage)
ODatabaseInternalreplaceStorage in interface ODatabaseInternal<T>iNewStorage - The new storage to use. Usually it's a wrapped instance of the current
cluster.public void drop()
ODatabasepublic ODatabase.STATUS getStatus()
ODatabasepublic <THISDB extends ODatabase> THISDB setStatus(ODatabase.STATUS iStatus)
ODatabasepublic String getName()
ODatabasepublic String getURL()
ODatabasepublic OStorage getStorage()
ODatabaseInternalgetStorage in interface ODatabaseInternal<T>OStoragepublic OBasicTransaction getMicroOrRegularTransaction()
ODatabaseInternalgetMicroOrRegularTransaction in interface ODatabaseInternal<T>public OLocalRecordCache getLocalCache()
ODatabasegetLocalCache in interface ODatabase<T>public boolean isClosed()
ODatabasepublic long countClusterElements(int iClusterId)
ODatabasecountClusterElements in interface ODatabase<T>iClusterId - Cluster idpublic void truncateCluster(String clusterName)
truncateCluster in interface ODatabase<T>clusterName - Name of cluster to be truncated.public long countClusterElements(int[] iClusterIds)
ODatabasecountClusterElements in interface ODatabase<T>iClusterIds - Array of cluster ids Cluster idpublic long countClusterElements(String iClusterName)
ODatabasecountClusterElements in interface ODatabase<T>iClusterName - Cluster namepublic long countClusterElements(int iClusterId,
boolean countTombstones)
countClusterElements in interface ODatabase<T>public long countClusterElements(int[] iClusterIds,
boolean countTombstones)
countClusterElements in interface ODatabase<T>public int getClusters()
ODatabasegetClusters in interface ODatabase<T>public boolean existsCluster(String iClusterName)
ODatabaseexistsCluster in interface ODatabase<T>iClusterName - Cluster namepublic Collection<String> getClusterNames()
ODatabasegetClusterNames in interface ODatabase<T>public int getClusterIdByName(String iClusterName)
ODatabasegetClusterIdByName in interface ODatabase<T>iClusterName - Cluster namepublic String getClusterNameById(int iClusterId)
ODatabasegetClusterNameById in interface ODatabase<T>iClusterId - Cluster idpublic long getClusterRecordSizeById(int iClusterId)
ODatabasegetClusterRecordSizeById in interface ODatabase<T>iClusterId - Cluster idpublic long getClusterRecordSizeByName(String iClusterName)
ODatabasegetClusterRecordSizeByName in interface ODatabase<T>iClusterName - Cluster namepublic int addCluster(String iClusterName, int iRequestedId)
ODatabaseaddCluster in interface ODatabase<T>iClusterName - Cluster nameiRequestedId - requested id of the clusterpublic int addCluster(String iClusterName, Object... iParameters)
ODatabaseaddCluster in interface ODatabase<T>iClusterName - Cluster nameiParameters - Additional parameters to pass to the factoriespublic boolean dropCluster(String iClusterName)
ODatabasedropCluster in interface ODatabase<T>iClusterName - the name of the clusterpublic boolean dropCluster(int iClusterId)
ODatabasedropCluster in interface ODatabase<T>iClusterId - id of cluster to deletepublic int getDefaultClusterId()
ODatabasegetDefaultClusterId in interface ODatabase<T>public boolean declareIntent(OIntent iIntent)
ODatabasedeclareIntent in interface ODatabase<T>iIntent - The intentpublic OIntent getActiveIntent()
ODatabasegetActiveIntent in interface ODatabase<T>public <DBTYPE extends ODatabase> DBTYPE getUnderlying()
ODatabaseInternalgetUnderlying in interface ODatabaseInternal<T>public ODatabaseInternal<?> getDatabaseOwner()
ODatabaseInternalgetDatabaseOwner in interface ODatabaseInternal<T>public ODatabaseInternal<?> setDatabaseOwner(ODatabaseInternal<?> iOwner)
ODatabaseInternalsetDatabaseOwner in interface ODatabaseInternal<T>public Object setProperty(String iName, Object iValue)
ODatabasesetProperty in interface ODatabase<T>iName - Property nameiValue - new value to setpublic Object getProperty(String iName)
ODatabasegetProperty in interface ODatabase<T>iName - Property namepublic Iterator<Map.Entry<String,Object>> getProperties()
ODatabasegetProperties in interface ODatabase<T>public Object get(ODatabase.ATTRIBUTES iAttribute)
ODatabasepublic <THISDB extends ODatabase> THISDB set(ODatabase.ATTRIBUTES attribute, Object iValue)
ODatabasepublic void registerListener(ODatabaseListener iListener)
ODatabaseregisterListener in interface ODatabase<T>iListener - the listener to registerpublic void unregisterListener(ODatabaseListener iListener)
ODatabaseunregisterListener in interface ODatabase<T>iListener - the listener to unregisterpublic ORecordMetadata getRecordMetadata(ORID rid)
getRecordMetadata in interface ODatabase<T>public long getSize()
ODatabasepublic void freeze(boolean throwException)
ODatabaseAfter this call users can perform only select queries. All write-related commands will
queued till ODatabase.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 ODatabase<T>throwException - If true OModificationOperationProhibitedException
exception will be thrown in case of write command will be performed.public void freeze()
ODatabaseAfter this call users can perform only idempotent calls like read records and
select/traverse queries. All write-related operations will queued till ODatabase.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 ODatabase<T>ODatabase.release()public void release()
ODatabaseODatabase.freeze() command.release in interface ODatabase<T>ODatabase.freeze()protected void checkOpenness()
Copyright © 2009–2025 OrientDB. All rights reserved.