org.eclipse.rdf4j.federated.endpoint

## Class EndpointBase

- java.lang.Object
- - org.eclipse.rdf4j.federated.endpoint.EndpointBase

- All Implemented Interfaces:
    Endpoint
  Direct Known Subclasses:
    RepositoryEndpoint, ResolvableEndpoint

      public abstract class EndpointBase
      extends Object
      implements Endpoint

  Base implementation for an `Endpoint`.

  Provides implementation for the common behavior as well as connection management. Typically a fresh `RepositoryConnection` is returned when invoking `getConnection()`, however, it is configurable that a managed (singleton) connection can be used.

  Author:
    Andreas Schwarte
  See Also:
    `EndpointManager`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `EndpointBase.ManagedRepositoryConnection` A wrapper for managed `RepositoryConnection`s which makes sure that `EndpointBase.ManagedRepositoryConnection.close()` is a no-op, i.e.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected String` | `endpoint`
    `protected EndpointClassification` | `endpointClassification`
    `protected EndpointConfiguration` | `endpointConfiguration`
    `protected boolean` | `initialized`
    `protected static org.slf4j.Logger` | `log`
    `protected RepositoryInformation` | `repoInfo`
    `protected TripleSource` | `tripleSource`
    `protected boolean` | `writable`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `EndpointBase(RepositoryInformation repoInfo, String endpoint, EndpointClassification endpointClassification)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object obj)`
    `RepositoryConnection` | `getConnection()` Return a `RepositoryConnection` for the `Repository` represented by this endpoint.
    `String` | `getEndpoint()` Get the endpoint location, e.g.
    `EndpointClassification` | `getEndpointClassification()`
    `EndpointConfiguration` | `getEndpointConfiguration()` Additional endpoint specific configuration.
    `protected RepositoryConnection` | `getFreshConnection()`
    `String` | `getId()`
    `String` | `getName()`
    `RepositoryInformation` | `getRepoInfo()`
    `TripleSource` | `getTripleSource()`
    `EndpointType` | `getType()`
    `int` | `hashCode()`
    `void` | `init(FederationContext federationContext)` Initialize this `Endpoint`
    `boolean` | `isInitialized()`
    `boolean` | `isLocal()`
    `boolean` | `isWritable()`
    `void` | `setEndpointClassification(EndpointClassification endpointClassification)`
    `void` | `setEndpointConfiguration(EndpointConfiguration endpointConfiguration)`
    `void` | `setWritable(boolean writable)`
    `void` | `shutDown()` Shutdown this `Endpoint`
    `long` | `size()` Returns the size of the given repository, i.e.
    `String` | `toString()`
    `protected boolean` | `useSingleConnection()` Whether to reuse the same `RepositoryConnection` throughout the lifetime of this Endpoint.

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

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

    - ### Methods inherited from interface org.eclipse.rdf4j.federated.endpoint.Endpoint

      `getRepository`

- - ### Field Detail

    - #### log

          protected static final org.slf4j.Logger log

    - #### repoInfo

          protected final RepositoryInformation repoInfo

    - #### endpoint

          protected final String endpoint

    - #### endpointClassification

          protected EndpointClassification endpointClassification

    - #### writable

          protected boolean writable

    - #### initialized

          protected boolean initialized

    - #### tripleSource

          protected TripleSource tripleSource

    - #### endpointConfiguration

          protected EndpointConfiguration endpointConfiguration

  - ### Constructor Detail

    - #### EndpointBase

          public EndpointBase(RepositoryInformation repoInfo,
                              String endpoint,
                              EndpointClassification endpointClassification)

  - ### Method Detail

    - #### getName

          public String getName()

      Specified by:
        `getName` in interface `Endpoint`
      Returns:
        the name of the federation member

    - #### getTripleSource

          public TripleSource getTripleSource()

      Specified by:
        `getTripleSource` in interface `Endpoint`
      Returns:
        the `TripleSource`

    - #### getEndpointClassification

          public EndpointClassification getEndpointClassification()

      Specified by:
        `getEndpointClassification` in interface `Endpoint`
      Returns:
        the `EndpointClassification`

    - #### setEndpointClassification

          public void setEndpointClassification(EndpointClassification endpointClassification)

    - #### isLocal

          public boolean isLocal()

    - #### isWritable

          public boolean isWritable()

      Specified by:
        `isWritable` in interface `Endpoint`
      Returns:
        whether this endpoint is writable

    - #### getRepoInfo

          public RepositoryInformation getRepoInfo()

    - #### setWritable

          public void setWritable(boolean writable)

      Parameters:
        `writable` - the writable to set

    - #### getEndpointConfiguration

          public EndpointConfiguration getEndpointConfiguration()

      Description copied from interface: `Endpoint`
      Additional endpoint specific configuration.
      Specified by:
        `getEndpointConfiguration` in interface `Endpoint`
      Returns:
        the endpointConfiguration

    - #### setEndpointConfiguration

          public void setEndpointConfiguration(EndpointConfiguration endpointConfiguration)

      Parameters:
        `endpointConfiguration` - the endpointConfiguration to set

    - #### getConnection

          public RepositoryConnection getConnection()

      Description copied from interface: `Endpoint`
      Return a `RepositoryConnection` for the `Repository` represented by this endpoint.

      Callers of this method need to ensure to close the connection after use.

      Typical pattern:

           try (RepositoryConnection conn = endpoint.getConnection()) {
                  // do something with the connection
           }

      If the `RepositoryConnection` needs to stay open outside the scope of a method (e.g. for streaming results), consider using `CloseDependentConnectionIteration`.

      Specified by:
        `getConnection` in interface `Endpoint`
      Returns:
        the repository connection

    - #### getFreshConnection

          protected RepositoryConnection getFreshConnection()

    - #### getId

          public String getId()

      Specified by:
        `getId` in interface `Endpoint`
      Returns:
        the identifier of the federation member

    - #### getEndpoint

          public String getEndpoint()

      Description copied from interface: `Endpoint`
      Get the endpoint location, e.g. for SPARQL endpoints the url
      Specified by:
        `getEndpoint` in interface `Endpoint`
      Returns:
        the endpoint location

    - #### getType

          public EndpointType getType()

    - #### isInitialized

          public boolean isInitialized()

      Specified by:
        `isInitialized` in interface `Endpoint`
      Returns:
        whether this Endpoint is initialized

    - #### size

          public long size()
                    throws RepositoryException

      Description copied from interface: `Endpoint`
      Returns the size of the given repository, i.e. the number of triples.
      Specified by:
        `size` in interface `Endpoint`
      Returns:
        the size of the endpoint
      Throws:
        `RepositoryException`

    - #### init

          public void init(FederationContext federationContext)
                    throws RepositoryException

      Description copied from interface: `Endpoint`
      Initialize this `Endpoint`
      Specified by:
        `init` in interface `Endpoint`
      Throws:
        `RepositoryException`

    - #### useSingleConnection

          protected boolean useSingleConnection()

      Whether to reuse the same `RepositoryConnection` throughout the lifetime of this Endpoint.

      Note that the `RepositoryConnection` is wrapped as `EndpointBase.ManagedRepositoryConnection`

      Returns:
        indicator whether a single connection should be used

    - #### shutDown

          public void shutDown()
                        throws RepositoryException

      Description copied from interface: `Endpoint`
      Shutdown this `Endpoint`
      Specified by:
        `shutDown` in interface `Endpoint`
      Throws:
        `RepositoryException`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals(Object obj)

      Overrides:
        `equals` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

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