public class ODatabaseDocumentRemote extends ODatabaseDocumentAbstract
ODatabase.ATTRIBUTES, ODatabase.OPERATION_MODE, ODatabase.STATUS
Modifier and Type | Field and Description |
---|---|
protected OStorageRemoteSession |
sessionMetadata |
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 |
---|
ODatabaseDocumentRemote(OStorageRemote storage) |
Modifier and Type | Method and Description |
---|---|
int |
addBlobCluster(String iClusterName,
Object... iParameters)
Adds a new cluster for store blobs.
|
void |
afterCreateOperations(OIdentifiable id) |
void |
afterDeleteOperations(OIdentifiable id) |
void |
afterReadOperations(OIdentifiable identifiable) |
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) |
ODatabaseDocumentAbstract |
begin(OTransaction.TXTYPE iType)
Begins a new transaction specifying the transaction type.
|
protected OMicroTransaction |
beginMicroTransaction() |
<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)
Checks if the operation on a resource is allowed for the current user.
|
<DB extends ODatabaseDocument> |
checkSecurity(String iResourceGeneric,
int iOperation,
Object... iResourcesSpecific)
Checks if the operation against multiple resources is allowed for the current user.
|
<DB extends ODatabaseDocument> |
checkSecurity(String iResourceGeneric,
int iOperation,
Object iResourceSpecific)
Checks if the operation on a resource is allowed for the current user.
|
void |
closeQuery(String queryId) |
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() |
<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.
|
static void |
deInit(OStorageRemote storage) |
ODatabaseDocumentAbstract |
delete(ORecord record)
Deletes an entity from the database in synchronous mode.
|
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 record,
int iVersion,
boolean iRequired,
ODatabase.OPERATION_MODE iMode,
boolean prohibitTombstones) |
<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.
|
void |
fetchNextPage(ORemoteResultSet rs) |
String |
getClusterName(ORecord record) |
OStorageRemoteSession |
getSessionMetadata() |
OStorageRemote |
getStorage()
Returns the underlying storage implementation.
|
OStorageInfo |
getStorageInfo() |
OResultSet |
indexQuery(String indexName,
String query,
Object... args) |
void |
internalLockRecord(OIdentifiable iRecord,
OStorage.LOCKING_STRATEGY lockingStrategy) |
void |
internalOpen(String user,
String password,
OrientDBConfig config,
OSharedContext ctx) |
void |
internalUnlockRecord(OIdentifiable iRecord) |
boolean |
isRemote() |
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 ctx) |
<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.
|
OResultSet |
query(String query,
Map args)
Executes an SQL query (idempotent).
|
OResultSet |
query(String query,
Object[] args)
Executes an SQL query.
|
void |
recycle(ORecord record) |
void |
replaceStorage(OStorage iNewStorage)
Internal only: replace the storage with a new one.
|
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
|
<DB extends ODatabase> |
setCustom(String name,
Object iValue) |
void |
setSessionMetadata(OStorageRemoteSession sessionMetadata) |
void |
unlock(ORID recordId)
Pessimistic unlock
|
static void |
updateFunction(OStorageRemote storage) |
static void |
updateIndexManager(OStorageRemote storage,
ODocument indexManager) |
static void |
updateSchema(OStorageRemote storage,
ODocument schema) |
static void |
updateSequences(OStorageRemote storage) |
activateOnCurrentThread, addCluster, addCluster, afterCommitOperations, afterRollbackOperations, assignAndCheckCluster, backup, beforeCommitOperations, beforeRollbackOperations, begin, begin, browseClass, browseClass, browseCluster, browseCluster, browseCluster, browseCluster, browseCluster, callbackHookFailure, callbackHookFinalize, callbackHooks, callbackHookSuccess, callOnCloseListeners, callOnDropListeners, callOnOpenListeners, checkClusterSecurity, checkForClusterPermissions, checkIfActive, checkOpenness, checkRecordClass, 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, getViewFromCluster, incrementalBackup, init, internalClose, internalCommit, isActiveOnCurrentThread, isClosed, 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, unregisterHook
browseListeners, getListenersCopy, registerListener, resetListeners, unregisterListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getHaStatus, isDistributed, queryOnNode, realClose, removeHaServer, reuse, sync, syncCommit
createClassIfNotExist, createEdgeClass, createVertexClass, newEdge, newVertex
createClass, executeWithRetry, getClass, registerListener, unregisterListener
getActiveClusterMap, getActiveDataCenterMap, getEnterpriseEndpoint, getLocalNodeName, isSharded
protected OStorageRemoteSession sessionMetadata
public ODatabaseDocumentRemote(OStorageRemote storage)
public <DB extends ODatabase> DB open(String iUserName, String iUserPassword)
ODatabase
iUserName
- Username to loginiUserPassword
- Password associated to the user@Deprecated public <DB extends ODatabase> DB open(OToken iToken)
ODatabaseInternal
iToken
- Authentication tokenpublic <DB extends ODatabase> DB create()
ODatabase
public <DB extends ODatabase> DB create(String incrementalBackupPath)
ODatabase
DB
- Concrete database instance type.incrementalBackupPath
- Path to incremental backuppublic <DB extends ODatabase> DB create(Map<OGlobalConfiguration,Object> iInitialSettings)
ODatabase
public void drop()
ODatabase
public <DB extends ODatabase> DB set(ODatabase.ATTRIBUTES iAttribute, Object iValue)
ODatabase
iAttribute
- Attributes between #ATTRIBUTES enumiValue
- Value to setpublic ODatabaseDocumentInternal copy()
public boolean exists()
ODatabase
public void internalOpen(String user, String password, OrientDBConfig config, OSharedContext ctx)
protected void loadMetadata()
loadMetadata
in class ODatabaseDocumentAbstract
protected void loadMetadata(OSharedContext ctx)
loadMetadata
in class ODatabaseDocumentAbstract
public ODatabaseDocumentAbstract begin(OTransaction.TXTYPE iType)
ODatabase
ODatabase.commit()
or ODatabase.rollback()
.begin
in interface ODatabase<ORecord>
begin
in class ODatabaseDocumentAbstract
public OStorageRemoteSession getSessionMetadata()
public void setSessionMetadata(OStorageRemoteSession sessionMetadata)
public OStorageRemote getStorage()
ODatabaseInternal
OStorage
public OStorageInfo getStorageInfo()
public void replaceStorage(OStorage iNewStorage)
ODatabaseInternal
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();
query
- the query stringargs
- query parameters (positional)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();
query
- the query stringargs
- query parameters (named)public OResultSet indexQuery(String indexName, String query, Object... args)
public OResultSet command(String query, Object... args)
ODatabase
OResultSet rs = db.command("INSERT INTO Person SET name = ?", "John"); ... rs.close();
args
- query argumentspublic 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) throws OCommandExecutionException, OCommandScriptException
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 = ?;";
OCommandExecutionException
OCommandScriptException
public OResultSet execute(String language, String script, Map<String,?> args) throws OCommandExecutionException, OCommandScriptException
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");
OCommandExecutionException
OCommandScriptException
public void closeQuery(String queryId)
public void fetchNextPage(ORemoteResultSet rs)
public OLiveQueryMonitor live(String query, OLiveQueryResultListener listener, Object... args)
ODatabase
query
- live querylistener
- the listener that receive the query resultsargs
- the live query argspublic OLiveQueryMonitor live(String query, OLiveQueryResultListener listener, Map<String,?> args)
ODatabase
query
- live querylistener
- the listener that receive the query resultsargs
- the live query argspublic void recycle(ORecord record)
protected OMicroTransaction beginMicroTransaction()
public static void deInit(OStorageRemote storage)
public static void updateSchema(OStorageRemote storage, ODocument schema)
public static void updateIndexManager(OStorageRemote storage, ODocument indexManager)
public static void updateFunction(OStorageRemote storage)
public static void updateSequences(OStorageRemote storage)
public int addBlobCluster(String iClusterName, Object... iParameters)
ODatabase
iClusterName
- Cluster nameiParameters
- Additional parameters to pass to the factoriespublic void executeDeleteRecord(OIdentifiable record, int iVersion, boolean iRequired, ODatabase.OPERATION_MODE iMode, boolean prohibitTombstones)
public OIdentifiable beforeCreateOperations(OIdentifiable id, String iClusterName)
public OIdentifiable beforeUpdateOperations(OIdentifiable id, String iClusterName)
public void beforeDeleteOperations(OIdentifiable id, String iClusterName)
public void afterUpdateOperations(OIdentifiable id)
public void afterCreateOperations(OIdentifiable id)
public void afterDeleteOperations(OIdentifiable id)
public boolean beforeReadOperations(OIdentifiable identifiable)
public void afterReadOperations(OIdentifiable identifiable)
public ORecord saveAll(ORecord iRecord, String iClusterName, ODatabase.OPERATION_MODE iMode, boolean iForceCreate, ORecordCallback<? extends Number> iRecordCreatedCallback, ORecordCallback<Integer> iRecordUpdatedCallback)
public <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 ODatabaseDocumentInternal
executeReadRecord
in class ODatabaseDocumentAbstract
public void internalLockRecord(OIdentifiable iRecord, OStorage.LOCKING_STRATEGY lockingStrategy)
public void internalUnlockRecord(OIdentifiable iRecord)
public <RET extends ORecord> RET lock(ORID recordId) throws OLockException
ODatabase
In 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.
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
ODatabase
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
ODatabase
recordId
- the id of the record to unlockOLockException
- if the record is not locked.public <T> T sendSequenceAction(OSequenceAction action) throws ExecutionException, InterruptedException
public ODatabaseDocumentAbstract delete(ORecord record)
ODatabase
record
- The entity to delete.public <DB extends ODatabaseDocument> DB checkSecurity(ORule.ResourceGeneric resourceGeneric, String resourceSpecific, int iOperation)
ODatabaseDocument
resourceGeneric
- Generic Resource where to execute the operationiOperation
- Operation to execute against the resourcepublic <DB extends ODatabaseDocument> DB checkSecurity(ORule.ResourceGeneric iResourceGeneric, int iOperation, Object iResourceSpecific)
ODatabaseDocument
iResourceGeneric
- 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 <DB extends ODatabaseDocument> DB checkSecurity(ORule.ResourceGeneric iResourceGeneric, int iOperation, Object... iResourcesSpecific)
ODatabaseDocument
iResourceGeneric
- 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(String iResource, int iOperation)
ODatabaseDocument
iResource
- Resource where to execute the operationiOperation
- Operation to execute against the resourcepublic <DB extends ODatabaseDocument> DB checkSecurity(String iResourceGeneric, int iOperation, Object iResourceSpecific)
ODatabaseDocument
iResourceGeneric
- 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 <DB extends ODatabaseDocument> DB checkSecurity(String iResourceGeneric, int iOperation, Object... iResourcesSpecific)
ODatabaseDocument
iResourceGeneric
- 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 isRemote()
Copyright © 2009–2020 OrientDB. All rights reserved.