Class RDFoxServer

java.lang.Object
tech.oxfordsemantic.jrdfox.client.RDFoxServer

public class RDFoxServer
extends java.lang.Object
Provides ways to manage the server instance and create connections.
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    static class  RDFoxServer.InstanceState
    Describes the state of an RDFox instance in a given server directory.
  • Constructor Summary

    Constructors 
    Constructor Description
    RDFoxServer()  
  • Method Summary

    Modifier and Type Method Description
    static RDFoxServer.InstanceState analyzeState​(java.lang.String serverDirectoryPath)
    Analyzes the state of the server instance in the specified server directory.
    static void createFirstRole​(java.lang.String firstRoleName, java.lang.String password)
    Creates the first role in the server.
    static long getNumberOfRoles()
    Returns the number of roles currently present in the server.
    static void initialize​(java.lang.String serverDirectoryPath, java.lang.String persistenceEncryptionKey, java.util.Map<java.lang.String,​java.lang.String> permanentServerParameters)
    Initializes the server instance in the specified server directory using the supplied server parameters.
    static void loadRDFoxNativeLibraryFromAbsolutePath​(java.lang.String filePath)
    Loads the RDFox native library from the file with the given name using System.load().
    static void loadRDFoxNativeLibraryFromDefaultPath​(java.lang.String libraryName)
    Loads the RDFox native library with the given library name using the System.loadLibrary() method.
    static DataStoreConnection newDataStoreConnection​(java.lang.String dataStoreName, java.lang.String roleName, java.lang.String password)
    Creates a new connection to a data store at the server.
    static ServerConnection newServerConnection​(java.lang.String roleName, java.lang.String password)
    Creates a new connection to the RDFox server.
    static int start​(java.util.Map<java.lang.String,​java.lang.String> serverParameters)
    Starts the server using the supplied parameters and returns the number of data stores in the server (or -1 is the server is already running).
    static void stop()
    Stops the server, or does nothing if the server is not running.
    static void upgrade​(java.lang.String serverDirectoryPath, java.lang.String persistenceEncryptionKey, java.io.OutputStream outputStream)
    Upgrades the server instance in the specified server directory to the version used by this RDFox version.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • loadRDFoxNativeLibraryFromAbsolutePath

      public static void loadRDFoxNativeLibraryFromAbsolutePath​(java.lang.String filePath)
      Loads the RDFox native library from the file with the given name using System.load(). This function prevents the library from being loaded more than once.
      Parameters:
      filePath - the path to the library file
    • loadRDFoxNativeLibraryFromDefaultPath

      public static void loadRDFoxNativeLibraryFromDefaultPath​(java.lang.String libraryName)
      Loads the RDFox native library with the given library name using the System.loadLibrary() method. This function prevents the library from being loaded more than once.
      Parameters:
      libraryName - the name of the library to load
    • newServerConnection

      public static ServerConnection newServerConnection​(java.lang.String roleName, java.lang.String password) throws JRDFoxException
      Creates a new connection to the RDFox server. The server can be started explicitly, or it will be started automatically before the first server connection to it is created. If a server instance is started when the server connection is created, the server is initialized using a parameter map according to the following system properties: - "RDFox.api-log": If this is set to "true", the parameters map includes key "api-log" and value "true". - "RDFox.api-log.directory": If this is set, the parameters map includes "api-log.directory" and value equal to the value of the system property. - "RDFox.api-log.input-recording-limit": If this is set, the the parameters map includes key "api-log.input-recording-limit" and value equal to the value of the system property.
      Parameters:
      roleName - the role name
      password - the password
      Returns:
      the server connection
      Throws:
      JRDFoxException - thrown if there is an error
    • newDataStoreConnection

      public static DataStoreConnection newDataStoreConnection​(java.lang.String dataStoreName, java.lang.String roleName, java.lang.String password) throws JRDFoxException
      Creates a new connection to a data store at the server. This method throws an exception if the server is not running.
      Parameters:
      dataStoreName - the name of the data store inside the server
      roleName - the role name
      password - the password
      Returns:
      the data store connection
      Throws:
      JRDFoxException - thrown if there is an error
    • analyzeState

      public static RDFoxServer.InstanceState analyzeState​(java.lang.String serverDirectoryPath) throws JRDFoxException
      Analyzes the state of the server instance in the specified server directory.
      Parameters:
      serverDirectoryPath - the path to the server directory
      Throws:
      JRDFoxException - thrown if there is an error
    • initialize

      public static void initialize​(java.lang.String serverDirectoryPath, java.lang.String persistenceEncryptionKey, java.util.Map<java.lang.String,​java.lang.String> permanentServerParameters) throws JRDFoxException
      Initializes the server instance in the specified server directory using the supplied server parameters.
      Parameters:
      serverDirectoryPath - the path to the server directory
      persistenceEncryptionKey - the new used to encrypt the server state (should be null if encryption is not used)
      permanentServerParameters - the parameters of the server (see Server Parameters)
      Throws:
      JRDFoxException - thrown if there is an error
    • upgrade

      public static void upgrade​(java.lang.String serverDirectoryPath, java.lang.String persistenceEncryptionKey, java.io.OutputStream outputStream) throws JRDFoxException
      Upgrades the server instance in the specified server directory to the version used by this RDFox version.
      Parameters:
      serverDirectoryPath - the path to the server directory
      persistenceEncryptionKey - the new used to encrypt the server state (should be null if encryption is not used)
      outputStream - receives textual description of the progress of the upgrade process
      Throws:
      JRDFoxException - thrown if there is an error
    • start

      public static int start​(java.util.Map<java.lang.String,​java.lang.String> serverParameters) throws JRDFoxException
      Starts the server using the supplied parameters and returns the number of data stores in the server (or -1 is the server is already running).
      Parameters:
      serverParameters - the parameters of the server (see Server Parameters)
      Returns:
      the number of data stores in the server, or -1 if the server is already running
      Throws:
      JRDFoxException - thrown if there is an error
    • getNumberOfRoles

      public static long getNumberOfRoles() throws JRDFoxException
      Returns the number of roles currently present in the server.
      Returns:
      the number of roles in the server
      Throws:
      JRDFoxException - thrown if there is an error
    • createFirstRole

      public static void createFirstRole​(java.lang.String firstRoleName, java.lang.String password) throws JRDFoxException
      Creates the first role in the server. An exception is thrown if the server already contains the first role.
      Parameters:
      firstRoleName - the name for the first role that is to be created
      password - the password for the first role
      Throws:
      JRDFoxException - thrown if there is an error
    • stop

      public static void stop() throws JRDFoxException
      Stops the server, or does nothing if the server is not running.
      Throws:
      JRDFoxException - thrown if there is an error