Package com.arangodb

Interface ArangoDatabase

All Superinterfaces:
ArangoSerdeAccessor
All Known Implementing Classes:
ArangoDatabaseImpl

@ThreadSafe public interface ArangoDatabase extends ArangoSerdeAccessor
Interface for operations on ArangoDB database level.
Author:
Mark Vollmary, Michele Rastelli
See Also:
  • Method Details

    • 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:
    • getEngine

      ArangoDBEngine getEngine()
      Returns the name of the used storage engine.
      Returns:
      the storage engine name
      See Also:
    • exists

      boolean exists()
      Checks whether the database exists
      Returns:
      true if the database exists, otherwise false
      See Also:
    • 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:
    • collection

      ArangoCollection collection(String name)
      Returns a ArangoCollection 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:
    • createCollection

      CollectionEntity createCollection(String name, CollectionCreateOptions options)
      Creates a collection with the given options for this collection's name, then returns collection information from the server.
      Parameters:
      name - The name of the collection
      options - Additional options, can be null
      Returns:
      information about the collection
      See Also:
    • 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:
    • getCollections

      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:
    • getIndex

      IndexEntity getIndex(String id)
      Returns an index
      Parameters:
      id - The index-handle
      Returns:
      information about the index
      See Also:
    • deleteIndex

      String deleteIndex(String id)
      Deletes an index
      Parameters:
      id - The index-handle
      Returns:
      the id of the index
      See Also:
    • create

      Boolean create()
      Creates the database
      Returns:
      true if the database was created successfully.
      See Also:
    • drop

      Boolean drop()
      Deletes the database from the server.
      Returns:
      true if the database was dropped successfully
      See Also:
    • grantAccess

      void grantAccess(String user, Permissions permissions)
      Grants or revoke access to the database for user user. You need permission to the _system database in order to execute this call.
      Parameters:
      user - The name of the user
      permissions - The permissions the user grant
      See Also:
    • grantAccess

      void grantAccess(String user)
      Grants access to the database for user user. You need permission to the _system database in order to execute this call.
      Parameters:
      user - The name of the user
      See Also:
    • revokeAccess

      void revokeAccess(String user)
      Revokes access to the database dbname for user user. You need permission to the _system database in order to execute this call.
      Parameters:
      user - The name of the user
      See Also:
    • 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:
    • grantDefaultCollectionAccess

      void grantDefaultCollectionAccess(String user, Permissions permissions)
      Sets the default access level for collections within this database for the user user. You need permission to the _system database in order to execute this call.
      Parameters:
      user - The name of the user
      permissions - The permissions the user grant
      Since:
      ArangoDB 3.2.0
      See Also:
    • 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:
    • query

      <T> ArangoCursor<T> query(String query, Class<T> type, Map<String,Object> bindVars, AqlQueryOptions options)
      Performs a database query using the given query and bindVars, then returns a new ArangoCursor instance for the result list.
      Parameters:
      query - An AQL query string
      type - The type of the result (POJO or RawData)
      bindVars - key/value pairs defining the variables to bind the query to
      options - Additional options that will be passed to the query API, can be null
      Returns:
      cursor of the results
      See Also:
    • query

      <T> ArangoCursor<T> query(String query, Class<T> type, AqlQueryOptions options)
      Performs a database query using the given query, then returns a new ArangoCursor instance for the result list.
      Parameters:
      query - An AQL query string
      type - The type of the result (POJO or RawData)
      options - Additional options that will be passed to the query API, can be null
      Returns:
      cursor of the results
      See Also:
    • query

      <T> ArangoCursor<T> query(String query, Class<T> type, Map<String,Object> bindVars)
      Performs a database query using the given query and bindVars, then returns a new ArangoCursor instance for the result list.
      Parameters:
      query - An AQL query string
      type - The type of the result (POJO or RawData)
      bindVars - key/value pairs defining the variables to bind the query to
      Returns:
      cursor of the results
      See Also:
    • query

      <T> ArangoCursor<T> query(String query, Class<T> type)
      Performs a database query using the given query, then returns a new ArangoCursor instance for the result list.
      Parameters:
      query - An AQL query string
      type - The type of the result (POJO or RawData)
      Returns:
      cursor of the results
      See Also:
    • 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 cursor
      type - The type of the result (POJO or RawData)
      Returns:
      cursor of the results
      See Also:
    • cursor

      <T> ArangoCursor<T> cursor(String cursorId, Class<T> type, AqlQueryOptions options)
      Return an cursor from the given cursor-ID if still existing
      Parameters:
      cursorId - The ID of the cursor
      type - The type of the result (POJO or RawData)
      options - options
      Returns:
      cursor of the results
      See Also:
    • cursor

      <T> ArangoCursor<T> cursor(String cursorId, Class<T> type, String nextBatchId)
      Return an cursor from the given cursor-ID if still existing
      Parameters:
      cursorId - The ID of the cursor
      type - The type of the result (POJO or RawData)
      nextBatchId - The ID of the next cursor batch (set only if cursor allows retries, see AqlQueryOptions.allowRetry(Boolean)
      Returns:
      cursor of the results
      Since:
      ArangoDB 3.11
      See Also:
    • cursor

      <T> ArangoCursor<T> cursor(String cursorId, Class<T> type, String nextBatchId, AqlQueryOptions options)
      Return an cursor from the given cursor-ID if still existing
      Parameters:
      cursorId - The ID of the cursor
      type - The type of the result (POJO or RawData)
      nextBatchId - The ID of the next cursor batch (set only if cursor allows retries, see AqlQueryOptions.allowRetry(Boolean)
      options - options
      Returns:
      cursor of the results
      Since:
      ArangoDB 3.11
      See Also:
    • explainQuery

      Deprecated.
      Explain an AQL query and return information about it
      Parameters:
      query - the query which you want explained
      bindVars - key/value pairs representing the bind parameters
      options - Additional options, can be null
      Returns:
      information about the query
      See Also:
    • explainAqlQuery

      @Deprecated AqlQueryExplainEntity explainAqlQuery(String query, Map<String,Object> bindVars, AqlQueryExplainOptions options)
      Deprecated.
      Explain an AQL query and return information about it
      Parameters:
      query - the query which you want explained
      bindVars - key/value pairs representing the bind parameters
      options - Additional options, can be null
      Returns:
      information about the query
      See Also:
    • explainAqlQuery

      AqlQueryExplainEntity explainAqlQuery(String query, Map<String,Object> bindVars, ExplainAqlQueryOptions options)
      Explain an AQL query and return information about it
      Parameters:
      query - the query which you want explained
      bindVars - key/value pairs representing the bind parameters
      options - Additional options, can be null
      Returns:
      information about the query
      See Also:
    • 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, see query(String, Class, Map, AqlQueryOptions)
      Parameters:
      query - the query which you want parse
      Returns:
      imformation about the query
      See Also:
    • clearQueryCache

      void clearQueryCache()
      Clears the AQL query cache
      See Also:
    • getQueryCacheProperties

      QueryCachePropertiesEntity getQueryCacheProperties()
      Returns the global configuration for the AQL query cache
      Returns:
      configuration for the AQL query cache
      See Also:
    • 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:
    • getQueryTrackingProperties

      QueryTrackingPropertiesEntity getQueryTrackingProperties()
      Returns the configuration for the AQL query tracking
      Returns:
      configuration for the AQL query tracking
      See Also:
    • 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:
    • getCurrentlyRunningQueries

      Collection<QueryEntity> getCurrentlyRunningQueries()
      Returns a list of currently running AQL queries
      Returns:
      a list of currently running AQL queries
      See Also:
    • getSlowQueries

      Collection<QueryEntity> getSlowQueries()
      Returns a list of slow running AQL queries
      Returns:
      a list of slow running AQL queries
      See Also:
    • clearSlowQueries

      void clearSlowQueries()
      Clears the list of slow AQL queries
      See Also:
    • 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:
    • 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 function
      options - Additional options, can be null
      See Also:
    • 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 delete
      options - Additional options, can be null
      Returns:
      number of deleted functions (since ArangoDB 3.4.0)
      See Also:
    • getAqlFunctions

      Gets all reqistered AQL user functions
      Parameters:
      options - Additional options, can be null
      Returns:
      all reqistered AQL user functions
      See Also:
    • graph

      ArangoGraph graph(String name)
      Returns a ArangoGraph instance for the given graph name.
      Parameters:
      name - Name of the graph
      Returns:
      graph handler
    • createGraph

      GraphEntity createGraph(String name, Iterable<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 graph
      edgeDefinitions - An array of definitions for the edge
      Returns:
      information about the graph
      See Also:
    • createGraph

      GraphEntity createGraph(String name, Iterable<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 graph
      edgeDefinitions - An array of definitions for the edge
      options - Additional options, can be null
      Returns:
      information about the graph
      See Also:
    • getGraphs

      Collection<GraphEntity> getGraphs()
      Lists all graphs known to the graph module
      Returns:
      graphs stored in this database
      See Also:
    • 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 or RawData)
      options - Additional options, can be null
      Returns:
      the result of the transaction if it succeeded
      See Also:
    • 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:
    • abortStreamTransaction

      StreamTransactionEntity abortStreamTransaction(String id)
      Aborts a Stream Transaction.
      Returns:
      information about the transaction
      See Also:
    • getStreamTransaction

      StreamTransactionEntity getStreamTransaction(String id)
      Gets information about a Stream Transaction.
      Returns:
      information about the transaction
      Since:
      ArangoDB 3.5.0
      See Also:
    • 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:
    • commitStreamTransaction

      StreamTransactionEntity commitStreamTransaction(String id)
      Commits a Stream Transaction.
      Returns:
      information about the transaction
      Since:
      ArangoDB 3.5.0
      See Also:
    • getInfo

      DatabaseEntity getInfo()
      Retrieves information about the current database
      Returns:
      information about the current database
      See Also:
    • reloadRouting

      void reloadRouting()
      Reload the routing table.
      See Also:
    • getViews

      Collection<ViewEntity> getViews()
      Fetches all views from the database and returns a list of view descriptions.
      Returns:
      list of information about all views
      Since:
      ArangoDB 3.4.0
      See Also:
    • view

      ArangoView view(String name)
      Returns a ArangoView 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 a ArangoSearch 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 a SearchAlias 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 given type, then returns view information from the server.
      Parameters:
      name - The name of the view
      type - 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 given options, then returns view information from the server.
      Parameters:
      name - The name of the view
      options - Additional options, can be null
      Returns:
      information about the view
      Since:
      ArangoDB 3.4.0
      See Also:
    • createSearchAlias

      ViewEntity createSearchAlias(String name, SearchAliasCreateOptions options)
      Creates a SearchAlias view with the given options, then returns view information from the server.
      Parameters:
      name - The name of the view
      options - Additional options, can be null
      Returns:
      information about the view
      Since:
      ArangoDB 3.10
      See Also:
    • createSearchAnalyzer

      SearchAnalyzer createSearchAnalyzer(SearchAnalyzer analyzer)
      Creates an Analyzer
      Parameters:
      analyzer - SearchAnalyzer
      Returns:
      the created Analyzer
      Since:
      ArangoDB 3.5.0
      See Also:
    • 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:
    • getSearchAnalyzers

      Collection<SearchAnalyzer> getSearchAnalyzers()
      Retrieves all analyzers definitions.
      Returns:
      collection of all analyzers definitions
      Since:
      ArangoDB 3.5.0
      See Also:
    • deleteSearchAnalyzer

      void deleteSearchAnalyzer(String name)
      Deletes an Analyzer
      Parameters:
      name - of the Analyzer without database prefix
      Since:
      ArangoDB 3.5.0
      See Also:
    • deleteSearchAnalyzer

      void deleteSearchAnalyzer(String name, AnalyzerDeleteOptions options)
      Deletes an Analyzer
      Parameters:
      name - of the Analyzer without database prefix
      options - AnalyzerDeleteOptions
      Since:
      ArangoDB 3.5.0
      See Also: