Interface FunctionDatabase

All Superinterfaces:
AutoCloseable
All Known Subinterfaces:
SQLFunctionDatabase
All Known Implementing Classes:
AbstractSQLFunctionDatabase, ElasticDatabase, FunctionDatabaseProxy, H2FileFunctionDatabase, PostgresFunctionDatabase

public interface FunctionDatabase extends AutoCloseable
  • Method Details

    • isPasswordChangeAllowed

      default boolean isPasswordChangeAllowed()
      Determine if the connected database supports a user password change.
      Returns:
      true if a password change is permitted, else false.
    • changePassword

      default String changePassword(char[] newPassword)
      Issue password change request to the server. The method isPasswordChangeAllowed() must be invoked first to ensure that the user password may be changed.
      Parameters:
      newPassword - is password data
      Returns:
      null if change was successful, or the error message
    • getStatus

      Returns:
      the status of the current connection with this database
    • getConnectionType

      FunctionDatabase.ConnectionType getConnectionType()
      Returns:
      the type of connection
    • getUserName

      String getUserName()
      Returns:
      username (being used to establish connection)
    • getLSHVectorFactory

      LSHVectorFactory getLSHVectorFactory()
      Returns:
      factory the database is using to create LSHVector objects
    • getInfo

      Returns:
      an information object giving general characteristics and descriptions of this database
    • compareLayout

      int compareLayout()
      Return -1 if info layout version is earlier than current client expectation Return 1 if info layout version is later than current client expectation Return 0 if info version and client version are the same
      Returns:
      comparison of actual database layout with layout expected by client
    • getServerInfo

      BSimServerInfo getServerInfo()
      Return the server info object for this database
      Returns:
      the server info object
    • getURLString

      @Deprecated String getURLString()
      Deprecated.
    • initialize

      boolean initialize()
      Initialize (a connection with) the database. If initialization is not successful, this routine will return false and an error description can be obtained using getLastError
      Returns:
      true if the database ready for querying
    • close

      void close()
      Close down (the connection with) the database
      Specified by:
      close in interface AutoCloseable
    • getLastError

      If the last query failed to produce a response, use this method to recover the error message
      Returns:
      a String describing the error
    • query

      QueryResponseRecord query(BSimQuery<?> query)
      Send a query to the database. The response is returned as a QueryResponseRecord. If this is null, an error has occurred and an error message can be obtained from getLastError
      Parameters:
      query - an object describing the query
      Returns:
      the response object or null if there is an error
    • checkSettingsForQuery

      static void checkSettingsForQuery(DescriptionManager manage, DatabaseInformation info) throws LSHException
      Throws:
      LSHException
    • checkSettingsForInsert

      static boolean checkSettingsForInsert(DescriptionManager manage, DatabaseInformation info) throws LSHException, FunctionDatabase.DatabaseNonFatalException
      Throws:
      LSHException
      FunctionDatabase.DatabaseNonFatalException
    • constructFatalError

      static String constructFatalError(int flags, ExecutableRecord newrec, ExecutableRecord orig)
    • constructNonfatalError

      static String constructNonfatalError(int flags, ExecutableRecord newrec, ExecutableRecord orig)
    • loadConfigurationTemplate

      static Configuration loadConfigurationTemplate(String configname) throws LSHException
      Throws:
      LSHException
    • generateLSHVectorFactory

      static WeightedLSHCosineVectorFactory generateLSHVectorFactory()
      Central location for building vector factory used by FunctionDatabase
      Returns:
      the LSHVectorFactory object
    • getConfigurationTemplates

      static List<File> getConfigurationTemplates()
      Returns a list of all configuration template files.
      Returns:
      list of template files
    • isConfigTemplate

      static boolean isConfigTemplate(File file)
      Determines if a given xml file is a config template. This is done by opening the file and checking for the presence of a <dbconfig> root tag.
      Parameters:
      file - the file to inspect
      Returns:
      true if the file is config template
    • getQueriedFunctionsPerStage

      default int getQueriedFunctionsPerStage()
      Get the maximum number of functions to be queried per staged query when searching for similar functions.
      Returns:
      maximum number of functions to be queried per staged query, or 0 for default which is generally ten (10) per stage. See SFQueryInfo.DEFAULT_QUERIES_PER_STAGE.
    • getOverviewFunctionsPerStage

      default int getOverviewFunctionsPerStage()
      Get the maximum number of functions to be queried per staged query when performing an overview query.
      Returns:
      maximum number of functions to be queried per staged query, or 0 for default which is generally ten (10) per stage. See SFOverviewInfo.DEFAULT_QUERIES_PER_STAGE.