Class ConnectionFactory

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

public class ConnectionFactory
extends java.lang.Object
Provides ways to create connections, as well as start and stop local server instances.
  • Constructor Summary

    Constructors 
    Constructor Description
    ConnectionFactory()  
  • Method Summary

    Modifier and Type Method Description
    static void createFirstLocalServerRole​(java.lang.String firstRoleName, java.lang.String password)
    Creates the first role in the local server.
    static long getNumberOfLocalServerRoles()
    Returns the number of roles currently present in the local server.
    static DataStoreConnection newDataStoreConnection​(java.lang.String serverURL, java.lang.String dataStoreName, java.lang.String roleName, java.lang.String password)
    Creates a new connection to a data store at the server whose location is specified by the given URL.
    static ServerConnection newServerConnection​(java.lang.String serverURL, java.lang.String roleName, java.lang.String password)
    Creates a new connection to a server whose location is specified by the given URL.
    static java.lang.String[] startLocalServer​(java.util.Map<java.lang.String,​java.lang.String> serverParameters)
    Starts the local server and initialises it using the supplied parameters.
    static void stopLocalServer()
    Stops the local server, or does nothing if the local server is not running.

    Methods inherited from class java.lang.Object

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

  • Method Details

    • newServerConnection

      public static ServerConnection newServerConnection​(java.lang.String serverURL, java.lang.String roleName, java.lang.String password) throws JRDFoxException
      Creates a new connection to a server whose location is specified by the given URL. URL rdfox:local designates a connection to the local (i.e., in-process) server. The local server can be started explicitly, or it will be started automatically before the first server connection to it is created.
      Parameters:
      serverURL - the URL of the server being accessed
      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 serverURL, 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 whose location is specified by the given URL. This method throws an exception if the local server is not running.
      Parameters:
      serverURL - the URL of the server being accessed
      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
    • startLocalServer

      public static java.lang.String[] startLocalServer​(java.util.Map<java.lang.String,​java.lang.String> serverParameters) throws JRDFoxException
      Starts the local server and initialises it using the supplied parameters. If a local server instance is started when the first server connection to it is created, the server is initialised using the empty parameter map. An exception is thrown if the local server is already running.
      Parameters:
      serverParameters - the parameters of the local server (see Server Parameters)
      Returns:
      any warning messages as an array of strings. This array is empty if there are no warnings.
      Throws:
      JRDFoxException - thrown if there is an error
    • getNumberOfLocalServerRoles

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

      public static void createFirstLocalServerRole​(java.lang.String firstRoleName, java.lang.String password) throws JRDFoxException
      Creates the first role in the local 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
    • stopLocalServer

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