Package org.eclipse.rdf4j.federated

## Class FederationManager

- java.lang.Object
- - org.eclipse.rdf4j.federated.FederationManager

-     public class FederationManager
      extends Object

  The FederationManager manages all modules necessary for the runtime behavior. This includes for instance the federation layer instance, cache and statistics. It is Singleton and there can only be on federation instance at a time.

  The factory `FedXFactory` provides various functions for initialization of FedX and should be used as the entry point for any application using FedX.

       Config.initialize(fedxConfig);
       List<Endpoint> members = ...                  // e.g. use EndpointFactory methods
       FedXRepository repo = FedXFactory.initializeFederation(endpoints);
       ReositoryConnection conn = repo.getConnection();

       // Do something with the connection, e.g. query evaluation
       repo.shutDown();

  Author:
    Andreas Schwarte

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static class` | `FederationManager.FederationType` | The Federation type definition: Local, Remote, Hybrid

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `FederationManager()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addAll​(List<Endpoint> endpoints)` | Add the specified endpoints to the federation and take care for updating all structures.
    `void` | `addEndpoint​(Endpoint e, boolean... updateStrategy)` | Add the specified endpoint to the federation.
    `WorkerUnionBase<BindingSet>` | `createWorkerUnion​(QueryInfo queryInfo)` | Create an appropriate worker union for this federation, i.e.
    `Executor` | `getExecutor()` | Returns the managed `Executor` which takes for properly handling any configured `FedXConfig.getTaskWrapper()`
    `FedX` | `getFederation()` |
    `FederationManager.FederationType` | `getFederationType()` |
    `ControlledWorkerScheduler<BindingSet>` | `getJoinScheduler()` |
    `ControlledWorkerScheduler<BindingSet>` | `getLeftJoinScheduler()` |
    `FederationEvalStrategy` | `getStrategy()` |
    `ControlledWorkerScheduler<BindingSet>` | `getUnionScheduler()` |
    `void` | `init​(FedX federation, FederationContext federationContext)` |
    `void` | `removeAll()` | Remove all endpoints from the federation, e.g.
    `void` | `removeEndpoint​(Endpoint e, boolean... updateStrategy)` | Remove the specified endpoint from the federation.
    `void` | `reset()` | Reset the `Scheduler` instances, i.e.
    `void` | `shutDown()` | Shutdown the federation including the following operations:
    `void` | `updateStrategy()` | Update the federation evaluation strategy using the classification of endpoints as provided by `Endpoint.getEndpointClassification()`:

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

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

- - ### Constructor Detail

    - #### FederationManager

          public FederationManager()

  - ### Method Detail

    - #### init

          public void init​(FedX federation,
                           FederationContext federationContext)

    - #### reset

          public void reset()

      Reset the `Scheduler` instances, i.e. abort all running threads and create a new scheduler instance.

    - #### getExecutor

          public Executor getExecutor()

      Returns the managed `Executor` which takes for properly handling any configured `FedXConfig.getTaskWrapper()`

    - #### getFederation

          public FedX getFederation()

    - #### getStrategy

          public FederationEvalStrategy getStrategy()

    - #### getJoinScheduler

          public ControlledWorkerScheduler<BindingSet> getJoinScheduler()

    - #### getLeftJoinScheduler

          public ControlledWorkerScheduler<BindingSet> getLeftJoinScheduler()

    - #### getUnionScheduler

          public ControlledWorkerScheduler<BindingSet> getUnionScheduler()

    - #### getFederationType

          public FederationManager.FederationType getFederationType()

    - #### addEndpoint

          public void addEndpoint​(Endpoint e,
                                  boolean... updateStrategy)
                           throws FedXRuntimeException

      Add the specified endpoint to the federation. The federation must not contain a member with the same endpoint location.
      Parameters:
        `e` - the endpoint
        `updateStrategy` - optional parameter, to determine if strategy is to be updated, default=true
      Throws:
        `FedXRuntimeException` - if the federation has already a member with the same location

    - #### addAll

          public void addAll​(List<Endpoint> endpoints)

      Add the specified endpoints to the federation and take care for updating all structures.
      Parameters:
        `endpoints` - a list of endpoints to add

    - #### removeEndpoint

          public void removeEndpoint​(Endpoint e,
                                     boolean... updateStrategy)
                              throws RepositoryException

      Remove the specified endpoint from the federation.
      Parameters:
        `e` - the endpoint
        `updateStrategy` - optional parameter, to determine if strategy is to be updated, default=true
      Throws:
        `RepositoryException`

    - #### removeAll

          public void removeAll()
                         throws RepositoryException

      Remove all endpoints from the federation, e.g. to load a new preset. Repositories of the endpoints are shutDown, and the EndpointManager is added accordingly.
      Throws:
        `RepositoryException`

    - #### shutDown

          public void shutDown()
                        throws FedXException

      Shutdown the federation including the following operations:

      - shut down repositories of all federation members
      - persist the cached information
      - clear the endpoint manager
      Throws:
        `FedXException` - if an error occurs while shutting down the federation

    - #### createWorkerUnion

          public WorkerUnionBase<BindingSet> createWorkerUnion​(QueryInfo queryInfo)

      Create an appropriate worker union for this federation, i.e. a synchronous worker union for local federations and a multithreaded worker union for remote & hybrid federations.
      Returns:
        the `WorkerUnionBase`
      See Also:
        `ControlledWorkerUnion`, `SynchronousWorkerUnion`

    - #### updateStrategy

          public void updateStrategy()

      Update the federation evaluation strategy using the classification of endpoints as provided by `Endpoint.getEndpointClassification()`:

      Which strategy is applied depends on `FederationEvaluationStrategyFactory`. Default strategies:

      - local federation: `SailFederationEvalStrategy`
      - endpoint federation: `SparqlFederationEvalStrategy`
      - hybrid federation: `SparqlFederationEvalStrategy`