Package com.arangodb
Interface ArangoDatabase
-
- All Superinterfaces:
ArangoSerdeAccessor
@ThreadSafe public interface ArangoDatabase extends ArangoSerdeAccessor
Interface for operations on ArangoDB database level.- Author:
- Mark Vollmary, Michele Rastelli
- See Also:
- Databases API Documentation, Query API Documentation
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StreamTransactionEntityabortStreamTransaction(String id)Aborts a Stream Transaction.ArangoDBarango()Return the main entry point for the ArangoDB driverArangoSearcharangoSearch(String name)Returns aArangoSearchinstance for the given view name.StreamTransactionEntitybeginStreamTransaction(StreamTransactionOptions options)Begins a Stream Transaction.voidclearQueryCache()Clears the AQL query cachevoidclearSlowQueries()Clears the list of slow AQL queriesArangoCollectioncollection(String name)Returns aArangoCollectioninstance for the given collection name.StreamTransactionEntitycommitStreamTransaction(String id)Commits a Stream Transaction.Booleancreate()Creates the databasevoidcreateAqlFunction(String name, String code, AqlFunctionCreateOptions options)Create a new AQL user functionViewEntitycreateArangoSearch(String name, ArangoSearchCreateOptions options)Creates a ArangoSearch view with the givenoptions, then returns view information from the server.CollectionEntitycreateCollection(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.ViewEntitycreateSearchAlias(String name, SearchAliasCreateOptions options)Creates a SearchAlias view with the givenoptions, then returns view information from the server.SearchAnalyzercreateSearchAnalyzer(SearchAnalyzer analyzer)Creates an AnalyzerViewEntitycreateView(String name, ViewType type)Creates a view of the giventype, then returns view information from the server.<T> ArangoCursor<T>cursor(String cursorId, Class<T> type)Return an cursor from the given cursor-ID if still existingDbNamedbName()Returns the name of the databaseIntegerdeleteAqlFunction(String name, AqlFunctionDeleteOptions options)Deletes the AQL user function with the given name from the database.StringdeleteIndex(String id)Deletes an indexvoiddeleteSearchAnalyzer(String name)Deletes an AnalyzervoiddeleteSearchAnalyzer(String name, AnalyzerDeleteOptions options)Deletes an AnalyzerBooleandrop()Deletes the database from the server.booleanexists()Checks whether the database existsAqlExecutionExplainEntityexplainQuery(String query, Map<String,Object> bindVars, AqlQueryExplainOptions options)Explain an AQL query and return information about itCollection<String>getAccessibleDatabases()Retrieves a list of all databases the current user can accessCollection<AqlFunctionEntity>getAqlFunctions(AqlFunctionGetOptions options)Gets all reqistered AQL user functionsCollection<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 documentArangoDBEnginegetEngine()Returns the name of the used storage engine.Collection<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 levelQueryCachePropertiesEntitygetQueryCacheProperties()Returns the global configuration for the AQL query cacheQueryTrackingPropertiesEntitygetQueryTrackingProperties()Returns the configuration for the AQL query trackingSearchAnalyzergetSearchAnalyzer(String name)Gets information about an AnalyzerCollection<SearchAnalyzer>getSearchAnalyzers()Retrieves all analyzers definitions.Collection<QueryEntity>getSlowQueries()Returns a list of slow running AQL queriesStreamTransactionEntitygetStreamTransaction(String id)Gets information about a Stream Transaction.Collection<TransactionEntity>getStreamTransactions()Gets all the currently running Stream Transactions.ArangoDBVersiongetVersion()Returns the server name and version number.Collection<ViewEntity>getViews()Fetches all views from the database and returns an list of view descriptions.voidgrantAccess(String user)Grants access to the database for useruser.voidgrantAccess(String user, Permissions permissions)Grants or revoke access to the database for useruser.voidgrantDefaultCollectionAccess(String user, Permissions permissions)Sets the default access level for collections within this database for the useruser.ArangoGraphgraph(String name)Returns aArangoGraphinstance for the given graph name.voidkillQuery(String id)Kills a running query.AqlParseEntityparseQuery(String query)Parse an AQL query and return information about it This method is for query validation only.<T> ArangoCursor<T>query(String query, AqlQueryOptions options, Class<T> type)Performs a database query using the givenquery, then returns a newArangoCursorinstance for the result list.<T> ArangoCursor<T>query(String query, Class<T> type)Performs a database query using the givenquery, then returns a newArangoCursorinstance for the result list.<T> ArangoCursor<T>query(String query, Map<String,Object> bindVars, AqlQueryOptions options, Class<T> type)Performs a database query using the givenqueryandbindVars, then returns a newArangoCursorinstance for the result list.<T> ArangoCursor<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.voidreloadRouting()Reload the routing table.voidresetAccess(String user)Clear the database access level, revert back to the default access level.voidrevokeAccess(String user)Revokes access to the database dbname for useruser.SearchAliassearchAlias(String name)Returns aSearchAliasinstance for the given view name.QueryCachePropertiesEntitysetQueryCacheProperties(QueryCachePropertiesEntity properties)Changes the configuration for the AQL query cache.QueryTrackingPropertiesEntitysetQueryTrackingProperties(QueryTrackingPropertiesEntity properties)Changes the configuration for the AQL query tracking<T> Ttransaction(String action, Class<T> type, TransactionOptions options)Performs a server-side transaction and returns its return value.ArangoViewview(String name)Returns aArangoViewinstance for the given view name.-
Methods inherited from interface com.arangodb.ArangoSerdeAccessor
getSerde
-
-
-
-
Method Detail
-
arango
ArangoDB arango()
Return the main entry point for the ArangoDB driver- Returns:
- main entry point
-
dbName
DbName dbName()
Returns the name of the database- Returns:
- database name
-
getVersion
ArangoDBVersion getVersion()
Returns the server name and version number.- Returns:
- the server version, number
- See Also:
- API Documentation
-
getEngine
ArangoDBEngine getEngine()
Returns the name of the used storage engine.- Returns:
- the storage engine name
- See Also:
- API Documentation
-
exists
boolean exists()
Checks whether the database exists- Returns:
- true if the database exists, otherwise false
-
getAccessibleDatabases
Collection<String> getAccessibleDatabases()
Retrieves a list of all databases the current user can access- Returns:
- a list of all databases the current user can access
- See Also:
- API Documentation
-
collection
ArangoCollection collection(String name)
Returns aArangoCollectioninstance for the given collection name.- Parameters:
name- Name of the collection- Returns:
- collection handler
-
createCollection
CollectionEntity createCollection(String name)
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
- See Also:
- API Documentation
-
createCollection
CollectionEntity createCollection(String name, CollectionCreateOptions options)
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
- See Also:
- API Documentation
-
getCollections
Collection<CollectionEntity> getCollections()
Fetches all collections from the database and returns an list of collection descriptions.- Returns:
- list of information about all collections
- See Also:
- API Documentation
-
getCollections
Collection<CollectionEntity> getCollections(CollectionsReadOptions options)
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
- See Also:
- API Documentation
-
getIndex
IndexEntity getIndex(String id)
Returns an index- Parameters:
id- The index-handle- Returns:
- information about the index
- See Also:
- API Documentation
-
deleteIndex
String deleteIndex(String id)
Deletes an index- Parameters:
id- The index-handle- Returns:
- the id of the index
- See Also:
- API Documentation
-
create
Boolean create()
Creates the database- Returns:
- true if the database was created successfully.
- See Also:
- API Documentation
-
drop
Boolean drop()
Deletes the database from the server.- Returns:
- true if the database was dropped successfully
- See Also:
- API Documentation
-
grantAccess
void grantAccess(String user, Permissions permissions)
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- See Also:
- API Documentation
-
grantAccess
void grantAccess(String user)
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- See Also:
- API Documentation
-
revokeAccess
void revokeAccess(String user)
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- See Also:
- API Documentation
-
resetAccess
void resetAccess(String user)
Clear the database access level, revert back to the default access level.- Parameters:
user- The name of the user- Since:
- ArangoDB 3.2.0
- See Also:
- API Documentation
-
grantDefaultCollectionAccess
void grantDefaultCollectionAccess(String user, Permissions permissions)
Sets the default access level for collections within this database for the 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- Since:
- ArangoDB 3.2.0
-
getPermissions
Permissions getPermissions(String user)
Get specific database access level- Parameters:
user- The name of the user- Returns:
- permissions of the user
- Since:
- ArangoDB 3.2.0
- See Also:
- API Documentation
-
query
<T> ArangoCursor<T> query(String query, Map<String,Object> bindVars, AqlQueryOptions options, Class<T> type)
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 tooptions- Additional options that will be passed to the query API, can be nulltype- The type of the result (POJO orRawData)- Returns:
- cursor of the results
- See Also:
- API Documentation
-
query
<T> ArangoCursor<T> query(String query, AqlQueryOptions options, Class<T> type)
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 orRawData)- Returns:
- cursor of the results
- See Also:
- API Documentation
-
query
<T> ArangoCursor<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.- Parameters:
query- An AQL query stringbindVars- key/value pairs defining the variables to bind the query totype- The type of the result (POJO orRawData)- Returns:
- cursor of the results
- See Also:
- API Documentation
-
query
<T> ArangoCursor<T> query(String query, Class<T> type)
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 orRawData)- Returns:
- cursor of the results
- See Also:
- API Documentation
-
cursor
<T> ArangoCursor<T> cursor(String cursorId, Class<T> type)
Return an cursor from the given cursor-ID if still existing- Parameters:
cursorId- The ID of the cursortype- The type of the result (POJO orRawData)- Returns:
- cursor of the results
- See Also:
- API Documentation
-
explainQuery
AqlExecutionExplainEntity explainQuery(String query, Map<String,Object> bindVars, AqlQueryExplainOptions options)
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
- See Also:
- API Documentation
-
parseQuery
AqlParseEntity parseQuery(String query)
Parse an AQL query and return information about it This method is for query validation only. To actually query the database, seequery(String, Map, AqlQueryOptions, Class)- Parameters:
query- the query which you want parse- Returns:
- imformation about the query
- See Also:
- API Documentation
-
clearQueryCache
void clearQueryCache()
Clears the AQL query cache- See Also:
- API Documentation
-
getQueryCacheProperties
QueryCachePropertiesEntity getQueryCacheProperties()
Returns the global configuration for the AQL query cache- Returns:
- configuration for the AQL query cache
- See Also:
- API Documentation
-
setQueryCacheProperties
QueryCachePropertiesEntity setQueryCacheProperties(QueryCachePropertiesEntity properties)
Changes the configuration for the AQL query cache. Note: changing the properties may invalidate all results in the cache.- Parameters:
properties- properties to be set- Returns:
- current set of properties
- See Also:
- API Documentation
-
getQueryTrackingProperties
QueryTrackingPropertiesEntity getQueryTrackingProperties()
Returns the configuration for the AQL query tracking- Returns:
- configuration for the AQL query tracking
- See Also:
- API Documentation
-
setQueryTrackingProperties
QueryTrackingPropertiesEntity setQueryTrackingProperties(QueryTrackingPropertiesEntity properties)
Changes the configuration for the AQL query tracking- Parameters:
properties- properties to be set- Returns:
- current set of properties
- See Also:
- API Documentation
-
getCurrentlyRunningQueries
Collection<QueryEntity> getCurrentlyRunningQueries()
Returns a list of currently running AQL queries- Returns:
- a list of currently running AQL queries
- See Also:
- API Documentation
-
getSlowQueries
Collection<QueryEntity> getSlowQueries()
Returns a list of slow running AQL queries- Returns:
- a list of slow running AQL queries
- See Also:
- API Documentation
-
clearSlowQueries
void clearSlowQueries()
Clears the list of slow AQL queries- See Also:
- API Documentation
-
killQuery
void killQuery(String id)
Kills a running query. The query will be terminated at the next cancelation point.- Parameters:
id- The id of the query- See Also:
- API Documentation
-
createAqlFunction
void createAqlFunction(String name, String code, AqlFunctionCreateOptions options)
Create a new AQL user function- Parameters:
name- A valid AQL function name, e.g.: `"myfuncs::accounting::calculate_vat"`code- A String evaluating to a JavaScript functionoptions- Additional options, can be null- See Also:
- API Documentation
-
deleteAqlFunction
Integer deleteAqlFunction(String name, AqlFunctionDeleteOptions options)
Deletes the AQL user function with the given name from the database.- Parameters:
name- The name of the user function to deleteoptions- Additional options, can be null- Returns:
- number of deleted functions (since ArangoDB 3.4.0)
- See Also:
- API Documentation
-
getAqlFunctions
Collection<AqlFunctionEntity> getAqlFunctions(AqlFunctionGetOptions options)
Gets all reqistered AQL user functions- Parameters:
options- Additional options, can be null- Returns:
- all reqistered AQL user functions
- See Also:
- API Documentation
-
graph
ArangoGraph 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)
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
- See Also:
- API Documentation
-
createGraph
GraphEntity createGraph(String name, Collection<EdgeDefinition> edgeDefinitions, GraphCreateOptions options)
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
- See Also:
- API Documentation
-
getGraphs
Collection<GraphEntity> getGraphs()
Lists all graphs known to the graph module- Returns:
- graphs stored in this database
- See Also:
- API Documentation
-
transaction
<T> T transaction(String action, Class<T> type, TransactionOptions options)
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 orRawData)options- Additional options, can be null- Returns:
- the result of the transaction if it succeeded
- See Also:
- API Documentation
-
beginStreamTransaction
StreamTransactionEntity beginStreamTransaction(StreamTransactionOptions options)
Begins a Stream Transaction.- Parameters:
options- Additional options, can be null- Returns:
- information about the transaction
- Since:
- ArangoDB 3.5.0
- See Also:
- API Documentation
-
abortStreamTransaction
StreamTransactionEntity abortStreamTransaction(String id)
Aborts a Stream Transaction.- Returns:
- information about the transaction
- See Also:
- API Documentation
-
getStreamTransaction
StreamTransactionEntity getStreamTransaction(String id)
Gets information about a Stream Transaction.- Returns:
- information about the transaction
- Since:
- ArangoDB 3.5.0
- See Also:
- API Documentation
-
getStreamTransactions
Collection<TransactionEntity> getStreamTransactions()
Gets all the currently running Stream Transactions.- Returns:
- all the currently running Stream Transactions
- Since:
- ArangoDB 3.5.0
- See Also:
- API Documentation
-
commitStreamTransaction
StreamTransactionEntity commitStreamTransaction(String id)
Commits a Stream Transaction.- Returns:
- information about the transaction
- Since:
- ArangoDB 3.5.0
- See Also:
- API Documentation
-
getInfo
DatabaseEntity getInfo()
Retrieves information about the current database- Returns:
- information about the current database
- See Also:
- API Documentation
-
getDocument
<T> T getDocument(String id, Class<T> type)
Reads a single document- Parameters:
id- The id of the documenttype- The type of the document (POJO orRawData)- Returns:
- the document identified by the id
- See Also:
- API Documentation
-
getDocument
<T> T getDocument(String id, Class<T> type, DocumentReadOptions options)
Reads a single document- Parameters:
id- The id of the documenttype- The type of the document (POJO orRawData)options- Additional options, can be null- Returns:
- the document identified by the id
- See Also:
- API Documentation
-
reloadRouting
void reloadRouting()
Reload the routing table.- See Also:
- API Documentation
-
getViews
Collection<ViewEntity> getViews()
Fetches all views from the database and returns an list of view descriptions.- Returns:
- list of information about all views
- Since:
- ArangoDB 3.4.0
- See Also:
- API Documentation
-
view
ArangoView view(String name)
Returns aArangoViewinstance for the given view name.- Parameters:
name- Name of the view- Returns:
- view handler
- Since:
- ArangoDB 3.4.0
-
arangoSearch
ArangoSearch arangoSearch(String name)
Returns aArangoSearchinstance for the given view name.- Parameters:
name- Name of the view- Returns:
- ArangoSearch view handler
- Since:
- ArangoDB 3.4.0
-
searchAlias
SearchAlias searchAlias(String name)
Returns aSearchAliasinstance for the given view name.- Parameters:
name- Name of the view- Returns:
- SearchAlias view handler
- Since:
- ArangoDB 3.10
-
createView
ViewEntity createView(String name, ViewType type)
Creates a view of the giventype, then returns view information from the server.- Parameters:
name- The name of the viewtype- The type of the view- Returns:
- information about the view
- Since:
- ArangoDB 3.4.0
-
createArangoSearch
ViewEntity createArangoSearch(String name, ArangoSearchCreateOptions options)
Creates a ArangoSearch view with the givenoptions, then returns view information from the server.- Parameters:
name- The name of the viewoptions- Additional options, can be null- Returns:
- information about the view
- Since:
- ArangoDB 3.4.0
- See Also:
- API Documentation
-
createSearchAlias
ViewEntity createSearchAlias(String name, SearchAliasCreateOptions options)
Creates a SearchAlias view with the givenoptions, then returns view information from the server.- Parameters:
name- The name of the viewoptions- Additional options, can be null- Returns:
- information about the view
- Since:
- ArangoDB 3.10
- See Also:
- API Documentation
-
createSearchAnalyzer
SearchAnalyzer createSearchAnalyzer(SearchAnalyzer analyzer)
Creates an Analyzer- Parameters:
analyzer- SearchAnalyzer- Returns:
- the created Analyzer
- Since:
- ArangoDB 3.5.0
- See Also:
- API Documentation
-
getSearchAnalyzer
SearchAnalyzer getSearchAnalyzer(String name)
Gets information about an Analyzer- Parameters:
name- of the Analyzer without database prefix- Returns:
- information about an Analyzer
- Since:
- ArangoDB 3.5.0
- See Also:
- API Documentation
-
getSearchAnalyzers
Collection<SearchAnalyzer> getSearchAnalyzers()
Retrieves all analyzers definitions.- Returns:
- collection of all analyzers definitions
- Since:
- ArangoDB 3.5.0
- See Also:
- API Documentation
-
deleteSearchAnalyzer
void deleteSearchAnalyzer(String name)
Deletes an Analyzer- Parameters:
name- of the Analyzer without database prefix- Since:
- ArangoDB 3.5.0
- See Also:
- API Documentation
-
deleteSearchAnalyzer
void deleteSearchAnalyzer(String name, AnalyzerDeleteOptions options)
Deletes an Analyzer- Parameters:
name- of the Analyzer without database prefixoptions- AnalyzerDeleteOptions- Since:
- ArangoDB 3.5.0
- See Also:
- API Documentation
-
-