Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.graph.connector.federation
Class FederatedRepositorySource

    java.lang.Object
      org.modeshape.graph.connector.federation.FederatedRepositorySource

All Implemented Interfaces:
  Serializable, Referenceable, ObjectFactory, RepositorySource

    @ThreadSafe
    public class FederatedRepositorySource

extends Object
implements RepositorySource, ObjectFactory

A `RepositorySource` for a federated repository.

See Also:
  Serialized Form

Field Summary
`static int` | `DEFAULT_RETRY_LIMIT` The default limit is 0 for retrying `connection` calls to the underlying source.
`protected static String` | `RETRY_LIMIT`
`protected static String` | `SOURCE_NAME`

Constructor Summary
`FederatedRepositorySource()` Construct a new instance of a `RepositorySource` for a federated repository.

Method Summary
`org.modeshape.graph.connector.federation.FederatedWorkspace` | `addWorkspace(String workspaceName, Iterable<Projection> projections, boolean isDefault)` Add a federated workspace to this source.
`protected void` | `changeConfiguration()` Mark the current configuration (if there is one) as being invalid.
`void` | `close()` Signal this source that it is no longer needed and should begin the process of reclaiming or closing all resources that it has acquired.
`protected Projection` | `createProjection(ExecutionContext context, ProjectionParser projectionParser, Node node)` Instantiate the `Projection` described by the supplied properties.
`boolean` | `equals(Object obj)`
`RepositorySourceCapabilities` | `getCapabilities()` Get the capabilities for this source.
`RepositoryConnection` | `getConnection()` Get a connection from this source.
`String` | `getName()` Get the name for this repository source.
`Object` | `getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?,?> environment)`
`Reference` | `getReference()`
`int` | `getRetryLimit()` Get the maximum number of retries that may be performed on a given operation when using `connections` created by this source.
`int` | `hashCode()`
`boolean` | `hasWorkspace(String workspaceName)`
`void` | `initialize(RepositoryContext context)` Initialize this source to use the supplied `RepositoryContext`, from which this source can obtain the `configuration` defining this source, `connections` to other `sources`, and the `execution context`.
`protected org.modeshape.graph.connector.federation.FederatedRepository` | `loadRepository(String name, RepositoryContext repositoryContext)` Utility to load the current configuration for this source from the `configuration repository`.
`boolean` | `removeWorkspace(String workspaceName)` Remove the named workspace from the repository source.
`void` | `setName(String name)`
`void` | `setRetryLimit(int limit)` Set the maximum number of retries that may be performed on a given operation when using `connections` created by this source.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEFAULT_RETRY_LIMIT

    public static final int DEFAULT_RETRY_LIMIT

  The default limit is 0 for retrying `connection` calls to the underlying source.

  See Also:
    Constant Field Values

### SOURCE_NAME

    protected static final String SOURCE_NAME

See Also:
  Constant Field Values

### RETRY_LIMIT

    protected static final String RETRY_LIMIT

See Also:
  Constant Field Values

Constructor Detail

### FederatedRepositorySource

    public FederatedRepositorySource()

  Construct a new instance of a `RepositorySource` for a federated repository.

Method Detail

### getName

    public String getName()

  Get the name for this repository source.

  Specified by:
    `getName` in interface `RepositorySource`
  Returns:
    the name; never null or empty
  See Also:
    `RepositorySource.getName()`

### setName

    public void setName(String name)

  Parameters:
    `name` - Sets name to the specified value.

### getRetryLimit

    public int getRetryLimit()

  Get the maximum number of retries that may be performed on a given operation when using `connections` created by this source. This value does not constitute a minimum number of retries; in fact, the connection user is not required to retry any operations.

  Specified by:
    `getRetryLimit` in interface `RepositorySource`
  Returns:
    the maximum number of allowable retries, or 0 if the source has no limit
  See Also:
    `RepositorySource.getRetryLimit()`

### setRetryLimit

    public void setRetryLimit(int limit)

  Set the maximum number of retries that may be performed on a given operation when using `connections` created by this source. This value does not constitute a minimum number of retries; in fact, the connection user is not required to retry any operations.

  Specified by:
    `setRetryLimit` in interface `RepositorySource`
  Parameters:
    `limit` - the maximum number of allowable retries, or 0 if the source has no limit
  See Also:
    `RepositorySource.setRetryLimit(int)`

### getCapabilities

    public RepositorySourceCapabilities getCapabilities()

  Get the capabilities for this source.

  Specified by:
    `getCapabilities` in interface `RepositorySource`
  Returns:
    the capabilities for this source; never null
  See Also:
    `RepositorySource.getCapabilities()`

### initialize

    public void initialize(RepositoryContext context)
                    throws RepositorySourceException

  Initialize this source to use the supplied `RepositoryContext`, from which this source can obtain the `configuration` defining this source, `connections` to other `sources`, and the `execution context`.

  This method may be called each time the configuration changes, allowing the source to update itself.

  Specified by:
    `initialize` in interface `RepositorySource`
  Throws:
    `RepositorySourceException`
  See Also:
    `RepositorySource.initialize(org.modeshape.graph.connector.RepositoryContext)`

### getConnection

    public RepositoryConnection getConnection()
                                       throws RepositorySourceException

  Get a connection from this source. Even though each RepositorySource need not be thread safe, this method should be safe to be called concurrently by multiple threads.

  Specified by:
    `getConnection` in interface `RepositorySource`
  Returns:
    a connection
  Throws:
    `RepositorySourceException` - if there is a problem obtaining a connection
  See Also:
    `RepositorySource.getConnection()`

### close

    public void close()

  Signal this source that it is no longer needed and should begin the process of reclaiming or closing all resources that it has acquired. Because `connections` may still be in use, this method may not necessarily close all resources immediately.

  This is a required method, and must be called when this source is no longer needed if one or more `connections` have been obtained since the previous call to this method.

  Note that calling this method also does not preclude `obtaining more connections` after this method is called. If that happens, this source should simply reacquire any resources necessary to provide additional connections, and this method needs to be called once again.

  Specified by:
    `close` in interface `RepositorySource`
  See Also:
    `RepositorySource.close()`

### getReference

    public Reference getReference()

  Specified by:
    `getReference` in interface `Referenceable`
  See Also:
    `Referenceable.getReference()`

### getObjectInstance

    public Object getObjectInstance(Object obj,
                                    Name name,
                                    Context nameCtx,
                                    Hashtable<?,?> environment)
                             throws Exception

  Specified by:
    `getObjectInstance` in interface `ObjectFactory`
  Throws:
    `Exception`
  See Also:
    `ObjectFactory.getObjectInstance(java.lang.Object, javax.naming.Name, javax.naming.Context, java.util.Hashtable)`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

### equals

    public boolean equals(Object obj)

  Overrides:
    `equals` in class `Object`

### changeConfiguration

    protected void changeConfiguration()

  Mark the current configuration (if there is one) as being invalid.

### loadRepository

    protected org.modeshape.graph.connector.federation.FederatedRepository loadRepository(String name,
                                                                                          RepositoryContext repositoryContext)
                                                                                   throws RepositorySourceException

  Utility to load the current configuration for this source from the `configuration repository`. This method may only be called after the source is `initialized`.

  Parameters:
    `name` - the name of the source; may not be null
    `repositoryContext` - the repository context; may not be null
  Returns:
    the configuration; never null
  Throws:
    `RepositorySourceException` - if there is a problem with the configuration

### addWorkspace

    public org.modeshape.graph.connector.federation.FederatedWorkspace addWorkspace(String workspaceName,
                                                                                    Iterable<Projection> projections,
                                                                                    boolean isDefault)

  Add a federated workspace to this source. If a workspace with the supplied name already exists, it will be replaced with the new one.

  Parameters:
    `workspaceName` - the name of the new federated workspace
    `projections` - the projections that should be used in the workspace
    `isDefault` - true if this workspace should be used as the default workspace, or false otherwise
  Returns:
    the federated workspace
  Throws:
    `IllegalArgumentException` - if the workspace name or the projections reference are null

### removeWorkspace

    public boolean removeWorkspace(String workspaceName)

  Remove the named workspace from the repository source.

  Parameters:
    `workspaceName` - the name of the workspace to remove
  Returns:
    true if the workspace was removed, or false otherwise
  Throws:
    `IllegalArgumentException` - if the workspace name is null

### hasWorkspace

    public boolean hasWorkspace(String workspaceName)

### createProjection

    protected Projection createProjection(ExecutionContext context,
                                          ProjectionParser projectionParser,
                                          Node node)

  Instantiate the `Projection` described by the supplied properties.

  Parameters:
    `context` - the execution context that should be used to read the configuration; may not be null
    `projectionParser` - the projection rule parser that should be used; may not be null
    `node` - the node where these properties were found; never null
  Returns:
    the region instance, or null if it could not be created

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008-2011 JBoss, a division of Red Hat. All Rights Reserved.