org.jboss.dna.graph.connectors
Interface RepositorySource

All Superinterfaces:
Referenceable, Serializable
All Known Implementing Classes:
FederatedRepositorySource, InMemoryRepositorySource, JBossCacheSource, SVNRepositorySource

public interface RepositorySource
extends Referenceable, Serializable

A repository source is a description of a resource that can be used to access or store repository information. This class serves as a factory for RepositoryConnection instances and provides some basic configuration information.

Typically this interface is implemented by classes that provide standard-style getters and setters for the various properties necessary for proper configuration via reflection or introspection. This interface expects nor defines any such properties, leaving that entirely to the implementation classes.

Implementations should also provide a no-arg constructor so that it is possible to easily create instances and initialize using the standard getters and setters. One example where this is required is when a RepositorySource instance is recorded in a repository (e.g., in a configuration area), and needs to be reinstantiated.

Objects that implement this RepositorySource interface are typically registered with a naming service such as Java Naming and Directory InterfaceTM (JNDI). This interface extends both Referenceable and Serializable so that such objects can be stored in any JNDI naming context and enable proper system recovery,

If the connections to a source are to be pooled, see RepositoryConnectionPool.

Author:
Randall Hauch

Method Summary
 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.
 int getRetryLimit()
          Get the maximum number of retries that may be performed on a given operation when using connections created by this source.
 void initialize(RepositoryContext context)
          Initialize this source to use the supplied RepositoryContext, from which this source can obtain connections to other sources as well as execution contexts.
 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 interface javax.naming.Referenceable
getReference
 

Method Detail

initialize

void initialize(RepositoryContext context)
                throws RepositorySourceException
Initialize this source to use the supplied RepositoryContext, from which this source can obtain connections to other sources as well as execution contexts.

Parameters:
context -
Throws:
RepositorySourceException

getName

String getName()
Get the name for this repository source.

Returns:
the name; never null or empty

getConnection

RepositoryConnection getConnection()
                                   throws RepositorySourceException
Get a connection from this source.

Returns:
a connection
Throws:
RepositorySourceException - if there is a problem obtaining a connection
IllegalStateException - if the factory is not in a state to create or return connections

getRetryLimit

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.

Returns:
the maximum number of allowable retries, or 0 if the source has no limit

setRetryLimit

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.

Parameters:
limit - the maximum number of allowable retries, or 0 if the source has no limit

getCapabilities

RepositorySourceCapabilities getCapabilities()
Get the capabilities for this source.

Returns:
the capabilities for this source; never null


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