Package com.complexible.stardog.api

# Interface Driver

public interface Driver

The interface that any Driver must implement. A driver will provide a `connection` implementation specific to its underlying protocol. To `connect(java.lang.String, com.complexible.common.base.Options)`, you must provide a valid connection string for the protocol. Use `LoginConnectionConfiguration` to programmatically create a connection string and use the appropriate Driver to connect to Stardog.

Optionally, a driver can support performing admin operations by providing an `AdminConnection` implementation. If the underlying protocol supports admin operations then `connectAdmin(String, Options)` function can be used to perform admin operations.

Since:
  0.3
Version:
  2.0
Author:
  Michael Grove

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `acceptsURL(String theURL)`
  Whether or not this driver can provide a connection for the provided URL
  `Connection`
  `connect(String theURL, Options theOptions)`
  Open a connection to the database
  `AdminConnection`
  `connectAdmin(String theURL, Options theOptions)`
  [Optional] Creates an `AdminConnection` to the database if the underlying protocol supports admin operations.
  `int`
  `getMajorVersion()`
  Return the major version of this driver
  `int`
  `getMinorVersion()`
  Return the minor version of this driver

- ## Method Details

  - ### connect

    Connection connect(String theURL, Options theOptions) throws StardogException
    Open a connection to the database
    Parameters:
      `theURL` - the URL of the database
      `theOptions` - any options needed for the connection, such as timeouts or username/pw
    Returns:
      the connection
    Throws:
      `StardogException` - if the driver is unable to establish the connection

  - ### connectAdmin

    AdminConnection connectAdmin(String theURL, Options theOptions) throws StardogException, UnsupportedOperationException
    [Optional] Creates an `AdminConnection` to the database if the underlying protocol supports admin operations.
    Parameters:
      `theURL` - the URL of the database
      `theOptions` - any options needed for the connection, such as timeouts or username/pw
    Returns:
      admin client
    Throws:
      `StardogException` - if the driver is unable to establish the connection
      `UnsupportedOperationException` - if the driver does not support admin operations

  - ### getMajorVersion

    int getMajorVersion()
    Return the major version of this driver
    Returns:
      the major version

  - ### getMinorVersion

    int getMinorVersion()
    Return the minor version of this driver
    Returns:
      the minor version

  - ### acceptsURL

    boolean acceptsURL(String theURL)
    Whether or not this driver can provide a connection for the provided URL
    Parameters:
      `theURL` - the URL
    Returns:
      true if it can (potentially) connect to it, false otherwise