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 StreamTransactionEntity
abortStreamTransaction(String id)
Aborts a Stream Transaction.ArangoDB
arango()
Return the main entry point for the ArangoDB driverArangoSearch
arangoSearch(String name)
Returns aArangoSearch
instance for the given view name.StreamTransactionEntity
beginStreamTransaction(StreamTransactionOptions options)
Begins a Stream Transaction.void
clearQueryCache()
Clears the AQL query cachevoid
clearSlowQueries()
Clears the list of slow AQL queriesArangoCollection
collection(String name)
Returns aArangoCollection
instance for the given collection name.StreamTransactionEntity
commitStreamTransaction(String id)
Commits a Stream Transaction.Boolean
create()
Creates the databasevoid
createAqlFunction(String name, String code, AqlFunctionCreateOptions options)
Create a new AQL user functionViewEntity
createArangoSearch(String name, ArangoSearchCreateOptions options)
Creates a ArangoSearch view with the givenoptions
, then returns view information from the server.CollectionEntity
createCollection(String name)
Creates a collection for the given collection's name, then returns collection information from the server.CollectionEntity
createCollection(String name, CollectionCreateOptions options)
Creates a collection with the givenoptions
for this collection's name, then returns collection information from the server.GraphEntity
createGraph(String name, Collection<EdgeDefinition> edgeDefinitions)
Create a new graph in the graph module.GraphEntity
createGraph(String name, Collection<EdgeDefinition> edgeDefinitions, GraphCreateOptions options)
Create a new graph in the graph module.ViewEntity
createSearchAlias(String name, SearchAliasCreateOptions options)
Creates a SearchAlias view with the givenoptions
, then returns view information from the server.SearchAnalyzer
createSearchAnalyzer(SearchAnalyzer analyzer)
Creates an AnalyzerViewEntity
createView(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 existingInteger
deleteAqlFunction(String name, AqlFunctionDeleteOptions options)
Deletes the AQL user function with the given name from the database.String
deleteIndex(String id)
Deletes an indexvoid
deleteSearchAnalyzer(String name)
Deletes an Analyzervoid
deleteSearchAnalyzer(String name, AnalyzerDeleteOptions options)
Deletes an AnalyzerBoolean
drop()
Deletes the database from the server.boolean
exists()
Checks whether the database existsAqlExecutionExplainEntity
explainQuery(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 queriesArangoDBEngine
getEngine()
Returns the name of the used storage engine.Collection<GraphEntity>
getGraphs()
Lists all graphs known to the graph moduleIndexEntity
getIndex(String id)
Returns an indexDatabaseEntity
getInfo()
Retrieves information about the current databasePermissions
getPermissions(String user)
Get specific database access levelQueryCachePropertiesEntity
getQueryCacheProperties()
Returns the global configuration for the AQL query cacheQueryTrackingPropertiesEntity
getQueryTrackingProperties()
Returns the configuration for the AQL query trackingSearchAnalyzer
getSearchAnalyzer(String name)
Gets information about an AnalyzerCollection<SearchAnalyzer>
getSearchAnalyzers()
Retrieves all analyzers definitions.Collection<QueryEntity>
getSlowQueries()
Returns a list of slow running AQL queriesStreamTransactionEntity
getStreamTransaction(String id)
Gets information about a Stream Transaction.Collection<TransactionEntity>
getStreamTransactions()
Gets all the currently running Stream Transactions.ArangoDBVersion
getVersion()
Returns the server name and version number.Collection<ViewEntity>
getViews()
Fetches all views from the database and returns an list of view descriptions.void
grantAccess(String user)
Grants access to the database for useruser
.void
grantAccess(String user, Permissions permissions)
Grants or revoke access to the database for useruser
.void
grantDefaultCollectionAccess(String user, Permissions permissions)
Sets the default access level for collections within this database for the useruser
.ArangoGraph
graph(String name)
Returns aArangoGraph
instance for the given graph name.void
killQuery(String id)
Kills a running query.String
name()
Returns the name of the databaseAqlParseEntity
parseQuery(String query)
Parse an AQL query and return information about it This method is for query validation only.<T> ArangoCursor<T>
query(String query, Class<T> type)
Performs a database query using the givenquery
, then returns a newArangoCursor
instance for the result list.<T> ArangoCursor<T>
query(String query, Class<T> type, AqlQueryOptions options)
Performs a database query using the givenquery
, then returns a newArangoCursor
instance for the result list.<T> ArangoCursor<T>
query(String query, Class<T> type, Map<String,Object> bindVars)
Performs a database query using the givenquery
andbindVars
, then returns a newArangoCursor
instance for the result list.<T> ArangoCursor<T>
query(String query, Class<T> type, Map<String,Object> bindVars, AqlQueryOptions options)
Performs a database query using the givenquery
andbindVars
, then returns a newArangoCursor
instance for the result list.void
reloadRouting()
Reload the routing table.void
resetAccess(String user)
Clear the database access level, revert back to the default access level.void
revokeAccess(String user)
Revokes access to the database dbname for useruser
.SearchAlias
searchAlias(String name)
Returns aSearchAlias
instance for the given view name.QueryCachePropertiesEntity
setQueryCacheProperties(QueryCachePropertiesEntity properties)
Changes the configuration for the AQL query cache.QueryTrackingPropertiesEntity
setQueryTrackingProperties(QueryTrackingPropertiesEntity properties)
Changes the configuration for the AQL query tracking<T> T
transaction(String action, Class<T> type, TransactionOptions options)
Performs a server-side transaction and returns its return value.ArangoView
view(String name)
Returns aArangoView
instance 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
-
name
String name()
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 aArangoCollection
instance 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 givenoptions
for 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, Class<T> type, Map<String,Object> bindVars, AqlQueryOptions options)
Performs a database query using the givenquery
andbindVars
, then returns a newArangoCursor
instance for the result list.- Parameters:
query
- An AQL query stringtype
- The type of the result (POJO orRawData
)bindVars
- key/value pairs defining the variables to bind the query tooptions
- Additional options that will be passed to the query API, can be null- Returns:
- cursor of the results
- See Also:
- API Documentation
-
query
<T> ArangoCursor<T> query(String query, Class<T> type, AqlQueryOptions options)
Performs a database query using the givenquery
, then returns a newArangoCursor
instance for the result list.- Parameters:
query
- An AQL query stringtype
- The type of the result (POJO orRawData
)options
- Additional options that will be passed to the query API, can be null- Returns:
- cursor of the results
- See Also:
- API Documentation
-
query
<T> ArangoCursor<T> query(String query, Class<T> type, Map<String,Object> bindVars)
Performs a database query using the givenquery
andbindVars
, then returns a newArangoCursor
instance for the result list.- Parameters:
query
- An AQL query stringtype
- The type of the result (POJO orRawData
)bindVars
- key/value pairs defining the variables to bind the query to- 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 newArangoCursor
instance 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, Class, Map, AqlQueryOptions)
- 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 aArangoGraph
instance 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
-
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 aArangoView
instance 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 aArangoSearch
instance 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 aSearchAlias
instance 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
-
-