Package com.complexible.stardog.api.admin

# Class AbstractAdminConnection

java.lang.Object
com.complexible.stardog.api.admin.AbstractAdminConnection

All Implemented Interfaces:
  `AdminConnection`, `AutoCloseable`

Direct Known Subclasses:
  `KernelAdminConnection`

public abstract class AbstractAdminConnection extends Object implements AdminConnection

Since:
  5.0
Version:
  5.0
Author:
  Michael Grove

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from interface com.complexible.stardog.api.admin.AdminConnection

  `AdminConnection.StreamConsumer, AdminConnection.TxLogRange`

- ## Field Summary

  ### Fields inherited from interface com.complexible.stardog.api.admin.AdminConnection

  `NO_TIMEOUT`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AbstractAdminConnection(Views<AdminConnection> theViews)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected abstract void`
  `_close()`
  `protected abstract Metadata`
  `_get(String theName, Iterable<? extends MetaProperty<?>> theOptions)`
  `protected abstract <T> String`
  `_set(String theName, MetaProperty<T> theOption, T theValue)`
  `final <T extends AdminConnection>
  T`
  `as(Class<T> theView)`
  Return this admin connection viewed as a different type of admin connection.
  `protected void`
  `assertOpen()`
  Assert that the client is currently logged into the Stardog server
  `protected void`
  `assertValidName(String theName)`
  `DatabaseBuilder`
  `builder(Metadata theOptions)`
  Convenience method to create a database builder with the given options.
  `final void`
  `close()`
  Log out of the Stardog server and close the client.
  `DatabaseBuilder`
  `disk(String theName)`
  Create a new builder for creating disk databases
  `<T> T`
  `get(String theName, MetaProperty<T> theOption)`
  Gets the value of the specified option in the given database.
  `final Metadata`
  `get(String theName, Iterable<? extends MetaProperty<?>> theOptions)`
  Gets the values of the specified options in the given database.
  `final boolean`
  `isOpen()`
  Return whether or not this connection is open.
  `final DatabaseBuilder`
  `newDatabase(String theName)`
  Create a builder for creating a new database.
  `protected abstract DatabaseBuilder`
  `newDatabaseBuilder()`
  `String`
  `offline(String theName)`
  Makes the database offline according to the default strategy and default timeout.
  `final <T> String`
  `set(String theName, MetaProperty<T> theOption, T theValue)`
  Sets the value of the specified option for the database with the given name.

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

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

  ### Methods inherited from interface com.complexible.stardog.api.admin.AdminConnection

  `backup, backup, backup, backup, backupAll, checkpoint, currentStatus, currentStatus, drop, generateDiagnosticReport, getLogs, getPermissionManager, getProcessManager, getProperty, getQueryManager, getRoleManager, getStoredFunctions, getStoredQueries, getTokenManager, getUserManager, list, offline, online, optimize, optimize, renameDatabase, repair, replayTransactionLog, restore, restore, setProperty, shutdown, transactionLog, verify, whoami`

- ## Constructor Details

  - ### AbstractAdminConnection

    public AbstractAdminConnection(Views<AdminConnection> theViews)

- ## Method Details

  - ### _close

    protected abstract void _close()

  - ### newDatabaseBuilder

    protected abstract DatabaseBuilder newDatabaseBuilder()

  - ### _set

    protected abstract <T> String _set(String theName, MetaProperty<T> theOption, T theValue) throws StardogException
    Throws:
      `StardogException`

  - ### _get

    protected abstract Metadata _get(String theName, Iterable<? extends MetaProperty<?>> theOptions) throws StardogException
    Throws:
      `StardogException`

  - ### disk

    public DatabaseBuilder disk(String theName) throws StardogException
    Create a new builder for creating disk databases
    Specified by:
      `disk` in interface `AdminConnection`
    Parameters:
      `theName` - the name of the disk database to create
    Returns:
      a builder for a disk database
    Throws:
      `StardogException` - if the name of the database is invalid

  - ### builder

    public DatabaseBuilder builder(Metadata theOptions) throws StardogException
    Convenience method to create a database builder with the given options. The provided options should include at least two options: the name of the database and the index type.
    Specified by:
      `builder` in interface `AdminConnection`
    Returns:
      a builder for a database
    Throws:
      `StardogException` - if there was an error while creating the db

  - ### close

    public final void close()
    Log out of the Stardog server and close the client.
    Specified by:
      `close` in interface `AdminConnection`
    Specified by:
      `close` in interface `AutoCloseable`

  - ### as

    public final <T extends AdminConnection> T as(Class<T> theView) throws StardogException
    Return this admin connection viewed as a different type of admin connection.
    Specified by:
      `as` in interface `AdminConnection`
    Type Parameters:
      `T` - the connection view to return
    Parameters:
      `theView` - the type of connection to view this object as
    Returns:
      the new view of the connection.
    Throws:
      `StardogException` - if the connection cannot be viewed as the provided type. This could be from the parent connection having been closed or it does not support the provided view.

  - ### isOpen

    public final boolean isOpen()
    Return whether or not this connection is open.
    Specified by:
      `isOpen` in interface `AdminConnection`
    Returns:
      true if it is open, false otherwise

  - ### newDatabase

    public final DatabaseBuilder newDatabase(String theName) throws StardogException
    Create a builder for creating a new database.
    Specified by:
      `newDatabase` in interface `AdminConnection`
    Parameters:
      `theName` - the name of the database to create
    Returns:
      a builder for a database
    Throws:
      `StardogException` - if the name of the database is invalid

  - ### get

    public <T> T get(String theName, MetaProperty<T> theOption) throws StardogException
    Gets the value of the specified option in the given database. The function will return `null` if the option is NOT a `known Stardog options`, or if it is NOT `readable`. The function may also return `null` if the option is set to `null` value for the database. To differentiate these cases, `AdminConnection.get(String, Iterable)` function can be used instead. This function will throw an exception if the user does not have read access to the database metadata.
    Specified by:
      `get` in interface `AdminConnection`
    Type Parameters:
      `T` - type of the option value
    Parameters:
      `theName` - name of the database
      `theOption` - the option to get
    Returns:
      current value of the option in the database or `null` as explained above
    Throws:
      `StardogException` - if there was an error while getting the value

  - ### get

    public final Metadata get(String theName, Iterable<? extends MetaProperty<?>> theOptions) throws StardogException
    Gets the values of the specified options in the given database. The returned map is not guaranteed to `contain` all the specified options. Only the values for `known Stardog options` that are should be `readable` will be contained in the result. This function will throw an exception if the user does not have read access to the database metadata.
    Specified by:
      `get` in interface `AdminConnection`
    Parameters:
      `theName` - database name
      `theOptions` - options for which values will be retrieved
    Returns:
      metadata that contains values for the specified met properties
    Throws:
      `StardogException` - if an error occurs while retrieving option values

  - ### set

    public final <T> String set(String theName, MetaProperty<T> theOption, T theValue) throws StardogException
    Sets the value of the specified option for the database with the given name. For this function to complete without an exception, the logged in user should have write access to the database metadata for the specified database, the option should be a `known Stardog option`, the provided value should be `valid`, and either the option should be `writable online` or it should be `writable` and the database should NOT be `online`.
    Specified by:
      `set` in interface `AdminConnection`
    Type Parameters:
      `T` - type of the option value
    Parameters:
      `theName` - name of the database
      `theOption` - option to set
      `theValue` - option value
    Throws:
      `StardogException` - if an error occurs trying to set the option value

  - ### offline

    public String offline(String theName) throws StardogException
    Makes the database offline according to the default strategy and default timeout. Offline databases cannot be queried or updated and will be inaccessible to users.
    Specified by:
      `offline` in interface `AdminConnection`
    Returns:
      the server output of offline
    Throws:
      `StardogException`

  - ### assertOpen

    protected void assertOpen()
    Assert that the client is currently logged into the Stardog server
    Throws:
      `IllegalStateException` - if the client is not connected

  - ### assertValidName

    protected void assertValidName(String theName) throws StardogException
    Throws:
      `StardogException`