org.eclipse.rdf4j.sail.helpers

## Class SailWrapper

- java.lang.Object
- - org.eclipse.rdf4j.sail.helpers.SailWrapper

- All Implemented Interfaces:
    FederatedServiceResolverClient, Sail, StackableSail
  Direct Known Subclasses:
    NotifyingSailWrapper

      public class SailWrapper
      extends Object
      implements StackableSail, FederatedServiceResolverClient

  An implementation of the StackableSail interface that wraps another Sail object and forwards any relevant calls to the wrapped Sail.
  Author:
    Arjohn Kampman

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SailWrapper()` Creates a new SailWrapper.
    `SailWrapper(Sail baseSail)` Creates a new SailWrapper that wraps the supplied Sail.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Sail` | `getBaseSail()` Gets the base Sail that this Sail works on top of.
    `SailConnection` | `getConnection()` Opens a connection on the Sail which can be used to query and update data.
    `File` | `getDataDir()` Gets the Sail's data directory.
    `IsolationLevel` | `getDefaultIsolationLevel()` Retrieves the default `IsolationLevel` level on which transactions in this Sail operate.
    `List<IsolationLevel>` | `getSupportedIsolationLevels()` Retrieve the `IsolationLevel`s supported by this SAIL, ordered by increasing complexity.
    `ValueFactory` | `getValueFactory()` Gets a ValueFactory object that can be used to create IRI-, blank node-, literal- and statement objects.
    `void` | `initialize()` Initializes the Sail.
    `boolean` | `isWritable()` Checks whether this Sail object is writable, i.e.
    `void` | `setBaseSail(Sail baseSail)` Sets the base Sail that this Sail will work on top of.
    `void` | `setDataDir(File dataDir)` Sets the data directory for the Sail.
    `void` | `setFederatedServiceResolver(FederatedServiceResolver resolver)` Sets the `FederatedServiceResolver` to use for this client.
    `void` | `shutDown()` Shuts down the Sail, giving it the opportunity to synchronize any stale data.
    `protected void` | `verifyBaseSailSet()`

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

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

    - ### Methods inherited from interface org.eclipse.rdf4j.sail.Sail

      `init`

- - ### Constructor Detail

    - #### SailWrapper

          public SailWrapper()

      Creates a new SailWrapper. The base Sail for the created SailWrapper can be set later using `setBaseSail(org.eclipse.rdf4j.sail.Sail)`.

    - #### SailWrapper

          public SailWrapper(Sail baseSail)

      Creates a new SailWrapper that wraps the supplied Sail.

  - ### Method Detail

    - #### setBaseSail

          public void setBaseSail(Sail baseSail)

      Description copied from interface: `StackableSail`
      Sets the base Sail that this Sail will work on top of. This method will be called before the initialize() method is called.
      Specified by:
        `setBaseSail` in interface `StackableSail`

    - #### getBaseSail

          public Sail getBaseSail()

      Description copied from interface: `StackableSail`
      Gets the base Sail that this Sail works on top of.
      Specified by:
        `getBaseSail` in interface `StackableSail`

    - #### verifyBaseSailSet

          protected void verifyBaseSailSet()

    - #### setFederatedServiceResolver

          public void setFederatedServiceResolver(FederatedServiceResolver resolver)

      Description copied from interface: `FederatedServiceResolverClient`
      Sets the `FederatedServiceResolver` to use for this client.
      Specified by:
        `setFederatedServiceResolver` in interface `FederatedServiceResolverClient`
      Parameters:
        `resolver` - The resolver to use.

    - #### getDataDir

          public File getDataDir()

      Description copied from interface: `Sail`
      Gets the Sail's data directory.
      Specified by:
        `getDataDir` in interface `Sail`
      See Also:
        `Sail.setDataDir(File)`

    - #### setDataDir

          public void setDataDir(File dataDir)

      Description copied from interface: `Sail`
      Sets the data directory for the Sail. The Sail can use this directory for storage of data, parameters, etc. This directory must be set before the Sail is `initialized`.
      Specified by:
        `setDataDir` in interface `Sail`

    - #### initialize

          public void initialize()
                          throws SailException

      Description copied from interface: `Sail`
      Initializes the Sail. Care should be taken that required initialization parameters have been set before this method is called. Please consult the specific Sail implementation for information about the relevant parameters.
      Specified by:
        `initialize` in interface `Sail`
      Throws:
        `SailException` - If the Sail could not be initialized.

    - #### shutDown

          public void shutDown()
                        throws SailException

      Description copied from interface: `Sail`
      Shuts down the Sail, giving it the opportunity to synchronize any stale data. Care should be taken that all initialized Sails are being shut down before an application exits to avoid potential loss of data. Once shut down, a Sail can no longer be used until it is re-initialized.
      Specified by:
        `shutDown` in interface `Sail`
      Throws:
        `SailException` - If the Sail object encountered an error or unexpected situation internally.

    - #### isWritable

          public boolean isWritable()
                             throws SailException

      Description copied from interface: `Sail`
      Checks whether this Sail object is writable, i.e. if the data contained in this Sail object can be changed.
      Specified by:
        `isWritable` in interface `Sail`
      Throws:
        `SailException`

    - #### getConnection

          public SailConnection getConnection()
                                       throws SailException

      Description copied from interface: `Sail`
      Opens a connection on the Sail which can be used to query and update data. Depending on how the implementation handles concurrent access, a call to this method might block when there is another open connection on this Sail.
      Specified by:
        `getConnection` in interface `Sail`
      Throws:
        `SailException` - If no transaction could be started, for example because the Sail is not writable.

    - #### getValueFactory

          public ValueFactory getValueFactory()

      Description copied from interface: `Sail`
      Gets a ValueFactory object that can be used to create IRI-, blank node-, literal- and statement objects.
      Specified by:
        `getValueFactory` in interface `Sail`
      Returns:
        a ValueFactory object for this Sail object.

    - #### getSupportedIsolationLevels

          public List<IsolationLevel> getSupportedIsolationLevels()

      Description copied from interface: `Sail`
      Retrieve the `IsolationLevel`s supported by this SAIL, ordered by increasing complexity.
      Specified by:
        `getSupportedIsolationLevels` in interface `Sail`
      Returns:
        a non-empty List of supported Isolation Levels, in order of increasing complexity. Every SAIL supports at least one `IsolationLevel`.

    - #### getDefaultIsolationLevel

          public IsolationLevel getDefaultIsolationLevel()

      Description copied from interface: `Sail`
      Retrieves the default `IsolationLevel` level on which transactions in this Sail operate.
      Specified by:
        `getDefaultIsolationLevel` in interface `Sail`
      Returns:
        the `IsolationLevel` that will be used with `SailConnection.begin()`, for SAIL connections returned by `Sail.getConnection()`.

Copyright © 2015-2022 Eclipse Foundation. All Rights Reserved.