Package org.eclipse.rdf4j.federated

## Class FedXFactory

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

-     public class FedXFactory
      extends Object

  FedX initialization factory methods for convenience: methods initialize the `FederationManager` and all required FedX structures. See `FederationManager` for some a code snippet.

  Use the `newFederation()` builder to create an advanced and customized federation

  Author:
    Andreas Schwarte

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected FedXConfig` | `config` |
    `protected FederatedServiceResolver` | `federatedServiceResolver` |
    `protected File` | `fedxBaseDir` |
    `protected static org.slf4j.Logger` | `log` |
    `protected List<Endpoint>` | `members` |
    `protected RepositoryResolver` | `repositoryResolver` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `FedXRepository` | `create()` | Create the federation using the provided configuration
    `static FedXRepository` | `createFederation​(File dataConfig)` | Create the federation with a specified data source configuration file (*.ttl).
    `static FedXRepository` | `createFederation​(List<Endpoint> endpoints)` | Create the federation by providing the endpoints to add.
    `static FedXRepository` | `createSparqlFederation​(List<String> sparqlEndpoints)` | Create a federation with the provided sparql endpoints
    `static FedXFactory` | `newFederation()` | Create a new customizable FedX federation.
    `FedXFactory` | `withConfig​(FedXConfig config)` |
    `FedXFactory` | `withFederatedServiceResolver​(FederatedServiceResolver federatedServiceResolver)` |
    `FedXFactory` | `withFedXBaseDir​(File fedxBaseDir)` | Configure the FedX base directory at federation construction time.
    `FedXFactory` | `withMembers​(File dataConfig)` |
    `FedXFactory` | `withMembers​(List<Endpoint> endpoints)` |
    `FedXFactory` | `withMembers​(Model model)` | Initialize the federation with members from the model.
    `FedXFactory` | `withRepositoryResolver​(RepositoryResolver repositoryResolver)` |
    `FedXFactory` | `withResolvableEndpoint​(String repositoryId)` |
    `FedXFactory` | `withResolvableEndpoint​(String repositoryId, boolean writable)` |
    `FedXFactory` | `withSparqlEndpoint​(String sparqlEndpoint)` |
    `FedXFactory` | `withSparqlEndpoints​(List<String> sparqlEndpoints)` |

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

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

- - ### Field Detail

    - #### log

          protected static final org.slf4j.Logger log

    - #### repositoryResolver

          protected RepositoryResolver repositoryResolver

    - #### federatedServiceResolver

          protected FederatedServiceResolver federatedServiceResolver

    - #### members

          protected List<Endpoint> members

    - #### config

          protected FedXConfig config

    - #### fedxBaseDir

          protected File fedxBaseDir

  - ### Method Detail

    - #### createSparqlFederation

          public static FedXRepository createSparqlFederation​(List<String> sparqlEndpoints)
                                                       throws Exception

      Create a federation with the provided sparql endpoints
      Parameters:
        `sparqlEndpoints` - the list of SPARQL endpoints
      Returns:
        the configured FedX federation `Sail` wrapped in a `FedXRepository`
      Throws:
        `Exception`

    - #### createFederation

          public static FedXRepository createFederation​(File dataConfig)
                                                 throws Exception

      Create the federation with a specified data source configuration file (*.ttl). Federation members are constructed from the data source configuration. Sample data source configuration files can be found in the documentation.
      Parameters:
        `dataConfig` - the location of the data source configuration
      Returns:
        the configured FedX federation `Sail` wrapped in a `FedXRepository`
      Throws:
        `Exception`

    - #### createFederation

          public static FedXRepository createFederation​(List<Endpoint> endpoints)
                                                 throws FedXException

      Create the federation by providing the endpoints to add. The fedx configuration can provide information about the dataConfig to be used which may contain the default federation members.

      Parameters:
        `endpoints` - additional endpoints to be added, may be null or empty
      Returns:
        the configured FedX federation `Sail` wrapped in a `FedXRepository`
      Throws:
        `FedXException`

    - #### newFederation

          public static FedXFactory newFederation()

      Create a new customizable FedX federation. Once all configuration is supplied, the Federation can be created using `create()`
      Returns:
        the `FedXFactory` builder

    - #### withRepositoryResolver

          public FedXFactory withRepositoryResolver​(RepositoryResolver repositoryResolver)

    - #### withFederatedServiceResolver

          public FedXFactory withFederatedServiceResolver​(FederatedServiceResolver federatedServiceResolver)

    - #### withMembers

          public FedXFactory withMembers​(List<Endpoint> endpoints)

    - #### withMembers

          public FedXFactory withMembers​(File dataConfig)

    - #### withMembers

          public FedXFactory withMembers​(Model model)

      Initialize the federation with members from the model.

      Currently the types NativeStore, ResolvableEndpoint and SPARQLEndpoint are supported. For details please refer to the documentation in `NativeRepositoryInformation`, `ResolvableRepositoryInformation` and `SPARQLRepositoryInformation`.

      Parameters:
        `model` - the model defining the federation members
      Returns:
        the factory

    - #### withSparqlEndpoint

          public FedXFactory withSparqlEndpoint​(String sparqlEndpoint)

    - #### withSparqlEndpoints

          public FedXFactory withSparqlEndpoints​(List<String> sparqlEndpoints)

    - #### withResolvableEndpoint

          public FedXFactory withResolvableEndpoint​(String repositoryId)

    - #### withResolvableEndpoint

          public FedXFactory withResolvableEndpoint​(String repositoryId,
                                                    boolean writable)

    - #### withConfig

          public FedXFactory withConfig​(FedXConfig config)

    - #### withFedXBaseDir

          public FedXFactory withFedXBaseDir​(File fedxBaseDir)

      Configure the FedX base directory at federation construction time.
      Parameters:
        `fedxBaseDir` - the fedx base directory
      Returns:
        the `FedXFactory` instance

    - #### create

          public FedXRepository create()

      Create the federation using the provided configuration
      Returns:
        the configured `FedXRepository`