org.eclipse.rdf4j.federated

## Class FedX

- java.lang.Object
- - org.eclipse.rdf4j.sail.helpers.AbstractSail
  - - org.eclipse.rdf4j.federated.FedX

- All Implemented Interfaces:
    RepositoryResolverClient, Sail

      public class FedX
      extends AbstractSail
      implements RepositoryResolverClient

  FedX serves as implementation of the federation layer. It implements Sesame's Sail interface and can thus be used as a normal repository in a Sesame environment. The federation layer enables transparent access to the underlying members as if they were a central repository.

  For initialization of the federation and usage see `FederationManager`.

  Author:
    Andreas Schwarte

- - ### Field Summary

    - ### Fields inherited from class org.eclipse.rdf4j.sail.helpers.AbstractSail

      `connectionTimeOut, DEFAULT_CONNECTION_TIMEOUT, DEFAULT_ITERATION_SYNC_THRESHOLD, initializationLock`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FedX(List<Endpoint> endpoints)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `addMember(Endpoint endpoint)` Add a member to the federation (internal).
    `protected SailConnection` | `getConnectionInternal()` Returns a store-specific SailConnection object.
    `File` | `getDataDir()` Gets the Sail's data directory.
    `List<Endpoint>` | `getMembers()`
    `ValueFactory` | `getValueFactory()` Gets a ValueFactory object that can be used to create IRI-, blank node-, literal- and statement objects.
    `WriteStrategy` | `getWriteStrategy()` Compute and return the `WriteStrategy` depending on the current federation configuration.
    `protected void` | `initializeInternal()` Do store-specific operations to initialize the store.
    `protected void` | `initializeMember(Endpoint member)`
    `boolean` | `isWritable()` Checks whether this Sail object is writable, i.e.
    `boolean` | `removeMember(Endpoint endpoint)` Remove a member from the federation (internal)
    `void` | `setDataDir(File dataDir)` Sets the data directory for the Sail.
    `void` | `setFederationContext(FederationContext federationContext)`
    `void` | `setRepositoryResolver(RepositoryResolver resolver)`
    `protected void` | `shutDownInternal()` Try to shut down all federation members.

    - ### Methods inherited from class org.eclipse.rdf4j.sail.helpers.AbstractSail

      `addSupportedIsolationLevel, connectionClosed, debugEnabled, getConnection, getDefaultIsolationLevel, getIterationCacheSyncThreshold, getSupportedIsolationLevels, init, initialize, isInitialized, isTrackResultSize, removeSupportedIsolationLevel, setConnectionTimeOut, setDefaultIsolationLevel, setIterationCacheSyncThreshold, setSupportedIsolationLevels, setSupportedIsolationLevels, setTrackResultSize, shutDown, toString`

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

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

- - ### Constructor Detail

    - #### FedX

          public FedX(List<Endpoint> endpoints)

  - ### Method Detail

    - #### setFederationContext

          public void setFederationContext(FederationContext federationContext)

    - #### addMember

          protected void addMember(Endpoint endpoint)

      Add a member to the federation (internal).

      If the federation is already initialized, the given endpoint is explicitly initialized as well.

      Parameters:
        `endpoint` -

    - #### removeMember

          public boolean removeMember(Endpoint endpoint)

      Remove a member from the federation (internal)
      Parameters:
        `endpoint` -
      Returns:
        whether the member was removed

    - #### getWriteStrategy

          public WriteStrategy getWriteStrategy()

      Compute and return the `WriteStrategy` depending on the current federation configuration. The default implementation uses the `RepositoryWriteStrategy` with the first discovered writable `Endpoint`. In none is found, the `ReadOnlyWriteStrategy` is used.
      Returns:
        the `WriteStrategy`
      Throws:
        `FedXRuntimeException` - if the `WriteStrategy` could not be created

    - #### getConnectionInternal

          protected SailConnection getConnectionInternal()
                                                  throws SailException

      Description copied from class: `AbstractSail`
      Returns a store-specific SailConnection object.
      Specified by:
        `getConnectionInternal` in class `AbstractSail`
      Returns:
        A connection to the store.
      Throws:
        `SailException`

    - #### getDataDir

          public File getDataDir()

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

    - #### 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.

    - #### initializeInternal

          protected void initializeInternal()
                                     throws SailException

      Description copied from class: `AbstractSail`
      Do store-specific operations to initialize the store. The default implementation of this method does nothing.
      Overrides:
        `initializeInternal` in class `AbstractSail`
      Throws:
        `SailException`

    - #### initializeMember

          protected void initializeMember(Endpoint member)
                                   throws SailException

      Throws:
        `SailException`

    - #### 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`

    - #### 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`
      Overrides:
        `setDataDir` in class `AbstractSail`

    - #### shutDownInternal

          protected void shutDownInternal()
                                   throws SailException

      Try to shut down all federation members.
      Specified by:
        `shutDownInternal` in class `AbstractSail`
      Throws:
        `FedXException` - if not all members could be shut down
        `SailException`

    - #### getMembers

          public List<Endpoint> getMembers()

      Returns:
        an unmodifiable view of the current members

    - #### setRepositoryResolver

          public void setRepositoryResolver(RepositoryResolver resolver)

      Specified by:
        `setRepositoryResolver` in interface `RepositoryResolverClient`

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