org.eclipse.rdf4j.repository.sail

## Class ProxyRepository

- java.lang.Object
- - org.eclipse.rdf4j.repository.base.AbstractRepository
  - - org.eclipse.rdf4j.repository.sail.ProxyRepository

- All Implemented Interfaces:
    Repository, RepositoryResolverClient

      public class ProxyRepository
      extends AbstractRepository
      implements RepositoryResolverClient

  `Repository` implementation that takes a `RepositoryResolver` instance and the id of a managed repository, and delegate all calls through to the given repository.

  The purpose is to allow `Sail`s to refer to other local repositories using a unique identifier without having to go through an HTTP layer.

  The implementation is independent of `DelegatingRepository` so that it is freed from having to provide implementation details in its configuration data. Instead, it only has to provide an unambiguous local identifier to the proxy.

  Author:
    Dale Visser

- - ### Field Summary

    - ### Fields inherited from class org.eclipse.rdf4j.repository.base.AbstractRepository

      `logger`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ProxyRepository()`
    `ProxyRepository(RepositoryResolver resolver, String proxiedIdentity)` Creates a repository instance that proxies to the given repository.
    `ProxyRepository(String proxiedIdentity)` Creates a repository instance that proxies to a repository of the give ID.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `RepositoryConnection` | `getConnection()` Opens a connection to this repository that can be used for querying and updating the contents of the repository.
    `File` | `getDataDir()` Get the directory where data and logging for this repository is stored.
    `String` | `getProxiedIdentity()`
    `ValueFactory` | `getValueFactory()` Gets a ValueFactory for this Repository.
    `protected void` | `initializeInternal()`
    `boolean` | `isWritable()` Checks whether this repository is writable, i.e.
    `void` | `setDataDir(File dataDir)` Set the directory where data and logging for this repository is stored.
    `void` | `setProxiedIdentity(String value)`
    `void` | `setRepositoryResolver(RepositoryResolver resolver)`
    `protected void` | `shutDownInternal()`

    - ### Methods inherited from class org.eclipse.rdf4j.repository.base.AbstractRepository

      `init, initialize, isInitialized, shutDown`

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

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

- - ### Constructor Detail

    - #### ProxyRepository

          public ProxyRepository()

    - #### ProxyRepository

          public ProxyRepository(String proxiedIdentity)

      Creates a repository instance that proxies to a repository of the give ID.
      Parameters:
        `proxiedIdentity` - id of the proxied repository

    - #### ProxyRepository

          public ProxyRepository(RepositoryResolver resolver,
                                 String proxiedIdentity)

      Creates a repository instance that proxies to the given repository.
      Parameters:
        `resolver` - manager that the proxied repository is associated with
        `proxiedIdentity` - id of the proxied repository

  - ### Method Detail

    - #### setProxiedIdentity

          public final void setProxiedIdentity(String value)

    - #### getProxiedIdentity

          public String getProxiedIdentity()

    - #### setRepositoryResolver

          public final void setRepositoryResolver(RepositoryResolver resolver)

      Specified by:
        `setRepositoryResolver` in interface `RepositoryResolverClient`

    - #### setDataDir

          public void setDataDir(File dataDir)

      Description copied from interface: `Repository`
      Set the directory where data and logging for this repository is stored.
      Specified by:
        `setDataDir` in interface `Repository`
      Parameters:
        `dataDir` - the directory where data for this repository is stored

    - #### getDataDir

          public File getDataDir()

      Description copied from interface: `Repository`
      Get the directory where data and logging for this repository is stored.
      Specified by:
        `getDataDir` in interface `Repository`
      Returns:
        the directory where data for this repository is stored.

    - #### isWritable

          public boolean isWritable()
                             throws RepositoryException

      Description copied from interface: `Repository`
      Checks whether this repository is writable, i.e. if the data contained in this repository can be changed. The writability of the repository is determined by the writability of the Sail that this repository operates on.
      Specified by:
        `isWritable` in interface `Repository`
      Throws:
        `RepositoryException`

    - #### getConnection

          public RepositoryConnection getConnection()
                                             throws RepositoryException

      Description copied from interface: `Repository`
      Opens a connection to this repository that can be used for querying and updating the contents of the repository. Created connections need to be closed to make sure that any resources they keep hold of are released. The best way to do this is to use a try-with-resources block, as follows:

           try (RepositoryConnection conn = repository.getConnection()) {
                  // perform operations on the connection
           }

      Note that `RepositoryConnection` is not guaranteed to be thread-safe! The recommended pattern for repository access in a multi-threaded application is to share the Repository object between threads, but have each thread create and use its own `RepositoryConnection`s.
      Specified by:
        `getConnection` in interface `Repository`
      Returns:
        A connection that allows operations on this repository.
      Throws:
        `RepositoryException` - If something went wrong during the creation of the Connection.

    - #### getValueFactory

          public ValueFactory getValueFactory()

      Description copied from interface: `Repository`
      Gets a ValueFactory for this Repository.
      Specified by:
        `getValueFactory` in interface `Repository`
      Returns:
        A repository-specific ValueFactory.

    - #### initializeInternal

          protected void initializeInternal()
                                     throws RepositoryException

      Specified by:
        `initializeInternal` in class `AbstractRepository`
      Throws:
        `RepositoryException`

    - #### shutDownInternal

          protected void shutDownInternal()
                                   throws RepositoryException

      Specified by:
        `shutDownInternal` in class `AbstractRepository`
      Throws:
        `RepositoryException`

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