public class ODatabaseDocumentEmbedded extends ODatabaseDocumentAbstract implements OQueryLifecycleListener
ODatabase.ATTRIBUTES, ODatabase.OPERATION_MODE, ODatabase.STATUS
activeQueries, componentsFactory, currentIntent, currentTx, databaseOwner, hooks, hooksByScope, inHook, initialized, localCache, metadata, microTransaction, properties, recordType, retainRecords, serializer, sharedContext, status, unmodifiableHooks, url, user
TYPE
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.
|
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() |
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.
|
protected void |
createMetadata() |
static void |
deInit(OAbstractPaginatedStorage storage) |
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:
Map<String, Object> params = new HashMapMap<>(); params.put("surname1", "Jones"); params.put("surname2", "May");
params.put("surname3", "Ali");
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();
|
OResultSet |
execute(String language,
String script,
Object... args)
Execute a script in a specified query language.
|
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.
|
<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.
|
boolean |
exists()
Checks if the database exists.
|
OrientDBConfig |
getConfig() |
OStorage |
getStorage()
Returns the underlying storage implementation.
|
void |
init(OrientDBConfig config) |
protected void |
installHooksEmbedded() |
void |
internalCreate(OrientDBConfig config) |
void |
internalOpen(String iUserName,
String iUserPassword) |
void |
internalOpen(String iUserName,
String iUserPassword,
boolean checkPassword) |
boolean |
isClosed()
Checks if the database is closed.
|
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() |
<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.
|
<DB extends ODatabase> |
set(ODatabase.ATTRIBUTES iAttribute,
Object iValue)
Sets a database attribute value
|
<DB extends ODatabase> |
setCustom(String name,
Object iValue) |
activateOnCurrentThread, addCluster, addCluster, assignAndCheckCluster, backup, beforeCommitOperations, beforeRollbackOperations, begin, begin, begin, browseClass, browseClass, browseCluster, browseCluster, browseCluster, browseCluster, browseCluster, callbackHookFailure, callbackHookFinalize, callbackHooks, callbackHookSuccess, callOnCloseListeners, callOnDropListeners, callOnOpenListeners, checkClusterSecurity, checkForClusterPermissions, checkIfActive, checkOpenness, checkRecordClass, checkSecurity, checkSecurity, checkSecurity, checkSecurity, checkSecurity, checkSecurity, cleanOutRecord, clearDocumentTracking, close, closeActiveQueries, command, commit, commit, countClass, countClass, countClusterElements, countClusterElements, countClusterElements, countClusterElements, countClusterElements, declareIntent, delete, delete, delete, delete, dropCluster, dropCluster, executeHideRecord, executeReadRecord, executeSaveEmptyRecord, 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, hide, incrementalBackup, init, internalClose, internalCommit, isActiveOnCurrentThread, isClusterEdge, isClusterVertex, isMVCC, isPooled, isPrefetchRecords, isRetainRecords, isUseLightweightEdges, isValidationEnabled, load, load, load, load, load, load, load, load, load, load, loadIfVersionIsNotLatest, newBlob, newBlob, newEdge, newEdge, newElement, newElement, newElement, newInstance, newInstance, newLightweightEdge, newRegularEdge, newVertex, newVertex, 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, unregisterHook
browseListeners, getListenersCopy, registerListener, resetListeners, unregisterListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
queryClosed, queryStarted
getHaStatus, indexQuery, queryOnNode, realClose, removeHaServer, reuse
createClassIfNotExist, createEdgeClass, createVertexClass, newEdge, newVertex
createClass, executeWithRetry, getClass, registerListener, unregisterListener
getActiveClusterMap, getActiveDataCenterMap, getEnterpriseEndpoint, getLocalNodeName, isSharded
public ODatabaseDocumentEmbedded(OStorage storage)
public <DB extends ODatabase> DB open(String iUserName, String iUserPassword)
ODatabase
public void init(OrientDBConfig config)
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()
ODatabase
public void internalCreate(OrientDBConfig config)
public void callOnCreateListeners()
protected void createMetadata()
protected void loadMetadata()
loadMetadata
in class ODatabaseDocumentAbstract
public <DB extends ODatabase> DB set(ODatabase.ATTRIBUTES iAttribute, Object iValue)
ODatabase
public <DB extends ODatabase> DB setCustom(String name, Object iValue)
setCustom
in interface ODatabaseDocumentInternal
public <DB extends ODatabase> DB create(String incrementalBackupPath)
public <DB extends ODatabase> DB create(Map<OGlobalConfiguration,Object> iInitialSettings)
ODatabase
public ODatabaseDocumentInternal copy()
copy
in interface ODatabaseDocumentInternal
public boolean exists()
ODatabase
public boolean isClosed()
ODatabase
isClosed
in interface ODatabase<ORecord>
isClosed
in class ODatabaseDocumentAbstract
public void rebuildIndexes()
protected void installHooksEmbedded()
public OStorage getStorage()
ODatabaseInternal
getStorage
in interface ODatabaseInternal<ORecord>
OStorage
public void replaceStorage(OStorage iNewStorage)
ODatabaseInternal
replaceStorage
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)
ODatabase
public OLiveQueryMonitor live(String query, OLiveQueryResultListener listener, Map<String,?> args)
ODatabase
public void recycle(ORecord record)
recycle
in interface ODatabaseDocumentInternal
protected OMicroTransaction beginMicroTransaction()
public static void deInit(OAbstractPaginatedStorage storage)
public int addBlobCluster(String iClusterName, Object... iParameters)
ODatabase
addBlobCluster
in interface ODatabaseDocument
addBlobCluster
in interface ODatabase<ORecord>
iClusterName
- Cluster nameiParameters
- Additional parameters to pass to the factoriespublic void executeDeleteRecord(OIdentifiable record, int iVersion, boolean iRequired, ODatabase.OPERATION_MODE iMode, boolean prohibitTombstones)
executeDeleteRecord
in interface ODatabaseDocumentInternal
executeDeleteRecord
in class ODatabaseDocumentAbstract
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)
executeSaveRecord
in interface ODatabaseDocumentInternal
executeSaveRecord
in class ODatabaseDocumentAbstract
public 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 OIdentifiable beforeCreateOperations(OIdentifiable id, String iClusterName)
beforeCreateOperations
in interface ODatabaseDocumentInternal
public OIdentifiable beforeUpdateOperations(OIdentifiable id, String iClusterName)
beforeUpdateOperations
in interface ODatabaseDocumentInternal
public void beforeDeleteOperations(OIdentifiable id, String iClusterName)
beforeDeleteOperations
in interface ODatabaseDocumentInternal
public void afterCreateOperations(OIdentifiable id)
afterCreateOperations
in interface ODatabaseDocumentInternal
public void afterUpdateOperations(OIdentifiable id)
afterUpdateOperations
in interface ODatabaseDocumentInternal
public void afterDeleteOperations(OIdentifiable id)
afterDeleteOperations
in interface ODatabaseDocumentInternal
public void afterReadOperations(OIdentifiable identifiable)
afterReadOperations
in interface ODatabaseDocumentInternal
public boolean beforeReadOperations(OIdentifiable identifiable)
beforeReadOperations
in interface ODatabaseDocumentInternal
protected void afterCommitOperations()
afterCommitOperations
in class ODatabaseDocumentAbstract
protected void afterRollbackOperations()
afterRollbackOperations
in class ODatabaseDocumentAbstract
Copyright © 2009–2020 OrientDB. All rights reserved.