Package com.c8db
Interface C8Database
-
- All Superinterfaces:
C8SerializationAccessor
- All Known Implementing Classes:
C8DatabaseImpl
public interface C8Database extends C8SerializationAccessor
Interface for operations on C8DB database level.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StreamTransactionEntityabortStreamTransaction(String id)Aborts a Stream Transaction.C8Adminadmin()Returns aC8Admininstance.C8ApiKeysapiKeys()Returns aC8ApiKeysinstance.StreamTransactionEntitybeginStreamTransaction(StreamTransactionOptions options)Begins a Stream Transaction.C8DBc8db()Return the main entry point for the C8DB drivervoidclearBacklog()Clear backlog for all streams on a stream db.voidclearBacklog(String subscriptionName)Clear backlog for given subscription.voidclearSlowQueries()Clears the list of slow AQL queriesC8Collectioncollection(String name)Returns aArangoCollectioninstance for the given collection name.StreamTransactionEntitycommitStreamTransaction(String id)Commits a Stream Transaction.Booleancreate()Creates the databaseBooleancreate(String geoFabric)Create a geofabric/db in Demo tenantCollectionEntitycreateCollection(String name)Creates a collection for the given collection's name, then returns collection information from the server.CollectionEntitycreateCollection(String name, CollectionCreateOptions options)Creates a collection with the givenoptionsfor this collection's name, then returns collection information from the server.GraphEntitycreateGraph(String name, Collection<EdgeDefinition> edgeDefinitions)Create a new graph in the graph module.GraphEntitycreateGraph(String name, Collection<EdgeDefinition> edgeDefinitions, GraphCreateOptions options)Create a new graph in the graph module.voidcreatePersistentStream(String name, C8StreamCreateOptions options)Create asynchronously a persistent stream for a given fabric.UserQueryEntitycreateUserQuery(UserQueryOptions userQueryDefinition)Creates user query as the current userUserQueryEntitycreateUserQuery(UserQueryOptions userQueryDefinition, String user)Creates user query as a given user.<T> C8Cursor<T>cursor(String cursorId, Class<T> type)Return an cursor from the given cursor-ID if still existingStringdeleteIndex(String id)Deletes an indexBooleandrop()Deletes the database from the server.C8Eventevent()<V,E>
TraversalEntity<V,E>executeTraversal(Class<V> vertexClass, Class<E> edgeClass, TraversalOptions options)Execute a server-side traversal<T> C8Cursor<T>executeUserQuery(String userName, String name, Map<String,Object> bindVars, Class<T> type)Executes a saved using query using the givennameandbindVars, then returns a newC8Cursorinstance for the result list.booleanexists()Checks whether the database existsC8qlExecutionExplainEntityexplainQuery(String query, Map<String,Object> bindVars, C8qlQueryExplainOptions options)Explain an AQL query and return information about itCollection<String>getAccessibleGeoFabrics()Retrieves a list of all databases the current user can accessCollection<CollectionEntity>getCollections()Fetches all collections from the database and returns an list of collection descriptions.Collection<CollectionEntity>getCollections(CollectionsReadOptions options)Fetches all collections from the database and returns an list of collection descriptions.Collection<QueryEntity>getCurrentlyRunningQueries()Returns a list of currently running AQL queries<T> TgetDocument(String id, Class<T> type)Reads a single document<T> TgetDocument(String id, Class<T> type, DocumentReadOptions options)Reads a single documentCollection<GraphEntity>getGraphs()Lists all graphs known to the graph moduleIndexEntitygetIndex(String id)Returns an indexDatabaseEntitygetInfo()Retrieves information about the current databasePermissionsgetPermissions(String user)Get specific database access levelCollection<C8StreamEntity>getPersistentStreams(C8StreamCreateOptions options)Get list of persistent streams under the given stream db.QueryTrackingPropertiesEntitygetQueryTrackingProperties()Returns the configuration for the AQL query trackingCollection<QueryEntity>getSlowQueries()Returns a list of slow running AQL queriesCollection<C8StreamEntity>getStreams()Get list of all streams under given database.StreamTransactionEntitygetStreamTransaction(String id)Gets information about a Stream Transaction.Collection<TransactionEntity>getStreamTransactions()Gets all the currently running Stream Transactions.C8DBVersiongetVersion()Returns the server name and version number.voidgrantAccess(String user)Grants access to the database for useruser.voidgrantAccess(String user, Permissions permissions)Grants or revoke access to the database for useruser.C8Graphgraph(String name)Returns aArangoGraphinstance for the given graph name.voidkillQuery(String id)Kills a running query.Stringname()Returns the name of the databaseC8qlParseEntityparseQuery(String query)Parse an AQL query and return information about it This method is for query validation only.<T> C8Cursor<T>query(String query, C8qlQueryOptions options, Class<T> type)Performs a database query using the givenquery, then returns a newArangoCursorinstance for the result list.<T> C8Cursor<T>query(String query, Class<T> type)Performs a database query using the givenquery, then returns a newArangoCursorinstance for the result list.<T> C8Cursor<T>query(String query, Map<String,Object> bindVars, C8qlQueryOptions options, Class<T> type)Performs a database query using the givenqueryandbindVars, then returns a newC8Cursorinstance for the result list.<T> C8Cursor<T>query(String query, Map<String,Object> bindVars, Class<T> type)Performs a database query using the givenqueryandbindVars, then returns a newArangoCursorinstance for the result list.voidresetAccess(String user)Clear the database access level, revert back to the default access level.Restqlrestql()Returns aRestqlinstance.voidrevokeAccess(String user)Revokes access to the database dbname for useruser.QueryTrackingPropertiesEntitysetQueryTrackingProperties(QueryTrackingPropertiesEntity properties)Changes the configuration for the AQL query trackingC8Streamstream(String name)Returns aC8Streaminstance for the given stream name.Stringtenant()Returns the name of the tenant<T> Ttransaction(String action, Class<T> type, C8TransactionOptions options)Performs a server-side transaction and returns its return value.voidunsubscribe(String subscriptionName)Unsubscribes the given subscription on all streams on a stream db.-
Methods inherited from interface com.c8db.C8SerializationAccessor
util, util
-
-
-
-
Method Detail
-
c8db
C8DB c8db()
Return the main entry point for the C8DB driver- Returns:
- main entry point
-
tenant
String tenant()
Returns the name of the tenant- Returns:
- tenant name
-
name
String name()
Returns the name of the database- Returns:
- database name
-
getVersion
C8DBVersion getVersion() throws C8DBException
Returns the server name and version number.- Returns:
- the server version, number
- Throws:
C8DBException
-
exists
boolean exists() throws C8DBExceptionChecks whether the database exists- Returns:
- true if the database exists, otherwise false
- Throws:
C8DBException
-
getAccessibleGeoFabrics
Collection<String> getAccessibleGeoFabrics() throws C8DBException
Retrieves a list of all databases the current user can access- Returns:
- a list of all databases the current user can access
- Throws:
C8DBException
-
collection
C8Collection collection(String name)
Returns aArangoCollectioninstance for the given collection name.- Parameters:
name- Name of the collection- Returns:
- collection handler
-
createCollection
CollectionEntity createCollection(String name) throws C8DBException
Creates a collection for the given collection's name, then returns collection information from the server.- Parameters:
name- The name of the collection- Returns:
- information about the collection
- Throws:
C8DBException
-
createCollection
CollectionEntity createCollection(String name, CollectionCreateOptions options) throws C8DBException
Creates a collection with the givenoptionsfor this collection's name, then returns collection information from the server.- Parameters:
name- The name of the collectionoptions- Additional options, can be null- Returns:
- information about the collection
- Throws:
C8DBException
-
getCollections
Collection<CollectionEntity> getCollections() throws C8DBException
Fetches all collections from the database and returns an list of collection descriptions.- Returns:
- list of information about all collections
- Throws:
C8DBException
-
getCollections
Collection<CollectionEntity> getCollections(CollectionsReadOptions options) throws C8DBException
Fetches all collections from the database and returns an list of collection descriptions.- Parameters:
options- Additional options, can be null- Returns:
- list of information about all collections
- Throws:
C8DBException- See Also:
- API Documentation
-
getIndex
IndexEntity getIndex(String id) throws C8DBException
Returns an index- Parameters:
id- The index-handle- Returns:
- information about the index
- Throws:
C8DBException- See Also:
- API Documentation
-
deleteIndex
String deleteIndex(String id) throws C8DBException
Deletes an index- Parameters:
id- The index-handle- Returns:
- the id of the index
- Throws:
C8DBException- See Also:
- API Documentation
-
create
Boolean create() throws C8DBException
Creates the database- Returns:
- true if the database was created successfully.
- Throws:
C8DBException- See Also:
- API Documentation
-
drop
Boolean drop() throws C8DBException
Deletes the database from the server.- Returns:
- true if the database was dropped successfully
- Throws:
C8DBException- See Also:
- API Documentation
-
grantAccess
void grantAccess(String user, Permissions permissions) throws C8DBException
Grants or revoke access to the database for useruser. You need permission to the _system database in order to execute this call.- Parameters:
user- The name of the userpermissions- The permissions the user grant- Throws:
C8DBException- See Also:
- API Documentation
-
grantAccess
void grantAccess(String user) throws C8DBException
Grants access to the database for useruser. You need permission to the _system database in order to execute this call.- Parameters:
user- The name of the user- Throws:
C8DBException- See Also:
- API Documentation
-
revokeAccess
void revokeAccess(String user) throws C8DBException
Revokes access to the database dbname for useruser. You need permission to the _system database in order to execute this call.- Parameters:
user- The name of the user- Throws:
C8DBException
-
resetAccess
void resetAccess(String user) throws C8DBException
Clear the database access level, revert back to the default access level.- Parameters:
user- The name of the user- Throws:
C8DBException- Since:
- ArangoDB 3.2.0
- See Also:
- API Documentation
-
getPermissions
Permissions getPermissions(String user) throws C8DBException
Get specific database access level- Parameters:
user- The name of the user- Returns:
- permissions of the user
- Throws:
C8DBException- Since:
- ArangoDB 3.2.0
- See Also:
- API Documentation
-
query
<T> C8Cursor<T> query(String query, Map<String,Object> bindVars, C8qlQueryOptions options, Class<T> type) throws C8DBException
Performs a database query using the givenqueryandbindVars, then returns a newC8Cursorinstance for the result list.- Parameters:
query- A C8QL query stringbindVars- key/value pairs defining the variables to bind the query tooptions- Additional options that will be passed to the query API, can be nulltype- The type of the result (POJO class, VPackSlice, String for JSON, or Collection/List/Map)- Returns:
- cursor of the results
- Throws:
C8DBException- See Also:
- API Documentation
-
query
<T> C8Cursor<T> query(String query, C8qlQueryOptions options, Class<T> type) throws C8DBException
Performs a database query using the givenquery, then returns a newArangoCursorinstance for the result list.- Parameters:
query- An AQL query stringoptions- Additional options that will be passed to the query API, can be nulltype- The type of the result (POJO class, VPackSlice, String for JSON, or Collection/List/Map)- Returns:
- cursor of the results
- Throws:
C8DBException- See Also:
- API Documentation
-
query
<T> C8Cursor<T> query(String query, Map<String,Object> bindVars, Class<T> type) throws C8DBException
Performs a database query using the givenqueryandbindVars, then returns a newArangoCursorinstance for the result list.- Parameters:
query- An AQL query stringbindVars- key/value pairs defining the variables to bind the query totype- The type of the result (POJO class, VPackSlice, String for JSON, or Collection/List/Map)- Returns:
- cursor of the results
- Throws:
C8DBException- See Also:
- API Documentation
-
query
<T> C8Cursor<T> query(String query, Class<T> type) throws C8DBException
Performs a database query using the givenquery, then returns a newArangoCursorinstance for the result list.- Parameters:
query- An AQL query stringtype- The type of the result (POJO class, VPackSlice, String for JSON, or Collection/List/Map)- Returns:
- cursor of the results
- Throws:
C8DBException- See Also:
- API Documentation
-
cursor
<T> C8Cursor<T> cursor(String cursorId, Class<T> type) throws C8DBException
Return an cursor from the given cursor-ID if still existing- Parameters:
cursorId- The ID of the cursortype- The type of the result (POJO class, VPackSlice, String for JSON, or Collection/List/Map)- Returns:
- cursor of the results
- Throws:
C8DBException- See Also:
- API Documentation
-
explainQuery
C8qlExecutionExplainEntity explainQuery(String query, Map<String,Object> bindVars, C8qlQueryExplainOptions options) throws C8DBException
Explain an AQL query and return information about it- Parameters:
query- the query which you want explainedbindVars- key/value pairs representing the bind parametersoptions- Additional options, can be null- Returns:
- information about the query
- Throws:
C8DBException- See Also:
- API Documentation
-
parseQuery
C8qlParseEntity parseQuery(String query) throws C8DBException
Parse an AQL query and return information about it This method is for query validation only. To actually query the database, seequery(String, Map, C8qlQueryOptions, Class)- Parameters:
query- the query which you want parse- Returns:
- imformation about the query
- Throws:
C8DBException- See Also:
- API Documentation
-
getCurrentlyRunningQueries
Collection<QueryEntity> getCurrentlyRunningQueries() throws C8DBException
Returns a list of currently running AQL queries- Returns:
- a list of currently running AQL queries
- Throws:
C8DBException
-
getSlowQueries
Collection<QueryEntity> getSlowQueries() throws C8DBException
Returns a list of slow running AQL queries- Returns:
- a list of slow running AQL queries
- Throws:
C8DBException
-
getQueryTrackingProperties
QueryTrackingPropertiesEntity getQueryTrackingProperties() throws C8DBException
Returns the configuration for the AQL query tracking- Returns:
- configuration for the AQL query tracking
- Throws:
C8DBException
-
setQueryTrackingProperties
QueryTrackingPropertiesEntity setQueryTrackingProperties(QueryTrackingPropertiesEntity properties) throws C8DBException
Changes the configuration for the AQL query tracking- Parameters:
properties- properties to be set- Returns:
- current set of properties
- Throws:
C8DBException
-
clearSlowQueries
void clearSlowQueries() throws C8DBExceptionClears the list of slow AQL queries- Throws:
C8DBException
-
killQuery
void killQuery(String id) throws C8DBException
Kills a running query. The query will be terminated at the next cancelation point.- Parameters:
id- The id of the query- Throws:
C8DBException- See Also:
- API Documentation
-
graph
C8Graph graph(String name)
Returns aArangoGraphinstance for the given graph name.- Parameters:
name- Name of the graph- Returns:
- graph handler
-
createGraph
GraphEntity createGraph(String name, Collection<EdgeDefinition> edgeDefinitions) throws C8DBException
Create a new graph in the graph module. The creation of a graph requires the name of the graph and a definition of its edges.- Parameters:
name- Name of the graphedgeDefinitions- An array of definitions for the edge- Returns:
- information about the graph
- Throws:
C8DBException- See Also:
- API Documentation
-
createGraph
GraphEntity createGraph(String name, Collection<EdgeDefinition> edgeDefinitions, GraphCreateOptions options) throws C8DBException
Create a new graph in the graph module. The creation of a graph requires the name of the graph and a definition of its edges.- Parameters:
name- Name of the graphedgeDefinitions- An array of definitions for the edgeoptions- Additional options, can be null- Returns:
- information about the graph
- Throws:
C8DBException- See Also:
- API Documentation
-
getGraphs
Collection<GraphEntity> getGraphs() throws C8DBException
Lists all graphs known to the graph module- Returns:
- graphs stored in this database
- Throws:
C8DBException
-
restql
Restql restql()
Returns aRestqlinstance.- Returns:
- Restql handler
-
transaction
<T> T transaction(String action, Class<T> type, C8TransactionOptions options) throws C8DBException
Performs a server-side transaction and returns its return value.- Parameters:
action- A String evaluating to a JavaScript function to be executed on the server.type- The type of the result (POJO class, VPackSlice or String for JSON)options- Additional options, can be null- Returns:
- the result of the transaction if it succeeded
- Throws:
C8DBException
-
beginStreamTransaction
StreamTransactionEntity beginStreamTransaction(StreamTransactionOptions options) throws C8DBException
Begins a Stream Transaction.- Parameters:
options- Additional options, can be null- Returns:
- information about the transaction
- Throws:
C8DBException
-
abortStreamTransaction
StreamTransactionEntity abortStreamTransaction(String id) throws C8DBException
Aborts a Stream Transaction.- Returns:
- information about the transaction
- Throws:
C8DBException
-
getStreamTransaction
StreamTransactionEntity getStreamTransaction(String id) throws C8DBException
Gets information about a Stream Transaction.- Returns:
- information about the transaction
- Throws:
C8DBException
-
getStreamTransactions
Collection<TransactionEntity> getStreamTransactions() throws C8DBException
Gets all the currently running Stream Transactions.- Returns:
- all the currently running Stream Transactions
- Throws:
C8DBException
-
commitStreamTransaction
StreamTransactionEntity commitStreamTransaction(String id) throws C8DBException
Commits a Stream Transaction.- Returns:
- information about the transaction
- Throws:
C8DBException
-
getInfo
DatabaseEntity getInfo() throws C8DBException
Retrieves information about the current database- Returns:
- information about the current database
- Throws:
C8DBException
-
executeTraversal
<V,E> TraversalEntity<V,E> executeTraversal(Class<V> vertexClass, Class<E> edgeClass, TraversalOptions options) throws C8DBException
Execute a server-side traversal- Parameters:
vertexClass- The type of the vertex documents (POJO class, VPackSlice or String for JSON)edgeClass- The type of the edge documents (POJO class, VPackSlice or String for JSON)options- Additional options- Returns:
- Result of the executed traversal
- Throws:
C8DBException- See Also:
- API Documentation
-
getDocument
<T> T getDocument(String id, Class<T> type) throws C8DBException
Reads a single document- Parameters:
id- The id of the documenttype- The type of the document (POJO class, VPackSlice or String for JSON)- Returns:
- the document identified by the id
- Throws:
C8DBException- See Also:
- API Documentation
-
getDocument
<T> T getDocument(String id, Class<T> type, DocumentReadOptions options) throws C8DBException
Reads a single document- Parameters:
id- The id of the documenttype- The type of the document (POJO class, VPackSlice or String for JSON)options- Additional options, can be null- Returns:
- the document identified by the id
- Throws:
C8DBException
-
stream
C8Stream stream(String name)
Returns aC8Streaminstance for the given stream name.- Parameters:
name- Name of the stream- Returns:
- stream handler
-
createPersistentStream
void createPersistentStream(String name, C8StreamCreateOptions options) throws C8DBException
Create asynchronously a persistent stream for a given fabric.- Parameters:
name- of the streamoptions- C8StreamCreateOptions- Throws:
C8DBException
-
getPersistentStreams
Collection<C8StreamEntity> getPersistentStreams(C8StreamCreateOptions options) throws C8DBException
Get list of persistent streams under the given stream db. Returns either a list of global or of local streams.- Parameters:
options-- Returns:
- Throws:
C8DBException
-
getStreams
Collection<C8StreamEntity> getStreams() throws C8DBException
Get list of all streams under given database.- Returns:
- Throws:
C8DBException
-
clearBacklog
void clearBacklog()
Clear backlog for all streams on a stream db.
-
clearBacklog
void clearBacklog(String subscriptionName)
Clear backlog for given subscription.- Parameters:
subscriptionName- Name of the subscription
-
unsubscribe
void unsubscribe(String subscriptionName)
Unsubscribes the given subscription on all streams on a stream db.- Parameters:
subscriptionName- Identifying name of the subscripton.
-
createUserQuery
UserQueryEntity createUserQuery(UserQueryOptions userQueryDefinition) throws C8DBException
Creates user query as the current user- Parameters:
userQueryDefinition- user query definition- Returns:
- user query entity.
- Throws:
C8DBException
-
createUserQuery
UserQueryEntity createUserQuery(UserQueryOptions userQueryDefinition, String user) throws C8DBException
Creates user query as a given user.Note: this can only be invoked by a admin user.
- Parameters:
userQueryDefinition- user query definition.user- user name.- Returns:
- user query entity.
- Throws:
C8DBException
-
executeUserQuery
<T> C8Cursor<T> executeUserQuery(String userName, String name, Map<String,Object> bindVars, Class<T> type) throws C8DBException
Executes a saved using query using the givennameandbindVars, then returns a newC8Cursorinstance for the result list. IfuserNameis null then tries to execute it for current user.- Parameters:
userName- user the query belongs to. If null executes it for current username- A user query namebindVars- key/value pairs defining the variables to bind the query totype- The type of the result (POJO class, VPackSlice, String for JSON, or Collection/List/Map)- Returns:
- cursor of the results
- Throws:
C8DBException
-
event
C8Event event()
-
create
Boolean create(String geoFabric) throws C8DBException
Create a geofabric/db in Demo tenant- Parameters:
geoFabric- The name of the geofabric- Returns:
- Throws:
C8DBException
-
admin
C8Admin admin()
Returns aC8Admininstance.- Returns:
- C8Admin handler
-
apiKeys
C8ApiKeys apiKeys()
Returns aC8ApiKeysinstance.- Returns:
- C8ApiKeys handler
-
-