[dna-commits] DNA SVN: r403 - in trunk: connectors/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/executor and 8 other directories.

dna-commits at lists.jboss.org dna-commits at lists.jboss.org
Thu Aug 7 18:37:39 EDT 2008


Author: rhauch
Date: 2008-08-07 18:37:39 -0400 (Thu, 07 Aug 2008)
New Revision: 403

Added:
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositoryConnectionFactory.java
Removed:
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/connector/AbstractRepositorySource.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositorySourceRegistry.java
Modified:
   trunk/connectors/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedRepository.java
   trunk/connectors/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedRepositorySource.java
   trunk/connectors/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/executor/FederatingCommandExecutor.java
   trunk/connectors/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/executor/SingleProjectionCommandExecutor.java
   trunk/connectors/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederatedRepositorySourceTest.java
   trunk/connectors/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederatedRepositoryTest.java
   trunk/connectors/dna-connector-inmemory/src/main/java/org/jboss/dna/connector/inmemory/InMemoryRepositorySource.java
   trunk/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheSource.java
   trunk/connectors/dna-connector-jbosscache/src/test/java/org/jboss/dna/connector/jbosscache/JBossCacheSourceTest.java
   trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryService.java
   trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositorySourceManager.java
   trunk/dna-repository/src/test/java/org/jboss/dna/repository/RepositoryServiceTest.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositoryConnectionPool.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositorySource.java
   trunk/dna-spi/src/test/java/org/jboss/dna/spi/connector/RepositoryConnectionPoolTest.java
   trunk/dna-spi/src/test/java/org/jboss/dna/spi/connector/SimpleRepositorySource.java
   trunk/dna-spi/src/test/java/org/jboss/dna/spi/connector/TimeDelayingRepositorySource.java
Log:
DNA-192 - Clean up the repository connector SPI
http://jira.jboss.com/jira/browse/DNA-192

Refactored the classes again, since the RepositorySource needs to be serializable and able to be turned into a JNDI reference. In other words, the RepositorySource needs to be a factory for creating connections to a specific repository, but it shouldn't manage the pool of connections (since the pool and any live connections cannot be serialized).

Modified: trunk/connectors/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedRepository.java
===================================================================
--- trunk/connectors/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedRepository.java	2008-08-07 19:56:15 UTC (rev 402)
+++ trunk/connectors/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedRepository.java	2008-08-07 22:37:39 UTC (rev 403)
@@ -32,15 +32,15 @@
 import org.jboss.dna.connector.federation.executor.FederatingCommandExecutor;
 import org.jboss.dna.spi.ExecutionContext;
 import org.jboss.dna.spi.connector.RepositoryConnection;
+import org.jboss.dna.spi.connector.RepositoryConnectionFactory;
 import org.jboss.dna.spi.connector.RepositorySource;
 import org.jboss.dna.spi.connector.RepositorySourceListener;
-import org.jboss.dna.spi.connector.RepositorySourceRegistry;
 import org.jboss.dna.spi.graph.commands.executor.CommandExecutor;
 
 /**
  * The component that represents a single federated repository. The federated repository uses a set of {@link RepositorySource
- * federated sources} as designated by name through the {@link #getConfiguration() configuration}, and provides the logic of
- * interacting with those sources and presenting a single unified graph.
+ * federated connectionFactory} as designated by name through the {@link #getConfiguration() configuration}, and provides the
+ * logic of interacting with those connectionFactory and presenting a single unified graph.
  * 
  * @author Randall Hauch
  */
@@ -48,7 +48,7 @@
 public class FederatedRepository {
 
     private final ExecutionContext context;
-    private final RepositorySourceRegistry sources;
+    private final RepositoryConnectionFactory connectionFactory;
     private FederatedRepositoryConfig config;
     private final AtomicInteger openExecutors = new AtomicInteger(0);
     private final CountDownLatch shutdownLatch = new CountDownLatch(1);
@@ -59,18 +59,18 @@
      * Create a federated repository instance.
      * 
      * @param context the execution context
-     * @param sources the registry of {@link RepositorySource} instances that should be used
+     * @param connectionFactory the factory for {@link RepositoryConnection} instances that should be used
      * @param config the configuration for this repository
      * @throws IllegalArgumentException if any of the parameters are null, or if the name is blank
      */
     public FederatedRepository( ExecutionContext context,
-                                RepositorySourceRegistry sources,
+                                RepositoryConnectionFactory connectionFactory,
                                 FederatedRepositoryConfig config ) {
-        ArgCheck.isNotNull(sources, "sources");
+        ArgCheck.isNotNull(connectionFactory, "connectionFactory");
         ArgCheck.isNotNull(context, "context");
         ArgCheck.isNotNull(config, "config");
         this.context = context;
-        this.sources = sources;
+        this.connectionFactory = connectionFactory;
         this.config = config;
     }
 
@@ -91,17 +91,17 @@
     }
 
     /**
-     * @return the sources
+     * @return the connectionFactory
      */
-    protected RepositorySourceRegistry getRepositorySourceRegistry() {
-        return sources;
+    protected RepositoryConnectionFactory getConnectionFactory() {
+        return connectionFactory;
     }
 
     /**
      * Utility method called by the administrator.
      */
     public synchronized void start() {
-        // Do not establish connections to the sources; these will be established as needed
+        // Do not establish connections to the connectionFactory; these will be established as needed
     }
 
     /**
@@ -232,7 +232,7 @@
                                            String sourceName ) {
         FederatedRepositoryConfig config = this.getConfiguration();
         return new FederatingCommandExecutor(context, sourceName, config.getCacheProjection(), config.getDefaultCachePolicy(),
-                                             config.getSourceProjections(), getRepositorySourceRegistry());
+                                             config.getSourceProjections(), getConnectionFactory());
     }
 
     /**

Modified: trunk/connectors/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedRepositorySource.java
===================================================================
--- trunk/connectors/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedRepositorySource.java	2008-08-07 19:56:15 UTC (rev 402)
+++ trunk/connectors/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedRepositorySource.java	2008-08-07 22:37:39 UTC (rev 403)
@@ -28,6 +28,7 @@
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.atomic.AtomicInteger;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.RefAddr;
@@ -52,12 +53,11 @@
 import org.jboss.dna.spi.ExecutionContextFactory;
 import org.jboss.dna.spi.cache.BasicCachePolicy;
 import org.jboss.dna.spi.cache.CachePolicy;
-import org.jboss.dna.spi.connector.AbstractRepositorySource;
 import org.jboss.dna.spi.connector.RepositoryConnection;
+import org.jboss.dna.spi.connector.RepositoryConnectionFactory;
 import org.jboss.dna.spi.connector.RepositorySource;
 import org.jboss.dna.spi.connector.RepositorySourceCapabilities;
 import org.jboss.dna.spi.connector.RepositorySourceException;
-import org.jboss.dna.spi.connector.RepositorySourceRegistry;
 import org.jboss.dna.spi.graph.InvalidPathException;
 import org.jboss.dna.spi.graph.Name;
 import org.jboss.dna.spi.graph.NameFactory;
@@ -78,12 +78,17 @@
  * @author Randall Hauch
  */
 @ThreadSafe
-public class FederatedRepositorySource extends AbstractRepositorySource implements ObjectFactory {
+public class FederatedRepositorySource implements RepositorySource, ObjectFactory {
 
     /**
      */
     private static final long serialVersionUID = 7587346948013486977L;
 
+    /**
+     * The default limit is {@value} for retrying {@link RepositoryConnection connection} calls to the underlying source.
+     */
+    public static final int DEFAULT_RETRY_LIMIT = 0;
+
     public static final String[] DEFAULT_CONFIGURATION_SOURCE_PROJECTION_RULES = {"/dna:system => /"};
 
     protected static final String REPOSITORY_NAME = "repositoryName";
@@ -92,7 +97,7 @@
     protected static final String PASSWORD = "password";
     protected static final String CONFIGURATION_SOURCE_NAME = "configurationSourceName";
     protected static final String CONFIGURATION_SOURCE_PROJECTION_RULES = "configurationSourceProjectionRules";
-    protected static final String REPOSITORY_SOURCE_REGISTRY_JNDI_NAME = "repositorySourceRegistryJndiName";
+    protected static final String REPOSITORY_CONNECTION_FACTORY_JNDI_NAME = "repositoryConnectionFactoryJndiName";
     protected static final String EXECUTION_CONTEXT_FACTORY_JNDI_NAME = "executionContextFacotryJndiName";
     protected static final String REPOSITORY_JNDI_NAME = "repositoryJndiName";
     protected static final String SECURITY_DOMAIN = "securityDomain";
@@ -107,10 +112,11 @@
     private String password;
     private String configurationSourceName;
     private String[] configurationSourceProjectionRules = DEFAULT_CONFIGURATION_SOURCE_PROJECTION_RULES;
-    private String repositorySourceRegistryJndiName;
+    private String repositoryConnectionFactoryJndiName;
     private String executionContextFactoryJndiName;
     private String securityDomain;
     private String repositoryJndiName;
+    private final AtomicInteger retryLimit = new AtomicInteger(DEFAULT_RETRY_LIMIT);
     private transient FederatedRepository repository;
     private transient Context jndiContext;
 
@@ -149,7 +155,7 @@
      * 
      * @param sourceName the name of this repository source
      * @see #setConfigurationSourceName(String)
-     * @see #setRepositorySourceRegistryJndiName(String)
+     * @see #setRepositoryConnectionFactoryJndiName(String)
      * @see #setConfigurationSourceProjectionRules(String[])
      * @see #setPassword(String)
      * @see #setUsername(String)
@@ -166,6 +172,24 @@
     }
 
     /**
+     * {@inheritDoc}
+     * 
+     * @see org.jboss.dna.spi.connector.RepositorySource#getRetryLimit()
+     */
+    public int getRetryLimit() {
+        return retryLimit.get();
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.jboss.dna.spi.connector.RepositorySource#setRetryLimit(int)
+     */
+    public void setRetryLimit( int limit ) {
+        retryLimit.set(limit < 0 ? 0 : limit);
+    }
+
+    /**
      * Get the name in JNDI of a {@link FederatedRepository} instance that should be used. If this is set (and an instance can be
      * found at that location), few of the remaining properties on this instance may not be used (basically just
      * {@link #getUsername() username}, {@link #getPassword() password}, and {@link #getName() source name}).
@@ -219,8 +243,8 @@
 
     /**
      * Get the name of a {@link RepositorySource} instance that should be used by the {@link FederatedRepository federated
-     * repository} as the configuration repository. The instance will be retrieved from the {@link RepositorySourceRegistry}
-     * instance {@link #getRepositorySourceRegistryJndiName() found in JDNI}.
+     * repository} as the configuration repository. The instance will be retrieved from the {@link RepositoryConnectionFactory}
+     * instance {@link #getRepositoryConnectionFactoryJndiName() found in JDNI}.
      * <p>
      * This is a required property (unless the {@link #getRepositoryJndiName() federated repository is to be found in JDNI}).
      * </p>
@@ -228,7 +252,7 @@
      * @param sourceName the name of the {@link RepositorySource} instance that should be used for the configuration, or null if
      *        the federated repository instance is to be found in JNDI
      * @see #getConfigurationSourceName()
-     * @see #setRepositorySourceRegistryJndiName(String)
+     * @see #setRepositoryConnectionFactoryJndiName(String)
      * @see #setConfigurationSourceProjectionRules(String[])
      * @see #setPassword(String)
      * @see #setUsername(String)
@@ -270,7 +294,7 @@
      * @param projectionRules the string array of projection rules, or null if the projection rules haven't yet been set or if the
      *        federated repository instance is to be found in JNDI
      * @see #setConfigurationSourceProjectionRules(String[])
-     * @see #setRepositorySourceRegistryJndiName(String)
+     * @see #setRepositoryConnectionFactoryJndiName(String)
      * @see #setConfigurationSourceName(String)
      * @see #setPassword(String)
      * @see #setUsername(String)
@@ -316,7 +340,7 @@
      * @see #getExecutionContextFactoryJndiName()
      * @see #setConfigurationSourceName(String)
      * @see #setConfigurationSourceProjectionRules(String[])
-     * @see #setRepositorySourceRegistryJndiName(String)
+     * @see #setRepositoryConnectionFactoryJndiName(String)
      * @see #setPassword(String)
      * @see #setUsername(String)
      * @see #setRepositoryName(String)
@@ -329,32 +353,32 @@
     }
 
     /**
-     * Get the name in JNDI where the {@link RepositorySourceRegistry} instance that can be used by the
+     * Get the name in JNDI where the {@link RepositoryConnectionFactory} instance that can be used by the
      * {@link FederatedRepository federated repository} can find any {@link RepositorySource} sources it needs, including those
      * used for {@link Projection sources} and that used for it's {@link #getConfigurationSourceName() configuration}.
      * <p>
      * This is a required property (unless the {@link #getRepositoryJndiName() federated repository is to be found in JDNI}).
      * </p>
      * 
-     * @return the JNDI name where the {@link RepositorySourceRegistry} instance can be found, or null if the federated repository
-     *         instance is to be found in JNDI
-     * @see #setRepositorySourceRegistryJndiName(String)
+     * @return the JNDI name where the {@link RepositoryConnectionFactory} instance can be found, or null if the federated
+     *         repository instance is to be found in JNDI
+     * @see #setRepositoryConnectionFactoryJndiName(String)
      */
-    public String getRepositorySourceRegistryJndiName() {
-        return repositorySourceRegistryJndiName;
+    public String getRepositoryConnectionFactoryJndiName() {
+        return repositoryConnectionFactoryJndiName;
     }
 
     /**
-     * Set the name in JNDI where the {@link RepositorySourceRegistry} instance that can be used by the
+     * Set the name in JNDI where the {@link RepositoryConnectionFactory} instance that can be used by the
      * {@link FederatedRepository federated repository} can find any {@link RepositorySource} sources it needs, including those
      * used for {@link Projection sources} and that used for it's {@link #getConfigurationSourceName() configuration}.
      * <p>
      * This is a required property (unless the {@link #getRepositoryJndiName() federated repository is to be found in JDNI}).
      * </p>
      * 
-     * @param jndiName the JNDI name where the {@link RepositorySourceRegistry} instance can be found, or null if the federated
+     * @param jndiName the JNDI name where the {@link RepositoryConnectionFactory} instance can be found, or null if the federated
      *        repository instance is to be found in JNDI
-     * @see #getRepositorySourceRegistryJndiName()
+     * @see #getRepositoryConnectionFactoryJndiName()
      * @see #setConfigurationSourceName(String)
      * @see #setConfigurationSourceProjectionRules(String[])
      * @see #setPassword(String)
@@ -363,10 +387,10 @@
      * @see #setExecutionContextFactoryJndiName(String)
      * @see #setName(String)
      */
-    public synchronized void setRepositorySourceRegistryJndiName( String jndiName ) {
-        if (this.repositorySourceRegistryJndiName == jndiName || this.repositorySourceRegistryJndiName != null
-            && this.repositorySourceRegistryJndiName.equals(jndiName)) return; // unchanged
-        this.repositorySourceRegistryJndiName = jndiName;
+    public synchronized void setRepositoryConnectionFactoryJndiName( String jndiName ) {
+        if (this.repositoryConnectionFactoryJndiName == jndiName || this.repositoryConnectionFactoryJndiName != null
+            && this.repositoryConnectionFactoryJndiName.equals(jndiName)) return; // unchanged
+        this.repositoryConnectionFactoryJndiName = jndiName;
         changeRepositoryConfig();
     }
 
@@ -418,7 +442,7 @@
      * @see #setConfigurationSourceProjectionRules(String[])
      * @see #setPassword(String)
      * @see #setUsername(String)
-     * @see #setRepositorySourceRegistryJndiName(String)
+     * @see #setRepositoryConnectionFactoryJndiName(String)
      * @see #setExecutionContextFactoryJndiName(String)
      * @see #setName(String)
      */
@@ -455,7 +479,7 @@
      * @see #setConfigurationSourceProjectionRules(String[])
      * @see #setPassword(String)
      * @see #setRepositoryName(String)
-     * @see #setRepositorySourceRegistryJndiName(String)
+     * @see #setRepositoryConnectionFactoryJndiName(String)
      * @see #setExecutionContextFactoryJndiName(String)
      * @see #setName(String)
      */
@@ -490,7 +514,7 @@
      * @see #setConfigurationSourceProjectionRules(String[])
      * @see #setUsername(String)
      * @see #setRepositoryName(String)
-     * @see #setRepositorySourceRegistryJndiName(String)
+     * @see #setRepositoryConnectionFactoryJndiName(String)
      * @see #setExecutionContextFactoryJndiName(String)
      * @see #setName(String)
      */
@@ -503,16 +527,16 @@
     /**
      * This method is called to signal that some aspect of the configuration has changed. If a {@link #getRepository() repository}
      * instance has been created, it's configuration is
-     * {@link #getRepositoryConfiguration(ExecutionContext, RepositorySourceRegistry) rebuilt} and updated. Nothing is done,
+     * {@link #getRepositoryConfiguration(ExecutionContext, RepositoryConnectionFactory) rebuilt} and updated. Nothing is done,
      * however, if there is currently no {@link #getRepository() repository}.
      */
     protected synchronized void changeRepositoryConfig() {
         if (this.repository != null) {
             // Find in JNDI the repository source registry and the environment ...
             ExecutionContext context = getExecutionContext();
-            RepositorySourceRegistry registry = getRepositorySourceRegistry();
+            RepositoryConnectionFactory factory = getConnectionFactory();
             // Compute a new repository config and set it on the repository ...
-            FederatedRepositoryConfig newConfig = getRepositoryConfiguration(context, registry);
+            FederatedRepositoryConfig newConfig = getRepositoryConfiguration(context, factory);
             this.repository.setConfiguration(newConfig);
         }
     }
@@ -520,10 +544,9 @@
     /**
      * {@inheritDoc}
      * 
-     * @see org.jboss.dna.spi.connector.AbstractRepositorySource#createConnection()
+     * @see org.jboss.dna.spi.connector.RepositorySource#getConnection()
      */
-    @Override
-    protected synchronized RepositoryConnection createConnection() throws RepositorySourceException {
+    public RepositoryConnection getConnection() throws RepositorySourceException {
         if (getName() == null) {
             I18n msg = FederationI18n.propertyIsRequired;
             throw new RepositorySourceException(getName(), msg.text("name"));
@@ -536,7 +559,7 @@
             I18n msg = FederationI18n.propertyIsRequired;
             throw new RepositorySourceException(getName(), msg.text("security domain"));
         }
-        if (getRepositorySourceRegistryJndiName() == null) {
+        if (getRepositoryConnectionFactoryJndiName() == null) {
             I18n msg = FederationI18n.propertyIsRequired;
             throw new RepositorySourceException(getName(), msg.text("repository source registry JNDI name"));
         }
@@ -559,7 +582,7 @@
      * <ol>
      * <li>If a {@link FederatedRepository} already was obtained from a prior call, the same instance is returned.</li>
      * <li>A {@link FederatedRepository} is created using a {@link FederatedRepositoryConfig} is created from this instance's
-     * properties and {@link ExecutionContext} and {@link RepositorySourceRegistry} instances obtained from JNDI.</li>
+     * properties and {@link ExecutionContext} and {@link RepositoryConnectionFactory} instances obtained from JNDI.</li>
      * <li></li>
      * <li></li>
      * </ol>
@@ -594,10 +617,10 @@
             if (repository == null) {
                 // Find in JNDI the repository source registry and the environment ...
                 ExecutionContext context = getExecutionContext();
-                RepositorySourceRegistry registry = getRepositorySourceRegistry();
+                RepositoryConnectionFactory connectionFactory = getConnectionFactory();
                 // And create the configuration and the repository ...
-                FederatedRepositoryConfig config = getRepositoryConfiguration(context, registry);
-                repository = new FederatedRepository(context, registry, config);
+                FederatedRepositoryConfig config = getRepositoryConfiguration(context, connectionFactory);
+                repository = new FederatedRepository(context, connectionFactory, config);
             }
         }
         return repository;
@@ -639,22 +662,22 @@
         }
     }
 
-    protected RepositorySourceRegistry getRepositorySourceRegistry() {
-        RepositorySourceRegistry factories = null;
+    protected RepositoryConnectionFactory getConnectionFactory() {
+        RepositoryConnectionFactory factories = null;
         Context context = getContext();
-        String jndiName = getRepositorySourceRegistryJndiName();
+        String jndiName = getRepositoryConnectionFactoryJndiName();
         if (jndiName != null && jndiName.trim().length() != 0) {
             Object object = null;
             try {
                 if (context == null) context = new InitialContext();
                 object = context.lookup(jndiName);
-                if (object != null) factories = (RepositorySourceRegistry)object;
+                if (object != null) factories = (RepositoryConnectionFactory)object;
             } catch (ClassCastException err) {
                 I18n msg = FederationI18n.objectFoundInJndiWasNotOfExpectedType;
                 String className = object != null ? object.getClass().getName() : "null";
                 throw new RepositorySourceException(getName(), msg.text(jndiName,
                                                                         this.getName(),
-                                                                        RepositorySourceRegistry.class.getName(),
+                                                                        RepositoryConnectionFactory.class.getName(),
                                                                         className), err);
             } catch (Throwable err) {
                 I18n msg = FederationI18n.unableToFindRepositoryConnectionFactoriesInJndi;
@@ -698,11 +721,11 @@
      * <i>not</i> modify the state of this instance.
      * 
      * @param context the execution context that should be used to read the configuration; may not be null
-     * @param registry the registry from which {@link RepositorySource} instances can be obtained; may not be null
+     * @param connectionFactory the factory for {@link RepositoryConnection}s can be obtained; may not be null
      * @return a configuration reflecting the current state of this instance
      */
     protected synchronized FederatedRepositoryConfig getRepositoryConfiguration( ExecutionContext context,
-                                                                                 RepositorySourceRegistry registry ) {
+                                                                                 RepositoryConnectionFactory connectionFactory ) {
         Problems problems = new SimpleProblems();
         ValueFactories valueFactories = context.getValueFactories();
         PathFactory pathFactory = valueFactories.getPathFactory();
@@ -725,10 +748,11 @@
         } else if (configurationProjection.isSimple()) {
             // There is just a single projection for the configuration repository, so just use an executor that
             // translates the paths using the projection
-            executor = new SingleProjectionCommandExecutor(context, configurationSourceName, configurationProjection, registry);
+            executor = new SingleProjectionCommandExecutor(context, configurationSourceName, configurationProjection,
+                                                           connectionFactory);
         } else {
             // The configuration repository has more than one projection, so we need to merge the results
-            executor = new FederatingCommandExecutor(context, configurationSourceName, projections, registry);
+            executor = new FederatingCommandExecutor(context, configurationSourceName, projections, connectionFactory);
         }
         // Wrap the executor with a logging executor ...
         executor = new LoggingCommandExecutor(executor, Logger.getLogger(getClass()), Logger.Level.INFO);
@@ -884,8 +908,8 @@
             }
             ref.add(new StringRefAddr(CONFIGURATION_SOURCE_PROJECTION_RULES, sb.toString()));
         }
-        if (getRepositorySourceRegistryJndiName() != null) {
-            ref.add(new StringRefAddr(REPOSITORY_SOURCE_REGISTRY_JNDI_NAME, getRepositorySourceRegistryJndiName()));
+        if (getRepositoryConnectionFactoryJndiName() != null) {
+            ref.add(new StringRefAddr(REPOSITORY_CONNECTION_FACTORY_JNDI_NAME, getRepositoryConnectionFactoryJndiName()));
         }
         if (getExecutionContextFactoryJndiName() != null) {
             ref.add(new StringRefAddr(EXECUTION_CONTEXT_FACTORY_JNDI_NAME, getExecutionContextFactoryJndiName()));
@@ -925,7 +949,7 @@
             String password = values.get(FederatedRepositorySource.PASSWORD);
             String configurationSourceName = values.get(FederatedRepositorySource.CONFIGURATION_SOURCE_NAME);
             String projectionRules = values.get(FederatedRepositorySource.CONFIGURATION_SOURCE_PROJECTION_RULES);
-            String connectionFactoriesJndiName = values.get(FederatedRepositorySource.REPOSITORY_SOURCE_REGISTRY_JNDI_NAME);
+            String connectionFactoriesJndiName = values.get(FederatedRepositorySource.REPOSITORY_CONNECTION_FACTORY_JNDI_NAME);
             String environmentJndiName = values.get(FederatedRepositorySource.EXECUTION_CONTEXT_FACTORY_JNDI_NAME);
             String repositoryJndiName = values.get(FederatedRepositorySource.REPOSITORY_JNDI_NAME);
             String securityDomain = values.get(FederatedRepositorySource.SECURITY_DOMAIN);
@@ -942,7 +966,7 @@
                 List<String> rules = StringUtil.splitLines(projectionRules);
                 source.setConfigurationSourceProjectionRules(rules.toArray(new String[rules.size()]));
             }
-            if (connectionFactoriesJndiName != null) source.setRepositorySourceRegistryJndiName(connectionFactoriesJndiName);
+            if (connectionFactoriesJndiName != null) source.setRepositoryConnectionFactoryJndiName(connectionFactoriesJndiName);
             if (environmentJndiName != null) source.setExecutionContextFactoryJndiName(environmentJndiName);
             if (repositoryJndiName != null) source.setRepositoryJndiName(repositoryJndiName);
             if (securityDomain != null) source.setSecurityDomain(securityDomain);

Modified: trunk/connectors/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/executor/FederatingCommandExecutor.java
===================================================================
--- trunk/connectors/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/executor/FederatingCommandExecutor.java	2008-08-07 19:56:15 UTC (rev 402)
+++ trunk/connectors/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/executor/FederatingCommandExecutor.java	2008-08-07 22:37:39 UTC (rev 403)
@@ -43,9 +43,9 @@
 import org.jboss.dna.spi.ExecutionContext;
 import org.jboss.dna.spi.cache.CachePolicy;
 import org.jboss.dna.spi.connector.RepositoryConnection;
+import org.jboss.dna.spi.connector.RepositoryConnectionFactory;
 import org.jboss.dna.spi.connector.RepositorySource;
 import org.jboss.dna.spi.connector.RepositorySourceException;
-import org.jboss.dna.spi.connector.RepositorySourceRegistry;
 import org.jboss.dna.spi.graph.DateTime;
 import org.jboss.dna.spi.graph.DateTimeFactory;
 import org.jboss.dna.spi.graph.Name;
@@ -77,7 +77,7 @@
     private final Projection cacheProjection;
     private final List<Projection> sourceProjections;
     private final Set<String> sourceNames;
-    private final RepositorySourceRegistry sourceRegistry;
+    private final RepositoryConnectionFactory connectionFactory;
     private final MergeStrategy mergingStrategy;
     /** The set of all connections, including the cache connection */
     private final Map<String, RepositoryConnection> connectionsBySourceName;
@@ -88,19 +88,19 @@
      * Create a command executor that federates (merges) the information from multiple sources described by the source
      * projections. The resulting command executor does not first consult a cache for the merged information; if a cache is
      * desired, see
-     * {@link #FederatingCommandExecutor(ExecutionContext, String, Projection, CachePolicy, List, RepositorySourceRegistry)
+     * {@link #FederatingCommandExecutor(ExecutionContext, String, Projection, CachePolicy, List, RepositoryConnectionFactory)
      * constructor} that takes a {@link Projection cache projection}.
      * 
      * @param context the execution context in which the executor will be run; may not be null
      * @param sourceName the name of the {@link RepositorySource} that is making use of this executor; may not be null or empty
      * @param sourceProjections the source projections; may not be null
-     * @param sourceRegistry the registry of {@link RepositorySource} instances
+     * @param connectionFactory the factory for {@link RepositoryConnection} instances
      */
     public FederatingCommandExecutor( ExecutionContext context,
                                       String sourceName,
                                       List<Projection> sourceProjections,
-                                      RepositorySourceRegistry sourceRegistry ) {
-        this(context, sourceName, null, null, sourceProjections, sourceRegistry);
+                                      RepositoryConnectionFactory connectionFactory ) {
+        this(context, sourceName, null, null, sourceProjections, connectionFactory);
     }
 
     /**
@@ -116,22 +116,22 @@
      * @param defaultCachePolicy the default caching policy that outlines the length of time that information should be cached, or
      *        null if there is no cache or no specific cache policy
      * @param sourceProjections the source projections; may not be null
-     * @param sourceRegistry the registry of {@link RepositorySource} instances
+     * @param connectionFactory the factory for {@link RepositoryConnection} instances
      */
     public FederatingCommandExecutor( ExecutionContext context,
                                       String sourceName,
                                       Projection cacheProjection,
                                       CachePolicy defaultCachePolicy,
                                       List<Projection> sourceProjections,
-                                      RepositorySourceRegistry sourceRegistry ) {
+                                      RepositoryConnectionFactory connectionFactory ) {
         super(context, sourceName);
         assert sourceProjections != null;
-        assert sourceRegistry != null;
+        assert connectionFactory != null;
         assert cacheProjection != null ? defaultCachePolicy != null : defaultCachePolicy == null;
         this.cacheProjection = cacheProjection;
         this.defaultCachePolicy = defaultCachePolicy;
         this.sourceProjections = sourceProjections;
-        this.sourceRegistry = sourceRegistry;
+        this.connectionFactory = connectionFactory;
         this.connectionsBySourceName = new HashMap<String, RepositoryConnection>();
         this.uuidPropertyName = context.getValueFactories().getNameFactory().create(DnaLexicon.PropertyNames.UUID);
         this.mergePlanPropertyName = context.getValueFactories().getNameFactory().create(DnaLexicon.PropertyNames.MERGE_PLAN);
@@ -181,10 +181,7 @@
         String sourceName = projection.getSourceName();
         RepositoryConnection connection = connectionsBySourceName.get(sourceName);
         if (connection == null) {
-            RepositorySource source = sourceRegistry.getRepositorySource(sourceName);
-            if (source != null) {
-                connection = source.getConnection();
-            }
+            connection = connectionFactory.createConnection(sourceName);
             connectionsBySourceName.put(sourceName, connection);
         }
         return connection;

Modified: trunk/connectors/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/executor/SingleProjectionCommandExecutor.java
===================================================================
--- trunk/connectors/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/executor/SingleProjectionCommandExecutor.java	2008-08-07 19:56:15 UTC (rev 402)
+++ trunk/connectors/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/executor/SingleProjectionCommandExecutor.java	2008-08-07 22:37:39 UTC (rev 403)
@@ -26,9 +26,9 @@
 import org.jboss.dna.connector.federation.Projection;
 import org.jboss.dna.spi.ExecutionContext;
 import org.jboss.dna.spi.connector.RepositoryConnection;
+import org.jboss.dna.spi.connector.RepositoryConnectionFactory;
 import org.jboss.dna.spi.connector.RepositorySource;
 import org.jboss.dna.spi.connector.RepositorySourceException;
-import org.jboss.dna.spi.connector.RepositorySourceRegistry;
 import org.jboss.dna.spi.graph.DateTime;
 import org.jboss.dna.spi.graph.Path;
 import org.jboss.dna.spi.graph.PathFactory;
@@ -52,7 +52,7 @@
 
     private final Projection projection;
     private final PathFactory pathFactory;
-    private final RepositorySourceRegistry registry;
+    private final RepositoryConnectionFactory connectionFactory;
     private RepositoryConnection connection;
 
     /**
@@ -60,13 +60,13 @@
      * @param sourceName the name of the {@link RepositorySource} that is making use of this executor; may not be null or empty
      * @param projection the projection used for the cached information; may not be null and must have exactly one
      *        {@link Projection#getRules() rule}
-     * @param sourceRegistry the registry of {@link RepositorySource} instances
+     * @param connectionFactory the factory for {@link RepositoryConnection} instances
      */
     public SingleProjectionCommandExecutor( ExecutionContext context,
                                             String sourceName,
                                             Projection projection,
-                                            RepositorySourceRegistry sourceRegistry ) {
-        this(context, sourceName, null, projection, sourceRegistry);
+                                            RepositoryConnectionFactory connectionFactory ) {
+        this(context, sourceName, null, projection, connectionFactory);
     }
 
     /**
@@ -75,19 +75,19 @@
      * @param now the current time; may be null if the system time is to be used
      * @param projection the projection used for the cached information; may not be null and must have exactly one
      *        {@link Projection#getRules() rule}
-     * @param sourceRegistry the registry of {@link RepositorySource} instances
+     * @param connectionFactory the factory for {@link RepositoryConnection} instances
      */
     public SingleProjectionCommandExecutor( ExecutionContext context,
                                             String sourceName,
                                             DateTime now,
                                             Projection projection,
-                                            RepositorySourceRegistry sourceRegistry ) {
+                                            RepositoryConnectionFactory connectionFactory ) {
         super(context, sourceName, now);
-        assert sourceRegistry != null;
+        assert connectionFactory != null;
         assert projection != null;
         assert projection.getRules().size() == 1;
         this.projection = projection;
-        this.registry = sourceRegistry;
+        this.connectionFactory = connectionFactory;
         this.pathFactory = context.getValueFactories().getPathFactory();
         assert this.pathFactory != null;
     }
@@ -95,8 +95,7 @@
     protected RepositoryConnection getConnection() throws RepositorySourceException, InterruptedException {
         if (connection == null) {
             // Create a connection ...
-            RepositorySource source = this.registry.getRepositorySource(this.projection.getSourceName());
-            connection = source.getConnection();
+            connection = this.connectionFactory.createConnection(this.projection.getSourceName());
         }
         return connection;
     }

Modified: trunk/connectors/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederatedRepositorySourceTest.java
===================================================================
--- trunk/connectors/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederatedRepositorySourceTest.java	2008-08-07 19:56:15 UTC (rev 402)
+++ trunk/connectors/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederatedRepositorySourceTest.java	2008-08-07 22:37:39 UTC (rev 403)
@@ -45,8 +45,8 @@
 import org.jboss.dna.spi.ExecutionContextFactory;
 import org.jboss.dna.spi.connector.BasicExecutionContext;
 import org.jboss.dna.spi.connector.RepositoryConnection;
+import org.jboss.dna.spi.connector.RepositoryConnectionFactory;
 import org.jboss.dna.spi.connector.RepositorySourceException;
-import org.jboss.dna.spi.connector.RepositorySourceRegistry;
 import org.jboss.dna.spi.connector.SimpleRepository;
 import org.jboss.dna.spi.connector.SimpleRepositorySource;
 import org.junit.After;
@@ -67,18 +67,19 @@
     private String username;
     private String credentials;
     private String executionContextFactoryJndiName;
-    private String repositorySourceRegistryJndiName;
+    private String repositoryConnectionFactoryJndiName;
     private String configurationSourceName;
     private String securityDomain;
     private SimpleRepository configRepository;
     private SimpleRepositorySource configRepositorySource;
+    private RepositoryConnection configRepositoryConnection;
     private ExecutionContext context;
     @Mock
     private RepositoryConnection connection;
     @Mock
     private Context jndiContext;
     @Mock
-    private RepositorySourceRegistry sourceRegistry;
+    private RepositoryConnectionFactory connectionFactory;
     @Mock
     private ExecutionContextFactory executionContextFactory;
 
@@ -91,7 +92,7 @@
         context = new BasicExecutionContext();
         context.getNamespaceRegistry().register(DnaLexicon.NAMESPACE_PREFIX, DnaLexicon.NAMESPACE_URI);
         executionContextFactoryJndiName = "context factory jndi name";
-        repositorySourceRegistryJndiName = "repository source registry jndi name";
+        repositoryConnectionFactoryJndiName = "repository connection factory jndi name";
         configurationSourceName = "configuration source name";
         repositoryName = "Test Repository";
         securityDomain = "security domain";
@@ -104,7 +105,7 @@
         source.setPassword(credentials);
         source.setConfigurationSourceName(configurationSourceName);
         source.setConfigurationSourceProjectionRules(new String[] {"/dna:system/dna:federation/ => /dna:repositories/Test Repository"});
-        source.setRepositorySourceRegistryJndiName(repositorySourceRegistryJndiName);
+        source.setRepositoryConnectionFactoryJndiName(repositoryConnectionFactoryJndiName);
         source.setExecutionContextFactoryJndiName(executionContextFactoryJndiName);
         source.setContext(jndiContext);
         source.setSecurityDomain(securityDomain);
@@ -123,9 +124,10 @@
         configRepositorySource = new SimpleRepositorySource();
         configRepositorySource.setRepositoryName(configRepository.getRepositoryName());
         configRepositorySource.setName(configurationSourceName);
-        stub(sourceRegistry.getRepositorySource(configurationSourceName)).toReturn(configRepositorySource);
+        configRepositoryConnection = configRepositorySource.getConnection();
+        stub(connectionFactory.createConnection(configurationSourceName)).toReturn(configRepositoryConnection);
         stub(jndiContext.lookup(executionContextFactoryJndiName)).toReturn(executionContextFactory);
-        stub(jndiContext.lookup(repositorySourceRegistryJndiName)).toReturn(sourceRegistry);
+        stub(jndiContext.lookup(repositoryConnectionFactoryJndiName)).toReturn(connectionFactory);
         stub(executionContextFactory.create(eq(securityDomain), anyCallbackHandler())).toReturn(context);
     }
 
@@ -267,7 +269,7 @@
         source.setName("Some source");
         source.setConfigurationSourceName("config source");
         source.setConfigurationSourceProjectionRules(new String[] {"/dna:system => /a/b/c"});
-        source.setRepositorySourceRegistryJndiName("repository source registry jndi name");
+        source.setRepositoryConnectionFactoryJndiName("repository connection factory jndi name");
         source.setRepositoryJndiName("repository jndi name");
         source.setExecutionContextFactoryJndiName("env jndi name");
 
@@ -291,8 +293,8 @@
                    is(source.getConfigurationSourceName()));
         assertThat((String)refAttributes.remove(FederatedRepositorySource.CONFIGURATION_SOURCE_PROJECTION_RULES),
                    is("/dna:system => /a/b/c"));
-        assertThat((String)refAttributes.remove(FederatedRepositorySource.REPOSITORY_SOURCE_REGISTRY_JNDI_NAME),
-                   is(source.getRepositorySourceRegistryJndiName()));
+        assertThat((String)refAttributes.remove(FederatedRepositorySource.REPOSITORY_CONNECTION_FACTORY_JNDI_NAME),
+                   is(source.getRepositoryConnectionFactoryJndiName()));
         assertThat((String)refAttributes.remove(FederatedRepositorySource.EXECUTION_CONTEXT_FACTORY_JNDI_NAME),
                    is(source.getExecutionContextFactoryJndiName()));
         assertThat((String)refAttributes.remove(FederatedRepositorySource.REPOSITORY_JNDI_NAME),
@@ -315,7 +317,7 @@
         assertThat(recoveredSource.getRetryLimit(), is(source.getRetryLimit()));
         assertThat(recoveredSource.getConfigurationSourceName(), is(source.getConfigurationSourceName()));
         assertThat(recoveredSource.getConfigurationSourceProjectionRules(), is(source.getConfigurationSourceProjectionRules()));
-        assertThat(recoveredSource.getRepositorySourceRegistryJndiName(), is(source.getRepositorySourceRegistryJndiName()));
+        assertThat(recoveredSource.getRepositoryConnectionFactoryJndiName(), is(source.getRepositoryConnectionFactoryJndiName()));
         assertThat(recoveredSource.getExecutionContextFactoryJndiName(), is(source.getExecutionContextFactoryJndiName()));
         assertThat(recoveredSource.getRepositoryJndiName(), is(source.getRepositoryJndiName()));
         assertThat(recoveredSource.getSecurityDomain(), is(source.getSecurityDomain()));

Modified: trunk/connectors/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederatedRepositoryTest.java
===================================================================
--- trunk/connectors/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederatedRepositoryTest.java	2008-08-07 19:56:15 UTC (rev 402)
+++ trunk/connectors/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederatedRepositoryTest.java	2008-08-07 22:37:39 UTC (rev 403)
@@ -29,8 +29,8 @@
 import static org.junit.matchers.JUnitMatchers.hasItems;
 import org.jboss.dna.spi.ExecutionContext;
 import org.jboss.dna.spi.connector.BasicExecutionContext;
+import org.jboss.dna.spi.connector.RepositoryConnectionFactory;
 import org.jboss.dna.spi.connector.RepositorySourceListener;
-import org.jboss.dna.spi.connector.RepositorySourceRegistry;
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.MockitoAnnotations;
@@ -50,13 +50,13 @@
     @Mock
     private RepositorySourceListener listener2;
     @Mock
-    private RepositorySourceRegistry registry;
+    private RepositoryConnectionFactory connectionFactory;
 
     @Before
     public void beforeEach() {
         MockitoAnnotations.initMocks(this);
         context = new BasicExecutionContext();
-        repository = new FederatedRepository(context, registry, config);
+        repository = new FederatedRepository(context, connectionFactory, config);
     }
 
     @Test

Modified: trunk/connectors/dna-connector-inmemory/src/main/java/org/jboss/dna/connector/inmemory/InMemoryRepositorySource.java
===================================================================
--- trunk/connectors/dna-connector-inmemory/src/main/java/org/jboss/dna/connector/inmemory/InMemoryRepositorySource.java	2008-08-07 19:56:15 UTC (rev 402)
+++ trunk/connectors/dna-connector-inmemory/src/main/java/org/jboss/dna/connector/inmemory/InMemoryRepositorySource.java	2008-08-07 22:37:39 UTC (rev 403)
@@ -27,6 +27,7 @@
 import java.util.UUID;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReadWriteLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
@@ -40,21 +41,26 @@
 import net.jcip.annotations.GuardedBy;
 import org.jboss.dna.common.util.ArgCheck;
 import org.jboss.dna.spi.cache.CachePolicy;
-import org.jboss.dna.spi.connector.AbstractRepositorySource;
 import org.jboss.dna.spi.connector.RepositoryConnection;
+import org.jboss.dna.spi.connector.RepositorySource;
 import org.jboss.dna.spi.connector.RepositorySourceCapabilities;
 import org.jboss.dna.spi.connector.RepositorySourceException;
 
 /**
  * @author Randall Hauch
  */
-public class InMemoryRepositorySource extends AbstractRepositorySource implements ObjectFactory {
+public class InMemoryRepositorySource implements RepositorySource, ObjectFactory {
 
     /**
      * The initial version is 1
      */
     private static final long serialVersionUID = 1L;
 
+    /**
+     * The default limit is {@value} for retrying {@link RepositoryConnection connection} calls to the underlying source.
+     */
+    public static final int DEFAULT_RETRY_LIMIT = 0;
+
     private static final ConcurrentMap<String, InMemoryRepositorySource> sources = new ConcurrentHashMap<String, InMemoryRepositorySource>();
     private static final ReadWriteLock sourcesLock = new ReentrantReadWriteLock();
 
@@ -95,6 +101,7 @@
     private String jndiName;
     private UUID rootNodeUuid = UUID.randomUUID();
     private CachePolicy defaultCachePolicy;
+    private final AtomicInteger retryLimit = new AtomicInteger(DEFAULT_RETRY_LIMIT);
     private transient InMemoryRepository repository;
 
     /**
@@ -105,6 +112,24 @@
     }
 
     /**
+     * {@inheritDoc}
+     * 
+     * @see org.jboss.dna.spi.connector.RepositorySource#getRetryLimit()
+     */
+    public int getRetryLimit() {
+        return retryLimit.get();
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.jboss.dna.spi.connector.RepositorySource#setRetryLimit(int)
+     */
+    public void setRetryLimit( int limit ) {
+        retryLimit.set(limit < 0 ? 0 : limit);
+    }
+
+    /**
      * Get the default cache policy for this source, or null if the global default cache policy should be used
      * 
      * @return the default cache policy, or null if this source has no explicit default cache policy
@@ -223,10 +248,9 @@
     /**
      * {@inheritDoc}
      * 
-     * @see org.jboss.dna.spi.connector.AbstractRepositorySource#createConnection()
+     * @see org.jboss.dna.spi.connector.RepositorySource#getConnection()
      */
-    @Override
-    protected synchronized RepositoryConnection createConnection() throws RepositorySourceException {
+    public RepositoryConnection getConnection() throws RepositorySourceException {
         if (repository == null) {
             repository = new InMemoryRepository(name, rootNodeUuid);
         }

Modified: trunk/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheSource.java
===================================================================
--- trunk/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheSource.java	2008-08-07 19:56:15 UTC (rev 402)
+++ trunk/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheSource.java	2008-08-07 22:37:39 UTC (rev 403)
@@ -31,6 +31,7 @@
 import java.util.Hashtable;
 import java.util.Map;
 import java.util.UUID;
+import java.util.concurrent.atomic.AtomicInteger;
 import javax.naming.BinaryRefAddr;
 import javax.naming.Context;
 import javax.naming.InitialContext;
@@ -46,7 +47,6 @@
 import org.jboss.dna.common.i18n.I18n;
 import org.jboss.dna.spi.DnaLexicon;
 import org.jboss.dna.spi.cache.CachePolicy;
-import org.jboss.dna.spi.connector.AbstractRepositorySource;
 import org.jboss.dna.spi.connector.RepositoryConnection;
 import org.jboss.dna.spi.connector.RepositorySource;
 import org.jboss.dna.spi.connector.RepositorySourceCapabilities;
@@ -71,9 +71,13 @@
  * @author Randall Hauch
  */
 @ThreadSafe
-public class JBossCacheSource extends AbstractRepositorySource implements ObjectFactory {
+public class JBossCacheSource implements RepositorySource, ObjectFactory {
 
     private static final long serialVersionUID = 1L;
+    /**
+     * The default limit is {@value} for retrying {@link RepositoryConnection connection} calls to the underlying source.
+     */
+    public static final int DEFAULT_RETRY_LIMIT = 0;
     public static final String DEFAULT_UUID_PROPERTY_NAME = DnaLexicon.PropertyNames.UUID;
 
     protected static final String ROOT_NODE_UUID = "rootNodeUuid";
@@ -92,6 +96,7 @@
     private String cacheFactoryJndiName;
     private String cacheJndiName;
     private String uuidPropertyName = DEFAULT_UUID_PROPERTY_NAME;
+    private final AtomicInteger retryLimit = new AtomicInteger(DEFAULT_RETRY_LIMIT);
     private transient Cache<Name, Object> cache;
     private transient Context jndiContext;
 
@@ -109,6 +114,24 @@
     }
 
     /**
+     * {@inheritDoc}
+     * 
+     * @see org.jboss.dna.spi.connector.RepositorySource#getRetryLimit()
+     */
+    public int getRetryLimit() {
+        return retryLimit.get();
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.jboss.dna.spi.connector.RepositorySource#setRetryLimit(int)
+     */
+    public void setRetryLimit( int limit ) {
+        retryLimit.set(limit < 0 ? 0 : limit);
+    }
+
+    /**
      * Set the name of this source
      * 
      * @param name the name for this source
@@ -317,10 +340,11 @@
 
     /**
      * {@inheritDoc}
+     * 
+     * @see org.jboss.dna.spi.connector.RepositorySource#getConnection()
      */
     @SuppressWarnings( "unchecked" )
-    @Override
-    protected synchronized RepositoryConnection createConnection() {
+    public RepositoryConnection getConnection() throws RepositorySourceException {
         if (getName() == null) {
             I18n msg = JBossCacheConnectorI18n.propertyIsRequired;
             throw new RepositorySourceException(getName(), msg.text("name"));

Modified: trunk/connectors/dna-connector-jbosscache/src/test/java/org/jboss/dna/connector/jbosscache/JBossCacheSourceTest.java
===================================================================
--- trunk/connectors/dna-connector-jbosscache/src/test/java/org/jboss/dna/connector/jbosscache/JBossCacheSourceTest.java	2008-08-07 19:56:15 UTC (rev 402)
+++ trunk/connectors/dna-connector-jbosscache/src/test/java/org/jboss/dna/connector/jbosscache/JBossCacheSourceTest.java	2008-08-07 22:37:39 UTC (rev 403)
@@ -32,7 +32,6 @@
 import java.util.Hashtable;
 import java.util.Map;
 import java.util.UUID;
-import java.util.concurrent.TimeUnit;
 import javax.naming.Context;
 import javax.naming.Name;
 import javax.naming.RefAddr;
@@ -90,9 +89,6 @@
         if (connection != null) {
             connection.close();
         }
-        source.shutdownNow();
-        source.awaitTermination(4, TimeUnit.SECONDS);
-        // assertThat(source.isTerminated(), is(true));
     }
 
     @Test

Modified: trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryService.java
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryService.java	2008-08-07 19:56:15 UTC (rev 402)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryService.java	2008-08-07 22:37:39 UTC (rev 403)
@@ -196,9 +196,6 @@
             NameFactory nameFactory = valueFactories.getNameFactory();
 
             final String configurationSourceName = configurationProjection.getSourceName();
-            if (sources.getRepositorySource(configurationSourceName) == null) {
-                throw new FederationException(RepositoryI18n.unableToFindRepositorySourceWithName.text(configurationSourceName));
-            }
 
             // Create a federating command executor to execute the commands and merge the results into a single set of
             // commands.
@@ -242,7 +239,7 @@
                                 RepositorySource source = createRepositorySource(getSourceCommand.getPath(),
                                                                                  getSourceCommand.getProperties(),
                                                                                  problems);
-                                if (source != null) sources.addSource(source, true);
+                                if (source != null) sources.addSource(source);
                             }
                         }
                     }

Modified: trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositorySourceManager.java
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositorySourceManager.java	2008-08-07 19:56:15 UTC (rev 402)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositorySourceManager.java	2008-08-07 22:37:39 UTC (rev 403)
@@ -23,20 +23,30 @@
 
 import java.util.Collection;
 import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
 import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.locks.ReadWriteLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
+import net.jcip.annotations.ThreadSafe;
 import org.jboss.dna.repository.services.AbstractServiceAdministrator;
 import org.jboss.dna.repository.services.ServiceAdministrator;
 import org.jboss.dna.spi.connector.RepositoryConnection;
+import org.jboss.dna.spi.connector.RepositoryConnectionFactory;
+import org.jboss.dna.spi.connector.RepositoryConnectionPool;
 import org.jboss.dna.spi.connector.RepositorySource;
-import org.jboss.dna.spi.connector.RepositorySourceRegistry;
 
 /**
+ * A manager of {@link RepositorySource} instances and the {@link RepositoryConnectionPool} used to manage the connections for
+ * each.
+ * 
  * @author Randall Hauch
  */
-public class RepositorySourceManager implements RepositorySourceRegistry {
+ at ThreadSafe
+public class RepositorySourceManager implements RepositoryConnectionFactory {
 
     /**
      * The administrative component for this service.
@@ -87,36 +97,36 @@
 
     private final ServiceAdministrator administrator = new Administrator();
     private final ReadWriteLock sourcesLock = new ReentrantReadWriteLock();
-    private final CopyOnWriteArrayList<RepositorySource> sources = new CopyOnWriteArrayList<RepositorySource>();
-    private RepositorySourceRegistry delegate;
+    private final CopyOnWriteArrayList<RepositoryConnectionPool> pools = new CopyOnWriteArrayList<RepositoryConnectionPool>();
+    private RepositoryConnectionFactory delegate;
 
     /**
      * Create a new manager instance.
      * 
-     * @param delegate the registry to which this instance should delegate in the event that a source is not found in this
-     *        manager; may be null if there is no delegate
+     * @param delegate the connection factory to which this instance should delegate in the event that a source is not found in
+     *        this manager; may be null if there is no delegate
      */
-    public RepositorySourceManager( RepositorySourceRegistry delegate ) {
+    public RepositorySourceManager( RepositoryConnectionFactory delegate ) {
         this.delegate = delegate;
     }
 
     /**
-     * Get the delegate registry.
+     * Get the delegate connection factory.
      * 
-     * @return the registry to which this instance should delegate in the event that a source is not found in this manager, or
-     *         null if there is no delegate
+     * @return the connection factory to which this instance should delegate in the event that a source is not found in this
+     *         manager, or null if there is no delegate
      */
-    public RepositorySourceRegistry getDelegate() {
+    public RepositoryConnectionFactory getDelegate() {
         return delegate;
     }
 
     /**
-     * Set the delegate registry.
+     * Set the delegate connection factory.
      * 
-     * @param delegate the registry to which this instance should delegate in the event that a source is not found in this
-     *        manager; may be null if there is no delegate
+     * @param delegate the connection factory to which this instance should delegate in the event that a source is not found in
+     *        this manager; may be null if there is no delegate
      */
-    public void setDelegate( RepositorySourceRegistry delegate ) {
+    public void setDelegate( RepositoryConnectionFactory delegate ) {
         this.delegate = delegate;
     }
 
@@ -131,7 +141,7 @@
      * Utility method called by the administrator.
      */
     protected void start() {
-        // Do not establish connections to the sources; these will be established as needed
+        // Do not establish connections to the pools; these will be established as needed
 
     }
 
@@ -139,11 +149,11 @@
      * Utility method called by the administrator.
      */
     protected void shutdown() {
-        // Close all connections to the sources. This is done inside the sources write lock.
+        // Close all connections to the pools. This is done inside the pools write lock.
         try {
             this.sourcesLock.readLock().lock();
-            for (RepositorySource source : this.sources) {
-                source.shutdown();
+            for (RepositoryConnectionPool pool : this.pools) {
+                pool.shutdown();
             }
         } finally {
             this.sourcesLock.readLock().unlock();
@@ -161,11 +171,11 @@
      */
     protected boolean awaitTermination( long timeout,
                                         TimeUnit unit ) throws InterruptedException {
-        // Check whether all source pools are shut down. This is done inside the sources write lock.
+        // Check whether all source pools are shut down. This is done inside the pools write lock.
         try {
             this.sourcesLock.readLock().lock();
-            for (RepositorySource source : this.sources) {
-                if (!source.awaitTermination(timeout, unit)) return false;
+            for (RepositoryConnectionPool pool : this.pools) {
+                if (!pool.awaitTermination(timeout, unit)) return false;
             }
             return true;
         } finally {
@@ -186,8 +196,8 @@
     public boolean isTerminating() {
         try {
             this.sourcesLock.readLock().lock();
-            for (RepositorySource source : this.sources) {
-                if (source.isTerminating()) return true;
+            for (RepositoryConnectionPool pool : this.pools) {
+                if (pool.isTerminating()) return true;
             }
             return false;
         } finally {
@@ -204,8 +214,8 @@
     public boolean isTerminated() {
         try {
             this.sourcesLock.readLock().lock();
-            for (RepositorySource source : this.sources) {
-                if (!source.isTerminated()) return false;
+            for (RepositoryConnectionPool pool : this.pools) {
+                if (!pool.isTerminated()) return false;
             }
             return true;
         } finally {
@@ -214,37 +224,86 @@
     }
 
     /**
-     * Get an unmodifiable collection of {@link RepositorySource federated sources}.
-     * <p>
-     * This method can safely be called while the federation repository is in use.
-     * </p>
+     * Get an unmodifiable collection of {@link RepositorySource} names.
      * 
-     * @return the sources
+     * @return the pools
      */
+    public Collection<String> getSourceNames() {
+        Set<String> sourceNames = new HashSet<String>();
+        for (RepositoryConnectionPool pool : this.pools) {
+            sourceNames.add(pool.getRepositorySource().getName());
+        }
+        return Collections.unmodifiableCollection(sourceNames);
+    }
+
+    /**
+     * Get an unmodifiable collection of {@link RepositorySource} instances managed by this instance.
+     * 
+     * @return the pools
+     */
     public Collection<RepositorySource> getSources() {
-        return Collections.unmodifiableCollection(this.sources);
+        List<RepositorySource> sources = new LinkedList<RepositorySource>();
+        for (RepositoryConnectionPool pool : this.pools) {
+            sources.add(pool.getRepositorySource());
+        }
+        return Collections.unmodifiableCollection(sources);
     }
 
     /**
+     * Get the RepositorySource with the specified name managed by this instance.
+     * 
+     * @param sourceName the name of the source
+     * @return the source, or null if no such source exists in this instance
+     */
+    public RepositorySource getSource( String sourceName ) {
+        try {
+            this.sourcesLock.readLock().lock();
+            for (RepositoryConnectionPool existingPool : this.pools) {
+                RepositorySource source = existingPool.getRepositorySource();
+                if (source.getName().equals(sourceName)) return source;
+            }
+        } finally {
+            this.sourcesLock.readLock().unlock();
+        }
+        return null;
+    }
+
+    /**
+     * Get the connection pool managing the {@link RepositorySource} with the specified name managed by this instance.
+     * 
+     * @param sourceName the name of the source
+     * @return the pool, or null if no such pool exists in this instance
+     */
+    public RepositoryConnectionPool getConnectionPool( String sourceName ) {
+        try {
+            this.sourcesLock.readLock().lock();
+            for (RepositoryConnectionPool existingPool : this.pools) {
+                RepositorySource source = existingPool.getRepositorySource();
+                if (source.getName().equals(sourceName)) return existingPool;
+            }
+        } finally {
+            this.sourcesLock.readLock().unlock();
+        }
+        return null;
+    }
+
+    /**
      * Add the supplied federated source. This method returns false if the source is null.
-     * <p>
-     * This method can safely be called while the federation repository is in use.
-     * </p>
      * 
      * @param source the source to add
-     * @param force true if the valid source should be added even if there is an existing source with the supplied name
      * @return true if the source is added, or false if the reference is null or if there is already an existing source with the
      *         supplied name.
      */
-    public boolean addSource( RepositorySource source,
-                              boolean force ) {
+    public boolean addSource( RepositorySource source ) {
         if (source == null) return false;
         try {
             this.sourcesLock.writeLock().lock();
-            for (RepositorySource existingSource : this.sources) {
-                if (existingSource.getName().equals(source.getName())) return false;
+            for (RepositoryConnectionPool existingPool : this.pools) {
+                if (existingPool.getRepositorySource().getName().equals(source.getName())) return false;
             }
-            return force ? this.sources.add(source) : this.sources.addIfAbsent(source);
+            RepositoryConnectionPool pool = new RepositoryConnectionPool(source);
+            this.pools.add(pool);
+            return true;
         } finally {
             this.sourcesLock.writeLock().unlock();
         }
@@ -276,9 +335,6 @@
      * Remove from this federated repository the source with the supplied name. This call shuts down the connections in the source
      * in an orderly fashion, allowing those connection currently in use to be used and closed normally, but preventing further
      * connections from being used.
-     * <p>
-     * This method can safely be called while the federation repository is in use.
-     * </p>
      * 
      * @param name the name of the source to be removed
      * @param timeToAwait the amount of time to wait while all of the source's connections are closed, or non-positive if the call
@@ -293,13 +349,13 @@
                                           TimeUnit unit ) throws InterruptedException {
         try {
             this.sourcesLock.writeLock().lock();
-            for (RepositorySource existingSource : this.sources) {
-                if (existingSource.getName().equals(name)) {
+            for (RepositoryConnectionPool existingPool : this.pools) {
+                if (existingPool.getRepositorySource().getName().equals(name)) {
                     // Shut down the source ...
-                    existingSource.shutdown();
-                    if (timeToAwait > 0l) existingSource.awaitTermination(timeToAwait, unit);
+                    existingPool.shutdown();
+                    if (timeToAwait > 0L) existingPool.awaitTermination(timeToAwait, unit);
                 }
-                return existingSource;
+                return existingPool.getRepositorySource();
             }
         } finally {
             this.sourcesLock.writeLock().unlock();
@@ -310,22 +366,22 @@
     /**
      * {@inheritDoc}
      * 
-     * @see org.jboss.dna.spi.connector.RepositorySourceRegistry#getRepositorySource(java.lang.String)
+     * @see org.jboss.dna.spi.connector.RepositoryConnectionFactory#createConnection(java.lang.String)
      */
-    public RepositorySource getRepositorySource( String sourceName ) {
+    public RepositoryConnection createConnection( String sourceName ) throws InterruptedException {
         try {
             this.sourcesLock.readLock().lock();
-            for (RepositorySource existingSource : this.sources) {
-                if (existingSource.getName().equals(sourceName)) return existingSource;
+            for (RepositoryConnectionPool existingPool : this.pools) {
+                RepositorySource source = existingPool.getRepositorySource();
+                if (source.getName().equals(sourceName)) return existingPool.getConnection();
             }
-            RepositorySourceRegistry delegate = this.delegate;
+            RepositoryConnectionFactory delegate = this.delegate;
             if (delegate != null) {
-                return delegate.getRepositorySource(sourceName);
+                return delegate.createConnection(sourceName);
             }
         } finally {
             this.sourcesLock.readLock().unlock();
         }
         return null;
     }
-
 }

Modified: trunk/dna-repository/src/test/java/org/jboss/dna/repository/RepositoryServiceTest.java
===================================================================
--- trunk/dna-repository/src/test/java/org/jboss/dna/repository/RepositoryServiceTest.java	2008-08-07 19:56:15 UTC (rev 402)
+++ trunk/dna-repository/src/test/java/org/jboss/dna/repository/RepositoryServiceTest.java	2008-08-07 22:37:39 UTC (rev 403)
@@ -41,6 +41,7 @@
 import org.jboss.dna.repository.services.ServiceAdministrator;
 import org.jboss.dna.spi.DnaLexicon;
 import org.jboss.dna.spi.ExecutionContext;
+import org.jboss.dna.spi.connector.RepositoryConnection;
 import org.jboss.dna.spi.connector.RepositorySource;
 import org.jboss.dna.spi.connector.SimpleRepository;
 import org.jboss.dna.spi.connector.SimpleRepositorySource;
@@ -76,6 +77,7 @@
     private String configSourceName;
     private SimpleRepository configRepository;
     private SimpleRepositorySource configRepositorySource;
+    private RepositoryConnection configRepositoryConnection;
     @Mock
     private ExecutionContext context;
     @Mock
@@ -98,7 +100,8 @@
         configRepositorySource = new SimpleRepositorySource();
         configRepositorySource.setRepositoryName(configRepository.getRepositoryName());
         configRepositorySource.setName(configSourceName);
-        stub(sources.getRepositorySource(configSourceName)).toReturn(configRepositorySource);
+        configRepositoryConnection = configRepositorySource.getConnection();
+        stub(sources.createConnection(configSourceName)).toReturn(configRepositoryConnection);
         stub(context.getValueFactories()).toReturn(valueFactories);
         stub(context.getPropertyFactory()).toReturn(propertyFactory);
         stub(context.getNamespaceRegistry()).toReturn(registry);
@@ -157,32 +160,28 @@
     }
 
     @Test( expected = FederationException.class )
-    public void shouldFailToStartUpIfConfigurationRepositorySourceIsNotFound() {
-        stub(sources.getRepositorySource(configSourceName)).toReturn(null);
+    public void shouldFailToStartUpIfConfigurationRepositorySourceIsNotFound() throws Exception {
+        stub(sources.createConnection(configSourceName)).toReturn(null);
         service.getAdministrator().start();
     }
 
     @Test( expected = FederationException.class )
     public void shouldFailToStartUpIfUnableToConnectToConfigurationRepository() throws Exception {
-        RepositorySource mockSource = mock(RepositorySource.class);
-        stub(sources.getRepositorySource(configSourceName)).toReturn(mockSource);
-        stub(mockSource.getConnection()).toThrow(new UnsupportedOperationException());
+        stub(sources.createConnection(configSourceName)).toThrow(new UnsupportedOperationException());
         service.getAdministrator().start();
     }
 
     @Test( expected = FederationException.class )
     public void shouldFailToStartUpIfInterruptedWhileConnectingToConfigurationRepository() throws Exception {
-        RepositorySource mockSource = mock(RepositorySource.class);
-        stub(sources.getRepositorySource(configSourceName)).toReturn(mockSource);
-        stub(mockSource.getConnection()).toThrow(new InterruptedException());
+        stub(sources.createConnection(configSourceName)).toThrow(new InterruptedException());
         service.getAdministrator().start();
     }
 
     @Test
-    public void shouldStartUpUsingConfigurationRepositoryThatContainsSomeSources() {
+    public void shouldStartUpUsingConfigurationRepositoryThatContainsSomeSources() throws Exception {
         // Use a real source manager for this test ...
         sources = new RepositorySourceManager(sources);
-        sources.addSource(configRepositorySource, true);
+        sources.addSource(configRepositorySource);
         assertThat(sources.getSources(), hasItems((RepositorySource)configRepositorySource));
         assertThat(sources.getSources().size(), is(1));
         service = new RepositoryService(sources, configProjection, context, null);
@@ -207,28 +206,28 @@
 
         // and verify that the sources were added to the manager...
         assertThat(sources.getSources().size(), is(4));
-        assertThat(sources.getRepositorySource("source A"), is(instanceOf(SimpleRepositorySource.class)));
-        assertThat(sources.getRepositorySource("source B"), is(instanceOf(SimpleRepositorySource.class)));
-        assertThat(sources.getRepositorySource("source C"), is(instanceOf(SimpleRepositorySource.class)));
+        assertThat(sources.getSource("source A"), is(instanceOf(SimpleRepositorySource.class)));
+        assertThat(sources.getSource("source B"), is(instanceOf(SimpleRepositorySource.class)));
+        assertThat(sources.getSource("source C"), is(instanceOf(SimpleRepositorySource.class)));
 
-        SimpleRepositorySource sourceA = (SimpleRepositorySource)sources.getRepositorySource("source A");
+        SimpleRepositorySource sourceA = (SimpleRepositorySource)sources.getSource("source A");
         assertThat(sourceA.getName(), is("source A"));
         assertThat(sourceA.getRepositoryName(), is("sourceReposA"));
         assertThat(sourceA.getRetryLimit(), is(3));
 
-        SimpleRepositorySource sourceB = (SimpleRepositorySource)sources.getRepositorySource("source B");
+        SimpleRepositorySource sourceB = (SimpleRepositorySource)sources.getSource("source B");
         assertThat(sourceB.getName(), is("source B"));
         assertThat(sourceB.getRepositoryName(), is("sourceReposB"));
         assertThat(sourceB.getRetryLimit(), is(SimpleRepositorySource.DEFAULT_RETRY_LIMIT));
 
-        SimpleRepositorySource sourceC = (SimpleRepositorySource)sources.getRepositorySource("source C");
+        SimpleRepositorySource sourceC = (SimpleRepositorySource)sources.getSource("source C");
         assertThat(sourceC.getName(), is("source C"));
         assertThat(sourceC.getRepositoryName(), is("sourceReposC"));
         assertThat(sourceC.getRetryLimit(), is(SimpleRepositorySource.DEFAULT_RETRY_LIMIT));
     }
 
     @Test
-    public void shouldStartUpUsingConfigurationRepositoryThatContainsNoSources() {
+    public void shouldStartUpUsingConfigurationRepositoryThatContainsNoSources() throws Exception {
         // Set up the configuration repository to contain NO sources ...
         configRepository.create(context, "/reposX/dna:sources");
 
@@ -236,7 +235,7 @@
         service.getAdministrator().start();
 
         // and verify that the configuration source was obtained from the manager ...
-        verify(sources, times(2)).getRepositorySource(configSourceName); // once for checking source, second for getting
+        verify(sources, times(1)).createConnection(configSourceName); // once for checking source, second for getting
 
         // and verify that the sources were never added to the manager...
         verifyNoMoreInteractions(sources);

Deleted: trunk/dna-spi/src/main/java/org/jboss/dna/spi/connector/AbstractRepositorySource.java
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/connector/AbstractRepositorySource.java	2008-08-07 19:56:15 UTC (rev 402)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/connector/AbstractRepositorySource.java	2008-08-07 22:37:39 UTC (rev 403)
@@ -1,221 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors. 
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.dna.spi.connector;
-
-import java.io.IOException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-import net.jcip.annotations.ThreadSafe;
-
-/**
- * An abstract implementation of {@link RepositorySource} that may serve as a foundation for most implementations, since it
- * automatically manages the {@link RepositoryConnection connections} using an internal {@link RepositoryConnectionPool pool}.
- * 
- * @author Randall Hauch
- */
- at ThreadSafe
-public abstract class AbstractRepositorySource implements RepositorySource {
-
-    /**
-     */
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * The default limit is {@value} for retrying {@link RepositoryConnection connection} calls to the underlying source.
-     */
-    public static final int DEFAULT_RETRY_LIMIT = 0;
-
-    private final AtomicInteger retryLimit = new AtomicInteger(DEFAULT_RETRY_LIMIT);
-    private RepositoryConnectionPool.ConnectionFactory connectionFactory;
-    private transient RepositoryConnectionPool connections;
-
-    /**
-     * Create a new instance of the repository source. This constructor calls relying upon the {@link #createConnectionFactory()}
-     * method, which creation of the {@link RepositoryConnection connections}.
-     */
-    protected AbstractRepositorySource() {
-        this.connectionFactory = createConnectionFactory();
-        assert this.connectionFactory != null;
-        this.connections = new RepositoryConnectionPool(this.connectionFactory);
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see org.jboss.dna.spi.connector.RepositorySource#getRetryLimit()
-     */
-    public int getRetryLimit() {
-        return retryLimit.get();
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see org.jboss.dna.spi.connector.RepositorySource#setRetryLimit(int)
-     */
-    public void setRetryLimit( int limit ) {
-        retryLimit.set(limit < 0 ? 0 : limit);
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see org.jboss.dna.spi.connector.RepositorySource#isRunning()
-     */
-    public boolean isRunning() {
-        return this.connections.isRunning();
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see org.jboss.dna.spi.connector.RepositorySource#isShutdown()
-     */
-    public boolean isShutdown() {
-        return this.connections.isShutdown();
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see org.jboss.dna.spi.connector.RepositorySource#getConnection()
-     */
-    public RepositoryConnection getConnection() throws RepositorySourceException, InterruptedException {
-        return this.connections.getConnection();
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see org.jboss.dna.spi.connector.RepositorySource#shutdown()
-     */
-    public void shutdown() {
-        this.connections.shutdown();
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see org.jboss.dna.spi.connector.RepositorySource#shutdownNow()
-     */
-    public void shutdownNow() {
-        this.connections.shutdownNow();
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see org.jboss.dna.spi.connector.RepositorySource#isTerminated()
-     */
-    public boolean isTerminated() {
-        return this.connections.isTerminated();
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see org.jboss.dna.spi.connector.RepositorySource#isTerminating()
-     */
-    public boolean isTerminating() {
-        return this.connections.isTerminating();
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see org.jboss.dna.spi.connector.RepositorySource#awaitTermination(long, java.util.concurrent.TimeUnit)
-     */
-    public boolean awaitTermination( long timeout,
-                                     TimeUnit unit ) throws InterruptedException {
-        return this.connections.awaitTermination(timeout, unit);
-    }
-
-    private void writeObject( java.io.ObjectOutputStream out ) throws IOException {
-        out.writeInt(this.getRetryLimit());
-        // Write out the pool's state, since the pool is not serializable ...
-        out.writeLong(connections.getKeepAliveTime(TimeUnit.NANOSECONDS));
-        out.writeInt(connections.getCorePoolSize());
-        out.writeInt(connections.getMaximumPoolSize());
-        out.writeInt(connections.getMaxFailedAttemptsBeforeError());
-        out.writeBoolean(connections.getValidateConnectionBeforeUse());
-        out.writeLong(connections.getPingTimeoutInNanos());
-    }
-
-    private void readObject( java.io.ObjectInputStream in ) throws IOException {
-        setRetryLimit(in.readInt());
-        connectionFactory = createConnectionFactory();
-        // Read the pool state parameters ...
-        final long keepAliveTimeInNanos = in.readLong();
-        final int corePoolSize = in.readInt();
-        final int maxPoolSize = in.readInt();
-        final int maxFailedAttemptsBeforeError = in.readInt();
-        final boolean validateConnections = in.readBoolean();
-        final long pingTimeoutInNanos = in.readLong();
-        // Create a new pool and set it's parameters ...
-        connections = new RepositoryConnectionPool(connectionFactory, corePoolSize, maxPoolSize, keepAliveTimeInNanos,
-                                                   TimeUnit.NANOSECONDS);
-        connections.setMaxFailedAttemptsBeforeError(maxFailedAttemptsBeforeError);
-        connections.setValidateConnectionBeforeUse(validateConnections);
-        connections.setPingTimeout(pingTimeoutInNanos, TimeUnit.NANOSECONDS);
-    }
-
-    /**
-     * Create a connection factory that should be used. The default implementation returns a factory that delegates to the
-     * {@link #createConnection()} method, which should be overridden.
-     * 
-     * @return the connection factory; never null
-     */
-    protected RepositoryConnectionPool.ConnectionFactory createConnectionFactory() {
-        return new RepositoryConnectionPool.ConnectionFactory() {
-            /**
-             * {@inheritDoc}
-             * 
-             * @see org.jboss.dna.spi.connector.RepositoryConnectionPool.ConnectionFactory#createConnection()
-             */
-            public RepositoryConnection createConnection() throws RepositorySourceException, InterruptedException {
-                return AbstractRepositorySource.this.createConnection();
-            }
-
-            /**
-             * {@inheritDoc}
-             * 
-             * @see org.jboss.dna.spi.connector.RepositoryConnectionPool#getSourceName()
-             */
-            public String getSourceName() {
-                return AbstractRepositorySource.this.getName();
-            }
-        };
-    }
-
-    /**
-     * Method to create a new {@link RepositoryConnection} instance. This method is called by the
-     * {@link RepositoryConnectionPool.ConnectionFactory} returned by the default implementation of
-     * {@link #createConnectionFactory()}. If the {@link #createConnectionFactory()} method is overridden, this method will not be
-     * called.
-     * 
-     * @return the new connection
-     * @throws RepositorySourceException
-     * @throws InterruptedException
-     */
-    protected abstract RepositoryConnection createConnection() throws RepositorySourceException, InterruptedException;
-
-}

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositoryConnectionFactory.java (from rev 401, trunk/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositorySourceRegistry.java)
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositoryConnectionFactory.java	                        (rev 0)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositoryConnectionFactory.java	2008-08-07 22:37:39 UTC (rev 403)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors. 
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.dna.spi.connector;
+
+/**
+ * An interface for a factory of {@link RepositoryConnection}s using the names of the {@link RepositorySource} from which the
+ * connections are to be obtained.
+ * 
+ * @author Randall Hauch
+ */
+public interface RepositoryConnectionFactory {
+
+    /**
+     * Create a {@link RepositoryConnection} using the given {@link RepositorySource} name.
+     * 
+     * @param sourceName the name of the source from which a connection should be obtained
+     * @return the source, or null if no such source could be found (or created)
+     * @throws RepositorySourceException if there was an error obtaining the new connection
+     * @throws InterruptedException if the thread was interrupted during the operation
+     */
+    RepositoryConnection createConnection( String sourceName ) throws RepositorySourceException, InterruptedException;
+
+}

Modified: trunk/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositoryConnectionPool.java
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositoryConnectionPool.java	2008-08-07 19:56:15 UTC (rev 402)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositoryConnectionPool.java	2008-08-07 22:37:39 UTC (rev 403)
@@ -52,30 +52,6 @@
 public class RepositoryConnectionPool {
 
     /**
-     * A factory that is used by the connection pool to create new connections.
-     * 
-     * @author Randall Hauch
-     */
-    public interface ConnectionFactory {
-
-        /**
-         * Get the name for the source that owns the pool.
-         * 
-         * @return the name; never null or empty
-         */
-        String getSourceName();
-
-        /**
-         * Create a new connection to the underlying source.
-         * 
-         * @return the new connection
-         * @throws RepositorySourceException if there is a problem obtaining a connection
-         * @throws InterruptedException if the thread is interrupted while attempting to get a connection
-         */
-        RepositoryConnection createConnection() throws RepositorySourceException, InterruptedException;
-    }
-
-    /**
      * The core pool size for default-constructed pools is {@value} .
      */
     public static final int DEFAULT_CORE_POOL_SIZE = 1;
@@ -96,9 +72,9 @@
     private static final RuntimePermission shutdownPerm = new RuntimePermission("modifyThread");
 
     /**
-     * The factory that this pool uses to create new connections.
+     * The source that this pool uses to create new connections.
      */
-    private final ConnectionFactory connectionFactory;
+    private final RepositorySource source;
 
     /**
      * Lock held on updates to poolSize, corePoolSize, maximumPoolSize, and workers set.
@@ -189,18 +165,17 @@
      * uses the {@link #DEFAULT_CORE_POOL_SIZE default core pool size}, {@link #DEFAULT_MAXIMUM_POOL_SIZE default maximum pool
      * size}, and {@link #DEFAULT_KEEP_ALIVE_TIME_IN_SECONDS default keep-alive time (in seconds)}.
      * 
-     * @param connectionFactory the factory for connections
+     * @param source the source for connections
      * @throws IllegalArgumentException if the connection factory is null or any of the supplied arguments are invalid
      */
-    public RepositoryConnectionPool( ConnectionFactory connectionFactory ) {
-        this(connectionFactory, DEFAULT_CORE_POOL_SIZE, DEFAULT_MAXIMUM_POOL_SIZE, DEFAULT_KEEP_ALIVE_TIME_IN_SECONDS,
-             TimeUnit.SECONDS);
+    public RepositoryConnectionPool( RepositorySource source ) {
+        this(source, DEFAULT_CORE_POOL_SIZE, DEFAULT_MAXIMUM_POOL_SIZE, DEFAULT_KEEP_ALIVE_TIME_IN_SECONDS, TimeUnit.SECONDS);
     }
 
     /**
      * Create the pool to use the supplied connection factory, which is typically a {@link RepositorySource}.
      * 
-     * @param connectionFactory the factory for connections
+     * @param source the source for connections
      * @param corePoolSize the number of connections to keep in the pool, even if they are idle.
      * @param maximumPoolSize the maximum number of connections to allow in the pool.
      * @param keepAliveTime when the number of connection is greater than the core, this is the maximum time that excess idle
@@ -208,7 +183,7 @@
      * @param unit the time unit for the keepAliveTime argument.
      * @throws IllegalArgumentException if the connection factory is null or any of the supplied arguments are invalid
      */
-    public RepositoryConnectionPool( ConnectionFactory connectionFactory,
+    public RepositoryConnectionPool( RepositorySource source,
                                      int corePoolSize,
                                      int maximumPoolSize,
                                      long keepAliveTime,
@@ -216,11 +191,11 @@
         ArgCheck.isNonNegative(corePoolSize, "corePoolSize");
         ArgCheck.isPositive(maximumPoolSize, "maximumPoolSize");
         ArgCheck.isNonNegative(keepAliveTime, "keepAliveTime");
-        ArgCheck.isNotNull(connectionFactory, "repository connection factory");
+        ArgCheck.isNotNull(source, "source");
         if (maximumPoolSize < corePoolSize) {
             throw new IllegalArgumentException(SpiI18n.maximumPoolSizeMayNotBeSmallerThanCorePoolSize.text());
         }
-        this.connectionFactory = connectionFactory;
+        this.source = source;
         this.corePoolSize = corePoolSize;
         this.maximumPoolSize = maximumPoolSize;
         this.keepAliveTime = unit.toNanos(keepAliveTime);
@@ -228,12 +203,21 @@
     }
 
     /**
+     * Get the {@link RepositorySource} that's used by this pool.
+     * 
+     * @return the repository source; never null
+     */
+    public final RepositorySource getRepositorySource() {
+        return source;
+    }
+
+    /**
      * Get the name of this pool, which delegates to the connection factory.
      * 
      * @return the name of the source
      */
     protected String getSourceName() {
-        return connectionFactory.getSourceName();
+        return source.getName();
     }
 
     // -------------------------------------------------
@@ -847,7 +831,7 @@
      */
     @GuardedBy( "mainLock" )
     protected ConnectionWrapper newWrappedConnection() throws RepositorySourceException, InterruptedException {
-        RepositoryConnection connection = this.connectionFactory.createConnection();
+        RepositoryConnection connection = this.source.getConnection();
         ++this.poolSize;
         this.totalConnectionsCreated.incrementAndGet();
         return new ConnectionWrapper(connection);

Modified: trunk/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositorySource.java
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositorySource.java	2008-08-07 19:56:15 UTC (rev 402)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositorySource.java	2008-08-07 22:37:39 UTC (rev 403)
@@ -22,7 +22,6 @@
 package org.jboss.dna.spi.connector;
 
 import java.io.Serializable;
-import java.util.concurrent.TimeUnit;
 import javax.naming.Referenceable;
 
 /**
@@ -44,10 +43,7 @@
  * {@link Serializable} so that such objects can be stored in any JNDI naming context and enable proper system recovery,
  * </p>
  * <p>
- * Pooling connections is not done above or outside of the RepositorySource implementations. Therefore, if an implementation would
- * benefit from pooling connections, it should use a pool within the implementation (and expose any pool parameters as desired).
- * If this is the case, the implementation class may benefit from subclassing {@link AbstractRepositorySource} (which manages a
- * pool of connections).
+ * If the connections to a source are to be pooled, see {@link RepositoryConnectionPool}.
  * </p>
  * 
  * @author Randall Hauch
@@ -72,85 +68,6 @@
     RepositoryConnection getConnection() throws RepositorySourceException, InterruptedException;
 
     /**
-     * Initiates an orderly shutdown in which connections that are currently in use are allowed to be used and closed as normal,
-     * but no new connections will be created. Invocation has no additional effect if already shut down.
-     * <p>
-     * Once the source has been shutdown, it may not be used to {@link #getConnection() get connections}.
-     * </p>
-     * 
-     * @throws SecurityException if a security manager exists and shutting down this pool may manipulate threads that the caller
-     *         is not permitted to modify because it does not hold {@link java.lang.RuntimePermission}<tt>("modifyThread")</tt>,
-     *         or the security manager's <tt>checkAccess</tt> method denies access.
-     * @see #shutdownNow()
-     */
-    void shutdown();
-
-    /**
-     * Attempts to close all connections, including those connections currently in use, and prevent the use of other connections.
-     * 
-     * @throws SecurityException if a security manager exists and shutting down this pool may manipulate threads that the caller
-     *         is not permitted to modify because it does not hold {@link java.lang.RuntimePermission}<tt>("modifyThread")</tt>,
-     *         or the security manager's <tt>checkAccess</tt> method denies access.
-     * @see #shutdown()
-     */
-    void shutdownNow();
-
-    /**
-     * Return whether this source is running and is able to {@link #getConnection() provide connections}. Note that this method is
-     * effectively <code>!isShutdown()</code>.
-     * 
-     * @return true if this source is running, or false otherwise
-     * @see #isShutdown()
-     * @see #isTerminated()
-     * @see #isTerminating()
-     */
-    boolean isRunning();
-
-    /**
-     * Return whether this source is in the process of shutting down or has already been shut down. A result of <code>true</code>
-     * signals that the pool may no longer be used. Note that this method is effectively <code>!isRunning()</code>.
-     * 
-     * @return true if this source has been shut down, or false otherwise
-     * @see #isShutdown()
-     * @see #isTerminated()
-     * @see #isTerminating()
-     */
-    boolean isShutdown();
-
-    /**
-     * Returns true if this source is in the process of terminating after {@link #shutdown()} or {@link #shutdownNow()} has been
-     * called but has not completely terminated. This method may be useful for debugging. A return of <tt>true</tt> reported a
-     * sufficient period after shutdown may indicate that submitted tasks have ignored or suppressed interruption, causing this
-     * executor not to properly terminate.
-     * 
-     * @return true if terminating but not yet terminated, or false otherwise
-     * @see #isTerminated()
-     */
-    boolean isTerminating();
-
-    /**
-     * Return true if this pool has completed its termination and no longer has any open connections.
-     * 
-     * @return true if terminated, or false otherwise
-     * @see #isTerminating()
-     */
-    boolean isTerminated();
-
-    /**
-     * Method that can be called after {@link #shutdown()} or {@link #shutdownNow()} to wait until all connections in use at the
-     * time those methods were called have been closed normally. This method accepts a maximum time duration, after which it will
-     * return even if all connections have not been closed.
-     * 
-     * @param timeout the maximum time to wait for all connections to be closed and returned to the pool
-     * @param unit the time unit for <code>timeout</code>
-     * @return true if the pool was terminated in the supplied time (or was already terminated), or false if the timeout occurred
-     *         before all the connections were closed
-     * @throws InterruptedException if the thread was interrupted
-     */
-    boolean awaitTermination( long timeout,
-                              TimeUnit unit ) throws InterruptedException;
-
-    /**
      * Get the maximum number of retries that may be performed on a given operation when using {@link #getConnection()
      * 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.

Deleted: trunk/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositorySourceRegistry.java
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositorySourceRegistry.java	2008-08-07 19:56:15 UTC (rev 402)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositorySourceRegistry.java	2008-08-07 22:37:39 UTC (rev 403)
@@ -1,39 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors. 
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.dna.spi.connector;
-
-/**
- * An interface for any collection of {@link RepositorySource} instances that are accessed by their name.
- * 
- * @author Randall Hauch
- */
-public interface RepositorySourceRegistry {
-
-    /**
-     * Obtain a {@link RepositorySource} given its name.
-     * 
-     * @param sourceName the name of the source to obtain
-     * @return the source, or null if no such source could be found (or created)
-     */
-    RepositorySource getRepositorySource( String sourceName );
-
-}

Modified: trunk/dna-spi/src/test/java/org/jboss/dna/spi/connector/RepositoryConnectionPoolTest.java
===================================================================
--- trunk/dna-spi/src/test/java/org/jboss/dna/spi/connector/RepositoryConnectionPoolTest.java	2008-08-07 19:56:15 UTC (rev 402)
+++ trunk/dna-spi/src/test/java/org/jboss/dna/spi/connector/RepositoryConnectionPoolTest.java	2008-08-07 22:37:39 UTC (rev 403)
@@ -21,18 +21,14 @@
  */
 package org.jboss.dna.spi.connector;
 
-import static org.jboss.dna.spi.connector.RepositorySourceLoadHarness.runLoadTest;
 import static org.hamcrest.core.Is.is;
 import static org.hamcrest.core.IsNull.notNullValue;
+import static org.jboss.dna.spi.connector.RepositorySourceLoadHarness.runLoadTest;
 import static org.junit.Assert.assertThat;
 import java.util.List;
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 import org.jboss.dna.spi.ExecutionContext;
-import org.jboss.dna.spi.connector.RepositoryConnection;
-import org.jboss.dna.spi.connector.RepositoryConnectionPool;
-import org.jboss.dna.spi.connector.RepositorySource;
-import org.jboss.dna.spi.connector.RepositorySourceException;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Ignore;
@@ -44,23 +40,14 @@
 public class RepositoryConnectionPoolTest {
 
     private RepositoryConnectionPool pool;
-    private RepositoryConnectionPool.ConnectionFactory connectionFactory;
+    private RepositorySource source;
     private ExecutionContext context;
 
     @Before
     public void beforeEach() {
-        final RepositorySource repositorySource = new TimeDelayingRepositorySource("source 1");
-        this.connectionFactory = new RepositoryConnectionPool.ConnectionFactory() {
-            public RepositoryConnection createConnection() throws RepositorySourceException, InterruptedException {
-                return repositorySource.getConnection();
-            }
-
-            public String getSourceName() {
-                return repositorySource.getName();
-            }
-        };
-        this.pool = new RepositoryConnectionPool(this.connectionFactory, 1, 1, 100, TimeUnit.SECONDS);
-        this.context = null;
+        source = new TimeDelayingRepositorySource("source 1");
+        pool = new RepositoryConnectionPool(source, 1, 1, 100, TimeUnit.SECONDS);
+        context = null;
     }
 
     @After
@@ -174,7 +161,7 @@
     public void shouldBlockClientsWhenNotEnoughConnections() throws Exception {
         int numConnectionsInPool = 1;
         int numClients = 2;
-        RepositoryConnectionPool pool = new RepositoryConnectionPool(connectionFactory);
+        RepositoryConnectionPool pool = new RepositoryConnectionPool(source);
         pool.setCorePoolSize(numConnectionsInPool);
         pool.setMaximumPoolSize(numConnectionsInPool);
         RepositoryOperation.Factory<Integer> operationFactory = RepositorySourceLoadHarness.createMultipleLoadOperationFactory(10);
@@ -187,7 +174,7 @@
     public void shouldLimitClientsToRunSequentiallyWithOneConnectionInPool() throws Exception {
         int numConnectionsInPool = 1;
         int numClients = 3;
-        RepositoryConnectionPool pool = new RepositoryConnectionPool(connectionFactory);
+        RepositoryConnectionPool pool = new RepositoryConnectionPool(source);
         pool.setCorePoolSize(numConnectionsInPool);
         pool.setMaximumPoolSize(numConnectionsInPool);
         RepositoryOperation.Factory<Integer> operationFactory = RepositorySourceLoadHarness.createMultipleLoadOperationFactory(10);
@@ -200,7 +187,7 @@
     public void shouldClientsToRunConncurrentlyWithTwoConnectionsInPool() throws Exception {
         int numConnectionsInPool = 2;
         int numClients = 10;
-        RepositoryConnectionPool pool = new RepositoryConnectionPool(connectionFactory);
+        RepositoryConnectionPool pool = new RepositoryConnectionPool(source);
         pool.setCorePoolSize(numConnectionsInPool);
         pool.setMaximumPoolSize(numConnectionsInPool);
         RepositoryOperation.Factory<Integer> operationFactory = RepositorySourceLoadHarness.createMultipleLoadOperationFactory(10);
@@ -214,7 +201,7 @@
     public void shouldClientsToRunConncurrentlyWithMultipleConnectionInPool() throws Exception {
         int numConnectionsInPool = 10;
         int numClients = 50;
-        RepositoryConnectionPool pool = new RepositoryConnectionPool(connectionFactory);
+        RepositoryConnectionPool pool = new RepositoryConnectionPool(source);
         pool.setCorePoolSize(numConnectionsInPool);
         pool.setMaximumPoolSize(numConnectionsInPool);
         RepositoryOperation.Factory<Integer> operationFactory = RepositorySourceLoadHarness.createMultipleLoadOperationFactory(20);

Modified: trunk/dna-spi/src/test/java/org/jboss/dna/spi/connector/SimpleRepositorySource.java
===================================================================
--- trunk/dna-spi/src/test/java/org/jboss/dna/spi/connector/SimpleRepositorySource.java	2008-08-07 19:56:15 UTC (rev 402)
+++ trunk/dna-spi/src/test/java/org/jboss/dna/spi/connector/SimpleRepositorySource.java	2008-08-07 22:37:39 UTC (rev 403)
@@ -26,17 +26,12 @@
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
 import javax.naming.Reference;
 import javax.transaction.xa.XAResource;
 import net.jcip.annotations.ThreadSafe;
 import org.jboss.dna.spi.ExecutionContext;
 import org.jboss.dna.spi.cache.CachePolicy;
-import org.jboss.dna.spi.connector.AbstractRepositorySource;
-import org.jboss.dna.spi.connector.RepositoryConnection;
-import org.jboss.dna.spi.connector.RepositorySource;
-import org.jboss.dna.spi.connector.RepositorySourceCapabilities;
-import org.jboss.dna.spi.connector.RepositorySourceException;
-import org.jboss.dna.spi.connector.RepositorySourceListener;
 import org.jboss.dna.spi.graph.InvalidPathException;
 import org.jboss.dna.spi.graph.Name;
 import org.jboss.dna.spi.graph.Path;
@@ -53,12 +48,17 @@
  * @author Randall Hauch
  */
 @ThreadSafe
-public class SimpleRepositorySource extends AbstractRepositorySource {
+public class SimpleRepositorySource implements RepositorySource {
 
     private static final long serialVersionUID = 1L;
 
+    /**
+     * The default limit is {@value} for retrying {@link RepositoryConnection connection} calls to the underlying source.
+     */
+    public static final int DEFAULT_RETRY_LIMIT = 0;
     private String repositoryName;
     private String name;
+    private final AtomicInteger retryLimit = new AtomicInteger(DEFAULT_RETRY_LIMIT);
 
     public SimpleRepositorySource() {
         super();
@@ -97,6 +97,24 @@
     /**
      * {@inheritDoc}
      * 
+     * @see org.jboss.dna.spi.connector.RepositorySource#getRetryLimit()
+     */
+    public int getRetryLimit() {
+        return retryLimit.get();
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.jboss.dna.spi.connector.RepositorySource#setRetryLimit(int)
+     */
+    public void setRetryLimit( int limit ) {
+        retryLimit.set(limit < 0 ? 0 : limit);
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
      * @see javax.naming.Referenceable#getReference()
      */
     public Reference getReference() {
@@ -152,10 +170,9 @@
     /**
      * {@inheritDoc}
      * 
-     * @see org.jboss.dna.spi.connector.AbstractRepositorySource#createConnection()
+     * @see org.jboss.dna.spi.connector.RepositorySource#getConnection()
      */
-    @Override
-    protected synchronized RepositoryConnection createConnection() throws RepositorySourceException {
+    public RepositoryConnection getConnection() throws RepositorySourceException {
         String reposName = this.getRepositoryName();
         SimpleRepository repository = SimpleRepository.get(reposName);
         if (repository == null) {

Modified: trunk/dna-spi/src/test/java/org/jboss/dna/spi/connector/TimeDelayingRepositorySource.java
===================================================================
--- trunk/dna-spi/src/test/java/org/jboss/dna/spi/connector/TimeDelayingRepositorySource.java	2008-08-07 19:56:15 UTC (rev 402)
+++ trunk/dna-spi/src/test/java/org/jboss/dna/spi/connector/TimeDelayingRepositorySource.java	2008-08-07 22:37:39 UTC (rev 403)
@@ -34,12 +34,6 @@
 import net.jcip.annotations.ThreadSafe;
 import org.jboss.dna.spi.ExecutionContext;
 import org.jboss.dna.spi.cache.CachePolicy;
-import org.jboss.dna.spi.connector.AbstractRepositorySource;
-import org.jboss.dna.spi.connector.RepositoryConnection;
-import org.jboss.dna.spi.connector.RepositorySource;
-import org.jboss.dna.spi.connector.RepositorySourceCapabilities;
-import org.jboss.dna.spi.connector.RepositorySourceException;
-import org.jboss.dna.spi.connector.RepositorySourceListener;
 import org.jboss.dna.spi.graph.commands.GraphCommand;
 
 /**
@@ -48,11 +42,16 @@
  * @author Randall Hauch
  */
 @ThreadSafe
-public class TimeDelayingRepositorySource extends AbstractRepositorySource {
+public class TimeDelayingRepositorySource implements RepositorySource {
 
     /**
      */
     private static final long serialVersionUID = -2756725117087437347L;
+    /**
+     * The default limit is {@value} for retrying {@link RepositoryConnection connection} calls to the underlying source.
+     */
+    public static final int DEFAULT_RETRY_LIMIT = 0;
+
     private String name;
     private final AtomicInteger connectionsOpenedCount = new AtomicInteger(0);
     private final AtomicInteger connectionsClosedCount = new AtomicInteger(0);
@@ -61,6 +60,7 @@
     private final AtomicLong loadDelay = new AtomicLong(0);
     private final AtomicLong pingCount = new AtomicLong(0);
     private final AtomicLong pingDelay = new AtomicLong(0);
+    private final AtomicInteger retryLimit = new AtomicInteger(DEFAULT_RETRY_LIMIT);
     private CachePolicy defaultCachePolicy;
 
     public TimeDelayingRepositorySource( String identifier ) {
@@ -82,6 +82,24 @@
         this.name = name;
     }
 
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.jboss.dna.spi.connector.RepositorySource#getRetryLimit()
+     */
+    public int getRetryLimit() {
+        return retryLimit.get();
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.jboss.dna.spi.connector.RepositorySource#setRetryLimit(int)
+     */
+    public void setRetryLimit( int limit ) {
+        retryLimit.set(limit < 0 ? 0 : limit);
+    }
+
     public CachePolicy getDefaultCachePolicy() {
         return defaultCachePolicy;
     }
@@ -131,10 +149,9 @@
     /**
      * {@inheritDoc}
      * 
-     * @see org.jboss.dna.spi.connector.AbstractRepositorySource#createConnection()
+     * @see org.jboss.dna.spi.connector.RepositorySource#getConnection()
      */
-    @Override
-    protected RepositoryConnection createConnection() throws RepositorySourceException {
+    public RepositoryConnection getConnection() throws RepositorySourceException {
         int connectionNumber = this.connectionsOpenedCount.incrementAndGet();
         String connectionName = "Connection " + connectionNumber;
         XAResource xaResource = newXaResource(connectionName);




More information about the dna-commits mailing list