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 final Option<Integer>`
  `CLIENT_BUFFER_SIZE`
  `static final Option<String>`
  `DATABASE`
  `static final Option<Boolean>`
  `EXACT_SIZE`
  `static final Option<Boolean>`
  `OPTIMIZE_MIXED_UPDATES`
  `static final Option<Boolean>`
  `REASONING_ENABLED`
  Deprecated.
  Using this option directly is deprecated.
  `static final Option<String>`
  `REASONING_SCHEMA`
  `static final Option<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
  `protected`
  `ConnectionConfiguration()`
  `protected`
  `ConnectionConfiguration(Options theOptions)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static Connection`
  `at(String theConnectionString)`
  Open a connection to the database specified directly by the connection string which may contain connection options
  `Connection`
  `connect()`
  Create a connection object to the database as described by this configuration.
  `ConnectionConfiguration`
  `copy()`
  Create a deep copy of the object which does not share any references with the original.
  `ConnectionConfiguration`
  `credentials(ConnectionCredentials theConnectionCredentials)`
  Specify the credentials that should be used to authenticate to the database.
  `ConnectionConfiguration`
  `credentials(String theUsername, String thePassword)`
  Specify the username and password that should be used to authenticate to the database.
  `ConnectionConfiguration`
  `credentialSupplier(Supplier<ConnectionCredentials> theSupplier)`
  Specify the supplier which will provide credentials at the time which they will be used.
  `ConnectionConfiguration`
  `database(String theDB)`
  Specify the name of the db you want to connect to
  `ConnectionConfiguration`
  `exactSize(boolean theExactSize)`
  Specify whether `size()` calls on the connection must return accurate values.
  `static ConnectionConfiguration`
  `from(String theConnectionString)`
  Create a SNARLConnectionConfiguration based on the full connection string.
  `<V> V`
  `get(Option<V> theOption)`
  Return the value of the provide connection configuration option
  `ConnectionConfiguration`
  `reasoning(boolean theReasoningFlag)`
  Specify whether you would like the connection to utilize reasoning.
  `ConnectionConfiguration`
  `runningAs(String theUsername)`
  Run commands passed to this connection as the given user
  `ConnectionConfiguration`
  `schema(String theSchema)`
  Specify the reasoning schema that will be used by connection.
  `ConnectionConfiguration`
  `server(String theServerURL)`
  Specify the URL of the database server.
  `static ConnectionConfiguration`
  `to(String theDBName)`
  Create a new configuration object for connecting to the Stardog database with the provided name
  `ConnectionConfiguration`
  `with(Options theOptions)`
  Use the given options as parameters to the connection

  ### Methods inherited from class com.complexible.stardog.api.AbstractConnectionConfiguration

  `credentials, getOptions, set, setAll`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### REASONING_ENABLED

    @Deprecated public static final Option<Boolean> REASONING_ENABLED
    Deprecated.
    Using this option directly is deprecated. Either use one of the `reasoning(boolean)` or `schema(String)` functions or the `REASONING_SCHEMA` option instead.

  - ### REASONING_SCHEMA

    public static final Option<String> REASONING_SCHEMA

  - ### DATABASE

    public static final Option<String> DATABASE

  - ### TX

    public static final Option<UUID> TX

  - ### CLIENT_BUFFER_SIZE

    public static final Option<Integer> CLIENT_BUFFER_SIZE

  - ### OPTIMIZE_MIXED_UPDATES

    public static final Option<Boolean> OPTIMIZE_MIXED_UPDATES

  - ### EXACT_SIZE

    public static final Option<Boolean> EXACT_SIZE

- ## Constructor Details

  - ### ConnectionConfiguration

    protected ConnectionConfiguration()

  - ### ConnectionConfiguration

    protected ConnectionConfiguration(Options theOptions)

- ## Method Details

  - ### copy

    public ConnectionConfiguration copy()
    Create a deep copy of the object which does not share any references with the original.
    Specified by:
      `copy` in interface `Copyable<ConnectionConfiguration>`
    Returns:
      a copy of the object

  - ### credentials

    public ConnectionConfiguration credentials(String theUsername, String thePassword)
    Specify the username and password that should be used to authenticate to the database.
    Specified by:
      `credentials` in interface `LoginConnectionConfiguration<Connection>`
    Overrides:
      `credentials` in class `AbstractConnectionConfiguration<Connection>`
    Parameters:
      `theUsername` - the username
      `thePassword` - 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:
      `credentials` in interface `LoginConnectionConfiguration<Connection>`
    Overrides:
      `credentials` in class `AbstractConnectionConfiguration<Connection>`
    Parameters:
      `theConnectionCredentials` - the credentials
    Returns:
      this configuration

  - ### credentialSupplier

    public ConnectionConfiguration credentialSupplier(Supplier<ConnectionCredentials> theSupplier)
    Description copied from interface: `LoginConnectionConfiguration`
    Specify the supplier which will provide credentials at the time which they will be used.
    Specified by:
      `credentialSupplier` in interface `LoginConnectionConfiguration<Connection>`
    Overrides:
      `credentialSupplier` in class `AbstractConnectionConfiguration<Connection>`
    Parameters:
      `theSupplier` - the credential supplier
    Returns:
      this configuration

  - ### server

    public ConnectionConfiguration server(String theServerURL)
    Specify the URL of the database server.
    Specified by:
      `server` in interface `LoginConnectionConfiguration<Connection>`
    Overrides:
      `server` in class `AbstractConnectionConfiguration<Connection>`
    Parameters:
      `theServerURL` - the server url
    Returns:
      this configuration

  - ### runningAs

    public ConnectionConfiguration runningAs(String theUsername)
    Run commands passed to this connection as the given user
    Overrides:
      `runningAs` in class `AbstractConnectionConfiguration<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 the `schema(String)` function beforehand then calling `reasoning(true)` will have no effect. If schema is not set then calling `reasoning(true)` is equivalent to setting the schema to the `default schema`. Calling `reasoning(false)` is always equivalent to setting the schema to the `null schema`.
    Parameters:
      `theReasoningFlag` - the reasoning flag
    Returns:
      this configuration

  - ### schema

    public ConnectionConfiguration schema(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 call `reasoning(boolean)`.
    Parameters:
      `theSchema` - the name of the schema
    Returns:
      this query

  - ### exactSize

    public ConnectionConfiguration exactSize(boolean theExactSize)
    Specify whether `size()` calls on the connection must return accurate values.
    Parameters:
      `theExactSize` - the exact size flag
    Returns:
      this configuration

  - ### database

    public ConnectionConfiguration database(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 the `Connection` is used.
    Specified by:
      `connect` in interface `LoginConnectionConfiguration<Connection>`
    Returns:
      the connection
    Throws:
      `StardogException` - if there was an error while opening the connection

  - ### at

    public static Connection at(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(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 a `connection pool`.
    Parameters:
      `theConnectionString` - the connection string
    Returns:
      the configuration representing the connection string.

  - ### to

    public static ConnectionConfiguration to(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