Package com.complexible.stardog.api
Class ConnectionConfiguration
- java.lang.Object
-
- com.complexible.stardog.api.AbstractConnectionConfiguration<Connection>
-
- com.complexible.stardog.api.ConnectionConfiguration
-
- All Implemented Interfaces:
Copyable<ConnectionConfiguration>,LoginConnectionConfiguration<Connection>
public final class ConnectionConfiguration extends AbstractConnectionConfiguration<Connection> implements Copyable<ConnectionConfiguration>
- Since:
- 0.1
- Version:
- 3.0
- Author:
- Michael Grove Grove, Hector Perez-Urbina
-
-
Field Summary
Fields Modifier and Type Field Description static Option<java.lang.Integer>CLIENT_BUFFER_SIZEstatic Option<java.lang.String>DATABASEstatic Option<java.lang.Boolean>EXACT_SIZEstatic Option<java.lang.Boolean>OPTIMIZE_MIXED_UPDATESstatic Option<java.lang.Boolean>REASONING_ENABLEDDeprecated.Using this option directly is deprecated.static Option<java.lang.String>REASONING_SCHEMAstatic Option<java.util.UUID>TX-
Fields inherited from class com.complexible.stardog.api.AbstractConnectionConfiguration
CONNECTION_TYPE, mOptionParser, mOptions, RUN_AS_USER
-
Fields inherited from interface com.complexible.stardog.api.LoginConnectionConfiguration
BEARER, CREDENTIALS, CREDENTIALS_SUPPLIER, IS_TOKEN, KRB5_REVERSE_DNS, PASSWORD, SERVER, USERNAME
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedConnectionConfiguration()protectedConnectionConfiguration(Options theOptions)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Connectionat(java.lang.String theConnectionString)Open a connection to the database specified directly by the connection string which may contain connection optionsConnectionconnect()Create a connection object to the database as described by this configuration.ConnectionConfigurationcopy()Create a deep copy of the object which does not share any references with the original.ConnectionConfigurationcredentials(ConnectionCredentials theConnectionCredentials)Specify the credentials that should be used to authenticate to the database.ConnectionConfigurationcredentials(java.lang.String theUsername, java.lang.String thePassword)Specify the username and password that should be used to authenticate to the database.ConnectionConfigurationcredentialSupplier(java.util.function.Supplier<ConnectionCredentials> theSupplier)Specify the supplier which will provide credentials at the time which they will be used.ConnectionConfigurationdatabase(java.lang.String theDB)Specify the name of the db you want to connect toConnectionConfigurationexactSize(boolean theExactSize)Specify whethersize()calls on the connection must return accurate values.static ConnectionConfigurationfrom(java.lang.String theConnectionString)Create a SNARLConnectionConfiguration based on the full connection string.<V> Vget(Option<V> theOption)Return the value of the provide connection configuration optionConnectionConfigurationreasoning(boolean theReasoningFlag)Specify whether you would like the connection to utilize reasoning.ConnectionConfigurationrunningAs(java.lang.String theUsername)Run commands passed to this connection as the given userConnectionConfigurationschema(java.lang.String theSchema)Specify the reasoning schema that will be used by connection.ConnectionConfigurationserver(java.lang.String theServerURL)Specify the URL of the database server.static ConnectionConfigurationto(java.lang.String theDBName)Create a new configuration object for connecting to the Stardog database with the provided nameConnectionConfigurationwith(Options theOptions)Use the given options as parameters to the connection-
Methods inherited from class com.complexible.stardog.api.AbstractConnectionConfiguration
credentials, getOptions, set, setAll
-
-
-
-
Field Detail
-
REASONING_ENABLED
@Deprecated public static final Option<java.lang.Boolean> REASONING_ENABLED
Deprecated.Using this option directly is deprecated. Either use one of thereasoning(boolean)orschema(String)functions or theREASONING_SCHEMAoption instead.
-
REASONING_SCHEMA
public static final Option<java.lang.String> REASONING_SCHEMA
-
DATABASE
public static final Option<java.lang.String> DATABASE
-
TX
public static final Option<java.util.UUID> TX
-
CLIENT_BUFFER_SIZE
public static final Option<java.lang.Integer> CLIENT_BUFFER_SIZE
-
OPTIMIZE_MIXED_UPDATES
public static final Option<java.lang.Boolean> OPTIMIZE_MIXED_UPDATES
-
EXACT_SIZE
public static final Option<java.lang.Boolean> EXACT_SIZE
-
-
Constructor Detail
-
ConnectionConfiguration
protected ConnectionConfiguration()
-
ConnectionConfiguration
protected ConnectionConfiguration(Options theOptions)
-
-
Method Detail
-
copy
public ConnectionConfiguration copy()
Create a deep copy of the object which does not share any references with the original.- Specified by:
copyin interfaceCopyable<ConnectionConfiguration>- Returns:
- a copy of the object
-
credentials
public ConnectionConfiguration credentials(java.lang.String theUsername, java.lang.String thePassword)
Specify the username and password that should be used to authenticate to the database.- Specified by:
credentialsin interfaceLoginConnectionConfiguration<Connection>- Overrides:
credentialsin classAbstractConnectionConfiguration<Connection>- Parameters:
theUsername- the usernamethePassword- the password- Returns:
- this configuration
-
credentials
public ConnectionConfiguration credentials(ConnectionCredentials theConnectionCredentials)
Specify the credentials that should be used to authenticate to the database.- Specified by:
credentialsin interfaceLoginConnectionConfiguration<Connection>- Overrides:
credentialsin classAbstractConnectionConfiguration<Connection>- Parameters:
theConnectionCredentials- the credentials- Returns:
- this configuration
-
credentialSupplier
public ConnectionConfiguration credentialSupplier(java.util.function.Supplier<ConnectionCredentials> theSupplier)
Description copied from interface:LoginConnectionConfigurationSpecify the supplier which will provide credentials at the time which they will be used.- Specified by:
credentialSupplierin interfaceLoginConnectionConfiguration<Connection>- Overrides:
credentialSupplierin classAbstractConnectionConfiguration<Connection>- Parameters:
theSupplier- the credential supplier- Returns:
- this configuration
-
server
public ConnectionConfiguration server(java.lang.String theServerURL)
Specify the URL of the database server.- Specified by:
serverin interfaceLoginConnectionConfiguration<Connection>- Overrides:
serverin classAbstractConnectionConfiguration<Connection>- Parameters:
theServerURL- the server url- Returns:
- this configuration
-
runningAs
public ConnectionConfiguration runningAs(java.lang.String theUsername)
Run commands passed to this connection as the given user- Overrides:
runningAsin classAbstractConnectionConfiguration<Connection>- Parameters:
theUsername- the username- Returns:
- this object
-
reasoning
public ConnectionConfiguration reasoning(boolean theReasoningFlag)
Specify whether you would like the connection to utilize reasoning. If the reasoning schema was explicitly set via theschema(String)function beforehand then callingreasoning(true)will have no effect. If schema is not set then callingreasoning(true)is equivalent to setting the schema to thedefault schema. Callingreasoning(false)is always equivalent to setting the schema to thenull schema.- Parameters:
theReasoningFlag- the reasoning flag- Returns:
- this configuration
-
schema
public ConnectionConfiguration schema(java.lang.String theSchema)
Specify the reasoning schema that will be used by connection. If the schema is specified with this function then you do not need to callreasoning(boolean).- Parameters:
theSchema- the name of the schema- Returns:
- this query
-
exactSize
public ConnectionConfiguration exactSize(boolean theExactSize)
Specify whethersize()calls on the connection must return accurate values.- Parameters:
theExactSize- the exact size flag- Returns:
- this configuration
-
database
public ConnectionConfiguration database(java.lang.String theDB)
Specify the name of the db you want to connect to- Parameters:
theDB- the name of the database- Returns:
- this configuration
-
with
public ConnectionConfiguration with(Options theOptions)
Use the given options as parameters to the connection- Parameters:
theOptions- the connection options- Returns:
- this object
-
get
public <V> V get(Option<V> theOption)
Return the value of the provide connection configuration option- Type Parameters:
V- the option type- Parameters:
theOption- the value- Returns:
- the option value, or null if it is not set
-
connect
public Connection connect() throws StardogException
Create a connection object to the database as described by this configuration. This function does not necessarily open a network connection to the server which may happen later when theConnectionis used.- Specified by:
connectin interfaceLoginConnectionConfiguration<Connection>- Returns:
- the connection
- Throws:
StardogException- if there was an error while opening the connection
-
at
public static Connection at(java.lang.String theConnectionString) throws StardogException
Open a connection to the database specified directly by the connection string which may contain connection options- Parameters:
theConnectionString- the connection string- Returns:
- the connection
- Throws:
StardogException- if there is an error connecting to the specified repository
-
from
public static ConnectionConfiguration from(java.lang.String theConnectionString)
Create a SNARLConnectionConfiguration based on the full connection string. A ConnectionConfiguration is returned to give users the ability to change properties of the connection string before connecting, or to use to establish aconnection pool.- Parameters:
theConnectionString- the connection string- Returns:
- the configuration representing the connection string.
-
to
public static ConnectionConfiguration to(java.lang.String theDBName)
Create a new configuration object for connecting to the Stardog database with the provided name- Parameters:
theDBName- the name- Returns:
- a new connection configuration
-
-