Package com.arcadedb.server
Class ServerDatabase
- java.lang.Object
-
- com.arcadedb.server.ServerDatabase
-
- All Implemented Interfaces:
BasicDatabase
,Database
,DatabaseInternal
,AutoCloseable
public class ServerDatabase extends Object implements DatabaseInternal
Wrapper of database returned from the server when runs embedded that prevents the close(), drop() and kill() by the user.- Author:
- Luca Garulli ([email protected])
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.arcadedb.database.BasicDatabase
BasicDatabase.TransactionScope
-
Nested classes/interfaces inherited from interface com.arcadedb.database.Database
Database.TRANSACTION_ISOLATION_LEVEL
-
Nested classes/interfaces inherited from interface com.arcadedb.database.DatabaseInternal
DatabaseInternal.CALLBACK_EVENT
-
-
Constructor Summary
Constructors Constructor Description ServerDatabase(DatabaseInternal wrapped)
-
Method Summary
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.arcadedb.database.DatabaseInternal
getTransaction
-
-
-
-
Constructor Detail
-
ServerDatabase
public ServerDatabase(DatabaseInternal wrapped)
-
-
Method Detail
-
getWrappedDatabaseInstance
public DatabaseInternal getWrappedDatabaseInstance()
- Specified by:
getWrappedDatabaseInstance
in interfaceDatabaseInternal
-
drop
public void drop()
- Specified by:
drop
in interfaceBasicDatabase
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceBasicDatabase
-
kill
public void kill()
- Specified by:
kill
in interfaceDatabaseInternal
-
async
public DatabaseAsyncExecutor async()
-
getStats
public Map<String,Object> getStats()
- Specified by:
getStats
in interfaceBasicDatabase
-
getDatabasePath
public String getDatabasePath()
- Specified by:
getDatabasePath
in interfaceBasicDatabase
-
getCurrentUserName
public String getCurrentUserName()
- Specified by:
getCurrentUserName
in interfaceDatabase
-
alignToReplicas
public Map<String,Object> alignToReplicas()
- Specified by:
alignToReplicas
in interfaceDatabaseInternal
-
invokeAfterReadEvents
public Record invokeAfterReadEvents(Record record)
- Specified by:
invokeAfterReadEvents
in interfaceDatabaseInternal
-
getTransactionIfExists
public TransactionContext getTransactionIfExists()
- Specified by:
getTransactionIfExists
in interfaceDatabaseInternal
-
begin
public void begin()
- Specified by:
begin
in interfaceBasicDatabase
-
begin
public void begin(Database.TRANSACTION_ISOLATION_LEVEL isolationLevel)
- Specified by:
begin
in interfaceBasicDatabase
-
commit
public void commit()
- Specified by:
commit
in interfaceBasicDatabase
-
rollback
public void rollback()
- Specified by:
rollback
in interfaceBasicDatabase
-
rollbackAllNested
public void rollbackAllNested()
- Specified by:
rollbackAllNested
in interfaceDatabase
-
countBucket
public long countBucket(String bucketName)
- Specified by:
countBucket
in interfaceBasicDatabase
-
countType
public long countType(String typeName, boolean polymorphic)
- Specified by:
countType
in interfaceBasicDatabase
-
scanType
public void scanType(String typeName, boolean polymorphic, DocumentCallback callback)
-
scanType
public void scanType(String typeName, boolean polymorphic, DocumentCallback callback, ErrorRecordCallback errorRecordCallback)
-
scanBucket
public void scanBucket(String bucketName, RecordCallback callback)
- Specified by:
scanBucket
in interfaceDatabase
-
scanBucket
public void scanBucket(String bucketName, RecordCallback callback, ErrorRecordCallback errorRecordCallback)
- Specified by:
scanBucket
in interfaceDatabase
-
iterateType
public Iterator<Record> iterateType(String typeName, boolean polymorphic)
- Specified by:
iterateType
in interfaceBasicDatabase
-
iterateBucket
public Iterator<Record> iterateBucket(String bucketName)
- Specified by:
iterateBucket
in interfaceBasicDatabase
-
checkPermissionsOnDatabase
public void checkPermissionsOnDatabase(SecurityDatabaseUser.DATABASE_ACCESS access)
- Specified by:
checkPermissionsOnDatabase
in interfaceDatabaseInternal
-
checkPermissionsOnFile
public void checkPermissionsOnFile(int fileId, SecurityDatabaseUser.ACCESS access)
- Specified by:
checkPermissionsOnFile
in interfaceDatabaseInternal
-
getResultSetLimit
public long getResultSetLimit()
- Specified by:
getResultSetLimit
in interfaceDatabaseInternal
-
getReadTimeout
public long getReadTimeout()
- Specified by:
getReadTimeout
in interfaceDatabaseInternal
-
existsRecord
public boolean existsRecord(RID rid)
- Specified by:
existsRecord
in interfaceBasicDatabase
-
lookupByRID
public Record lookupByRID(RID rid, boolean loadContent)
- Specified by:
lookupByRID
in interfaceBasicDatabase
-
lookupByKey
public IndexCursor lookupByKey(String type, String keyName, Object keyValue)
- Specified by:
lookupByKey
in interfaceDatabase
-
lookupByKey
public IndexCursor lookupByKey(String type, String[] keyNames, Object[] keyValues)
- Specified by:
lookupByKey
in interfaceDatabase
-
registerCallback
public void registerCallback(DatabaseInternal.CALLBACK_EVENT event, Callable<Void> callback)
- Specified by:
registerCallback
in interfaceDatabaseInternal
-
unregisterCallback
public void unregisterCallback(DatabaseInternal.CALLBACK_EVENT event, Callable<Void> callback)
- Specified by:
unregisterCallback
in interfaceDatabaseInternal
-
getGraphEngine
public GraphEngine getGraphEngine()
- Specified by:
getGraphEngine
in interfaceDatabaseInternal
-
getTransactionManager
public TransactionManager getTransactionManager()
- Specified by:
getTransactionManager
in interfaceDatabaseInternal
-
isReadYourWrites
public boolean isReadYourWrites()
- Specified by:
isReadYourWrites
in interfaceDatabase
-
setReadYourWrites
public Database setReadYourWrites(boolean readYourWrites)
- Specified by:
setReadYourWrites
in interfaceDatabase
-
setTransactionIsolationLevel
public Database setTransactionIsolationLevel(Database.TRANSACTION_ISOLATION_LEVEL level)
- Specified by:
setTransactionIsolationLevel
in interfaceDatabase
-
getTransactionIsolationLevel
public Database.TRANSACTION_ISOLATION_LEVEL getTransactionIsolationLevel()
- Specified by:
getTransactionIsolationLevel
in interfaceDatabase
-
getEdgeListSize
public int getEdgeListSize()
- Specified by:
getEdgeListSize
in interfaceDatabase
-
setWALFlush
public Database setWALFlush(WALFile.FLUSH_TYPE flush)
- Specified by:
setWALFlush
in interfaceDatabase
-
isAsyncFlush
public boolean isAsyncFlush()
- Specified by:
isAsyncFlush
in interfaceDatabase
-
setAsyncFlush
public Database setAsyncFlush(boolean value)
- Specified by:
setAsyncFlush
in interfaceDatabase
-
createRecord
public void createRecord(MutableDocument record)
- Specified by:
createRecord
in interfaceDatabaseInternal
-
createRecord
public void createRecord(Record record, String bucketName)
- Specified by:
createRecord
in interfaceDatabaseInternal
-
createRecordNoLock
public void createRecordNoLock(Record record, String bucketName, boolean discardRecordAfter)
- Specified by:
createRecordNoLock
in interfaceDatabaseInternal
-
updateRecord
public void updateRecord(Record record)
- Specified by:
updateRecord
in interfaceDatabaseInternal
-
updateRecordNoLock
public void updateRecordNoLock(Record record, boolean discardRecordAfter)
- Specified by:
updateRecordNoLock
in interfaceDatabaseInternal
-
deleteRecordNoLock
public void deleteRecordNoLock(Record record)
- Specified by:
deleteRecordNoLock
in interfaceDatabaseInternal
-
deleteRecord
public void deleteRecord(Record record)
- Specified by:
deleteRecord
in interfaceBasicDatabase
-
isTransactionActive
public boolean isTransactionActive()
- Specified by:
isTransactionActive
in interfaceBasicDatabase
-
getNestedTransactions
public int getNestedTransactions()
- Specified by:
getNestedTransactions
in interfaceBasicDatabase
-
transaction
public void transaction(BasicDatabase.TransactionScope txBlock)
- Specified by:
transaction
in interfaceBasicDatabase
-
transaction
public boolean transaction(BasicDatabase.TransactionScope txBlock, boolean joinCurrentTx)
- Specified by:
transaction
in interfaceBasicDatabase
-
transaction
public boolean transaction(BasicDatabase.TransactionScope txBlock, boolean joinCurrentTx, int retries)
- Specified by:
transaction
in interfaceBasicDatabase
-
transaction
public boolean transaction(BasicDatabase.TransactionScope txBlock, boolean joinCurrentTx, int attempts, OkCallback ok, ErrorCallback error)
- Specified by:
transaction
in interfaceBasicDatabase
-
getRecordFactory
public RecordFactory getRecordFactory()
- Specified by:
getRecordFactory
in interfaceDatabaseInternal
-
getSchema
public Schema getSchema()
- Specified by:
getSchema
in interfaceBasicDatabase
- Specified by:
getSchema
in interfaceDatabase
-
getEvents
public RecordEvents getEvents()
-
getSerializer
public BinarySerializer getSerializer()
- Specified by:
getSerializer
in interfaceDatabaseInternal
-
getPageManager
public PageManager getPageManager()
- Specified by:
getPageManager
in interfaceDatabaseInternal
-
newDocument
public MutableDocument newDocument(String typeName)
- Specified by:
newDocument
in interfaceBasicDatabase
-
newEmbeddedDocument
public MutableEmbeddedDocument newEmbeddedDocument(EmbeddedModifier modifier, String typeName)
- Specified by:
newEmbeddedDocument
in interfaceDatabaseInternal
-
newVertex
public MutableVertex newVertex(String typeName)
- Specified by:
newVertex
in interfaceBasicDatabase
-
newEdgeByKeys
public Edge newEdgeByKeys(String sourceVertexType, String[] sourceVertexKeyNames, Object[] sourceVertexKeyValues, String destinationVertexType, String[] destinationVertexKeyNames, Object[] destinationVertexKeyValues, boolean createVertexIfNotExist, String edgeType, boolean bidirectional, Object... properties)
- Specified by:
newEdgeByKeys
in interfaceDatabase
-
newEdgeByKeys
public Edge newEdgeByKeys(Vertex sourceVertex, String destinationVertexType, String[] destinationVertexKeyNames, Object[] destinationVertexKeyValues, boolean createVertexIfNotExist, String edgeType, boolean bidirectional, Object... properties)
- Specified by:
newEdgeByKeys
in interfaceDatabase
-
getQueryEngine
public QueryEngine getQueryEngine(String language)
- Specified by:
getQueryEngine
in interfaceDatabase
-
isAutoTransaction
public boolean isAutoTransaction()
- Specified by:
isAutoTransaction
in interfaceDatabase
-
setAutoTransaction
public void setAutoTransaction(boolean autoTransaction)
- Specified by:
setAutoTransaction
in interfaceDatabase
-
getFileManager
public FileManager getFileManager()
- Specified by:
getFileManager
in interfaceDatabaseInternal
-
getName
public String getName()
- Specified by:
getName
in interfaceBasicDatabase
-
getMode
public ComponentFile.MODE getMode()
-
checkTransactionIsActive
public boolean checkTransactionIsActive(boolean createTx)
- Specified by:
checkTransactionIsActive
in interfaceDatabaseInternal
-
isAsyncProcessing
public boolean isAsyncProcessing()
- Specified by:
isAsyncProcessing
in interfaceDatabaseInternal
-
getIndexer
public DocumentIndexer getIndexer()
- Specified by:
getIndexer
in interfaceDatabaseInternal
-
command
public ResultSet command(String language, String query, ContextConfiguration configuration, Object... args)
- Specified by:
command
in interfaceBasicDatabase
-
command
public ResultSet command(String language, String query, Object... parameters)
- Specified by:
command
in interfaceBasicDatabase
-
command
public ResultSet command(String language, String query, Map<String,Object> parameters)
- Specified by:
command
in interfaceBasicDatabase
-
command
public ResultSet command(String language, String query, ContextConfiguration configuration, Map<String,Object> args)
- Specified by:
command
in interfaceBasicDatabase
- Specified by:
command
in interfaceDatabase
-
execute
@Deprecated public ResultSet execute(String language, String script, Map<String,Object> params)
Deprecated.
-
execute
@Deprecated public ResultSet execute(String language, String script, Object... args)
Deprecated.- Specified by:
execute
in interfaceBasicDatabase
-
query
public ResultSet query(String language, String query, Object... parameters)
- Specified by:
query
in interfaceBasicDatabase
-
query
public ResultSet query(String language, String query, Map<String,Object> parameters)
- Specified by:
query
in interfaceBasicDatabase
-
getContext
public DatabaseContext.DatabaseContextTL getContext()
- Specified by:
getContext
in interfaceDatabaseInternal
-
executeInReadLock
public <RET> RET executeInReadLock(Callable<RET> callable)
- Specified by:
executeInReadLock
in interfaceDatabase
-
executeInWriteLock
public <RET> RET executeInWriteLock(Callable<RET> callable)
- Specified by:
executeInWriteLock
in interfaceDatabase
-
executeLockingFiles
public <RET> RET executeLockingFiles(Collection<Integer> fileIds, Callable<RET> callable)
- Specified by:
executeLockingFiles
in interfaceDatabaseInternal
-
recordFileChanges
public <RET> RET recordFileChanges(Callable<Object> callback)
- Specified by:
recordFileChanges
in interfaceDatabaseInternal
-
saveConfiguration
public void saveConfiguration() throws IOException
- Specified by:
saveConfiguration
in interfaceDatabaseInternal
- Throws:
IOException
-
getStatementCache
public StatementCache getStatementCache()
- Specified by:
getStatementCache
in interfaceDatabaseInternal
-
getExecutionPlanCache
public ExecutionPlanCache getExecutionPlanCache()
- Specified by:
getExecutionPlanCache
in interfaceDatabaseInternal
-
getWALFileFactory
public WALFileFactory getWALFileFactory()
- Specified by:
getWALFileFactory
in interfaceDatabaseInternal
-
executeCallbacks
public void executeCallbacks(DatabaseInternal.CALLBACK_EVENT event) throws IOException
- Specified by:
executeCallbacks
in interfaceDatabaseInternal
- Throws:
IOException
-
getEmbedded
public DatabaseInternal getEmbedded()
- Specified by:
getEmbedded
in interfaceDatabaseInternal
-
getConfiguration
public ContextConfiguration getConfiguration()
- Specified by:
getConfiguration
in interfaceDatabase
-
isOpen
public boolean isOpen()
- Specified by:
isOpen
in interfaceBasicDatabase
-
setEdgeListSize
public Database setEdgeListSize(int size)
- Specified by:
setEdgeListSize
in interfaceDatabase
-
getNewEdgeListSize
public int getNewEdgeListSize(int previousSize)
- Specified by:
getNewEdgeListSize
in interfaceDatabaseInternal
-
getWrappers
public Map<String,Object> getWrappers()
- Specified by:
getWrappers
in interfaceDatabaseInternal
-
setWrapper
public void setWrapper(String name, Object instance)
- Specified by:
setWrapper
in interfaceDatabaseInternal
-
-