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 boolean
areLocalServerRolesEmpty()
Checks whether the list of roles of the local server is empty.static void
createFirstLocalServerRole(java.lang.String firstRoleName, java.lang.String password)
Creates the first role 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 of 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 of 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.
-
Constructor Details
-
ConnectionFactory
public ConnectionFactory()
-
-
Method Details
-
newServerConnection
public static ServerConnection newServerConnection(java.lang.String serverURL, java.lang.String roleName, java.lang.String password) throws JRDFoxExceptionCreates a new connection of a server whose location is specified by the given URL. URLrdfox: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 accessedroleName
- the role name (currently ignored)password
- the password (currently ignored)- 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 JRDFoxExceptionCreates a new connection of 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 accesseddataStoreName
- the name of the data store inside the serverroleName
- the role name (currently ignored)password
- the password (currently ignored)- 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 JRDFoxExceptionStarts 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; these can be used to supply license information (see section 1.4. RDFox License files of the user documentation for more information)- 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
-
areLocalServerRolesEmpty
Checks whether the list of roles of the local server is empty.- Returns:
true
if the list of roles of the local server is empty- Throws:
JRDFoxException
- thrown if there is an error
-
createFirstLocalServerRole
public static void createFirstLocalServerRole(java.lang.String firstRoleName, java.lang.String password) throws JRDFoxExceptionCreates 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 createdpassword
- the password for the first role- Throws:
JRDFoxException
- thrown if there is an error
-
stopLocalServer
Stops the local server, or does nothing if the local server is not running.- Throws:
JRDFoxException
- thrown if there is an error
-