[dna-commits] DNA SVN: r220 - in trunk: connectors and 31 other directories.

dna-commits at lists.jboss.org dna-commits at lists.jboss.org
Mon Jun 2 13:13:20 EDT 2008


Author: rhauch
Date: 2008-06-02 13:13:20 -0400 (Mon, 02 Jun 2008)
New Revision: 220

Added:
   trunk/connectors/
   trunk/connectors/dna-connector-jbosscache/
   trunk/connectors/dna-connector-jbosscache/.classpath
   trunk/connectors/dna-connector-jbosscache/.project
   trunk/connectors/dna-connector-jbosscache/pom.xml
   trunk/connectors/dna-connector-jbosscache/src/
   trunk/connectors/dna-connector-jbosscache/src/main/
   trunk/connectors/dna-connector-jbosscache/src/main/java/
   trunk/connectors/dna-connector-jbosscache/src/main/java/org/
   trunk/connectors/dna-connector-jbosscache/src/main/java/org/jboss/
   trunk/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/
   trunk/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/
   trunk/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/
   trunk/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheConnection.java
   trunk/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheConnectorI18n.java
   trunk/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheSource.java
   trunk/connectors/dna-connector-jbosscache/src/main/resources/
   trunk/connectors/dna-connector-jbosscache/src/main/resources/org/
   trunk/connectors/dna-connector-jbosscache/src/main/resources/org/jboss/
   trunk/connectors/dna-connector-jbosscache/src/main/resources/org/jboss/dna/
   trunk/connectors/dna-connector-jbosscache/src/main/resources/org/jboss/dna/connector/
   trunk/connectors/dna-connector-jbosscache/src/main/resources/org/jboss/dna/connector/jbosscache/
   trunk/connectors/dna-connector-jbosscache/src/main/resources/org/jboss/dna/connector/jbosscache/JBossCacheConnectorI18n.properties
   trunk/connectors/dna-connector-jbosscache/src/test/
   trunk/connectors/dna-connector-jbosscache/src/test/java/
   trunk/connectors/dna-connector-jbosscache/src/test/resources/
   trunk/dna-repository/src/main/java/org/jboss/dna/repository/FederationService.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/PropertyFactory.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/ActsAsUpdate.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/ActsOnPath.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/ActsOnProperties.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/CopyBranchCommand.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/CopyNodeCommand.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/CreateNodeCommand.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/DeleteBranchCommand.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GetChildrenCommand.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GetNodeCommand.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GetPropertiesCommand.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GraphCommand.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/MoveBranchCommand.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/SetPropertiesCommand.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicCopyBranchCommand.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicCopyNodeCommand.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicCreateNodeCommand.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicDeleteBranchCommand.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicGetChildrenCommand.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicGetNodeCommand.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicGetPropertiesCommand.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicGraphCommand.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicMoveBranchCommand.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicSetPropertiesCommand.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/ExecutionEnvironment.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryConnection.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryConnectionFactory.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryConnectionPool.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryOperation.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositorySource.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositorySourceException.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositorySourceListener.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/impl/BasicEmptyProperty.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/impl/BasicMultiValueProperty.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/impl/BasicProperty.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/impl/BasicPropertyFactory.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/impl/BasicSingleValueProperty.java
   trunk/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/
   trunk/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/MockRepositorySource.java
   trunk/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/RepositoryConnectionPoolTest.java
   trunk/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/RepositorySourceLoadHarness.java
   trunk/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/RepositoryTestOperations.java
Removed:
   trunk/connectors/dna-connector-jbosscache/
   trunk/connectors/dna-connector-jbosscache/.classpath
   trunk/connectors/dna-connector-jbosscache/.project
   trunk/connectors/dna-connector-jbosscache/pom.xml
   trunk/connectors/dna-connector-jbosscache/src/
   trunk/connectors/dna-connector-jbosscache/src/main/
   trunk/connectors/dna-connector-jbosscache/src/main/java/
   trunk/connectors/dna-connector-jbosscache/src/main/java/org/
   trunk/connectors/dna-connector-jbosscache/src/main/java/org/jboss/
   trunk/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/
   trunk/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/
   trunk/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/
   trunk/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheConnection.java
   trunk/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheConnectorI18n.java
   trunk/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheSource.java
   trunk/connectors/dna-connector-jbosscache/src/main/resources/
   trunk/connectors/dna-connector-jbosscache/src/main/resources/org/
   trunk/connectors/dna-connector-jbosscache/src/main/resources/org/jboss/
   trunk/connectors/dna-connector-jbosscache/src/main/resources/org/jboss/dna/
   trunk/connectors/dna-connector-jbosscache/src/main/resources/org/jboss/dna/connector/
   trunk/connectors/dna-connector-jbosscache/src/main/resources/org/jboss/dna/connector/jbosscache/
   trunk/connectors/dna-connector-jbosscache/src/main/resources/org/jboss/dna/connector/jbosscache/JBossCacheConnectorI18n.properties
   trunk/connectors/dna-connector-jbosscache/src/test/
   trunk/connectors/dna-connector-jbosscache/src/test/java/
   trunk/connectors/dna-connector-jbosscache/src/test/resources/
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/connector/
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/ActsAsUpdate.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/ActsOnPath.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/ActsOnProperties.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/CopyBranchCommand.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/CopyNodeCommand.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/CreateNodeCommand.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/DeleteBranchCommand.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GetChildrenCommand.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GetNodeCommand.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GetPropertiesCommand.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GraphCommand.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/MoveBranchCommand.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/SetPropertiesCommand.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicCopyBranchCommand.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicCopyNodeCommand.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicCreateNodeCommand.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicDeleteBranchCommand.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicGetChildrenCommand.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicGetNodeCommand.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicGetPropertiesCommand.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicGraphCommand.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicMoveBranchCommand.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicSetPropertiesCommand.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/ExecutionEnvironment.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryConnection.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryConnectionFactory.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryConnectionPool.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryOperation.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositorySource.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositorySourceException.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositorySourceListener.java
   trunk/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/MockRepositorySource.java
   trunk/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/RepositoryConnectionPoolTest.java
   trunk/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/RepositorySourceLoadHarness.java
   trunk/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/RepositoryTestOperations.java
Modified:
   trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryI18n.java
   trunk/dna-repository/src/main/java/org/jboss/dna/repository/observation/ObservationService.java
   trunk/dna-repository/src/main/java/org/jboss/dna/repository/rules/RuleService.java
   trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/SequencingService.java
   trunk/dna-repository/src/main/java/org/jboss/dna/repository/services/AbstractServiceAdministrator.java
   trunk/dna-repository/src/main/resources/org/jboss/dna/repository/RepositoryI18n.properties
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/SpiI18n.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/Property.java
   trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/PropertyType.java
   trunk/dna-spi/src/main/resources/org/jboss/dna/spi/SpiI18n.properties
   trunk/pom.xml
Log:
Merged from federation branch to trunk:  vn merge https://svn.jboss.org/repos/dna/trunk@219 https://svn.jboss.org/repos/dna/branches/federation@219

Copied: trunk/connectors (from rev 219, branches/federation/connectors)

Copied: trunk/connectors/dna-connector-jbosscache (from rev 219, branches/federation/connectors/dna-connector-jbosscache)


Property changes on: trunk/connectors/dna-connector-jbosscache
___________________________________________________________________
Name: svn:ignore
   + target


Deleted: trunk/connectors/dna-connector-jbosscache/.classpath
===================================================================
--- branches/federation/connectors/dna-connector-jbosscache/.classpath	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/connectors/dna-connector-jbosscache/.classpath	2008-06-02 17:13:20 UTC (rev 220)
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-	<classpathentry kind="src" path="src/main/java"/>
-	<classpathentry kind="src" path="src/main/resources"/>
-	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
-	<classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
-	<classpathentry kind="output" path="target/classes"/>
-</classpath>

Copied: trunk/connectors/dna-connector-jbosscache/.classpath (from rev 219, branches/federation/connectors/dna-connector-jbosscache/.classpath)
===================================================================
--- trunk/connectors/dna-connector-jbosscache/.classpath	                        (rev 0)
+++ trunk/connectors/dna-connector-jbosscache/.classpath	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src/main/java"/>
+	<classpathentry kind="src" path="src/main/resources"/>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

Deleted: trunk/connectors/dna-connector-jbosscache/.project
===================================================================
--- branches/federation/connectors/dna-connector-jbosscache/.project	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/connectors/dna-connector-jbosscache/.project	2008-06-02 17:13:20 UTC (rev 220)
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-	<name>dna-connector-jbosscache</name>
-	<comment></comment>
-	<projects>
-	</projects>
-	<buildSpec>
-		<buildCommand>
-			<name>org.maven.ide.eclipse.maven2Builder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>org.eclipse.jdt.core.javabuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-	</buildSpec>
-	<natures>
-		<nature>org.eclipse.jdt.core.javanature</nature>
-		<nature>org.maven.ide.eclipse.maven2Nature</nature>
-	</natures>
-</projectDescription>

Copied: trunk/connectors/dna-connector-jbosscache/.project (from rev 219, branches/federation/connectors/dna-connector-jbosscache/.project)
===================================================================
--- trunk/connectors/dna-connector-jbosscache/.project	                        (rev 0)
+++ trunk/connectors/dna-connector-jbosscache/.project	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>dna-connector-jbosscache</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.maven.ide.eclipse.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.maven.ide.eclipse.maven2Nature</nature>
+	</natures>
+</projectDescription>

Deleted: trunk/connectors/dna-connector-jbosscache/pom.xml
===================================================================
--- branches/federation/connectors/dna-connector-jbosscache/pom.xml	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/connectors/dna-connector-jbosscache/pom.xml	2008-06-02 17:13:20 UTC (rev 220)
@@ -1,100 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-    <groupId>org.jboss.dna</groupId>
-    <artifactId>dna</artifactId>
-    <version>0.2-SNAPSHOT</version>
-    <relativePath>../..</relativePath>
-  </parent>
-  <!-- The groupId and version values are inherited from parent -->
-  <artifactId>dna-connector-jbosscache</artifactId>
-  <packaging>jar</packaging>
-  <name>JBoss DNA Connector to JBoss Cache</name>
-  <description>JBoss DNA Connector that accesses an in-process JBoss Cache instance.</description>
-  <url>http://labs.jboss.org/dna</url>
-  
-  <properties>
-    <dna-version>0.2-SNAPSHOT</dna-version>
-  </properties>
-  <!--
-  Define the dependencies.  Note that all version and scopes default to those 
-  defined in the dependencyManagement section of the parent pom.
-  -->
-  <dependencies>
-    <!-- 
-    Common
-    -->
-    <dependency>
-      <groupId>org.jboss.dna</groupId>
-      <artifactId>dna-common</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.dna</groupId>
-      <artifactId>dna-spi</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.dna</groupId>
-      <artifactId>dna-common</artifactId>
-      <version>${dna-version}</version>
-      <type>test-jar</type>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.dna</groupId>
-      <artifactId>dna-spi</artifactId>
-      <version>${dna-version}</version>
-      <type>test-jar</type>
-      <scope>test</scope>
-    </dependency>
-    <!-- 
-    JBoss Cache
-    -->
-    <dependency>
-      <groupId>org.jboss.cache</groupId>
-      <artifactId>jbosscache-core</artifactId>
-      <version>2.2.0.CR1</version>
-    </dependency>
-    <!-- 
-    Testing (note the scope)
-    -->
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.hamcrest</groupId>
-      <artifactId>hamcrest-library</artifactId>
-    </dependency>
-    <!-- 
-    Logging (require SLF4J API for compiling, but use Log4J and its SLF4J binding for testing) 
-    -->
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-log4j12</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>log4j</groupId>
-      <artifactId>log4j</artifactId>
-    </dependency>
-    <!-- 
-    Java Concurrency in Practice annotations
-    -->
-  <dependency>
-    <groupId>net.jcip</groupId>
-    <artifactId>jcip-annotations</artifactId>
-  </dependency>
-  </dependencies>
-  <reporting>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-surefire-report-plugin</artifactId>
-      </plugin>
-    </plugins>
-  </reporting>
-</project>
\ No newline at end of file

Copied: trunk/connectors/dna-connector-jbosscache/pom.xml (from rev 219, branches/federation/connectors/dna-connector-jbosscache/pom.xml)
===================================================================
--- trunk/connectors/dna-connector-jbosscache/pom.xml	                        (rev 0)
+++ trunk/connectors/dna-connector-jbosscache/pom.xml	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.jboss.dna</groupId>
+    <artifactId>dna</artifactId>
+    <version>0.2-SNAPSHOT</version>
+    <relativePath>../..</relativePath>
+  </parent>
+  <!-- The groupId and version values are inherited from parent -->
+  <artifactId>dna-connector-jbosscache</artifactId>
+  <packaging>jar</packaging>
+  <name>JBoss DNA Connector to JBoss Cache</name>
+  <description>JBoss DNA Connector that accesses an in-process JBoss Cache instance.</description>
+  <url>http://labs.jboss.org/dna</url>
+  
+  <properties>
+    <dna-version>0.2-SNAPSHOT</dna-version>
+  </properties>
+  <!--
+  Define the dependencies.  Note that all version and scopes default to those 
+  defined in the dependencyManagement section of the parent pom.
+  -->
+  <dependencies>
+    <!-- 
+    Common
+    -->
+    <dependency>
+      <groupId>org.jboss.dna</groupId>
+      <artifactId>dna-common</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.dna</groupId>
+      <artifactId>dna-spi</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.dna</groupId>
+      <artifactId>dna-common</artifactId>
+      <version>${dna-version}</version>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.dna</groupId>
+      <artifactId>dna-spi</artifactId>
+      <version>${dna-version}</version>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    <!-- 
+    JBoss Cache
+    -->
+    <dependency>
+      <groupId>org.jboss.cache</groupId>
+      <artifactId>jbosscache-core</artifactId>
+      <version>2.2.0.CR1</version>
+    </dependency>
+    <!-- 
+    Testing (note the scope)
+    -->
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.hamcrest</groupId>
+      <artifactId>hamcrest-library</artifactId>
+    </dependency>
+    <!-- 
+    Logging (require SLF4J API for compiling, but use Log4J and its SLF4J binding for testing) 
+    -->
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+    </dependency>
+    <!-- 
+    Java Concurrency in Practice annotations
+    -->
+  <dependency>
+    <groupId>net.jcip</groupId>
+    <artifactId>jcip-annotations</artifactId>
+  </dependency>
+  </dependencies>
+  <reporting>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-report-plugin</artifactId>
+      </plugin>
+    </plugins>
+  </reporting>
+</project>
\ No newline at end of file

Copied: trunk/connectors/dna-connector-jbosscache/src (from rev 219, branches/federation/connectors/dna-connector-jbosscache/src)

Copied: trunk/connectors/dna-connector-jbosscache/src/main (from rev 219, branches/federation/connectors/dna-connector-jbosscache/src/main)

Copied: trunk/connectors/dna-connector-jbosscache/src/main/java (from rev 219, branches/federation/connectors/dna-connector-jbosscache/src/main/java)

Copied: trunk/connectors/dna-connector-jbosscache/src/main/java/org (from rev 219, branches/federation/connectors/dna-connector-jbosscache/src/main/java/org)

Copied: trunk/connectors/dna-connector-jbosscache/src/main/java/org/jboss (from rev 219, branches/federation/connectors/dna-connector-jbosscache/src/main/java/org/jboss)

Copied: trunk/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna (from rev 219, branches/federation/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna)

Copied: trunk/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector (from rev 219, branches/federation/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector)

Copied: trunk/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache (from rev 219, branches/federation/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache)

Deleted: trunk/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheConnection.java
===================================================================
--- branches/federation/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheConnection.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheConnection.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -1,323 +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.connector.jbosscache;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import java.util.concurrent.TimeUnit;
-import javax.transaction.xa.XAResource;
-import org.jboss.cache.Cache;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.Node;
-import org.jboss.dna.spi.graph.Name;
-import org.jboss.dna.spi.graph.Path;
-import org.jboss.dna.spi.graph.Property;
-import org.jboss.dna.spi.graph.Path.Segment;
-import org.jboss.dna.spi.graph.commands.ActsOnPath;
-import org.jboss.dna.spi.graph.commands.CopyBranchCommand;
-import org.jboss.dna.spi.graph.commands.CopyNodeCommand;
-import org.jboss.dna.spi.graph.commands.CreateNodeCommand;
-import org.jboss.dna.spi.graph.commands.DeleteBranchCommand;
-import org.jboss.dna.spi.graph.commands.GetChildrenCommand;
-import org.jboss.dna.spi.graph.commands.GetPropertiesCommand;
-import org.jboss.dna.spi.graph.commands.GraphCommand;
-import org.jboss.dna.spi.graph.commands.MoveBranchCommand;
-import org.jboss.dna.spi.graph.commands.SetPropertiesCommand;
-import org.jboss.dna.spi.graph.connection.ExecutionEnvironment;
-import org.jboss.dna.spi.graph.connection.RepositoryConnection;
-import org.jboss.dna.spi.graph.connection.RepositorySourceException;
-import org.jboss.dna.spi.graph.connection.RepositorySourceListener;
-
-/**
- * @author Randall Hauch
- */
-public class JBossCacheConnection implements RepositoryConnection {
-
-    protected static final RepositorySourceListener NO_OP_LISTENER = new RepositorySourceListener() {
-
-        /**
-         * {@inheritDoc}
-         */
-        public void notify( String sourceName, Object... events ) {
-            // do nothing
-        }
-    };
-
-    private boolean initializedUuidPropertyName = false;
-    private Name uuidPropertyName;
-    private final JBossCacheSource source;
-    private final Cache<Name, Object> cache;
-    private RepositorySourceListener listener = NO_OP_LISTENER;
-
-    /**
-     * 
-     */
-    /* package */JBossCacheConnection( JBossCacheSource source, Cache<Name, Object> cache ) {
-        assert source != null;
-        assert cache != null;
-        this.source = source;
-        this.cache = cache;
-    }
-
-    /**
-     * @return uuidPropertyName
-     */
-    public Name getUuidPropertyName() {
-        return this.uuidPropertyName;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public String getSourceName() {
-        return source.getName();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public XAResource getXAResource() {
-        return null;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean ping( long time, TimeUnit unit ) {
-        this.cache.getRoot();
-        return true;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void setListener( RepositorySourceListener listener ) {
-        this.listener = listener != null ? listener : NO_OP_LISTENER;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void close() {
-        // do nothing
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void execute( ExecutionEnvironment env, GraphCommand... commands ) throws RepositorySourceException {
-        // Set up the workspace ...
-
-        // Now execute the commands ...
-        for (GraphCommand command : commands) {
-            // This node reference is available for any command that extends ActsOnPath ...
-            Node<Name, Object> node = null;
-
-            // First, process the commands that create a new node ...
-            if (command instanceof CreateNodeCommand) {
-                CreateNodeCommand theCommand = (CreateNodeCommand)command;
-                Path path = theCommand.getPath();
-                Path parent = path.getAncestor();
-                Fqn<Segment> childFqn = getFullyQualifiedName(path.getLastSegment());
-                // Look up the parent node, which must exist ...
-                Node<Name, Object> parentNode = getNode(env, parent);
-                node = parentNode.addChild(childFqn);
-                // Add the UUID property (if required), which may be overwritten by a supplied property ...
-                Name uuidPropertyName = getUuidProperty(env);
-                if (uuidPropertyName != null) {
-                    node.put(uuidPropertyName, generateUuid());
-                }
-                // Now add the properties to the supplied node ...
-                for (Property property : theCommand.getProperties()) {
-                    if (property.size() == 0) continue;
-                    Name propName = property.getName();
-                    Object value = null;
-                    if (property.size() == 1) {
-                        value = property.iterator().next();
-                    } else {
-                        value = property.getValuesAsArray();
-                    }
-                    node.put(propName, value);
-                }
-                assert node != null;
-            }
-
-            // Otherwise, check whether the command is applies to a path; all the remaining commands
-            // that do so expect the node to exist ...
-            else if (command instanceof ActsOnPath) {
-                ActsOnPath theCommand = (ActsOnPath)command;
-                Path path = theCommand.getPath();
-                // Look up the node with the supplied path ...
-                node = getNode(env, path);
-                assert node != null;
-            }
-
-            if (command instanceof GetChildrenCommand) {
-                GetChildrenCommand theCommand = (GetChildrenCommand)command;
-                assert command instanceof ActsOnPath;
-                assert node != null;
-                // Get the names of the children ...
-                List<Segment> childSegments = new ArrayList<Segment>();
-                for (Node<Name, Object> child : node.getChildren()) {
-                    childSegments.add((Segment)child.getFqn().getLastElement());
-                }
-                theCommand.setChildren(childSegments);
-
-            }
-            if (command instanceof GetPropertiesCommand) {
-                GetPropertiesCommand theCommand = (GetPropertiesCommand)command;
-                assert command instanceof ActsOnPath;
-                assert node != null;
-                Map<Name, Object> dataMap = node.getData();
-                for (Map.Entry<Name, Object> data : dataMap.entrySet()) {
-                    Name propertyName = data.getKey();
-                    Object values = data.getValue();
-                    theCommand.setProperty(propertyName, values);
-                }
-            }
-            if (command instanceof SetPropertiesCommand) {
-                SetPropertiesCommand theCommand = (SetPropertiesCommand)command;
-                assert command instanceof ActsOnPath;
-                assert node != null;
-                // Now set (or remove) the properties to the supplied node ...
-                for (Property property : theCommand.getProperties()) {
-                    Name propName = property.getName();
-                    if (property.size() == 0) {
-                        node.remove(propName);
-                        continue;
-                    }
-                    Object value = null;
-                    if (property.size() == 1) {
-                        value = property.iterator().next();
-                    } else {
-                        value = property.getValuesAsArray();
-                    }
-                    node.put(propName, value);
-                }
-            }
-            if (command instanceof DeleteBranchCommand) {
-                assert command instanceof ActsOnPath;
-                assert node != null;
-                node.getParent().removeChild(node.getFqn().getLastElement());
-            }
-            if (command instanceof CopyNodeCommand) {
-                CopyNodeCommand theCommand = (CopyNodeCommand)command;
-                boolean recursive = command instanceof CopyBranchCommand;
-                // Look up the new parent, which must exist ...
-                Path newPath = theCommand.getNewPath();
-                Node<Name, Object> newParent = getNode(env, newPath.getAncestor());
-                copyNode(node, newParent, recursive, null);
-            }
-            if (command instanceof MoveBranchCommand) {
-                MoveBranchCommand theCommand = (MoveBranchCommand)command;
-                assert command instanceof ActsOnPath;
-                assert node != null;
-                boolean recursive = true;
-                Name uuidProperty = getUuidProperty(env);
-                // Look up the new parent, which must exist ...
-                Path newPath = theCommand.getNewPath();
-                Node<Name, Object> newParent = getNode(env, newPath.getAncestor());
-                copyNode(node, newParent, recursive, uuidProperty);
-                // Now delete the old node ...
-                Node<Name, Object> oldParent = node.getParent();
-                boolean removed = oldParent.removeChild(node.getFqn().getLastElement());
-                assert removed;
-            }
-        }
-    }
-
-    /**
-     * @return listener
-     */
-    protected RepositorySourceListener getListener() {
-        return this.listener;
-    }
-
-    /**
-     * Utility method to calculate (if required) and obtain the name that should be used to store the UUID values for each node.
-     * This method may be called without regard to synchronization, since it should return the same value if it happens to be
-     * called concurrently while not yet initialized.
-     * 
-     * @param env the environment
-     * @return the name, or null if the UUID should not be stored
-     */
-    protected Name getUuidProperty( ExecutionEnvironment env ) {
-        if (!initializedUuidPropertyName) {
-            this.uuidPropertyName = this.source.getUuidPropertyName(env.getValueFactories().getNameFactory());
-            initializedUuidPropertyName = true;
-        }
-        return this.uuidPropertyName;
-    }
-
-    protected Fqn<Path.Segment> getFullyQualifiedName( Path path ) {
-        return Fqn.fromList(path.getSegmentsList());
-    }
-
-    /**
-     * Get a relative fully-qualified name that consists only of the supplied segment.
-     * 
-     * @param pathSegment the segment from which the fully qualified name is to be created
-     * @return the relative fully-qualified name
-     */
-    protected Fqn<Path.Segment> getFullyQualifiedName( Path.Segment pathSegment ) {
-        return Fqn.fromElements(pathSegment);
-    }
-
-    protected Node<Name, Object> getNode( ExecutionEnvironment env, Path path ) {
-        // Look up the node with the supplied path ...
-        Fqn<Segment> fqn = getFullyQualifiedName(path);
-        Node<Name, Object> node = cache.getNode(fqn);
-        if (node == null) {
-            String nodePath = path.getString(env.getNamespaceRegistry());
-            throw new RepositorySourceException(getSourceName(), JBossCacheConnectorI18n.nodeDoesNotExist.text(nodePath));
-        }
-        return node;
-
-    }
-
-    protected UUID generateUuid() {
-        return UUID.randomUUID();
-    }
-
-    protected int copyNode( Node<Name, Object> original, Node<Name, Object> newParent, boolean recursive, Name uuidProperty ) {
-        // Get or create the new node ...
-        Segment name = (Segment)original.getFqn().getLastElement();
-        Node<Name, Object> copy = newParent.addChild(getFullyQualifiedName(name));
-        // Copy the properties ...
-        copy.clearData();
-        copy.putAll(original.getData());
-        if (uuidProperty != null) {
-            // Generate a new UUID for the new node ...
-            copy.put(uuidProperty, generateUuid());
-        }
-        int numNodesCopied = 1;
-        if (recursive) {
-            // Loop over each child and call this method ...
-            for (Node<Name, Object> child : original.getChildren()) {
-                numNodesCopied += copyNode(child, copy, true, uuidProperty);
-            }
-        }
-        return numNodesCopied;
-    }
-}

Copied: trunk/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheConnection.java (from rev 219, branches/federation/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheConnection.java)
===================================================================
--- trunk/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheConnection.java	                        (rev 0)
+++ trunk/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheConnection.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,323 @@
+/*
+ * 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.connector.jbosscache;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.TimeUnit;
+import javax.transaction.xa.XAResource;
+import org.jboss.cache.Cache;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.Node;
+import org.jboss.dna.spi.graph.Name;
+import org.jboss.dna.spi.graph.Path;
+import org.jboss.dna.spi.graph.Property;
+import org.jboss.dna.spi.graph.Path.Segment;
+import org.jboss.dna.spi.graph.commands.ActsOnPath;
+import org.jboss.dna.spi.graph.commands.CopyBranchCommand;
+import org.jboss.dna.spi.graph.commands.CopyNodeCommand;
+import org.jboss.dna.spi.graph.commands.CreateNodeCommand;
+import org.jboss.dna.spi.graph.commands.DeleteBranchCommand;
+import org.jboss.dna.spi.graph.commands.GetChildrenCommand;
+import org.jboss.dna.spi.graph.commands.GetPropertiesCommand;
+import org.jboss.dna.spi.graph.commands.GraphCommand;
+import org.jboss.dna.spi.graph.commands.MoveBranchCommand;
+import org.jboss.dna.spi.graph.commands.SetPropertiesCommand;
+import org.jboss.dna.spi.graph.connection.ExecutionEnvironment;
+import org.jboss.dna.spi.graph.connection.RepositoryConnection;
+import org.jboss.dna.spi.graph.connection.RepositorySourceException;
+import org.jboss.dna.spi.graph.connection.RepositorySourceListener;
+
+/**
+ * @author Randall Hauch
+ */
+public class JBossCacheConnection implements RepositoryConnection {
+
+    protected static final RepositorySourceListener NO_OP_LISTENER = new RepositorySourceListener() {
+
+        /**
+         * {@inheritDoc}
+         */
+        public void notify( String sourceName, Object... events ) {
+            // do nothing
+        }
+    };
+
+    private boolean initializedUuidPropertyName = false;
+    private Name uuidPropertyName;
+    private final JBossCacheSource source;
+    private final Cache<Name, Object> cache;
+    private RepositorySourceListener listener = NO_OP_LISTENER;
+
+    /**
+     * 
+     */
+    /* package */JBossCacheConnection( JBossCacheSource source, Cache<Name, Object> cache ) {
+        assert source != null;
+        assert cache != null;
+        this.source = source;
+        this.cache = cache;
+    }
+
+    /**
+     * @return uuidPropertyName
+     */
+    public Name getUuidPropertyName() {
+        return this.uuidPropertyName;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getSourceName() {
+        return source.getName();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public XAResource getXAResource() {
+        return null;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean ping( long time, TimeUnit unit ) {
+        this.cache.getRoot();
+        return true;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setListener( RepositorySourceListener listener ) {
+        this.listener = listener != null ? listener : NO_OP_LISTENER;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void close() {
+        // do nothing
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void execute( ExecutionEnvironment env, GraphCommand... commands ) throws RepositorySourceException {
+        // Set up the workspace ...
+
+        // Now execute the commands ...
+        for (GraphCommand command : commands) {
+            // This node reference is available for any command that extends ActsOnPath ...
+            Node<Name, Object> node = null;
+
+            // First, process the commands that create a new node ...
+            if (command instanceof CreateNodeCommand) {
+                CreateNodeCommand theCommand = (CreateNodeCommand)command;
+                Path path = theCommand.getPath();
+                Path parent = path.getAncestor();
+                Fqn<Segment> childFqn = getFullyQualifiedName(path.getLastSegment());
+                // Look up the parent node, which must exist ...
+                Node<Name, Object> parentNode = getNode(env, parent);
+                node = parentNode.addChild(childFqn);
+                // Add the UUID property (if required), which may be overwritten by a supplied property ...
+                Name uuidPropertyName = getUuidProperty(env);
+                if (uuidPropertyName != null) {
+                    node.put(uuidPropertyName, generateUuid());
+                }
+                // Now add the properties to the supplied node ...
+                for (Property property : theCommand.getProperties()) {
+                    if (property.size() == 0) continue;
+                    Name propName = property.getName();
+                    Object value = null;
+                    if (property.size() == 1) {
+                        value = property.iterator().next();
+                    } else {
+                        value = property.getValuesAsArray();
+                    }
+                    node.put(propName, value);
+                }
+                assert node != null;
+            }
+
+            // Otherwise, check whether the command is applies to a path; all the remaining commands
+            // that do so expect the node to exist ...
+            else if (command instanceof ActsOnPath) {
+                ActsOnPath theCommand = (ActsOnPath)command;
+                Path path = theCommand.getPath();
+                // Look up the node with the supplied path ...
+                node = getNode(env, path);
+                assert node != null;
+            }
+
+            if (command instanceof GetChildrenCommand) {
+                GetChildrenCommand theCommand = (GetChildrenCommand)command;
+                assert command instanceof ActsOnPath;
+                assert node != null;
+                // Get the names of the children ...
+                List<Segment> childSegments = new ArrayList<Segment>();
+                for (Node<Name, Object> child : node.getChildren()) {
+                    childSegments.add((Segment)child.getFqn().getLastElement());
+                }
+                theCommand.setChildren(childSegments);
+
+            }
+            if (command instanceof GetPropertiesCommand) {
+                GetPropertiesCommand theCommand = (GetPropertiesCommand)command;
+                assert command instanceof ActsOnPath;
+                assert node != null;
+                Map<Name, Object> dataMap = node.getData();
+                for (Map.Entry<Name, Object> data : dataMap.entrySet()) {
+                    Name propertyName = data.getKey();
+                    Object values = data.getValue();
+                    theCommand.setProperty(propertyName, values);
+                }
+            }
+            if (command instanceof SetPropertiesCommand) {
+                SetPropertiesCommand theCommand = (SetPropertiesCommand)command;
+                assert command instanceof ActsOnPath;
+                assert node != null;
+                // Now set (or remove) the properties to the supplied node ...
+                for (Property property : theCommand.getProperties()) {
+                    Name propName = property.getName();
+                    if (property.size() == 0) {
+                        node.remove(propName);
+                        continue;
+                    }
+                    Object value = null;
+                    if (property.size() == 1) {
+                        value = property.iterator().next();
+                    } else {
+                        value = property.getValuesAsArray();
+                    }
+                    node.put(propName, value);
+                }
+            }
+            if (command instanceof DeleteBranchCommand) {
+                assert command instanceof ActsOnPath;
+                assert node != null;
+                node.getParent().removeChild(node.getFqn().getLastElement());
+            }
+            if (command instanceof CopyNodeCommand) {
+                CopyNodeCommand theCommand = (CopyNodeCommand)command;
+                boolean recursive = command instanceof CopyBranchCommand;
+                // Look up the new parent, which must exist ...
+                Path newPath = theCommand.getNewPath();
+                Node<Name, Object> newParent = getNode(env, newPath.getAncestor());
+                copyNode(node, newParent, recursive, null);
+            }
+            if (command instanceof MoveBranchCommand) {
+                MoveBranchCommand theCommand = (MoveBranchCommand)command;
+                assert command instanceof ActsOnPath;
+                assert node != null;
+                boolean recursive = true;
+                Name uuidProperty = getUuidProperty(env);
+                // Look up the new parent, which must exist ...
+                Path newPath = theCommand.getNewPath();
+                Node<Name, Object> newParent = getNode(env, newPath.getAncestor());
+                copyNode(node, newParent, recursive, uuidProperty);
+                // Now delete the old node ...
+                Node<Name, Object> oldParent = node.getParent();
+                boolean removed = oldParent.removeChild(node.getFqn().getLastElement());
+                assert removed;
+            }
+        }
+    }
+
+    /**
+     * @return listener
+     */
+    protected RepositorySourceListener getListener() {
+        return this.listener;
+    }
+
+    /**
+     * Utility method to calculate (if required) and obtain the name that should be used to store the UUID values for each node.
+     * This method may be called without regard to synchronization, since it should return the same value if it happens to be
+     * called concurrently while not yet initialized.
+     * 
+     * @param env the environment
+     * @return the name, or null if the UUID should not be stored
+     */
+    protected Name getUuidProperty( ExecutionEnvironment env ) {
+        if (!initializedUuidPropertyName) {
+            this.uuidPropertyName = this.source.getUuidPropertyName(env.getValueFactories().getNameFactory());
+            initializedUuidPropertyName = true;
+        }
+        return this.uuidPropertyName;
+    }
+
+    protected Fqn<Path.Segment> getFullyQualifiedName( Path path ) {
+        return Fqn.fromList(path.getSegmentsList());
+    }
+
+    /**
+     * Get a relative fully-qualified name that consists only of the supplied segment.
+     * 
+     * @param pathSegment the segment from which the fully qualified name is to be created
+     * @return the relative fully-qualified name
+     */
+    protected Fqn<Path.Segment> getFullyQualifiedName( Path.Segment pathSegment ) {
+        return Fqn.fromElements(pathSegment);
+    }
+
+    protected Node<Name, Object> getNode( ExecutionEnvironment env, Path path ) {
+        // Look up the node with the supplied path ...
+        Fqn<Segment> fqn = getFullyQualifiedName(path);
+        Node<Name, Object> node = cache.getNode(fqn);
+        if (node == null) {
+            String nodePath = path.getString(env.getNamespaceRegistry());
+            throw new RepositorySourceException(getSourceName(), JBossCacheConnectorI18n.nodeDoesNotExist.text(nodePath));
+        }
+        return node;
+
+    }
+
+    protected UUID generateUuid() {
+        return UUID.randomUUID();
+    }
+
+    protected int copyNode( Node<Name, Object> original, Node<Name, Object> newParent, boolean recursive, Name uuidProperty ) {
+        // Get or create the new node ...
+        Segment name = (Segment)original.getFqn().getLastElement();
+        Node<Name, Object> copy = newParent.addChild(getFullyQualifiedName(name));
+        // Copy the properties ...
+        copy.clearData();
+        copy.putAll(original.getData());
+        if (uuidProperty != null) {
+            // Generate a new UUID for the new node ...
+            copy.put(uuidProperty, generateUuid());
+        }
+        int numNodesCopied = 1;
+        if (recursive) {
+            // Loop over each child and call this method ...
+            for (Node<Name, Object> child : original.getChildren()) {
+                numNodesCopied += copyNode(child, copy, true, uuidProperty);
+            }
+        }
+        return numNodesCopied;
+    }
+}

Deleted: trunk/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheConnectorI18n.java
===================================================================
--- branches/federation/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheConnectorI18n.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheConnectorI18n.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -1,55 +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.connector.jbosscache;
-
-import java.util.Locale;
-import java.util.Set;
-import org.jboss.dna.common.i18n.I18n;
-
-/**
- * @author Randall Hauch
- */
-public final class JBossCacheConnectorI18n {
-
-    public static I18n connectorName;
-    public static I18n nodeDoesNotExist;
-
-    static {
-        try {
-            I18n.initialize(JBossCacheConnectorI18n.class);
-        } catch (final Exception err) {
-            System.err.println(err);
-        }
-    }
-
-    public static Set<Locale> getLocalizationProblemLocales() {
-        return I18n.getLocalizationProblemLocales(JBossCacheConnectorI18n.class);
-    }
-
-    public static Set<String> getLocalizationProblems() {
-        return I18n.getLocalizationProblems(JBossCacheConnectorI18n.class);
-    }
-
-    public static Set<String> getLocalizationProblems( Locale locale ) {
-        return I18n.getLocalizationProblems(JBossCacheConnectorI18n.class, locale);
-    }
-}

Copied: trunk/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheConnectorI18n.java (from rev 219, branches/federation/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheConnectorI18n.java)
===================================================================
--- trunk/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheConnectorI18n.java	                        (rev 0)
+++ trunk/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheConnectorI18n.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,55 @@
+/*
+ * 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.connector.jbosscache;
+
+import java.util.Locale;
+import java.util.Set;
+import org.jboss.dna.common.i18n.I18n;
+
+/**
+ * @author Randall Hauch
+ */
+public final class JBossCacheConnectorI18n {
+
+    public static I18n connectorName;
+    public static I18n nodeDoesNotExist;
+
+    static {
+        try {
+            I18n.initialize(JBossCacheConnectorI18n.class);
+        } catch (final Exception err) {
+            System.err.println(err);
+        }
+    }
+
+    public static Set<Locale> getLocalizationProblemLocales() {
+        return I18n.getLocalizationProblemLocales(JBossCacheConnectorI18n.class);
+    }
+
+    public static Set<String> getLocalizationProblems() {
+        return I18n.getLocalizationProblems(JBossCacheConnectorI18n.class);
+    }
+
+    public static Set<String> getLocalizationProblems( Locale locale ) {
+        return I18n.getLocalizationProblems(JBossCacheConnectorI18n.class, locale);
+    }
+}

Deleted: trunk/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheSource.java
===================================================================
--- branches/federation/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheSource.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheSource.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -1,316 +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.connector.jbosscache;
-
-import java.util.Collections;
-import java.util.Hashtable;
-import java.util.Set;
-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;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.naming.RefAddr;
-import javax.naming.Reference;
-import javax.naming.StringRefAddr;
-import javax.naming.spi.ObjectFactory;
-import net.jcip.annotations.GuardedBy;
-import net.jcip.annotations.ThreadSafe;
-import org.jboss.cache.Cache;
-import org.jboss.cache.CacheFactory;
-import org.jboss.cache.DefaultCacheFactory;
-import org.jboss.dna.common.util.ArgCheck;
-import org.jboss.dna.spi.cache.CachePolicy;
-import org.jboss.dna.spi.graph.Name;
-import org.jboss.dna.spi.graph.NameFactory;
-import org.jboss.dna.spi.graph.connection.RepositoryConnection;
-import org.jboss.dna.spi.graph.connection.RepositorySource;
-import org.jboss.dna.spi.graph.connection.RepositorySourceException;
-
-/**
- * @author Randall Hauch
- */
- at ThreadSafe
-public class JBossCacheSource implements RepositorySource, ObjectFactory {
-
-    public static final String DEFAULT_UUID_PROPERTY_NAMESPACE = "http://www.jboss.org/dna/connector/jbosscache";
-    public static final String DEFAULT_UUID_PROPERTY_NAME = "uuid";
-
-    private static final ConcurrentMap<String, JBossCacheSource> sources = new ConcurrentHashMap<String, JBossCacheSource>();
-    private static final ReadWriteLock sourcesLock = new ReentrantReadWriteLock();
-
-    /**
-     * Get the names of the in-memory repository sources that are currently registered
-     * 
-     * @return the unmodifiable set of names
-     */
-    public static Set<String> getSourceNames() {
-        Lock lock = sourcesLock.readLock();
-        try {
-            lock.lock();
-            return Collections.unmodifiableSet(sources.keySet());
-        } finally {
-            lock.unlock();
-        }
-    }
-
-    /**
-     * Get the source with the supplied name.
-     * 
-     * @param name the name
-     * @return the source, or null if there is no source with the supplied name
-     */
-    public static JBossCacheSource getSource( String name ) {
-        Lock lock = sourcesLock.readLock();
-        try {
-            lock.lock();
-            return sources.get(name);
-        } finally {
-            lock.unlock();
-        }
-    }
-
-    @GuardedBy( "sourcesLock" )
-    private String name;
-    @GuardedBy( "this" )
-    private String jndiName;
-    private final AtomicInteger retryLimit = new AtomicInteger(0);
-    private UUID rootNodeUuid = UUID.randomUUID();
-    private CachePolicy defaultCachePolicy;
-    private String cacheConfigurationName;
-    private String uuidPropertyName = DEFAULT_UUID_PROPERTY_NAME;
-    private String uuidPropertyNamespaceUri = DEFAULT_UUID_PROPERTY_NAMESPACE;
-    private transient Cache<Name, Object> cache;
-
-    /**
-     * Create a repository source instance.
-     */
-    public JBossCacheSource() {
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public CachePolicy getDefaultCachePolicy() {
-        return defaultCachePolicy;
-    }
-
-    /**
-     * @param defaultCachePolicy Sets defaultCachePolicy to the specified value.
-     */
-    public void setDefaultCachePolicy( CachePolicy defaultCachePolicy ) {
-        this.defaultCachePolicy = defaultCachePolicy;
-    }
-
-    /**
-     * @return rootNodeUuid
-     */
-    public UUID getRootNodeUuid() {
-        return this.rootNodeUuid;
-    }
-
-    /**
-     * @param rootNodeUuid Sets rootNodeUuid to the specified value.
-     */
-    public void setRootNodeUuid( UUID rootNodeUuid ) {
-        this.rootNodeUuid = rootNodeUuid != null ? rootNodeUuid : UUID.randomUUID();
-    }
-
-    /**
-     * @return uuidPropertyName
-     */
-    public String getUuidPropertyName() {
-        return this.uuidPropertyName;
-    }
-
-    /**
-     * @param uuidPropertyName Sets uuidPropertyName to the specified value.
-     */
-    public synchronized void setUuidPropertyName( String uuidPropertyName ) {
-        this.uuidPropertyName = uuidPropertyName != null ? uuidPropertyName.trim() : DEFAULT_UUID_PROPERTY_NAME;
-    }
-
-    /**
-     * @return uuidPropertyNamespaceUri
-     */
-    public String getUuidPropertyNamespaceUri() {
-        return this.uuidPropertyNamespaceUri;
-    }
-
-    /**
-     * @param uuidPropertyNamespaceUri Sets uuidPropertyNamespaceUri to the specified value.
-     */
-    public synchronized void setUuidPropertyNamespaceUri( String uuidPropertyNamespaceUri ) {
-        this.uuidPropertyNamespaceUri = uuidPropertyNamespaceUri != null ? uuidPropertyNamespaceUri.trim() : DEFAULT_UUID_PROPERTY_NAMESPACE;
-    }
-
-    /**
-     * If you use this to set a JNDI name, this source will be bound to that name using the default {@link InitialContext}. You
-     * can also do this manually if you have additional requirements.
-     * 
-     * @param name the JNDI name
-     * @throws NamingException if there is a problem registering this object
-     * @see #getJndiName()
-     */
-    public void setJndiName( String name ) throws NamingException {
-        setJndiName(name, null);
-    }
-
-    /**
-     * Register this source in JNDI under the supplied name using the supplied context. to set a JNDI name, this source will be
-     * bound to that name using the default {@link InitialContext}. You can also do this manually if you have additional
-     * requirements.
-     * 
-     * @param name the JNDI name, or null if this object is to no longer be registered
-     * @param context the JNDI context, or null if the {@link InitialContext} should be used
-     * @throws NamingException if there is a problem registering this object
-     * @see #getJndiName()
-     */
-    public synchronized void setJndiName( String name, Context context ) throws NamingException {
-        ArgCheck.isNotNull(name, "name");
-        if (context == null) context = new InitialContext();
-
-        // First register in JNDI under the new name ...
-        if (name != null) {
-            context.bind(name, this);
-        }
-        // Second, unregister from JNDI if there is already a name ...
-        if (jndiName != null && !jndiName.equals(name)) {
-            context.unbind(jndiName);
-        }
-        // Record the new name ...
-        this.jndiName = name;
-    }
-
-    /**
-     * Gets the JNDI name this source is bound to. Only valid if you used setJNDIName to bind it.
-     * 
-     * @return the JNDI name, or null if it is not bound in JNDI
-     * @see #setJndiName(String)
-     */
-    public synchronized String getJndiName() {
-        return jndiName;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public String getName() {
-        Lock lock = sourcesLock.readLock();
-        try {
-            lock.lock();
-            return this.name;
-        } finally {
-            lock.unlock();
-        }
-    }
-
-    /**
-     * @param name Sets name to the specified value.
-     * @return true if the name was changed, or false if an existing instance already exists with that name
-     */
-    public boolean setName( String name ) {
-        Lock lock = sourcesLock.writeLock();
-        try {
-            lock.lock();
-            // Determine if this name is allowed ...
-            if (sources.containsKey(name)) return false;
-
-            // Remove this object under its current name
-            if (this.name != null) {
-                sources.remove(this.name);
-            }
-            // Register this object under the new name
-            this.name = name;
-            sources.put(this.name, this);
-            return true;
-        } finally {
-            lock.unlock();
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public int getRetryLimit() {
-        return retryLimit.get();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void setRetryLimit( int limit ) {
-        retryLimit.set(limit);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public synchronized RepositoryConnection getConnection() throws RepositorySourceException {
-        if (this.cache == null) {
-            CacheFactory<Name, Object> factory = new DefaultCacheFactory<Name, Object>();
-            cache = factory.createCache(cacheConfigurationName);
-        }
-        return new JBossCacheConnection(this, this.cache);
-    }
-
-    /**
-     * Utility method to obtain a consistent {@link Name} for the property that should store the UUID value on each node. This
-     * method is properly coded so that it is threadsafe.
-     * 
-     * @param factory the name factory; may not be null
-     * @return the property name, or null if UUIDs are not to be maintained
-     */
-    /* package */synchronized Name getUuidPropertyName( NameFactory factory ) {
-        if (this.uuidPropertyName.length() == 0 && this.uuidPropertyNamespaceUri.length() == 0) return null;
-        return factory.create(this.uuidPropertyNamespaceUri, this.uuidPropertyName);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Reference getReference() {
-        String className = getClass().getName();
-        String factoryClassName = className;
-        return new Reference(className, new StringRefAddr("DnaConnectorJBossCacheSource", getName()), factoryClassName, null);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Object getObjectInstance( Object obj, javax.naming.Name name, Context nameCtx, Hashtable<?, ?> environment ) throws Exception {
-        if (obj instanceof Reference) {
-            Reference ref = (Reference)obj;
-            if (ref.getClassName().equals(getClass().getName())) {
-                RefAddr addr = ref.get("DnaConnectorJBossCacheSource");
-                return JBossCacheSource.getSource((String)addr.getContent());
-            }
-        }
-        return null;
-    }
-
-}

Copied: trunk/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheSource.java (from rev 219, branches/federation/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	                        (rev 0)
+++ trunk/connectors/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheSource.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,316 @@
+/*
+ * 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.connector.jbosscache;
+
+import java.util.Collections;
+import java.util.Hashtable;
+import java.util.Set;
+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;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.naming.RefAddr;
+import javax.naming.Reference;
+import javax.naming.StringRefAddr;
+import javax.naming.spi.ObjectFactory;
+import net.jcip.annotations.GuardedBy;
+import net.jcip.annotations.ThreadSafe;
+import org.jboss.cache.Cache;
+import org.jboss.cache.CacheFactory;
+import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.spi.cache.CachePolicy;
+import org.jboss.dna.spi.graph.Name;
+import org.jboss.dna.spi.graph.NameFactory;
+import org.jboss.dna.spi.graph.connection.RepositoryConnection;
+import org.jboss.dna.spi.graph.connection.RepositorySource;
+import org.jboss.dna.spi.graph.connection.RepositorySourceException;
+
+/**
+ * @author Randall Hauch
+ */
+ at ThreadSafe
+public class JBossCacheSource implements RepositorySource, ObjectFactory {
+
+    public static final String DEFAULT_UUID_PROPERTY_NAMESPACE = "http://www.jboss.org/dna/connector/jbosscache";
+    public static final String DEFAULT_UUID_PROPERTY_NAME = "uuid";
+
+    private static final ConcurrentMap<String, JBossCacheSource> sources = new ConcurrentHashMap<String, JBossCacheSource>();
+    private static final ReadWriteLock sourcesLock = new ReentrantReadWriteLock();
+
+    /**
+     * Get the names of the in-memory repository sources that are currently registered
+     * 
+     * @return the unmodifiable set of names
+     */
+    public static Set<String> getSourceNames() {
+        Lock lock = sourcesLock.readLock();
+        try {
+            lock.lock();
+            return Collections.unmodifiableSet(sources.keySet());
+        } finally {
+            lock.unlock();
+        }
+    }
+
+    /**
+     * Get the source with the supplied name.
+     * 
+     * @param name the name
+     * @return the source, or null if there is no source with the supplied name
+     */
+    public static JBossCacheSource getSource( String name ) {
+        Lock lock = sourcesLock.readLock();
+        try {
+            lock.lock();
+            return sources.get(name);
+        } finally {
+            lock.unlock();
+        }
+    }
+
+    @GuardedBy( "sourcesLock" )
+    private String name;
+    @GuardedBy( "this" )
+    private String jndiName;
+    private final AtomicInteger retryLimit = new AtomicInteger(0);
+    private UUID rootNodeUuid = UUID.randomUUID();
+    private CachePolicy defaultCachePolicy;
+    private String cacheConfigurationName;
+    private String uuidPropertyName = DEFAULT_UUID_PROPERTY_NAME;
+    private String uuidPropertyNamespaceUri = DEFAULT_UUID_PROPERTY_NAMESPACE;
+    private transient Cache<Name, Object> cache;
+
+    /**
+     * Create a repository source instance.
+     */
+    public JBossCacheSource() {
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public CachePolicy getDefaultCachePolicy() {
+        return defaultCachePolicy;
+    }
+
+    /**
+     * @param defaultCachePolicy Sets defaultCachePolicy to the specified value.
+     */
+    public void setDefaultCachePolicy( CachePolicy defaultCachePolicy ) {
+        this.defaultCachePolicy = defaultCachePolicy;
+    }
+
+    /**
+     * @return rootNodeUuid
+     */
+    public UUID getRootNodeUuid() {
+        return this.rootNodeUuid;
+    }
+
+    /**
+     * @param rootNodeUuid Sets rootNodeUuid to the specified value.
+     */
+    public void setRootNodeUuid( UUID rootNodeUuid ) {
+        this.rootNodeUuid = rootNodeUuid != null ? rootNodeUuid : UUID.randomUUID();
+    }
+
+    /**
+     * @return uuidPropertyName
+     */
+    public String getUuidPropertyName() {
+        return this.uuidPropertyName;
+    }
+
+    /**
+     * @param uuidPropertyName Sets uuidPropertyName to the specified value.
+     */
+    public synchronized void setUuidPropertyName( String uuidPropertyName ) {
+        this.uuidPropertyName = uuidPropertyName != null ? uuidPropertyName.trim() : DEFAULT_UUID_PROPERTY_NAME;
+    }
+
+    /**
+     * @return uuidPropertyNamespaceUri
+     */
+    public String getUuidPropertyNamespaceUri() {
+        return this.uuidPropertyNamespaceUri;
+    }
+
+    /**
+     * @param uuidPropertyNamespaceUri Sets uuidPropertyNamespaceUri to the specified value.
+     */
+    public synchronized void setUuidPropertyNamespaceUri( String uuidPropertyNamespaceUri ) {
+        this.uuidPropertyNamespaceUri = uuidPropertyNamespaceUri != null ? uuidPropertyNamespaceUri.trim() : DEFAULT_UUID_PROPERTY_NAMESPACE;
+    }
+
+    /**
+     * If you use this to set a JNDI name, this source will be bound to that name using the default {@link InitialContext}. You
+     * can also do this manually if you have additional requirements.
+     * 
+     * @param name the JNDI name
+     * @throws NamingException if there is a problem registering this object
+     * @see #getJndiName()
+     */
+    public void setJndiName( String name ) throws NamingException {
+        setJndiName(name, null);
+    }
+
+    /**
+     * Register this source in JNDI under the supplied name using the supplied context. to set a JNDI name, this source will be
+     * bound to that name using the default {@link InitialContext}. You can also do this manually if you have additional
+     * requirements.
+     * 
+     * @param name the JNDI name, or null if this object is to no longer be registered
+     * @param context the JNDI context, or null if the {@link InitialContext} should be used
+     * @throws NamingException if there is a problem registering this object
+     * @see #getJndiName()
+     */
+    public synchronized void setJndiName( String name, Context context ) throws NamingException {
+        ArgCheck.isNotNull(name, "name");
+        if (context == null) context = new InitialContext();
+
+        // First register in JNDI under the new name ...
+        if (name != null) {
+            context.bind(name, this);
+        }
+        // Second, unregister from JNDI if there is already a name ...
+        if (jndiName != null && !jndiName.equals(name)) {
+            context.unbind(jndiName);
+        }
+        // Record the new name ...
+        this.jndiName = name;
+    }
+
+    /**
+     * Gets the JNDI name this source is bound to. Only valid if you used setJNDIName to bind it.
+     * 
+     * @return the JNDI name, or null if it is not bound in JNDI
+     * @see #setJndiName(String)
+     */
+    public synchronized String getJndiName() {
+        return jndiName;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getName() {
+        Lock lock = sourcesLock.readLock();
+        try {
+            lock.lock();
+            return this.name;
+        } finally {
+            lock.unlock();
+        }
+    }
+
+    /**
+     * @param name Sets name to the specified value.
+     * @return true if the name was changed, or false if an existing instance already exists with that name
+     */
+    public boolean setName( String name ) {
+        Lock lock = sourcesLock.writeLock();
+        try {
+            lock.lock();
+            // Determine if this name is allowed ...
+            if (sources.containsKey(name)) return false;
+
+            // Remove this object under its current name
+            if (this.name != null) {
+                sources.remove(this.name);
+            }
+            // Register this object under the new name
+            this.name = name;
+            sources.put(this.name, this);
+            return true;
+        } finally {
+            lock.unlock();
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public int getRetryLimit() {
+        return retryLimit.get();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setRetryLimit( int limit ) {
+        retryLimit.set(limit);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public synchronized RepositoryConnection getConnection() throws RepositorySourceException {
+        if (this.cache == null) {
+            CacheFactory<Name, Object> factory = new DefaultCacheFactory<Name, Object>();
+            cache = factory.createCache(cacheConfigurationName);
+        }
+        return new JBossCacheConnection(this, this.cache);
+    }
+
+    /**
+     * Utility method to obtain a consistent {@link Name} for the property that should store the UUID value on each node. This
+     * method is properly coded so that it is threadsafe.
+     * 
+     * @param factory the name factory; may not be null
+     * @return the property name, or null if UUIDs are not to be maintained
+     */
+    /* package */synchronized Name getUuidPropertyName( NameFactory factory ) {
+        if (this.uuidPropertyName.length() == 0 && this.uuidPropertyNamespaceUri.length() == 0) return null;
+        return factory.create(this.uuidPropertyNamespaceUri, this.uuidPropertyName);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Reference getReference() {
+        String className = getClass().getName();
+        String factoryClassName = className;
+        return new Reference(className, new StringRefAddr("DnaConnectorJBossCacheSource", getName()), factoryClassName, null);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Object getObjectInstance( Object obj, javax.naming.Name name, Context nameCtx, Hashtable<?, ?> environment ) throws Exception {
+        if (obj instanceof Reference) {
+            Reference ref = (Reference)obj;
+            if (ref.getClassName().equals(getClass().getName())) {
+                RefAddr addr = ref.get("DnaConnectorJBossCacheSource");
+                return JBossCacheSource.getSource((String)addr.getContent());
+            }
+        }
+        return null;
+    }
+
+}

Copied: trunk/connectors/dna-connector-jbosscache/src/main/resources (from rev 219, branches/federation/connectors/dna-connector-jbosscache/src/main/resources)

Copied: trunk/connectors/dna-connector-jbosscache/src/main/resources/org (from rev 219, branches/federation/connectors/dna-connector-jbosscache/src/main/resources/org)

Copied: trunk/connectors/dna-connector-jbosscache/src/main/resources/org/jboss (from rev 219, branches/federation/connectors/dna-connector-jbosscache/src/main/resources/org/jboss)

Copied: trunk/connectors/dna-connector-jbosscache/src/main/resources/org/jboss/dna (from rev 219, branches/federation/connectors/dna-connector-jbosscache/src/main/resources/org/jboss/dna)

Copied: trunk/connectors/dna-connector-jbosscache/src/main/resources/org/jboss/dna/connector (from rev 219, branches/federation/connectors/dna-connector-jbosscache/src/main/resources/org/jboss/dna/connector)

Copied: trunk/connectors/dna-connector-jbosscache/src/main/resources/org/jboss/dna/connector/jbosscache (from rev 219, branches/federation/connectors/dna-connector-jbosscache/src/main/resources/org/jboss/dna/connector/jbosscache)

Deleted: trunk/connectors/dna-connector-jbosscache/src/main/resources/org/jboss/dna/connector/jbosscache/JBossCacheConnectorI18n.properties
===================================================================
--- branches/federation/connectors/dna-connector-jbosscache/src/main/resources/org/jboss/dna/connector/jbosscache/JBossCacheConnectorI18n.properties	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/connectors/dna-connector-jbosscache/src/main/resources/org/jboss/dna/connector/jbosscache/JBossCacheConnectorI18n.properties	2008-06-02 17:13:20 UTC (rev 220)
@@ -1,24 +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.
-#
-
-connectorName = In-Memory Connector
-nodeDoesNotExist = Could not find an existing node at {0}
\ No newline at end of file

Copied: trunk/connectors/dna-connector-jbosscache/src/main/resources/org/jboss/dna/connector/jbosscache/JBossCacheConnectorI18n.properties (from rev 219, branches/federation/connectors/dna-connector-jbosscache/src/main/resources/org/jboss/dna/connector/jbosscache/JBossCacheConnectorI18n.properties)
===================================================================
--- trunk/connectors/dna-connector-jbosscache/src/main/resources/org/jboss/dna/connector/jbosscache/JBossCacheConnectorI18n.properties	                        (rev 0)
+++ trunk/connectors/dna-connector-jbosscache/src/main/resources/org/jboss/dna/connector/jbosscache/JBossCacheConnectorI18n.properties	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,24 @@
+#
+# 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.
+#
+
+connectorName = In-Memory Connector
+nodeDoesNotExist = Could not find an existing node at {0}
\ No newline at end of file

Copied: trunk/connectors/dna-connector-jbosscache/src/test (from rev 219, branches/federation/connectors/dna-connector-jbosscache/src/test)

Copied: trunk/connectors/dna-connector-jbosscache/src/test/java (from rev 219, branches/federation/connectors/dna-connector-jbosscache/src/test/java)

Copied: trunk/connectors/dna-connector-jbosscache/src/test/resources (from rev 219, branches/federation/connectors/dna-connector-jbosscache/src/test/resources)

Copied: trunk/dna-repository/src/main/java/org/jboss/dna/repository/FederationService.java (from rev 219, branches/federation/dna-repository/src/main/java/org/jboss/dna/repository/FederationService.java)
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/FederationService.java	                        (rev 0)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/FederationService.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,83 @@
+/*
+ * 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.repository;
+
+import java.util.concurrent.TimeUnit;
+import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.repository.services.AbstractServiceAdministrator;
+import org.jboss.dna.repository.services.AdministeredService;
+import org.jboss.dna.repository.services.ServiceAdministrator;
+import org.jboss.dna.spi.graph.connection.RepositorySource;
+
+/**
+ * @author Randall Hauch
+ */
+public class FederationService implements AdministeredService {
+
+    /**
+     * The administrative component for this service.
+     * @author Randall Hauch
+     */
+    protected class Administrator extends AbstractServiceAdministrator {
+
+        protected Administrator() {
+            super(RepositoryI18n.federationServiceName, State.STARTED);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public boolean awaitTermination( long timeout, TimeUnit unit ) {
+            return true;
+        }
+
+    }
+
+    private RepositorySource bootstrapSource;
+    private final Administrator administrator = new Administrator();
+
+    /**
+     * Create a federation service instance
+     * @param bootstrapSource the repository source that should be used to bootstrap the federation service
+     * @throws IllegalArgumentException if the bootstrap source is null
+     */
+    public FederationService( RepositorySource bootstrapSource ) {
+        ArgCheck.isNotNull(bootstrapSource, "bootstrapSource");
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ServiceAdministrator getAdministrator() {
+        return this.administrator;
+    }
+
+    /**
+     * Get the repository source used to obtain connections to the repository containing the configuration information for this
+     * federation service.
+     * @return bootstrapSource
+     */
+    public RepositorySource getBootstrapSource() {
+        return this.bootstrapSource;
+    }
+
+}

Modified: trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryI18n.java
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryI18n.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryI18n.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -60,6 +60,10 @@
     public static I18n errorObtainingSessionToRepositoryWorkspace;
     public static I18n errorWritingProblemsOnRuleSet;
 
+    public static I18n federationServiceName;
+    public static I18n observationServiceName;
+    public static I18n ruleServiceName;
+
     public static I18n sequencingServiceName;
     public static I18n unableToChangeExecutionContextWhileRunning;
     public static I18n unableToStartSequencingServiceWithoutExecutionContext;

Modified: trunk/dna-repository/src/main/java/org/jboss/dna/repository/observation/ObservationService.java
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/observation/ObservationService.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/observation/ObservationService.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -95,21 +95,13 @@
     protected class Administrator extends AbstractServiceAdministrator {
 
         protected Administrator() {
-            super(State.STARTED);
+            super(RepositoryI18n.observationServiceName, State.STARTED);
         }
 
         /**
          * {@inheritDoc}
          */
         @Override
-        protected String serviceName() {
-            return "ObservationService";
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
         protected void doShutdown( State fromState ) {
             super.doShutdown(fromState);
             shutdownService();

Modified: trunk/dna-repository/src/main/java/org/jboss/dna/repository/rules/RuleService.java
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/rules/RuleService.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/rules/RuleService.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -84,21 +84,13 @@
     protected class Administrator extends AbstractServiceAdministrator {
 
         protected Administrator() {
-            super(State.PAUSED);
+            super(RepositoryI18n.ruleServiceName, State.PAUSED);
         }
 
         /**
          * {@inheritDoc}
          */
         @Override
-        protected String serviceName() {
-            return "RuleService";
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
         protected void doShutdown( State fromState ) {
             super.doShutdown(fromState);
             // Remove all rule sets ...

Modified: trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/SequencingService.java
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/SequencingService.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/SequencingService.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -149,21 +149,13 @@
     protected class Administrator extends AbstractServiceAdministrator {
 
         protected Administrator() {
-            super(State.PAUSED);
+            super(RepositoryI18n.sequencingServiceName, State.PAUSED);
         }
 
         /**
          * {@inheritDoc}
          */
         @Override
-        protected String serviceName() {
-            return RepositoryI18n.sequencingServiceName.text();
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
         protected void doStart( State fromState ) {
             super.doStart(fromState);
             startService();

Modified: trunk/dna-repository/src/main/java/org/jboss/dna/repository/services/AbstractServiceAdministrator.java
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/services/AbstractServiceAdministrator.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/services/AbstractServiceAdministrator.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -21,9 +21,11 @@
  */
 package org.jboss.dna.repository.services;
 
-import org.jboss.dna.repository.RepositoryI18n;
+import java.util.Locale;
 import net.jcip.annotations.GuardedBy;
 import net.jcip.annotations.ThreadSafe;
+import org.jboss.dna.common.i18n.I18n;
+import org.jboss.dna.repository.RepositoryI18n;
 
 /**
  * Simple abstract implementation of the service administrator interface that can be easily subclassed by services that require an
@@ -34,10 +36,13 @@
 public abstract class AbstractServiceAdministrator implements ServiceAdministrator {
 
     private volatile State state;
+    private final I18n serviceName;
 
-    protected AbstractServiceAdministrator( State initialState ) {
+    protected AbstractServiceAdministrator( I18n serviceName, State initialState ) {
         assert initialState != null;
+        assert serviceName != null;
         this.state = initialState;
+        this.serviceName = serviceName;
     }
 
     /**
@@ -102,7 +107,7 @@
      * @see #isStarted()
      */
     public synchronized ServiceAdministrator start() {
-        if (isShutdown()) throw new IllegalStateException(RepositoryI18n.serviceShutdowAndMayNotBeStarted.text(serviceName()));
+        if (isShutdown()) throw new IllegalStateException(RepositoryI18n.serviceShutdowAndMayNotBeStarted.text(getServiceName()));
         if (this.state != State.STARTED) {
             doStart(this.state);
             this.state = State.STARTED;
@@ -131,7 +136,7 @@
      * @see #isPaused()
      */
     public synchronized ServiceAdministrator pause() {
-        if (isShutdown()) throw new IllegalStateException(RepositoryI18n.serviceShutdowAndMayNotBePaused.text(serviceName()));
+        if (isShutdown()) throw new IllegalStateException(RepositoryI18n.serviceShutdowAndMayNotBePaused.text(getServiceName()));
         if (this.state != State.PAUSED) {
             doPause(this.state);
             this.state = State.PAUSED;
@@ -212,5 +217,20 @@
         return this.state == State.SHUTDOWN;
     }
 
-    protected abstract String serviceName();
+    /**
+     * Get the name of this service in the current locale.
+     * @return the service name
+     */
+    public String getServiceName() {
+        return this.serviceName.text();
+    }
+
+    /**
+     * Get the name of this service in the specified locale.
+     * @param locale the locale in which the service name is to be returned; may be null if the default locale is to be used
+     * @return the service name
+     */
+    public String getServiceName( Locale locale ) {
+        return this.serviceName.text(locale);
+    }
 }

Modified: trunk/dna-repository/src/main/resources/org/jboss/dna/repository/RepositoryI18n.properties
===================================================================
--- trunk/dna-repository/src/main/resources/org/jboss/dna/repository/RepositoryI18n.properties	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-repository/src/main/resources/org/jboss/dna/repository/RepositoryI18n.properties	2008-06-02 17:13:20 UTC (rev 220)
@@ -28,6 +28,10 @@
 errorObtainingSessionToRepositoryWorkspace = Error obtaining JCR session to repository workspace {0}
 errorWritingProblemsOnRuleSet = Error while writing problems on rule set node {0}
 
+federationServiceName = Federation Service
+observationServiceName = Observation Service
+ruleServiceName = Rule Service
+
 sequencingServiceName = Sequencing Service
 unableToChangeExecutionContextWhileRunning = Unable to change the execution context while running
 unableToStartSequencingServiceWithoutExecutionContext = Unable to start the Sequencing Service without an execution context

Modified: trunk/dna-spi/src/main/java/org/jboss/dna/spi/SpiI18n.java
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/SpiI18n.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/SpiI18n.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -51,6 +51,11 @@
 
     public static I18n invalidQualifiedNameString;
 
+    public static I18n maximumPoolSizeMayNotBeSmallerThanCorePoolSize;
+    public static I18n repositoryConnectionPoolIsNotRunning;
+    public static I18n unableToObtainValidRepositoryAfterAttempts;
+    public static I18n closedConnectionMayNotBeUsed;
+
     static {
         try {
             I18n.initialize(SpiI18n.class);

Modified: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/Property.java
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/Property.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/Property.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -23,13 +23,13 @@
 
 import java.math.BigDecimal;
 import java.net.URI;
-import java.util.Calendar;
 import java.util.Iterator;
 import net.jcip.annotations.Immutable;
 
 /**
  * Representation of a property consisting of a name and value(s). Note that this property is immutable, meaning that the property
  * values may not be changed through this interface.
+ * 
  * @author Randall Hauch
  */
 @Immutable
@@ -37,52 +37,62 @@
 
     /**
      * Get the name of the property.
+     * 
      * @return the property name; never null
      */
     Name getName();
 
     /**
      * Get the name of the property's definition.
+     * 
      * @return the property definition's name; never null
      */
     Name getDefinitionName();
 
     /**
-     * Determine whether the property is defined to allow multiple values.
+     * Get the number of actual values in this property. If the property allows {@link #isMultiple() multiple values}, then this
+     * method may return a value greater than 1. If the property only allows a {@link #isSingle() single value}, then this method
+     * will return either 0 or 1. This method may return 0 regardless of whether the property allows a
+     * {@link #isSingle() single value}, or {@link #isMultiple() multiple values}.
+     * 
+     * @return the number of actual values in this property; always non-negative
+     */
+    int size();
+
+    /**
+     * Determine whether the property currently has multiple values.
+     * 
      * @return true if the property has multiple values, or false otherwise.
      * @see #isSingle()
+     * @see #isEmpty()
      */
     boolean isMultiple();
 
     /**
-     * Determine whether the property is defined to allow a single value. This is a convenience method that is equivalent to
-     * calling <code>!isMultiple()</code>.
-     * @return true if the property has multiple values, or false otherwise.
+     * Determine whether the property currently has a single value.
+     * 
+     * @return true if the property has a single value, or false otherwise.
      * @see #isMultiple()
+     * @see #isEmpty()
      */
     boolean isSingle();
 
     /**
-     * Get the number of actual values in this property. If the property allows {@link #isMultiple() multiple values}, then this
-     * method may return a value greater than 1. If the property only allows a {@link #isSingle() single value}, then this method
-     * will return either 0 or 1. This method may return 0 regardless of whether the property allows a
-     * {@link #isSingle() single value}, or {@link #isMultiple() multiple values}.
-     * @return the number of actual values in this property; always non-negative
-     */
-    int size();
-
-    /**
      * Determine whether this property has no actual values. This method may return <code>true</code> regardless of whether the
      * property allows a {@link #isSingle() single value}, or {@link #isMultiple() multiple values}.
      * <p>
      * This method is a convenience method that is equivalent to <code>size() == 0</code>.
      * </p>
-     * @return the number of actual values in this property; always non-negative
+     * 
+     * @return true if this property has no values, or false otherwise
+     * @see #isMultiple()
+     * @see #isSingle()
      */
     boolean isEmpty();
 
     /**
      * Get the type for this property.
+     * 
      * @return the property's type, which is never null
      */
     PropertyType getPropertyType();
@@ -96,12 +106,30 @@
      * <p>
      * The resulting iterator is immutable, and all property values are immutable.
      * </p>
+     * 
      * @return an iterator over the values; never null
      * @see Iterable#iterator()
+     * @see #getValuesAsArray()
      */
     Iterator<?> getValues();
 
     /**
+     * Obtain the property's values as an array of objects in their natural form, as defined by {@link #getPropertyType()}.
+     * <p>
+     * A valid array is return if the property has {@link #isSingle() single valued} or {@link #isMultiple() multi-valued}, or a
+     * null value is returned if the property is {@link #isEmpty() empty}.
+     * </p>
+     * <p>
+     * The resulting array is a copy, guaranteeing immutability for the property.
+     * </p>
+     * 
+     * @return the array of values
+     * @see Iterable#iterator()
+     * @see #getValues()
+     */
+    Object[] getValuesAsArray();
+
+    /**
      * Obtain the property's values in their natural form, converting the values to the supplied {@link PropertyType} if it is
      * different than this property's {@link #getPropertyType() property type}. Note that it is not always possible to convert
      * between PropertyTypes.
@@ -111,6 +139,7 @@
      * <p>
      * The resulting iterator is immutable, and all property values are immutable.
      * </p>
+     * 
      * @param type the property type defining the form of the values to be returned; if null, the
      * {@link #getPropertyType() property's type} is used
      * @return an iterator over the values; never null
@@ -126,6 +155,7 @@
      * <p>
      * The resulting iterator is immutable, and all property values are immutable.
      * </p>
+     * 
      * @return an iterator over the String values; never null
      */
     Iterator<String> getStringValues();
@@ -139,6 +169,7 @@
      * <p>
      * The resulting iterator is immutable, and all property values are immutable.
      * </p>
+     * 
      * @return an iterator over the {@link Binary} values; never null
      */
     Iterator<Binary> getBinaryValues();
@@ -152,6 +183,7 @@
      * <p>
      * The resulting iterator is immutable, and all property values are immutable.
      * </p>
+     * 
      * @return an iterator over the long values; never null
      */
     Iterator<Long> getLongValues();
@@ -165,6 +197,7 @@
      * <p>
      * The resulting iterator is immutable, and all property values are immutable.
      * </p>
+     * 
      * @return an iterator over the double values; never null
      */
     Iterator<Double> getDoubleValues();
@@ -179,12 +212,13 @@
      * <p>
      * The resulting iterator is immutable, and all property values are immutable.
      * </p>
+     * 
      * @return an iterator over the decimal values; never null
      */
     Iterator<BigDecimal> getDecimalValues();
 
     /**
-     * Obtain the property's values as {@link Calendar dates}, converting the values if the
+     * Obtain the property's values as {@link DateTime dates}, converting the values if the
      * {@link #getPropertyType() property type} is not {@link PropertyType#DATE}. Note that it is not always possible to convert
      * to a {@link PropertyType#DATE date} value.
      * <p>
@@ -193,9 +227,10 @@
      * <p>
      * The resulting iterator is immutable, and all property values are immutable.
      * </p>
-     * @return an iterator over the Calendar values; never null
+     * 
+     * @return an iterator over the DateTime values; never null
      */
-    Iterator<Calendar> getDateValues();
+    Iterator<DateTime> getDateValues();
 
     /**
      * Obtain the property's values as booleans, converting the values if the {@link #getPropertyType() property type} is not
@@ -207,6 +242,7 @@
      * <p>
      * The resulting iterator is immutable, and all property values are immutable.
      * </p>
+     * 
      * @return an iterator over the Boolean values; never null
      */
     Iterator<Boolean> getBooleanValues();
@@ -221,6 +257,7 @@
      * <p>
      * The resulting iterator is immutable, and all property values are immutable.
      * </p>
+     * 
      * @return an iterator over the Name values; never null
      */
     Iterator<Name> getNameValues();
@@ -235,6 +272,7 @@
      * <p>
      * The resulting iterator is immutable, and all property values are immutable.
      * </p>
+     * 
      * @return an iterator over the Path values; never null
      */
     Iterator<Path> getPathValues();
@@ -249,6 +287,7 @@
      * <p>
      * The resulting iterator is immutable, and all property values are immutable.
      * </p>
+     * 
      * @return an iterator over the Reference values; never null
      */
     Iterator<Reference> getReferenceValues();
@@ -262,6 +301,7 @@
      * <p>
      * The resulting iterator is immutable, and all property values are immutable.
      * </p>
+     * 
      * @return an iterator over the URI values; never null
      */
     Iterator<URI> getUriValues();

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/PropertyFactory.java (from rev 219, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/PropertyFactory.java)
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/PropertyFactory.java	                        (rev 0)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/PropertyFactory.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,37 @@
+/*
+ * 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.graph;
+
+import java.util.Iterator;
+
+/**
+ * @author Randall Hauch
+ */
+public interface PropertyFactory {
+
+    Property create( Name name, PropertyType type, Name definitionName, Object... values );
+
+    Property create( Name name, PropertyType type, Name definitionName, Iterable<?> values );
+
+    Property create( Name name, PropertyType type, Name definitionName, Iterator<?> values );
+
+}

Modified: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/PropertyType.java
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/PropertyType.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/PropertyType.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -24,6 +24,7 @@
 import java.math.BigDecimal;
 import java.net.URI;
 import java.util.Comparator;
+import java.util.Iterator;
 import net.jcip.annotations.Immutable;
 import org.jboss.dna.spi.SpiI18n;
 
@@ -68,17 +69,32 @@
         return this.comparator;
     }
 
-    public boolean isInstance( Object value ) {
+    public boolean isTypeFor( Object value ) {
         return this.valueClass.isInstance(value);
     }
 
+    public boolean isTypeForEach( Iterable<?> values ) {
+        for (Object value : values) {
+            if (!this.valueClass.isInstance(value)) return false;
+        }
+        return true;
+    }
+
+    public boolean isTypeForEach( Iterator<?> values ) {
+        while (values.hasNext()) {
+            Object value = values.next();
+            if (!this.valueClass.isInstance(value)) return false;
+        }
+        return true;
+    }
+
     public static PropertyType discoverType( Object value ) {
         if (value == null) {
             throw new ValueFormatException(SpiI18n.unableToDiscoverPropertyTypeForNullValue.text());
         }
         for (PropertyType type : PropertyType.values()) {
             if (type == OBJECT) continue;
-            if (type.isInstance(value)) return type;
+            if (type.isTypeFor(value)) return type;
         }
         return OBJECT;
     }

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands (from rev 219, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands)

Deleted: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/ActsAsUpdate.java
===================================================================
--- branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/ActsAsUpdate.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/ActsAsUpdate.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -1,30 +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.graph.commands;
-
-/**
- * Marker interface that signals that a command may update or modify information in a repository.
- * @author Randall Hauch
- */
-public interface ActsAsUpdate {
-
-}

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/ActsAsUpdate.java (from rev 219, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/ActsAsUpdate.java)
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/ActsAsUpdate.java	                        (rev 0)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/ActsAsUpdate.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,30 @@
+/*
+ * 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.graph.commands;
+
+/**
+ * Marker interface that signals that a command may update or modify information in a repository.
+ * @author Randall Hauch
+ */
+public interface ActsAsUpdate {
+
+}

Deleted: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/ActsOnPath.java
===================================================================
--- branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/ActsOnPath.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/ActsOnPath.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -1,38 +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.graph.commands;
-
-import org.jboss.dna.spi.graph.Path;
-
-/**
- * Aspect interface for any repository command that acts upon a specific path. This aspect adds a method that can be used by the
- * recipient to obtain the path that the command applies to.
- * @author Randall Hauch
- */
-public interface ActsOnPath {
-
-    /**
-     * Get the path to which this command applies.
-     * @return the path; never null
-     */
-    Path getPath();
-}

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/ActsOnPath.java (from rev 219, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/ActsOnPath.java)
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/ActsOnPath.java	                        (rev 0)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/ActsOnPath.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,38 @@
+/*
+ * 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.graph.commands;
+
+import org.jboss.dna.spi.graph.Path;
+
+/**
+ * Aspect interface for any repository command that acts upon a specific path. This aspect adds a method that can be used by the
+ * recipient to obtain the path that the command applies to.
+ * @author Randall Hauch
+ */
+public interface ActsOnPath {
+
+    /**
+     * Get the path to which this command applies.
+     * @return the path; never null
+     */
+    Path getPath();
+}

Deleted: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/ActsOnProperties.java
===================================================================
--- branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/ActsOnProperties.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/ActsOnProperties.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -1,41 +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.graph.commands;
-
-import org.jboss.dna.spi.cache.Cacheable;
-import org.jboss.dna.spi.graph.Property;
-
-/**
- * Aspect interface for any repository command that acts upon or updates properties on a given node. This aspect also allows for
- * the recipient to {@link Cacheable#setCachePolicy(org.jboss.dna.spi.cache.CachePolicy) update the cache policy} for the updated
- * information.
- * @author Randall Hauch
- */
-public interface ActsOnProperties extends ActsOnPath, Cacheable {
-
-    /**
-     * Get the properties. Any property with no values will be removed.
-     * @return the properties
-     */
-    Iterable<Property> getProperties();
-
-}

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/ActsOnProperties.java (from rev 219, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/ActsOnProperties.java)
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/ActsOnProperties.java	                        (rev 0)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/ActsOnProperties.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,41 @@
+/*
+ * 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.graph.commands;
+
+import org.jboss.dna.spi.cache.Cacheable;
+import org.jboss.dna.spi.graph.Property;
+
+/**
+ * Aspect interface for any repository command that acts upon or updates properties on a given node. This aspect also allows for
+ * the recipient to {@link Cacheable#setCachePolicy(org.jboss.dna.spi.cache.CachePolicy) update the cache policy} for the updated
+ * information.
+ * @author Randall Hauch
+ */
+public interface ActsOnProperties extends ActsOnPath, Cacheable {
+
+    /**
+     * Get the properties. Any property with no values will be removed.
+     * @return the properties
+     */
+    Iterable<Property> getProperties();
+
+}

Deleted: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/CopyBranchCommand.java
===================================================================
--- branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/CopyBranchCommand.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/CopyBranchCommand.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -1,31 +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.graph.commands;
-
-/**
- * Command that copies a branch from one path to another. In other words, this is a deep version of {@link CopyNodeCommand}.
- * 
- * @author Randall Hauch
- */
-public interface CopyBranchCommand extends CopyNodeCommand {
-
-}

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/CopyBranchCommand.java (from rev 219, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/CopyBranchCommand.java)
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/CopyBranchCommand.java	                        (rev 0)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/CopyBranchCommand.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,31 @@
+/*
+ * 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.graph.commands;
+
+/**
+ * Command that copies a branch from one path to another. In other words, this is a deep version of {@link CopyNodeCommand}.
+ * 
+ * @author Randall Hauch
+ */
+public interface CopyBranchCommand extends CopyNodeCommand {
+
+}

Deleted: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/CopyNodeCommand.java
===================================================================
--- branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/CopyNodeCommand.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/CopyNodeCommand.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -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.graph.commands;
-
-import org.jboss.dna.spi.graph.Path;
-
-/**
- * Command that makes a copy of a single node at another location.
- * 
- * @author Randall Hauch
- */
-public interface CopyNodeCommand extends GraphCommand, ActsOnPath, ActsAsUpdate {
-
-    /**
-     * Get the new path to which the copy is to be made.
-     * 
-     * @return the new path; never null
-     */
-    Path getNewPath();
-}

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/CopyNodeCommand.java (from rev 219, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/CopyNodeCommand.java)
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/CopyNodeCommand.java	                        (rev 0)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/CopyNodeCommand.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,39 @@
+/*
+ * 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.graph.commands;
+
+import org.jboss.dna.spi.graph.Path;
+
+/**
+ * Command that makes a copy of a single node at another location.
+ * 
+ * @author Randall Hauch
+ */
+public interface CopyNodeCommand extends GraphCommand, ActsOnPath, ActsAsUpdate {
+
+    /**
+     * Get the new path to which the copy is to be made.
+     * 
+     * @return the new path; never null
+     */
+    Path getNewPath();
+}

Deleted: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/CreateNodeCommand.java
===================================================================
--- branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/CreateNodeCommand.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/CreateNodeCommand.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -1,40 +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.graph.commands;
-
-import java.util.Iterator;
-import org.jboss.dna.spi.cache.Cacheable;
-import org.jboss.dna.spi.graph.Property;
-
-/**
- * A command to get the children of a single node given its path.
- * @author Randall Hauch
- */
-public interface CreateNodeCommand extends GraphCommand, ActsOnPath, Cacheable, ActsOnProperties, ActsAsUpdate {
-
-    /**
-     * Get the properties for this new node. The recipient of the command should {@link Iterator#remove() remove} any property
-     * that will not be stored.
-     * @return the property iterator; never null, but possibly empty
-     */
-    Iterable<Property> getProperties();
-}

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/CreateNodeCommand.java (from rev 219, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/CreateNodeCommand.java)
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/CreateNodeCommand.java	                        (rev 0)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/CreateNodeCommand.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,40 @@
+/*
+ * 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.graph.commands;
+
+import java.util.Iterator;
+import org.jboss.dna.spi.cache.Cacheable;
+import org.jboss.dna.spi.graph.Property;
+
+/**
+ * A command to get the children of a single node given its path.
+ * @author Randall Hauch
+ */
+public interface CreateNodeCommand extends GraphCommand, ActsOnPath, Cacheable, ActsOnProperties, ActsAsUpdate {
+
+    /**
+     * Get the properties for this new node. The recipient of the command should {@link Iterator#remove() remove} any property
+     * that will not be stored.
+     * @return the property iterator; never null, but possibly empty
+     */
+    Iterable<Property> getProperties();
+}

Deleted: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/DeleteBranchCommand.java
===================================================================
--- branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/DeleteBranchCommand.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/DeleteBranchCommand.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -1,29 +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.graph.commands;
-
-/**
- * Command that deletes a branch given by a specified path.
- * @author Randall Hauch
- */
-public interface DeleteBranchCommand extends GraphCommand, ActsOnPath, ActsAsUpdate {
-}

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/DeleteBranchCommand.java (from rev 219, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/DeleteBranchCommand.java)
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/DeleteBranchCommand.java	                        (rev 0)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/DeleteBranchCommand.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,29 @@
+/*
+ * 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.graph.commands;
+
+/**
+ * Command that deletes a branch given by a specified path.
+ * @author Randall Hauch
+ */
+public interface DeleteBranchCommand extends GraphCommand, ActsOnPath, ActsAsUpdate {
+}

Deleted: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GetChildrenCommand.java
===================================================================
--- branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GetChildrenCommand.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GetChildrenCommand.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -1,90 +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.graph.commands;
-
-import java.util.Iterator;
-import org.jboss.dna.spi.cache.Cacheable;
-import org.jboss.dna.spi.graph.Name;
-import org.jboss.dna.spi.graph.Path;
-
-/**
- * A command to get the children of a single node given its path.
- * 
- * @author Randall Hauch
- */
-public interface GetChildrenCommand extends GraphCommand, ActsOnPath, Cacheable {
-
-    /**
-     * Set the children of this node using an iterator of names. Any existing child references already set on this command will be
-     * replaced by those supplied to this method.
-     * <p>
-     * The indexes of the same-name siblings will be determined by the order in which they appear in the iterator.
-     * </p>
-     * <p>
-     * The caller may supply a custom iterator implementation, which will be called on this same connection within the same
-     * transaction when the node data is processed and consumed.
-     * </p>
-     * 
-     * @param namesOfChildren the iterator over the names of children; may be null if there are no children
-     */
-    void setChildren( Iterator<Path.Segment> namesOfChildren );
-
-    /**
-     * Set the children of this node using an iterator of names. Any existing child references already set on this command will be
-     * replaced by those supplied to this method.
-     * <p>
-     * The indexes of the same-name siblings will be determined by the order in which they appear in the iterator.
-     * </p>
-     * <p>
-     * The caller may supply a custom iterator implementation, which will be called on this same connection within the same
-     * transaction when the node data is processed and consumed.
-     * </p>
-     * 
-     * @param namesOfChildren the iterable names of children; may be null if there are no children
-     */
-    void setChildren( Iterable<Path.Segment> namesOfChildren );
-
-    /**
-     * Set the children of this node using the array of names. Any existing child references already set on this command will be
-     * replaced by those supplied to this method.
-     * <p>
-     * The indexes of the same-name siblings will be determined by the order in which they appear in the iterator.
-     * </p>
-     * 
-     * @param namesOfChildren the names of children; may be null if there are no children
-     */
-    void setChildren( Path.Segment... namesOfChildren );
-
-    /**
-     * Set the child of this node using the supplied name. Any existing child references already set on this command will be
-     * replaced by those supplied to this method. Note that a {@link Path.Segment segment} is not required in this case because
-     * there is only one child and (by definition) no index.
-     * 
-     * @param nameOfChild
-     */
-    void setChild( Name nameOfChild );
-
-    /**
-     * Set that this node has no children. Any existing child references already set on this command will be removed.
-     */
-    void setNoChildren();
-}

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GetChildrenCommand.java (from rev 219, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GetChildrenCommand.java)
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GetChildrenCommand.java	                        (rev 0)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GetChildrenCommand.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,90 @@
+/*
+ * 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.graph.commands;
+
+import java.util.Iterator;
+import org.jboss.dna.spi.cache.Cacheable;
+import org.jboss.dna.spi.graph.Name;
+import org.jboss.dna.spi.graph.Path;
+
+/**
+ * A command to get the children of a single node given its path.
+ * 
+ * @author Randall Hauch
+ */
+public interface GetChildrenCommand extends GraphCommand, ActsOnPath, Cacheable {
+
+    /**
+     * Set the children of this node using an iterator of names. Any existing child references already set on this command will be
+     * replaced by those supplied to this method.
+     * <p>
+     * The indexes of the same-name siblings will be determined by the order in which they appear in the iterator.
+     * </p>
+     * <p>
+     * The caller may supply a custom iterator implementation, which will be called on this same connection within the same
+     * transaction when the node data is processed and consumed.
+     * </p>
+     * 
+     * @param namesOfChildren the iterator over the names of children; may be null if there are no children
+     */
+    void setChildren( Iterator<Path.Segment> namesOfChildren );
+
+    /**
+     * Set the children of this node using an iterator of names. Any existing child references already set on this command will be
+     * replaced by those supplied to this method.
+     * <p>
+     * The indexes of the same-name siblings will be determined by the order in which they appear in the iterator.
+     * </p>
+     * <p>
+     * The caller may supply a custom iterator implementation, which will be called on this same connection within the same
+     * transaction when the node data is processed and consumed.
+     * </p>
+     * 
+     * @param namesOfChildren the iterable names of children; may be null if there are no children
+     */
+    void setChildren( Iterable<Path.Segment> namesOfChildren );
+
+    /**
+     * Set the children of this node using the array of names. Any existing child references already set on this command will be
+     * replaced by those supplied to this method.
+     * <p>
+     * The indexes of the same-name siblings will be determined by the order in which they appear in the iterator.
+     * </p>
+     * 
+     * @param namesOfChildren the names of children; may be null if there are no children
+     */
+    void setChildren( Path.Segment... namesOfChildren );
+
+    /**
+     * Set the child of this node using the supplied name. Any existing child references already set on this command will be
+     * replaced by those supplied to this method. Note that a {@link Path.Segment segment} is not required in this case because
+     * there is only one child and (by definition) no index.
+     * 
+     * @param nameOfChild
+     */
+    void setChild( Name nameOfChild );
+
+    /**
+     * Set that this node has no children. Any existing child references already set on this command will be removed.
+     */
+    void setNoChildren();
+}

Deleted: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GetNodeCommand.java
===================================================================
--- branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GetNodeCommand.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GetNodeCommand.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -1,30 +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.graph.commands;
-
-/**
- * A command to get the properties and children for a single node given its path.
- * @author Randall Hauch
- */
-public interface GetNodeCommand extends GetChildrenCommand, GetPropertiesCommand {
-
-}

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GetNodeCommand.java (from rev 219, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GetNodeCommand.java)
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GetNodeCommand.java	                        (rev 0)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GetNodeCommand.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,30 @@
+/*
+ * 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.graph.commands;
+
+/**
+ * A command to get the properties and children for a single node given its path.
+ * @author Randall Hauch
+ */
+public interface GetNodeCommand extends GetChildrenCommand, GetPropertiesCommand {
+
+}

Deleted: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GetPropertiesCommand.java
===================================================================
--- branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GetPropertiesCommand.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GetPropertiesCommand.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -1,68 +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.graph.commands;
-
-import java.util.Iterator;
-import org.jboss.dna.spi.cache.Cacheable;
-import org.jboss.dna.spi.graph.Name;
-
-/**
- * A command to obtain from the source the properties for a single node given its path.
- * 
- * @author Randall Hauch
- */
-public interface GetPropertiesCommand extends GraphCommand, ActsOnPath, Cacheable {
-
-    /**
-     * Set the values for the named property. Any existing property values, if previously set, will be overwritten. If there are
-     * no property vlaues or if all of the property values are null, the property will be removed.
-     * <p>
-     * The implementation should be capable of accepting an array, {@link Iterator}, or {@link Iterable} as a sole single
-     * parameter, and properly extracting the values. This is so that callers that have an {@link Object} reference to an array,
-     * Iterator, or Iterable don't need to type check and cast in order to call {@link #setProperty(Name, Iterable...) the}
-     * {@link #setProperty(Name, Iterator...) appropriate} method.
-     * </p>
-     * 
-     * @param propertyName the name of the property
-     * @param values the property values
-     */
-    void setProperty( Name propertyName, Object... values );
-
-    /**
-     * Set the values for the named property. Any existing property values, if previously set, will be overwritten. If there are
-     * no property vlaues or if all of the property values are null, the property will be removed.
-     * 
-     * @param propertyName the name of the property
-     * @param values the iterable property values
-     */
-    void setProperty( Name propertyName, Iterable<?> values );
-
-    /**
-     * Set the values for the named property. Any existing property values, if previously set, will be overwritten. If there are
-     * no property vlaues or if all of the property values are null, the property will be removed.
-     * 
-     * @param propertyName the name of the property
-     * @param values the iterator over the property values
-     */
-    void setProperty( Name propertyName, Iterator<?> values );
-
-}

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GetPropertiesCommand.java (from rev 219, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GetPropertiesCommand.java)
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GetPropertiesCommand.java	                        (rev 0)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GetPropertiesCommand.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,68 @@
+/*
+ * 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.graph.commands;
+
+import java.util.Iterator;
+import org.jboss.dna.spi.cache.Cacheable;
+import org.jboss.dna.spi.graph.Name;
+
+/**
+ * A command to obtain from the source the properties for a single node given its path.
+ * 
+ * @author Randall Hauch
+ */
+public interface GetPropertiesCommand extends GraphCommand, ActsOnPath, Cacheable {
+
+    /**
+     * Set the values for the named property. Any existing property values, if previously set, will be overwritten. If there are
+     * no property vlaues or if all of the property values are null, the property will be removed.
+     * <p>
+     * The implementation should be capable of accepting an array, {@link Iterator}, or {@link Iterable} as a sole single
+     * parameter, and properly extracting the values. This is so that callers that have an {@link Object} reference to an array,
+     * Iterator, or Iterable don't need to type check and cast in order to call {@link #setProperty(Name, Iterable...) the}
+     * {@link #setProperty(Name, Iterator...) appropriate} method.
+     * </p>
+     * 
+     * @param propertyName the name of the property
+     * @param values the property values
+     */
+    void setProperty( Name propertyName, Object... values );
+
+    /**
+     * Set the values for the named property. Any existing property values, if previously set, will be overwritten. If there are
+     * no property vlaues or if all of the property values are null, the property will be removed.
+     * 
+     * @param propertyName the name of the property
+     * @param values the iterable property values
+     */
+    void setProperty( Name propertyName, Iterable<?> values );
+
+    /**
+     * Set the values for the named property. Any existing property values, if previously set, will be overwritten. If there are
+     * no property vlaues or if all of the property values are null, the property will be removed.
+     * 
+     * @param propertyName the name of the property
+     * @param values the iterator over the property values
+     */
+    void setProperty( Name propertyName, Iterator<?> values );
+
+}

Deleted: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GraphCommand.java
===================================================================
--- branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GraphCommand.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GraphCommand.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -1,36 +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.graph.commands;
-
-/**
- * The base interface for all repository commands
- * @author Randall Hauch
- */
-public interface GraphCommand {
-
-    /**
-     * Return whether this command has been cancelled.
-     * @return true if this command has been cancelled, or false otherwise.
-     */
-    boolean isCancelled();
-
-}

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GraphCommand.java (from rev 219, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GraphCommand.java)
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GraphCommand.java	                        (rev 0)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GraphCommand.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,36 @@
+/*
+ * 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.graph.commands;
+
+/**
+ * The base interface for all repository commands
+ * @author Randall Hauch
+ */
+public interface GraphCommand {
+
+    /**
+     * Return whether this command has been cancelled.
+     * @return true if this command has been cancelled, or false otherwise.
+     */
+    boolean isCancelled();
+
+}

Deleted: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/MoveBranchCommand.java
===================================================================
--- branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/MoveBranchCommand.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/MoveBranchCommand.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -1,37 +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.graph.commands;
-
-import org.jboss.dna.spi.graph.Path;
-
-/**
- * Command that moves a branch from one path to another.
- * @author Randall Hauch
- */
-public interface MoveBranchCommand extends GraphCommand, ActsOnPath, ActsAsUpdate {
-
-    /**
-     * Get the new path to which the branch is to be moved.
-     * @return the new path; never null
-     */
-    Path getNewPath();
-}

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/MoveBranchCommand.java (from rev 219, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/MoveBranchCommand.java)
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/MoveBranchCommand.java	                        (rev 0)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/MoveBranchCommand.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,37 @@
+/*
+ * 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.graph.commands;
+
+import org.jboss.dna.spi.graph.Path;
+
+/**
+ * Command that moves a branch from one path to another.
+ * @author Randall Hauch
+ */
+public interface MoveBranchCommand extends GraphCommand, ActsOnPath, ActsAsUpdate {
+
+    /**
+     * Get the new path to which the branch is to be moved.
+     * @return the new path; never null
+     */
+    Path getNewPath();
+}

Deleted: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/SetPropertiesCommand.java
===================================================================
--- branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/SetPropertiesCommand.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/SetPropertiesCommand.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -1,30 +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.graph.commands;
-
-/**
- * A command to obtain from the source the properties for a single node given its path.
- * @author Randall Hauch
- */
-public interface SetPropertiesCommand extends GraphCommand, ActsOnPath, ActsOnProperties {
-
-}

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/SetPropertiesCommand.java (from rev 219, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/SetPropertiesCommand.java)
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/SetPropertiesCommand.java	                        (rev 0)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/SetPropertiesCommand.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,30 @@
+/*
+ * 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.graph.commands;
+
+/**
+ * A command to obtain from the source the properties for a single node given its path.
+ * @author Randall Hauch
+ */
+public interface SetPropertiesCommand extends GraphCommand, ActsOnPath, ActsOnProperties {
+
+}

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl (from rev 219, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl)

Deleted: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicCopyBranchCommand.java
===================================================================
--- branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicCopyBranchCommand.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicCopyBranchCommand.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -1,40 +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.graph.commands.impl;
-
-import org.jboss.dna.spi.graph.Path;
-import org.jboss.dna.spi.graph.commands.CopyBranchCommand;
-
-/**
- * @author Randall Hauch
- */
-public class BasicCopyBranchCommand extends BasicCopyNodeCommand implements CopyBranchCommand {
-
-    /**
-     * @param oldPath
-     * @param newPath
-     */
-    public BasicCopyBranchCommand( Path oldPath, Path newPath ) {
-        super(oldPath, newPath);
-    }
-
-}

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicCopyBranchCommand.java (from rev 219, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicCopyBranchCommand.java)
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicCopyBranchCommand.java	                        (rev 0)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicCopyBranchCommand.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,40 @@
+/*
+ * 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.graph.commands.impl;
+
+import org.jboss.dna.spi.graph.Path;
+import org.jboss.dna.spi.graph.commands.CopyBranchCommand;
+
+/**
+ * @author Randall Hauch
+ */
+public class BasicCopyBranchCommand extends BasicCopyNodeCommand implements CopyBranchCommand {
+
+    /**
+     * @param oldPath
+     * @param newPath
+     */
+    public BasicCopyBranchCommand( Path oldPath, Path newPath ) {
+        super(oldPath, newPath);
+    }
+
+}

Deleted: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicCopyNodeCommand.java
===================================================================
--- branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicCopyNodeCommand.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicCopyNodeCommand.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -1,63 +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.graph.commands.impl;
-
-import net.jcip.annotations.NotThreadSafe;
-import org.jboss.dna.spi.graph.Path;
-import org.jboss.dna.spi.graph.commands.CopyNodeCommand;
-
-/**
- * @author Randall Hauch
- */
- at NotThreadSafe
-public class BasicCopyNodeCommand extends BasicGraphCommand implements CopyNodeCommand {
-
-    private final Path oldPath;
-    private final Path newPath;
-
-    /**
-     * @param oldPath the path to the original; may not be null
-     * @param newPath the path to the copy; may not be null
-     */
-    public BasicCopyNodeCommand( Path oldPath, Path newPath ) {
-        super();
-        assert oldPath != null;
-        assert newPath != null;
-        this.oldPath = oldPath;
-        this.newPath = newPath;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Path getPath() {
-        return oldPath;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Path getNewPath() {
-        return newPath;
-    }
-
-}

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicCopyNodeCommand.java (from rev 219, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicCopyNodeCommand.java)
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicCopyNodeCommand.java	                        (rev 0)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicCopyNodeCommand.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,63 @@
+/*
+ * 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.graph.commands.impl;
+
+import net.jcip.annotations.NotThreadSafe;
+import org.jboss.dna.spi.graph.Path;
+import org.jboss.dna.spi.graph.commands.CopyNodeCommand;
+
+/**
+ * @author Randall Hauch
+ */
+ at NotThreadSafe
+public class BasicCopyNodeCommand extends BasicGraphCommand implements CopyNodeCommand {
+
+    private final Path oldPath;
+    private final Path newPath;
+
+    /**
+     * @param oldPath the path to the original; may not be null
+     * @param newPath the path to the copy; may not be null
+     */
+    public BasicCopyNodeCommand( Path oldPath, Path newPath ) {
+        super();
+        assert oldPath != null;
+        assert newPath != null;
+        this.oldPath = oldPath;
+        this.newPath = newPath;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Path getPath() {
+        return oldPath;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Path getNewPath() {
+        return newPath;
+    }
+
+}

Deleted: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicCreateNodeCommand.java
===================================================================
--- branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicCreateNodeCommand.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicCreateNodeCommand.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -1,96 +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.graph.commands.impl;
-
-import java.util.List;
-import net.jcip.annotations.NotThreadSafe;
-import org.jboss.dna.spi.cache.CachePolicy;
-import org.jboss.dna.spi.graph.Path;
-import org.jboss.dna.spi.graph.Property;
-import org.jboss.dna.spi.graph.commands.CreateNodeCommand;
-
-/**
- * @author Randall Hauch
- */
- at NotThreadSafe
-public class BasicCreateNodeCommand extends BasicGraphCommand implements CreateNodeCommand {
-
-    private final Path path;
-    private final List<Property> properties;
-    private CachePolicy cachePolicy;
-    private long timeLoaded;
-
-    /**
-     * @param path the path to the node; may not be null
-     * @param properties the properties of the node; may not be null
-     */
-    public BasicCreateNodeCommand( Path path, List<Property> properties ) {
-        super();
-        assert path != null;
-        assert properties != null;
-        this.properties = properties;
-        this.path = path;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Path getPath() {
-        return path;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Iterable<Property> getProperties() {
-        return properties;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public CachePolicy getCachePolicy() {
-        return cachePolicy;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public long getTimeLoaded() {
-        return timeLoaded;
-    }
-
-    /**
-     * @param timeLoaded Sets timeLoaded to the specified value.
-     */
-    public void setTimeLoaded( long timeLoaded ) {
-        this.timeLoaded = timeLoaded;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void setCachePolicy( CachePolicy cachePolicy ) {
-        this.cachePolicy = cachePolicy;
-    }
-
-}

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicCreateNodeCommand.java (from rev 219, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicCreateNodeCommand.java)
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicCreateNodeCommand.java	                        (rev 0)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicCreateNodeCommand.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,96 @@
+/*
+ * 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.graph.commands.impl;
+
+import java.util.List;
+import net.jcip.annotations.NotThreadSafe;
+import org.jboss.dna.spi.cache.CachePolicy;
+import org.jboss.dna.spi.graph.Path;
+import org.jboss.dna.spi.graph.Property;
+import org.jboss.dna.spi.graph.commands.CreateNodeCommand;
+
+/**
+ * @author Randall Hauch
+ */
+ at NotThreadSafe
+public class BasicCreateNodeCommand extends BasicGraphCommand implements CreateNodeCommand {
+
+    private final Path path;
+    private final List<Property> properties;
+    private CachePolicy cachePolicy;
+    private long timeLoaded;
+
+    /**
+     * @param path the path to the node; may not be null
+     * @param properties the properties of the node; may not be null
+     */
+    public BasicCreateNodeCommand( Path path, List<Property> properties ) {
+        super();
+        assert path != null;
+        assert properties != null;
+        this.properties = properties;
+        this.path = path;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Path getPath() {
+        return path;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Iterable<Property> getProperties() {
+        return properties;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public CachePolicy getCachePolicy() {
+        return cachePolicy;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public long getTimeLoaded() {
+        return timeLoaded;
+    }
+
+    /**
+     * @param timeLoaded Sets timeLoaded to the specified value.
+     */
+    public void setTimeLoaded( long timeLoaded ) {
+        this.timeLoaded = timeLoaded;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setCachePolicy( CachePolicy cachePolicy ) {
+        this.cachePolicy = cachePolicy;
+    }
+
+}

Deleted: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicDeleteBranchCommand.java
===================================================================
--- branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicDeleteBranchCommand.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicDeleteBranchCommand.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -1,52 +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.graph.commands.impl;
-
-import net.jcip.annotations.NotThreadSafe;
-import org.jboss.dna.spi.graph.Path;
-import org.jboss.dna.spi.graph.commands.DeleteBranchCommand;
-
-/**
- * @author Randall Hauch
- */
- at NotThreadSafe
-public class BasicDeleteBranchCommand extends BasicGraphCommand implements DeleteBranchCommand {
-
-    private final Path path;
-
-    /**
-     * @param path the path to the node; may not be null
-     */
-    public BasicDeleteBranchCommand( Path path ) {
-        super();
-        assert path != null;
-        this.path = path;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Path getPath() {
-        return path;
-    }
-
-}

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicDeleteBranchCommand.java (from rev 219, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicDeleteBranchCommand.java)
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicDeleteBranchCommand.java	                        (rev 0)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicDeleteBranchCommand.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,52 @@
+/*
+ * 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.graph.commands.impl;
+
+import net.jcip.annotations.NotThreadSafe;
+import org.jboss.dna.spi.graph.Path;
+import org.jboss.dna.spi.graph.commands.DeleteBranchCommand;
+
+/**
+ * @author Randall Hauch
+ */
+ at NotThreadSafe
+public class BasicDeleteBranchCommand extends BasicGraphCommand implements DeleteBranchCommand {
+
+    private final Path path;
+
+    /**
+     * @param path the path to the node; may not be null
+     */
+    public BasicDeleteBranchCommand( Path path ) {
+        super();
+        assert path != null;
+        this.path = path;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Path getPath() {
+        return path;
+    }
+
+}

Deleted: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicGetChildrenCommand.java
===================================================================
--- branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicGetChildrenCommand.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicGetChildrenCommand.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -1,131 +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.graph.commands.impl;
-
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import net.jcip.annotations.NotThreadSafe;
-import org.jboss.dna.spi.cache.CachePolicy;
-import org.jboss.dna.spi.graph.Name;
-import org.jboss.dna.spi.graph.Path;
-import org.jboss.dna.spi.graph.Path.Segment;
-import org.jboss.dna.spi.graph.commands.GetChildrenCommand;
-
-/**
- * @author Randall Hauch
- */
- at NotThreadSafe
-public class BasicGetChildrenCommand extends BasicGraphCommand implements GetChildrenCommand {
-
-    private List<Segment> children;
-    private final Path path;
-    private CachePolicy cachePolicy;
-    private long timeLoaded;
-
-    /**
-     * @param path the path to the node; may not be null
-     */
-    public BasicGetChildrenCommand( Path path ) {
-        super();
-        assert path != null;
-        this.path = path;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void setChild( Name nameOfChild ) {
-        children = createChildrenList(nameOfChild);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void setChildren( Iterator<Segment> namesOfChildren ) {
-        children = createChildrenList(namesOfChildren);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void setChildren( Iterable<Segment> namesOfChildren ) {
-        children = createChildrenList(namesOfChildren);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void setChildren( Segment... namesOfChildren ) {
-        children = createChildrenList(namesOfChildren);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void setNoChildren() {
-        children = Collections.emptyList();
-    }
-
-    /**
-     * @return children
-     */
-    public List<Segment> getChildren() {
-        return this.children;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Path getPath() {
-        return path;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public CachePolicy getCachePolicy() {
-        return cachePolicy;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public long getTimeLoaded() {
-        return timeLoaded;
-    }
-
-    /**
-     * @param timeLoaded Sets timeLoaded to the specified value.
-     */
-    public void setTimeLoaded( long timeLoaded ) {
-        this.timeLoaded = timeLoaded;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void setCachePolicy( CachePolicy cachePolicy ) {
-        this.cachePolicy = cachePolicy;
-    }
-
-}

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicGetChildrenCommand.java (from rev 219, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicGetChildrenCommand.java)
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicGetChildrenCommand.java	                        (rev 0)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicGetChildrenCommand.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,131 @@
+/*
+ * 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.graph.commands.impl;
+
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import net.jcip.annotations.NotThreadSafe;
+import org.jboss.dna.spi.cache.CachePolicy;
+import org.jboss.dna.spi.graph.Name;
+import org.jboss.dna.spi.graph.Path;
+import org.jboss.dna.spi.graph.Path.Segment;
+import org.jboss.dna.spi.graph.commands.GetChildrenCommand;
+
+/**
+ * @author Randall Hauch
+ */
+ at NotThreadSafe
+public class BasicGetChildrenCommand extends BasicGraphCommand implements GetChildrenCommand {
+
+    private List<Segment> children;
+    private final Path path;
+    private CachePolicy cachePolicy;
+    private long timeLoaded;
+
+    /**
+     * @param path the path to the node; may not be null
+     */
+    public BasicGetChildrenCommand( Path path ) {
+        super();
+        assert path != null;
+        this.path = path;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setChild( Name nameOfChild ) {
+        children = createChildrenList(nameOfChild);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setChildren( Iterator<Segment> namesOfChildren ) {
+        children = createChildrenList(namesOfChildren);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setChildren( Iterable<Segment> namesOfChildren ) {
+        children = createChildrenList(namesOfChildren);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setChildren( Segment... namesOfChildren ) {
+        children = createChildrenList(namesOfChildren);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setNoChildren() {
+        children = Collections.emptyList();
+    }
+
+    /**
+     * @return children
+     */
+    public List<Segment> getChildren() {
+        return this.children;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Path getPath() {
+        return path;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public CachePolicy getCachePolicy() {
+        return cachePolicy;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public long getTimeLoaded() {
+        return timeLoaded;
+    }
+
+    /**
+     * @param timeLoaded Sets timeLoaded to the specified value.
+     */
+    public void setTimeLoaded( long timeLoaded ) {
+        this.timeLoaded = timeLoaded;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setCachePolicy( CachePolicy cachePolicy ) {
+        this.cachePolicy = cachePolicy;
+    }
+
+}

Deleted: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicGetNodeCommand.java
===================================================================
--- branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicGetNodeCommand.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicGetNodeCommand.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -1,111 +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.graph.commands.impl;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import net.jcip.annotations.NotThreadSafe;
-import org.jboss.dna.spi.graph.Name;
-import org.jboss.dna.spi.graph.Path;
-import org.jboss.dna.spi.graph.Path.Segment;
-import org.jboss.dna.spi.graph.commands.GetNodeCommand;
-import org.jboss.dna.spi.graph.impl.BasicPathSegment;
-
-/**
- * @author Randall Hauch
- */
- at NotThreadSafe
-public class BasicGetNodeCommand extends BasicGetPropertiesCommand implements GetNodeCommand {
-
-    private List<Segment> children;
-
-    /**
-     * @param path
-     */
-    public BasicGetNodeCommand( Path path ) {
-        super(path);
-
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void setChild( Name nameOfChild ) {
-        if (nameOfChild == null) {
-            children = Collections.emptyList();
-        } else {
-            children = Collections.singletonList((Segment)new BasicPathSegment(nameOfChild));
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void setChildren( Iterator<Segment> namesOfChildren ) {
-        if (namesOfChildren == null) {
-            children = Collections.emptyList();
-        } else {
-            children = new ArrayList<Segment>();
-            while (namesOfChildren.hasNext()) {
-                children.add(namesOfChildren.next());
-            }
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void setChildren( Iterable<Segment> namesOfChildren ) {
-        if (namesOfChildren == null) {
-            children = Collections.emptyList();
-        } else {
-            children = new ArrayList<Segment>();
-            for (Segment childSegment : namesOfChildren) {
-                children.add(childSegment);
-            }
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void setChildren( Segment... namesOfChildren ) {
-        if (namesOfChildren == null || namesOfChildren.length == 0) {
-            children = Collections.emptyList();
-        } else {
-            children = new ArrayList<Segment>();
-            for (Segment childSegment : namesOfChildren) {
-                children.add(childSegment);
-            }
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void setNoChildren() {
-        children = Collections.emptyList();
-    }
-
-}

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicGetNodeCommand.java (from rev 219, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicGetNodeCommand.java)
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicGetNodeCommand.java	                        (rev 0)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicGetNodeCommand.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,111 @@
+/*
+ * 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.graph.commands.impl;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import net.jcip.annotations.NotThreadSafe;
+import org.jboss.dna.spi.graph.Name;
+import org.jboss.dna.spi.graph.Path;
+import org.jboss.dna.spi.graph.Path.Segment;
+import org.jboss.dna.spi.graph.commands.GetNodeCommand;
+import org.jboss.dna.spi.graph.impl.BasicPathSegment;
+
+/**
+ * @author Randall Hauch
+ */
+ at NotThreadSafe
+public class BasicGetNodeCommand extends BasicGetPropertiesCommand implements GetNodeCommand {
+
+    private List<Segment> children;
+
+    /**
+     * @param path
+     */
+    public BasicGetNodeCommand( Path path ) {
+        super(path);
+
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setChild( Name nameOfChild ) {
+        if (nameOfChild == null) {
+            children = Collections.emptyList();
+        } else {
+            children = Collections.singletonList((Segment)new BasicPathSegment(nameOfChild));
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setChildren( Iterator<Segment> namesOfChildren ) {
+        if (namesOfChildren == null) {
+            children = Collections.emptyList();
+        } else {
+            children = new ArrayList<Segment>();
+            while (namesOfChildren.hasNext()) {
+                children.add(namesOfChildren.next());
+            }
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setChildren( Iterable<Segment> namesOfChildren ) {
+        if (namesOfChildren == null) {
+            children = Collections.emptyList();
+        } else {
+            children = new ArrayList<Segment>();
+            for (Segment childSegment : namesOfChildren) {
+                children.add(childSegment);
+            }
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setChildren( Segment... namesOfChildren ) {
+        if (namesOfChildren == null || namesOfChildren.length == 0) {
+            children = Collections.emptyList();
+        } else {
+            children = new ArrayList<Segment>();
+            for (Segment childSegment : namesOfChildren) {
+                children.add(childSegment);
+            }
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setNoChildren() {
+        children = Collections.emptyList();
+    }
+
+}

Deleted: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicGetPropertiesCommand.java
===================================================================
--- branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicGetPropertiesCommand.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicGetPropertiesCommand.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -1,119 +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.graph.commands.impl;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import net.jcip.annotations.NotThreadSafe;
-import org.jboss.dna.spi.cache.CachePolicy;
-import org.jboss.dna.spi.graph.Name;
-import org.jboss.dna.spi.graph.Path;
-import org.jboss.dna.spi.graph.commands.GetPropertiesCommand;
-
-/**
- * @author Randall Hauch
- */
- at NotThreadSafe
-public class BasicGetPropertiesCommand extends BasicGraphCommand implements GetPropertiesCommand {
-
-    private final Map<Name, List<Object>> propertyValues = new HashMap<Name, List<Object>>();
-    private final Path path;
-    private CachePolicy cachePolicy;
-    private long timeLoaded;
-
-    /**
-     * @param path the path to the node; may not be null
-     */
-    public BasicGetPropertiesCommand( Path path ) {
-        super();
-        assert path != null;
-        this.path = path;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void setProperty( Name propertyName, Object... values ) {
-        setProperty(propertyValues, propertyName, values);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void setProperty( Name propertyName, Iterable<?> values ) {
-        setProperty(propertyValues, propertyName, values);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void setProperty( Name propertyName, Iterator<?> values ) {
-        setProperty(propertyValues, propertyName, values);
-    }
-
-    /**
-     * Get the property values that were added to the command
-     * 
-     * @return the map of property name to values
-     */
-    public Map<Name, List<Object>> getPropertyValues() {
-        return this.propertyValues;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Path getPath() {
-        return path;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public CachePolicy getCachePolicy() {
-        return cachePolicy;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public long getTimeLoaded() {
-        return timeLoaded;
-    }
-
-    /**
-     * @param timeLoaded Sets timeLoaded to the specified value.
-     */
-    public void setTimeLoaded( long timeLoaded ) {
-        this.timeLoaded = timeLoaded;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void setCachePolicy( CachePolicy cachePolicy ) {
-        this.cachePolicy = cachePolicy;
-    }
-
-}

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicGetPropertiesCommand.java (from rev 219, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicGetPropertiesCommand.java)
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicGetPropertiesCommand.java	                        (rev 0)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicGetPropertiesCommand.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,119 @@
+/*
+ * 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.graph.commands.impl;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import net.jcip.annotations.NotThreadSafe;
+import org.jboss.dna.spi.cache.CachePolicy;
+import org.jboss.dna.spi.graph.Name;
+import org.jboss.dna.spi.graph.Path;
+import org.jboss.dna.spi.graph.commands.GetPropertiesCommand;
+
+/**
+ * @author Randall Hauch
+ */
+ at NotThreadSafe
+public class BasicGetPropertiesCommand extends BasicGraphCommand implements GetPropertiesCommand {
+
+    private final Map<Name, List<Object>> propertyValues = new HashMap<Name, List<Object>>();
+    private final Path path;
+    private CachePolicy cachePolicy;
+    private long timeLoaded;
+
+    /**
+     * @param path the path to the node; may not be null
+     */
+    public BasicGetPropertiesCommand( Path path ) {
+        super();
+        assert path != null;
+        this.path = path;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setProperty( Name propertyName, Object... values ) {
+        setProperty(propertyValues, propertyName, values);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setProperty( Name propertyName, Iterable<?> values ) {
+        setProperty(propertyValues, propertyName, values);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setProperty( Name propertyName, Iterator<?> values ) {
+        setProperty(propertyValues, propertyName, values);
+    }
+
+    /**
+     * Get the property values that were added to the command
+     * 
+     * @return the map of property name to values
+     */
+    public Map<Name, List<Object>> getPropertyValues() {
+        return this.propertyValues;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Path getPath() {
+        return path;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public CachePolicy getCachePolicy() {
+        return cachePolicy;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public long getTimeLoaded() {
+        return timeLoaded;
+    }
+
+    /**
+     * @param timeLoaded Sets timeLoaded to the specified value.
+     */
+    public void setTimeLoaded( long timeLoaded ) {
+        this.timeLoaded = timeLoaded;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setCachePolicy( CachePolicy cachePolicy ) {
+        this.cachePolicy = cachePolicy;
+    }
+
+}

Deleted: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicGraphCommand.java
===================================================================
--- branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicGraphCommand.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicGraphCommand.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -1,163 +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.graph.commands.impl;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import net.jcip.annotations.NotThreadSafe;
-import org.jboss.dna.spi.graph.Name;
-import org.jboss.dna.spi.graph.Path.Segment;
-import org.jboss.dna.spi.graph.commands.GraphCommand;
-import org.jboss.dna.spi.graph.impl.BasicPathSegment;
-
-/**
- * @author Randall Hauch
- */
- at NotThreadSafe
-public abstract class BasicGraphCommand implements GraphCommand {
-
-    private boolean cancelled = false;
-
-    /**
-     * 
-     */
-    public BasicGraphCommand() {
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean isCancelled() {
-        return cancelled;
-    }
-
-    /**
-     * @param cancelled Sets cancelled to the specified value.
-     */
-    public void setCancelled( boolean cancelled ) {
-        this.cancelled = cancelled;
-    }
-
-    // ----------------------------------------------------------------------------------------------------------------
-    // Utility methods used by concrete command implementations
-    // ----------------------------------------------------------------------------------------------------------------
-
-    protected List<Segment> createChildrenList( Name nameOfChild ) {
-        if (nameOfChild == null) {
-            return Collections.emptyList();
-        }
-        return Collections.singletonList((Segment)new BasicPathSegment(nameOfChild));
-    }
-
-    protected List<Segment> createChildrenList( Iterator<Segment> namesOfChildren ) {
-        if (namesOfChildren == null) {
-            return Collections.emptyList();
-        }
-        List<Segment> children = new ArrayList<Segment>();
-        while (namesOfChildren.hasNext()) {
-            children.add(namesOfChildren.next());
-        }
-        return children;
-    }
-
-    protected List<Segment> createChildrenList( Iterable<Segment> namesOfChildren ) {
-        if (namesOfChildren == null) {
-            return Collections.emptyList();
-        }
-        List<Segment> children = new ArrayList<Segment>();
-        for (Segment childSegment : namesOfChildren) {
-            children.add(childSegment);
-        }
-        return children;
-    }
-
-    protected static List<Segment> createChildrenList( Segment... namesOfChildren ) {
-        if (namesOfChildren == null || namesOfChildren.length == 0) {
-            return Collections.emptyList();
-        }
-        List<Segment> children = new ArrayList<Segment>();
-        for (Segment childSegment : namesOfChildren) {
-            children.add(childSegment);
-        }
-        return children;
-    }
-
-    protected static void setProperty( Map<Name, List<Object>> propertyValues, Name propertyName, Object... values ) {
-        if (values == null || values.length == 0) {
-            propertyValues.remove(propertyName);
-        } else {
-            List<Object> valuesList = null;
-            if (values.length == 1) {
-                Object value = values[0];
-                if (value instanceof Collection<?>) {
-                    setProperty(propertyValues, propertyName, ((Collection<?>)value).iterator());
-                    return;
-                } else if (value instanceof Iterable<?>) {
-                    setProperty(propertyValues, propertyName, (Iterable<?>)value);
-                    return;
-                } else if (value instanceof Iterator<?>) {
-                    setProperty(propertyValues, propertyName, (Iterator<?>)value);
-                    return;
-                }
-                // Otherwise, single object is just a normal value ...
-                valuesList = Collections.singletonList(value);
-            } else {
-                assert values.length > 1;
-                valuesList = new ArrayList<Object>(values.length);
-                for (Object arrayValue : values) {
-                    valuesList.add(arrayValue);
-                }
-            }
-            propertyValues.put(propertyName, valuesList);
-        }
-    }
-
-    protected static void setProperty( Map<Name, List<Object>> propertyValues, Name propertyName, Iterable<?> values ) {
-        if (values == null) {
-            propertyValues.remove(propertyName);
-        } else {
-            List<Object> valuesList = new ArrayList<Object>();
-            for (Object value : values) {
-                valuesList.add(value);
-            }
-            propertyValues.put(propertyName, valuesList);
-        }
-    }
-
-    protected static void setProperty( Map<Name, List<Object>> propertyValues, Name propertyName, Iterator<?> values ) {
-        if (values == null) {
-            propertyValues.remove(propertyName);
-        } else {
-            List<Object> valuesList = new ArrayList<Object>();
-            while (values.hasNext()) {
-                Object value = values.next();
-                valuesList.add(value);
-            }
-            propertyValues.put(propertyName, valuesList);
-        }
-    }
-
-}

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicGraphCommand.java (from rev 219, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicGraphCommand.java)
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicGraphCommand.java	                        (rev 0)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicGraphCommand.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,163 @@
+/*
+ * 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.graph.commands.impl;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import net.jcip.annotations.NotThreadSafe;
+import org.jboss.dna.spi.graph.Name;
+import org.jboss.dna.spi.graph.Path.Segment;
+import org.jboss.dna.spi.graph.commands.GraphCommand;
+import org.jboss.dna.spi.graph.impl.BasicPathSegment;
+
+/**
+ * @author Randall Hauch
+ */
+ at NotThreadSafe
+public abstract class BasicGraphCommand implements GraphCommand {
+
+    private boolean cancelled = false;
+
+    /**
+     * 
+     */
+    public BasicGraphCommand() {
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isCancelled() {
+        return cancelled;
+    }
+
+    /**
+     * @param cancelled Sets cancelled to the specified value.
+     */
+    public void setCancelled( boolean cancelled ) {
+        this.cancelled = cancelled;
+    }
+
+    // ----------------------------------------------------------------------------------------------------------------
+    // Utility methods used by concrete command implementations
+    // ----------------------------------------------------------------------------------------------------------------
+
+    protected List<Segment> createChildrenList( Name nameOfChild ) {
+        if (nameOfChild == null) {
+            return Collections.emptyList();
+        }
+        return Collections.singletonList((Segment)new BasicPathSegment(nameOfChild));
+    }
+
+    protected List<Segment> createChildrenList( Iterator<Segment> namesOfChildren ) {
+        if (namesOfChildren == null) {
+            return Collections.emptyList();
+        }
+        List<Segment> children = new ArrayList<Segment>();
+        while (namesOfChildren.hasNext()) {
+            children.add(namesOfChildren.next());
+        }
+        return children;
+    }
+
+    protected List<Segment> createChildrenList( Iterable<Segment> namesOfChildren ) {
+        if (namesOfChildren == null) {
+            return Collections.emptyList();
+        }
+        List<Segment> children = new ArrayList<Segment>();
+        for (Segment childSegment : namesOfChildren) {
+            children.add(childSegment);
+        }
+        return children;
+    }
+
+    protected static List<Segment> createChildrenList( Segment... namesOfChildren ) {
+        if (namesOfChildren == null || namesOfChildren.length == 0) {
+            return Collections.emptyList();
+        }
+        List<Segment> children = new ArrayList<Segment>();
+        for (Segment childSegment : namesOfChildren) {
+            children.add(childSegment);
+        }
+        return children;
+    }
+
+    protected static void setProperty( Map<Name, List<Object>> propertyValues, Name propertyName, Object... values ) {
+        if (values == null || values.length == 0) {
+            propertyValues.remove(propertyName);
+        } else {
+            List<Object> valuesList = null;
+            if (values.length == 1) {
+                Object value = values[0];
+                if (value instanceof Collection<?>) {
+                    setProperty(propertyValues, propertyName, ((Collection<?>)value).iterator());
+                    return;
+                } else if (value instanceof Iterable<?>) {
+                    setProperty(propertyValues, propertyName, (Iterable<?>)value);
+                    return;
+                } else if (value instanceof Iterator<?>) {
+                    setProperty(propertyValues, propertyName, (Iterator<?>)value);
+                    return;
+                }
+                // Otherwise, single object is just a normal value ...
+                valuesList = Collections.singletonList(value);
+            } else {
+                assert values.length > 1;
+                valuesList = new ArrayList<Object>(values.length);
+                for (Object arrayValue : values) {
+                    valuesList.add(arrayValue);
+                }
+            }
+            propertyValues.put(propertyName, valuesList);
+        }
+    }
+
+    protected static void setProperty( Map<Name, List<Object>> propertyValues, Name propertyName, Iterable<?> values ) {
+        if (values == null) {
+            propertyValues.remove(propertyName);
+        } else {
+            List<Object> valuesList = new ArrayList<Object>();
+            for (Object value : values) {
+                valuesList.add(value);
+            }
+            propertyValues.put(propertyName, valuesList);
+        }
+    }
+
+    protected static void setProperty( Map<Name, List<Object>> propertyValues, Name propertyName, Iterator<?> values ) {
+        if (values == null) {
+            propertyValues.remove(propertyName);
+        } else {
+            List<Object> valuesList = new ArrayList<Object>();
+            while (values.hasNext()) {
+                Object value = values.next();
+                valuesList.add(value);
+            }
+            propertyValues.put(propertyName, valuesList);
+        }
+    }
+
+}

Deleted: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicMoveBranchCommand.java
===================================================================
--- branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicMoveBranchCommand.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicMoveBranchCommand.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -1,63 +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.graph.commands.impl;
-
-import net.jcip.annotations.NotThreadSafe;
-import org.jboss.dna.spi.graph.Path;
-import org.jboss.dna.spi.graph.commands.MoveBranchCommand;
-
-/**
- * @author Randall Hauch
- */
- at NotThreadSafe
-public class BasicMoveBranchCommand extends BasicGraphCommand implements MoveBranchCommand {
-
-    private final Path oldPath;
-    private final Path newPath;
-
-    /**
-     * @param oldPath the path to the original; may not be null
-     * @param newPath the path to the new location; may not be null
-     */
-    public BasicMoveBranchCommand( Path oldPath, Path newPath ) {
-        super();
-        assert oldPath != null;
-        assert newPath != null;
-        this.oldPath = oldPath;
-        this.newPath = newPath;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Path getPath() {
-        return oldPath;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Path getNewPath() {
-        return newPath;
-    }
-
-}

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicMoveBranchCommand.java (from rev 219, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicMoveBranchCommand.java)
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicMoveBranchCommand.java	                        (rev 0)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicMoveBranchCommand.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,63 @@
+/*
+ * 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.graph.commands.impl;
+
+import net.jcip.annotations.NotThreadSafe;
+import org.jboss.dna.spi.graph.Path;
+import org.jboss.dna.spi.graph.commands.MoveBranchCommand;
+
+/**
+ * @author Randall Hauch
+ */
+ at NotThreadSafe
+public class BasicMoveBranchCommand extends BasicGraphCommand implements MoveBranchCommand {
+
+    private final Path oldPath;
+    private final Path newPath;
+
+    /**
+     * @param oldPath the path to the original; may not be null
+     * @param newPath the path to the new location; may not be null
+     */
+    public BasicMoveBranchCommand( Path oldPath, Path newPath ) {
+        super();
+        assert oldPath != null;
+        assert newPath != null;
+        this.oldPath = oldPath;
+        this.newPath = newPath;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Path getPath() {
+        return oldPath;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Path getNewPath() {
+        return newPath;
+    }
+
+}

Deleted: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicSetPropertiesCommand.java
===================================================================
--- branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicSetPropertiesCommand.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicSetPropertiesCommand.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -1,96 +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.graph.commands.impl;
-
-import java.util.List;
-import net.jcip.annotations.NotThreadSafe;
-import org.jboss.dna.spi.cache.CachePolicy;
-import org.jboss.dna.spi.graph.Path;
-import org.jboss.dna.spi.graph.Property;
-import org.jboss.dna.spi.graph.commands.SetPropertiesCommand;
-
-/**
- * @author Randall Hauch
- */
- at NotThreadSafe
-public class BasicSetPropertiesCommand extends BasicGraphCommand implements SetPropertiesCommand {
-
-    private final Path path;
-    private final List<Property> properties;
-    private CachePolicy cachePolicy;
-    private long timeLoaded;
-
-    /**
-     * @param path the path to the node; may not be null
-     * @param properties the properties of the node; may not be null
-     */
-    public BasicSetPropertiesCommand( Path path, List<Property> properties ) {
-        super();
-        assert path != null;
-        assert properties != null;
-        this.properties = properties;
-        this.path = path;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Path getPath() {
-        return path;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Iterable<Property> getProperties() {
-        return properties;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public CachePolicy getCachePolicy() {
-        return cachePolicy;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public long getTimeLoaded() {
-        return timeLoaded;
-    }
-
-    /**
-     * @param timeLoaded Sets timeLoaded to the specified value.
-     */
-    public void setTimeLoaded( long timeLoaded ) {
-        this.timeLoaded = timeLoaded;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void setCachePolicy( CachePolicy cachePolicy ) {
-        this.cachePolicy = cachePolicy;
-    }
-
-}

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicSetPropertiesCommand.java (from rev 219, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicSetPropertiesCommand.java)
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicSetPropertiesCommand.java	                        (rev 0)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/impl/BasicSetPropertiesCommand.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,96 @@
+/*
+ * 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.graph.commands.impl;
+
+import java.util.List;
+import net.jcip.annotations.NotThreadSafe;
+import org.jboss.dna.spi.cache.CachePolicy;
+import org.jboss.dna.spi.graph.Path;
+import org.jboss.dna.spi.graph.Property;
+import org.jboss.dna.spi.graph.commands.SetPropertiesCommand;
+
+/**
+ * @author Randall Hauch
+ */
+ at NotThreadSafe
+public class BasicSetPropertiesCommand extends BasicGraphCommand implements SetPropertiesCommand {
+
+    private final Path path;
+    private final List<Property> properties;
+    private CachePolicy cachePolicy;
+    private long timeLoaded;
+
+    /**
+     * @param path the path to the node; may not be null
+     * @param properties the properties of the node; may not be null
+     */
+    public BasicSetPropertiesCommand( Path path, List<Property> properties ) {
+        super();
+        assert path != null;
+        assert properties != null;
+        this.properties = properties;
+        this.path = path;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Path getPath() {
+        return path;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Iterable<Property> getProperties() {
+        return properties;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public CachePolicy getCachePolicy() {
+        return cachePolicy;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public long getTimeLoaded() {
+        return timeLoaded;
+    }
+
+    /**
+     * @param timeLoaded Sets timeLoaded to the specified value.
+     */
+    public void setTimeLoaded( long timeLoaded ) {
+        this.timeLoaded = timeLoaded;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setCachePolicy( CachePolicy cachePolicy ) {
+        this.cachePolicy = cachePolicy;
+    }
+
+}

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection (from rev 219, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection)

Deleted: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/ExecutionEnvironment.java
===================================================================
--- branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/ExecutionEnvironment.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/ExecutionEnvironment.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -1,62 +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.graph.connection;
-
-import org.jboss.dna.spi.graph.NamespaceRegistry;
-import org.jboss.dna.spi.graph.Property;
-import org.jboss.dna.spi.graph.PropertyFactory;
-import org.jboss.dna.spi.graph.ValueFactories;
-
-/**
- * @author Randall Hauch
- */
-public interface ExecutionEnvironment {
-
-    /**
-     * Get the factories that should be used to create values for {@link Property properties}.
-     * 
-     * @return the property value factory; never null
-     */
-    ValueFactories getValueFactories();
-
-    /**
-     * Get the namespace registry for this environment.
-     * 
-     * @return the namespace registry; never null
-     */
-    NamespaceRegistry getNamespaceRegistry();
-
-    /**
-     * Return the repository source against which this environment applies.
-     * 
-     * @return the repository source; never null
-     */
-    RepositorySource getRepositorySource();
-
-    /**
-     * Get the factory for creating {@link Property} objects.
-     * 
-     * @return the property factory; never null
-     */
-    PropertyFactory getPropertyFactory();
-
-}

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/ExecutionEnvironment.java (from rev 219, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/ExecutionEnvironment.java)
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/ExecutionEnvironment.java	                        (rev 0)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/ExecutionEnvironment.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,62 @@
+/*
+ * 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.graph.connection;
+
+import org.jboss.dna.spi.graph.NamespaceRegistry;
+import org.jboss.dna.spi.graph.Property;
+import org.jboss.dna.spi.graph.PropertyFactory;
+import org.jboss.dna.spi.graph.ValueFactories;
+
+/**
+ * @author Randall Hauch
+ */
+public interface ExecutionEnvironment {
+
+    /**
+     * Get the factories that should be used to create values for {@link Property properties}.
+     * 
+     * @return the property value factory; never null
+     */
+    ValueFactories getValueFactories();
+
+    /**
+     * Get the namespace registry for this environment.
+     * 
+     * @return the namespace registry; never null
+     */
+    NamespaceRegistry getNamespaceRegistry();
+
+    /**
+     * Return the repository source against which this environment applies.
+     * 
+     * @return the repository source; never null
+     */
+    RepositorySource getRepositorySource();
+
+    /**
+     * Get the factory for creating {@link Property} objects.
+     * 
+     * @return the property factory; never null
+     */
+    PropertyFactory getPropertyFactory();
+
+}

Deleted: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryConnection.java
===================================================================
--- branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryConnection.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryConnection.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -1,81 +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.graph.connection;
-
-import java.util.concurrent.TimeUnit;
-import javax.transaction.xa.XAResource;
-import org.jboss.dna.spi.graph.commands.GraphCommand;
-
-/**
- * A connection to a repository source.
- * <p>
- * These connections need not support concurrent operations by multiple threads, since the federation engine never uses them this
- * way.
- * </p>
- * @author Randall Hauch
- */
-public interface RepositoryConnection {
-
-    /**
-     * Get the name for this repository source. This value should be the same as that {@link RepositorySource#getName() returned}
-     * by the same {@link RepositorySource} that created this connection.
-     * @return the identifier; never null or empty
-     */
-    String getSourceName();
-
-    /**
-     * Return the transactional resource associated with this connection. The transaction manager will use this resource to manage
-     * the participation of this connection in a distributed transaction.
-     * @return the XA resource, or null if this connection is not aware of distributed transactions
-     */
-    XAResource getXAResource();
-
-    /**
-     * Ping the underlying system to determine if the connection is still valid and alive.
-     * @param time the length of time to wait before timing out
-     * @param unit the time unit to use; may not be null
-     * @return true if this connection is still valid and can still be used, or false otherwise
-     * @throws InterruptedException if the thread has been interrupted during the operation
-     */
-    boolean ping( long time, TimeUnit unit ) throws InterruptedException;
-
-    /**
-     * Set the listener that is to receive notifications to changes to content within this source.
-     * @param listener the new listener, or null if no component is interested in the change notifications
-     */
-    void setListener( RepositorySourceListener listener );
-
-    /**
-     * Execute the supplied commands against this repository source.
-     * @param env the environment in which the commands are being executed; never null
-     * @param commands the commands to be executed; never null
-     * @throws RepositorySourceException if there is a problem loading the node data
-     * @throws InterruptedException if the thread has been interrupted during the operation
-     */
-    void execute( ExecutionEnvironment env, GraphCommand... commands ) throws RepositorySourceException, InterruptedException;
-
-    /**
-     * Close this connection to signal that it is no longer needed and that any accumulated resources are to be released.
-     * @throws InterruptedException if the thread has been interrupted while the close was in progress
-     */
-    void close() throws InterruptedException;
-}

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryConnection.java (from rev 219, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryConnection.java)
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryConnection.java	                        (rev 0)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryConnection.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,81 @@
+/*
+ * 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.graph.connection;
+
+import java.util.concurrent.TimeUnit;
+import javax.transaction.xa.XAResource;
+import org.jboss.dna.spi.graph.commands.GraphCommand;
+
+/**
+ * A connection to a repository source.
+ * <p>
+ * These connections need not support concurrent operations by multiple threads, since the federation engine never uses them this
+ * way.
+ * </p>
+ * @author Randall Hauch
+ */
+public interface RepositoryConnection {
+
+    /**
+     * Get the name for this repository source. This value should be the same as that {@link RepositorySource#getName() returned}
+     * by the same {@link RepositorySource} that created this connection.
+     * @return the identifier; never null or empty
+     */
+    String getSourceName();
+
+    /**
+     * Return the transactional resource associated with this connection. The transaction manager will use this resource to manage
+     * the participation of this connection in a distributed transaction.
+     * @return the XA resource, or null if this connection is not aware of distributed transactions
+     */
+    XAResource getXAResource();
+
+    /**
+     * Ping the underlying system to determine if the connection is still valid and alive.
+     * @param time the length of time to wait before timing out
+     * @param unit the time unit to use; may not be null
+     * @return true if this connection is still valid and can still be used, or false otherwise
+     * @throws InterruptedException if the thread has been interrupted during the operation
+     */
+    boolean ping( long time, TimeUnit unit ) throws InterruptedException;
+
+    /**
+     * Set the listener that is to receive notifications to changes to content within this source.
+     * @param listener the new listener, or null if no component is interested in the change notifications
+     */
+    void setListener( RepositorySourceListener listener );
+
+    /**
+     * Execute the supplied commands against this repository source.
+     * @param env the environment in which the commands are being executed; never null
+     * @param commands the commands to be executed; never null
+     * @throws RepositorySourceException if there is a problem loading the node data
+     * @throws InterruptedException if the thread has been interrupted during the operation
+     */
+    void execute( ExecutionEnvironment env, GraphCommand... commands ) throws RepositorySourceException, InterruptedException;
+
+    /**
+     * Close this connection to signal that it is no longer needed and that any accumulated resources are to be released.
+     * @throws InterruptedException if the thread has been interrupted while the close was in progress
+     */
+    void close() throws InterruptedException;
+}

Deleted: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryConnectionFactory.java
===================================================================
--- branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryConnectionFactory.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryConnectionFactory.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -1,43 +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.graph.connection;
-
-/**
- * @author Randall Hauch
- */
-public interface RepositoryConnectionFactory {
-
-    /**
-     * Get the name for this repository source.
-     * @return the name; never null or empty
-     */
-    String getName();
-
-    /**
-     * Get a connection from this factory.
-     * @return a connection
-     * @throws RepositorySourceException if there is a problem obtaining a connection
-     * @throws InterruptedException if the thread is interrupted while attempting to get a connection
-     * @throws IllegalStateException if the factory is not in a state to create or return connections
-     */
-    RepositoryConnection getConnection() throws RepositorySourceException, InterruptedException;
-}

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryConnectionFactory.java (from rev 219, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryConnectionFactory.java)
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryConnectionFactory.java	                        (rev 0)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryConnectionFactory.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,43 @@
+/*
+ * 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.graph.connection;
+
+/**
+ * @author Randall Hauch
+ */
+public interface RepositoryConnectionFactory {
+
+    /**
+     * Get the name for this repository source.
+     * @return the name; never null or empty
+     */
+    String getName();
+
+    /**
+     * Get a connection from this factory.
+     * @return a connection
+     * @throws RepositorySourceException if there is a problem obtaining a connection
+     * @throws InterruptedException if the thread is interrupted while attempting to get a connection
+     * @throws IllegalStateException if the factory is not in a state to create or return connections
+     */
+    RepositoryConnection getConnection() throws RepositorySourceException, InterruptedException;
+}

Deleted: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryConnectionPool.java
===================================================================
--- branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryConnectionPool.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryConnectionPool.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -1,994 +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.graph.connection;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.Callable;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.concurrent.locks.Condition;
-import java.util.concurrent.locks.ReentrantLock;
-import javax.transaction.xa.XAResource;
-import net.jcip.annotations.GuardedBy;
-import net.jcip.annotations.ThreadSafe;
-import org.jboss.dna.common.util.ArgCheck;
-import org.jboss.dna.common.util.LogContext;
-import org.jboss.dna.common.util.Logger;
-import org.jboss.dna.spi.SpiI18n;
-import org.jboss.dna.spi.graph.commands.GraphCommand;
-
-/**
- * @author Randall Hauch
- */
- at ThreadSafe
-public class RepositoryConnectionPool implements RepositoryConnectionFactory {
-
-    /**
-     * Permission for checking shutdown
-     */
-    private static final RuntimePermission shutdownPerm = new RuntimePermission("modifyThread");
-
-    /**
-     * The factory that this pool uses to create new connections.
-     */
-    private final RepositoryConnectionFactory connectionFactory;
-
-    /**
-     * Lock held on updates to poolSize, corePoolSize, maximumPoolSize, and workers set.
-     */
-    private final ReentrantLock mainLock = new ReentrantLock();
-
-    /**
-     * Wait condition to support awaitTermination
-     */
-    private final Condition termination = mainLock.newCondition();
-
-    /**
-     * Set containing all connections that are available for use.
-     */
-    @GuardedBy( "mainLock" )
-    private final BlockingQueue<ConnectionWrapper> availableConnections = new LinkedBlockingQueue<ConnectionWrapper>();
-
-    /**
-     * The connections that are currently in use.
-     */
-    @GuardedBy( "mainLock" )
-    private final Set<ConnectionWrapper> inUseConnections = new HashSet<ConnectionWrapper>();
-
-    /**
-     * Timeout in nanoseconds for idle connections waiting to be used. Threads use this timeout only when there are more than
-     * corePoolSize present. Otherwise they wait forever to be used.
-     */
-    private volatile long keepAliveTime;
-
-    /**
-     * The target pool size, updated only while holding mainLock, but volatile to allow concurrent readability even during
-     * updates.
-     */
-    @GuardedBy( "mainLock" )
-    private volatile int corePoolSize;
-
-    /**
-     * Maximum pool size, updated only while holding mainLock but volatile to allow concurrent readability even during updates.
-     */
-    @GuardedBy( "mainLock" )
-    private volatile int maximumPoolSize;
-
-    /**
-     * Current pool size, updated only while holding mainLock but volatile to allow concurrent readability even during updates.
-     */
-    @GuardedBy( "mainLock" )
-    private volatile int poolSize;
-
-    /**
-     * Lifecycle state, updated only while holding mainLock but volatile to allow concurrent readability even during updates.
-     */
-    @GuardedBy( "mainLock" )
-    private volatile int runState;
-
-    // Special values for runState
-    /** Normal, not-shutdown mode */
-    static final int RUNNING = 0;
-    /** Controlled shutdown mode */
-    static final int SHUTDOWN = 1;
-    /** Immediate shutdown mode */
-    static final int STOP = 2;
-    /** Final state */
-    static final int TERMINATED = 3;
-
-    /**
-     * Flag specifying whether a connection should be validated before returning it from the {@link #getConnection()} method.
-     */
-    private final AtomicBoolean validateConnectionBeforeUse = new AtomicBoolean(false);
-
-    /**
-     * The time in nanoseconds that ping should wait before timing out and failing.
-     */
-    private final AtomicLong pingTimeout = new AtomicLong(0);
-
-    /**
-     * The number of times an attempt to obtain a connection should fail with invalid connections before throwing an exception.
-     */
-    private final AtomicInteger maxFailedAttemptsBeforeError = new AtomicInteger(10);
-
-    private final AtomicLong totalConnectionsCreated = new AtomicLong(0);
-
-    private final AtomicLong totalConnectionsUsed = new AtomicLong(0);
-
-    private final Logger logger = Logger.getLogger(this.getClass());
-
-    /**
-     * Create the pool to use the supplied connection factory, which is typically a {@link RepositorySource}.
-     * @param connectionFactory the factory 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
-     * connections will be kept before terminating.
-     * @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( RepositoryConnectionFactory connectionFactory, int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit ) {
-        ArgCheck.isNonNegative(corePoolSize, "corePoolSize");
-        ArgCheck.isPositive(maximumPoolSize, "maximumPoolSize");
-        ArgCheck.isNonNegative(keepAliveTime, "keepAliveTime");
-        ArgCheck.isNotNull(connectionFactory, "repository connection factory");
-        if (maximumPoolSize < corePoolSize) {
-            throw new IllegalArgumentException(SpiI18n.maximumPoolSizeMayNotBeSmallerThanCorePoolSize.text());
-        }
-        this.connectionFactory = connectionFactory;
-        this.corePoolSize = corePoolSize;
-        this.maximumPoolSize = maximumPoolSize;
-        this.keepAliveTime = unit.toNanos(keepAliveTime);
-        this.setPingTimeout(100, TimeUnit.MILLISECONDS);
-    }
-
-    public String getName() {
-        return this.connectionFactory.getName();
-    }
-
-    // -------------------------------------------------
-    // Property settings ...
-    // -------------------------------------------------
-
-    /**
-     * @return validateConnectionBeforeUse
-     */
-    public boolean getValidateConnectionBeforeUse() {
-        return this.validateConnectionBeforeUse.get();
-    }
-
-    /**
-     * @param validateConnectionBeforeUse Sets validateConnectionBeforeUse to the specified value.
-     */
-    public void setValidateConnectionBeforeUse( boolean validateConnectionBeforeUse ) {
-        this.validateConnectionBeforeUse.set(validateConnectionBeforeUse);
-    }
-
-    /**
-     * @return pingTimeout
-     */
-    public long getPingTimeoutInNanos() {
-        return this.pingTimeout.get();
-    }
-
-    /**
-     * @param pingTimeout the time to wait for a ping to complete
-     * @param unit the time unit of the time argument
-     */
-    public void setPingTimeout( long pingTimeout, TimeUnit unit ) {
-        ArgCheck.isNonNegative(pingTimeout, "time");
-        this.pingTimeout.set(unit.toNanos(pingTimeout));
-    }
-
-    /**
-     * @return maxFailedAttemptsBeforeError
-     */
-    public int getMaxFailedAttemptsBeforeError() {
-        return this.maxFailedAttemptsBeforeError.get();
-    }
-
-    /**
-     * @param maxFailedAttemptsBeforeError Sets maxFailedAttemptsBeforeError to the specified value.
-     */
-    public void setMaxFailedAttemptsBeforeError( int maxFailedAttemptsBeforeError ) {
-        this.maxFailedAttemptsBeforeError.set(maxFailedAttemptsBeforeError);
-    }
-
-    /**
-     * Sets the time limit for which connections may remain idle before being closed. If there are more than the core number of
-     * connections currently in the pool, after waiting this amount of time without being used, excess threads will be terminated.
-     * This overrides any value set in the constructor.
-     * @param time the time to wait. A time value of zero will cause excess connections to terminate immediately after being
-     * returned.
-     * @param unit the time unit of the time argument
-     * @throws IllegalArgumentException if time less than zero
-     * @see #getKeepAliveTime
-     */
-    public void setKeepAliveTime( long time, TimeUnit unit ) {
-        ArgCheck.isNonNegative(time, "time");
-        this.keepAliveTime = unit.toNanos(time);
-    }
-
-    /**
-     * Returns the connection keep-alive time, which is the amount of time which connections in excess of the core pool size may
-     * remain idle before being closed.
-     * @param unit the desired time unit of the result
-     * @return the time limit
-     * @see #setKeepAliveTime
-     */
-    public long getKeepAliveTime( TimeUnit unit ) {
-        assert unit != null;
-        return unit.convert(keepAliveTime, TimeUnit.NANOSECONDS);
-    }
-
-    /**
-     * @return maximumPoolSize
-     */
-    public int getMaximumPoolSize() {
-        return this.maximumPoolSize;
-    }
-
-    /**
-     * Sets the maximum allowed number of connections. This overrides any value set in the constructor. If the new value is
-     * smaller than the current value, excess existing but unused connections will be closed.
-     * @param maximumPoolSize the new maximum
-     * @throws IllegalArgumentException if maximumPoolSize less than zero or the {@link #getCorePoolSize() core pool size}
-     * @see #getMaximumPoolSize
-     */
-    public void setMaximumPoolSize( int maximumPoolSize ) {
-        ArgCheck.isPositive(maximumPoolSize, "maximum pool size");
-        if (maximumPoolSize < corePoolSize) {
-            throw new IllegalArgumentException(SpiI18n.maximumPoolSizeMayNotBeSmallerThanCorePoolSize.text());
-        }
-        final ReentrantLock mainLock = this.mainLock;
-        try {
-            mainLock.lock();
-            int extra = this.maximumPoolSize - maximumPoolSize;
-            this.maximumPoolSize = maximumPoolSize;
-            if (extra > 0 && poolSize > maximumPoolSize) {
-                // Drain the extra connections from those available ...
-                drainUnusedConnections(extra);
-            }
-        } finally {
-            mainLock.unlock();
-        }
-    }
-
-    /**
-     * Returns the core number of connections.
-     * @return the core number of connections
-     * @see #setCorePoolSize(int)
-     */
-    public int getCorePoolSize() {
-        return this.corePoolSize;
-    }
-
-    /**
-     * Sets the core number of connections. This overrides any value set in the constructor. If the new value is smaller than the
-     * current value, excess existing and unused connections will be closed. If larger, new connections will, if needed, be
-     * created.
-     * @param corePoolSize the new core size
-     * @throws RepositorySourceException if there was an error obtaining the new connection
-     * @throws InterruptedException if the thread was interrupted during the operation
-     * @throws IllegalArgumentException if <tt>corePoolSize</tt> less than zero
-     * @see #getCorePoolSize()
-     */
-    public void setCorePoolSize( int corePoolSize ) throws RepositorySourceException, InterruptedException {
-        ArgCheck.isNonNegative(corePoolSize, "core pool size");
-        if (maximumPoolSize < corePoolSize) {
-            throw new IllegalArgumentException(SpiI18n.maximumPoolSizeMayNotBeSmallerThanCorePoolSize.text());
-        }
-        final ReentrantLock mainLock = this.mainLock;
-        try {
-            mainLock.lock();
-            int extra = this.corePoolSize - corePoolSize;
-            this.corePoolSize = corePoolSize;
-            if (extra < 0) {
-                // Add connections ...
-                addConnectionsIfUnderCorePoolSize();
-            } else if (extra > 0 && poolSize > corePoolSize) {
-                // Drain the extra connections from those available ...
-                drainUnusedConnections(extra);
-            }
-        } finally {
-            mainLock.unlock();
-        }
-    }
-
-    // -------------------------------------------------
-    // Statistics ...
-    // -------------------------------------------------
-
-    /**
-     * Returns the current number of connections in the pool.
-     * @return the number of connections
-     */
-    public int getPoolSize() {
-        return poolSize;
-    }
-
-    /**
-     * Returns the approximate number of connections that have been checked out from the pool.
-     * @return the number of checked-out connections
-     */
-    public int getInUseCount() {
-        final ReentrantLock mainLock = this.mainLock;
-        try {
-            mainLock.lock();
-            return this.inUseConnections.size();
-        } finally {
-            mainLock.unlock();
-        }
-    }
-
-    /**
-     * Get the total number of connections that have been created by this pool.
-     * @return the total number of connections created by this pool
-     */
-    public long getTotalConnectionsCreated() {
-        return this.totalConnectionsCreated.get();
-    }
-
-    /**
-     * Get the total number of times connections have been {@link #getConnection()} used.
-     * @return the total number
-     */
-    public long getTotalConnectionsUsed() {
-        return this.totalConnectionsUsed.get();
-    }
-
-    // -------------------------------------------------
-    // Utility methods ...
-    // -------------------------------------------------
-
-    /**
-     * Call the supplied operation, using a connection from this pool.
-     * @param <T> the return type for the operation
-     * @param operation the operation to be run using a connection in this pool
-     * @return the results from the operation
-     * @throws RepositorySourceException if there was an error obtaining the new connection
-     * @throws InterruptedException if the thread was interrupted during the operation
-     * @throws IllegalArgumentException if the operation is null
-     * @see #callable(RepositoryOperation)
-     * @see #callables(Collection)
-     * @see #callables(RepositoryOperation...)
-     */
-    public <T> T call( RepositoryOperation<T> operation ) throws RepositorySourceException, InterruptedException {
-        ArgCheck.isNotNull(operation, "repository operation");
-        // Get a connection ...
-        T result = null;
-        LogContext.set("context", operation.getName());
-        RepositoryConnection conn = this.getConnection();
-        try {
-            // And run the client with the connection ...
-            result = operation.run(conn);
-        } finally {
-            conn.close();
-        }
-        LogContext.clear();
-        return result;
-    }
-
-    /**
-     * Return a callable object that, when run, performs the supplied repository operation against a connection in this pool.
-     * @param <T> the return type for the operation
-     * @param operation the operation to be run using a connection in this pool
-     * @return the callable
-     * @see #call(RepositoryOperation)
-     * @see #callables(Collection)
-     * @see #callables(RepositoryOperation...)
-     */
-    public <T> Callable<T> callable( final RepositoryOperation<T> operation ) {
-        ArgCheck.isNotNull(operation, "repository operation");
-        final RepositoryConnectionPool pool = this;
-        return new Callable<T>() {
-
-            /**
-             * Execute by getting a connection from this pool, running the client, and return the connection to the pool.
-             * @return the operation's result
-             * @throws Exception
-             */
-            public T call() throws Exception {
-                return pool.call(operation);
-            }
-        };
-    }
-
-    /**
-     * Return a collection of callable objects that, when run, perform the supplied repository operations against connections in
-     * this pool.
-     * @param <T> the return type for the operations
-     * @param operations the operations to be run using connection from this pool
-     * @return the collection of callables
-     * @see #call(RepositoryOperation)
-     * @see #callable(RepositoryOperation)
-     * @see #callables(Collection)
-     */
-    public <T> List<Callable<T>> callables( RepositoryOperation<T>... operations ) {
-        List<Callable<T>> callables = new ArrayList<Callable<T>>();
-        for (final RepositoryOperation<T> operation : operations) {
-            callables.add(callable(operation));
-        }
-        return callables;
-    }
-
-    /**
-     * Return a collection of callable objects that, when run, perform the supplied repository operations against connections in
-     * this pool.
-     * @param <T> the return type for the operations
-     * @param operations the operations to be run using connection from this pool
-     * @return the collection of callables
-     * @see #call(RepositoryOperation)
-     * @see #callable(RepositoryOperation)
-     * @see #callables(RepositoryOperation...)
-     */
-    public <T> List<Callable<T>> callables( Collection<RepositoryOperation<T>> operations ) {
-        List<Callable<T>> callables = new ArrayList<Callable<T>>();
-        for (final RepositoryOperation<T> operation : operations) {
-            callables.add(callable(operation));
-        }
-        return callables;
-    }
-
-    // -------------------------------------------------
-    // State management methods ...
-    // -------------------------------------------------
-
-    /**
-     * Starts a core connection, causing it to idly wait for use. This overrides the default policy of starting core connections
-     * only when they are {@link #getConnection() needed}. This method will return <tt>false</tt> if all core connections have
-     * already been started.
-     * @return true if a connection was started
-     * @throws RepositorySourceException if there was an error obtaining the new connection
-     * @throws InterruptedException if the thread was interrupted during the operation
-     */
-    public boolean prestartCoreConnection() throws RepositorySourceException, InterruptedException {
-        final ReentrantLock mainLock = this.mainLock;
-        try {
-            mainLock.lock();
-            return addConnectionIfUnderCorePoolSize();
-        } finally {
-            mainLock.unlock();
-        }
-    }
-
-    /**
-     * Starts all core connections, causing them to idly wait for use. This overrides the default policy of starting core
-     * connections only when they are {@link #getConnection() needed}.
-     * @return the number of connections started.
-     * @throws RepositorySourceException if there was an error obtaining the new connection
-     * @throws InterruptedException if the thread was interrupted during the operation
-     */
-    public int prestartAllCoreConnections() throws RepositorySourceException, InterruptedException {
-        final ReentrantLock mainLock = this.mainLock;
-        try {
-            mainLock.lock();
-            return addConnectionsIfUnderCorePoolSize();
-        } finally {
-            mainLock.unlock();
-        }
-    }
-
-    /**
-     * 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.
-     * @throws SecurityException if a security manager exists and shutting down this ConnectionPool 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.
-     */
-    public void shutdown() {
-        // Fail if caller doesn't have modifyThread permission. We
-        // explicitly check permissions directly because we can't trust
-        // implementations of SecurityManager to correctly override
-        // the "check access" methods such that our documented
-        // security policy is implemented.
-        SecurityManager security = System.getSecurityManager();
-        if (security != null) java.security.AccessController.checkPermission(shutdownPerm);
-
-        this.logger.debug("Shutting down repository connection pool for {0}", getName());
-        boolean fullyTerminated = false;
-        final ReentrantLock mainLock = this.mainLock;
-        try {
-            mainLock.lock();
-            int state = this.runState;
-            if (state == RUNNING) {
-                // don't override shutdownNow
-                this.runState = SHUTDOWN;
-            }
-
-            // Kill the maintenance thread ...
-
-            // Remove and close all available connections ...
-            if (!this.availableConnections.isEmpty()) {
-                // Drain the extra connections from those available ...
-                drainUnusedConnections(this.availableConnections.size());
-            }
-
-            // If there are no connections being used, trigger full termination now ...
-            if (this.inUseConnections.isEmpty()) {
-                fullyTerminated = true;
-                this.logger.trace("Signalling termination of repository connection pool for {0}", getName());
-                runState = TERMINATED;
-                termination.signalAll();
-                this.logger.debug("Terminated repository connection pool for {0}", getName());
-            }
-            // Otherwise the last connection that is closed will transition the runState to TERMINATED ...
-        } finally {
-            mainLock.unlock();
-        }
-        if (fullyTerminated) terminated();
-    }
-
-    /**
-     * Attempts to stop all actively executing tasks, halts the processing of waiting tasks, and returns a list of the tasks that
-     * were awaiting execution.
-     * <p>
-     * This implementation cancels tasks via {@link Thread#interrupt}, so if any tasks mask or fail to respond to interrupts,
-     * they may never terminate.
-     * @throws SecurityException if a security manager exists and shutting down this ExecutorService 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.
-     */
-    public void shutdownNow() {
-        // Almost the same code as shutdown()
-        SecurityManager security = System.getSecurityManager();
-        if (security != null) java.security.AccessController.checkPermission(shutdownPerm);
-
-        this.logger.debug("Shutting down (immediately) repository connection pool for {0}", getName());
-        boolean fullyTerminated = false;
-        final ReentrantLock mainLock = this.mainLock;
-        try {
-            mainLock.lock();
-            int state = this.runState;
-            if (state != TERMINATED) {
-                // don't override shutdownNow
-                this.runState = STOP;
-            }
-
-            // Kill the maintenance thread ...
-
-            // Remove and close all available connections ...
-            if (!this.availableConnections.isEmpty()) {
-                // Drain the extra connections from those available ...
-                drainUnusedConnections(this.availableConnections.size());
-            }
-
-            // If there are connections being used, close them now ...
-            if (!this.inUseConnections.isEmpty()) {
-                for (ConnectionWrapper connectionInUse : this.inUseConnections) {
-                    try {
-                        this.logger.trace("Closing repository connection to {0}", getName());
-                        connectionInUse.getOriginal().close();
-                    } catch (InterruptedException e) {
-                        // Ignore this ...
-                    }
-                }
-                this.poolSize -= this.inUseConnections.size();
-                // The last connection that is closed will transition the runState to TERMINATED ...
-            } else {
-                // There are no connections in use, so trigger full termination now ...
-                fullyTerminated = true;
-                this.logger.trace("Signalling termination of repository connection pool for {0}", getName());
-                runState = TERMINATED;
-                termination.signalAll();
-                this.logger.debug("Terminated repository connection pool for {0}", getName());
-            }
-
-        } finally {
-            mainLock.unlock();
-        }
-        if (fullyTerminated) terminated();
-    }
-
-    public boolean isShutdown() {
-        return runState != RUNNING;
-    }
-
-    /**
-     * Returns true if this executor is in the process of terminating after <tt>shutdown</tt> or <tt>shutdownNow</tt> 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.
-     */
-    public boolean isTerminating() {
-        return runState == STOP;
-    }
-
-    public boolean isTerminated() {
-        return runState == TERMINATED;
-    }
-
-    public boolean awaitTermination( long timeout, TimeUnit unit ) throws InterruptedException {
-        long nanos = unit.toNanos(timeout);
-        final ReentrantLock mainLock = this.mainLock;
-        try {
-            mainLock.lock();
-            for (;;) {
-                // this.logger.debug("---> Run state = {}; condition = {}", runState, termination);
-                if (runState == TERMINATED) return true;
-                if (nanos <= 0) return false;
-                nanos = termination.awaitNanos(nanos);
-                // this.logger.debug("---> Done waiting: run state = {}; condition = {}", runState, termination);
-            }
-        } finally {
-            mainLock.unlock();
-        }
-    }
-
-    /**
-     * Method invoked when the Executor has terminated. Default implementation does nothing. Note: To properly nest multiple
-     * overridings, subclasses should generally invoke <tt>super.terminated</tt> within this method.
-     */
-    protected void terminated() {
-    }
-
-    /**
-     * Invokes <tt>shutdown</tt> when this executor is no longer referenced.
-     */
-    @Override
-    protected void finalize() {
-        shutdown();
-    }
-
-    // -------------------------------------------------
-    // Connection management methods ...
-    // -------------------------------------------------
-
-    /**
-     * {@inheritDoc}
-     */
-    @SuppressWarnings( "null" )
-    public RepositoryConnection getConnection() throws RepositorySourceException, InterruptedException {
-        int attemptsAllowed = this.maxFailedAttemptsBeforeError.get();
-        ConnectionWrapper connection = null;
-        try {
-            // Do this until we get a good connection ...
-            int attemptsRemaining = attemptsAllowed;
-            while (connection == null && attemptsRemaining > 0) {
-                --attemptsRemaining;
-                ReentrantLock mainLock = this.mainLock;
-                try {
-                    mainLock.lock();
-                    // If we're shutting down the pool, then just close the connection ...
-                    if (this.runState != RUNNING) {
-                        throw new IllegalStateException(SpiI18n.repositoryConnectionPoolIsNotRunning.text());
-                    }
-                    // If there are fewer total connections than the core size ...
-                    if (this.poolSize < this.corePoolSize) {
-                        // Immediately create a wrapped connection and return it ...
-                        connection = newWrappedConnection();
-                    }
-                    // Peek to see if there is a connection available ...
-                    else if (this.availableConnections.peek() != null) {
-                        // There is, so take it and return it ...
-                        connection = this.availableConnections.take();
-                    }
-                    // There is no connection available. If there are fewer total connections than the maximum size ...
-                    else if (this.poolSize < this.maximumPoolSize) {
-                        // Immediately create a wrapped connection and return it ...
-                        connection = newWrappedConnection();
-                    }
-                    if (connection != null) {
-                        this.inUseConnections.add(connection);
-                    }
-                } finally {
-                    mainLock.unlock();
-                }
-                if (connection == null) {
-                    // There are not enough connections, so wait in line for the next available connection ...
-                    this.logger.trace("Waiting for a repository connection from pool {0}", getName());
-                    connection = this.availableConnections.take();
-                    mainLock = this.mainLock;
-                    mainLock.lock();
-                    try {
-                        if (connection != null) {
-                            this.inUseConnections.add(connection);
-                        }
-                    } finally {
-                        mainLock.unlock();
-                    }
-                    this.logger.trace("Recieved a repository connection from pool {0}", getName());
-                }
-                if (connection != null && this.validateConnectionBeforeUse.get()) {
-                    connection = validateConnection(connection);
-                }
-            }
-        } catch (InterruptedException e) {
-            this.logger.trace("Thread interrupted while waiting for a repository connection from pool {0}", getName());
-
-            // If the thread has been interrupted after we've taken a connection from the pool ...
-            if (connection != null) {
-                // We need to return the connection back into the pool ...
-                returnConnection(connection);
-            }
-            // And rethrow ...
-            throw e;
-        }
-        if (connection == null) {
-            // We were unable to obtain a usable connection, so fail ...
-            throw new RepositorySourceException(SpiI18n.unableToObtainValidRepositoryAfterAttempts.text(attemptsAllowed));
-        }
-        this.totalConnectionsUsed.incrementAndGet();
-        return connection;
-    }
-
-    /**
-     * This method is automatically called by the {@link ConnectionWrapper} when it is {@link ConnectionWrapper#close() closed}.
-     * @param wrapper the wrapper to the connection that is being returned to the pool
-     */
-    protected void returnConnection( ConnectionWrapper wrapper ) {
-        assert wrapper != null;
-        ConnectionWrapper wrapperToClose = null;
-        final ReentrantLock mainLock = this.mainLock;
-        try {
-            mainLock.lock();
-            // Remove the connection from the in-use set ...
-            boolean removed = this.inUseConnections.remove(wrapper);
-            assert removed;
-
-            // If we're shutting down the pool, then just close the connection ...
-            if (this.runState != RUNNING) {
-                wrapperToClose = wrapper;
-            }
-            // If there are more connections than the maximum size...
-            else if (this.poolSize > this.maximumPoolSize) {
-                // Immediately close this connection ...
-                wrapperToClose = wrapper;
-            }
-            // Attempt to make the connection available (this should generally work, unless there is an upper limit
-            // to the number of available connections) ...
-            else if (!this.availableConnections.offer(new ConnectionWrapper(wrapper.getOriginal()))) {
-                // The pool of available connection is full, so release it ...
-                wrapperToClose = wrapper;
-            }
-        } finally {
-            mainLock.unlock();
-        }
-        // Close the connection if we're supposed to (do it outside of the main lock)...
-        if (wrapperToClose != null) {
-            try {
-                closeConnection(wrapper);
-            } catch (InterruptedException e) {
-                // catch this, as there's not much we can do and the caller doesn't care or know how to handle it
-                this.logger.trace(e, "Interrupted while closing a repository connection");
-            }
-        }
-    }
-
-    /**
-     * Validate the supplied connection, returning the connection if valid or null if the connection is not valid.
-     * @param connection the connection to be validated; may not be null
-     * @return the validated connection, or null if the connection did not validate and was removed from the pool
-     */
-    protected ConnectionWrapper validateConnection( ConnectionWrapper connection ) {
-        assert connection != null;
-        ConnectionWrapper invalidConnection = null;
-        try {
-            if (!connection.ping(this.pingTimeout.get(), TimeUnit.NANOSECONDS)) {
-                invalidConnection = connection;
-            }
-        } catch (InterruptedException e) {
-            // catch this, as there's not much we can do and the caller doesn't care or know how to handle it
-            this.logger.trace(e, "Interrupted while pinging a repository connection");
-            invalidConnection = connection;
-        } finally {
-            if (invalidConnection != null) {
-                connection = null;
-                returnConnection(invalidConnection);
-            }
-        }
-        return connection;
-    }
-
-    /**
-     * Obtain a new connection wrapped in a {@link ConnectionWrapper}. This method does not check whether creating the new
-     * connection would violate the {@link #maximumPoolSize maximum pool size} nor does it add the new connection to the
-     * {@link #availableConnections available connections} (as the caller may want it immediately), but it does increment the
-     * {@link #poolSize pool size}.
-     * @return the connection wrapper with a new connection
-     * @throws RepositorySourceException if there was an error obtaining the new connection
-     * @throws InterruptedException if the thread was interrupted during the operation
-     */
-    @GuardedBy( "mainLock" )
-    protected ConnectionWrapper newWrappedConnection() throws RepositorySourceException, InterruptedException {
-        RepositoryConnection connection = this.connectionFactory.getConnection();
-        ++this.poolSize;
-        this.totalConnectionsCreated.incrementAndGet();
-        return new ConnectionWrapper(connection);
-    }
-
-    /**
-     * Close a connection that is in the pool but no longer in the {@link #availableConnections available connections}. This
-     * method does decrement the {@link #poolSize pool size}.
-     * @param wrapper the wrapper for the connection to be closed
-     * @throws InterruptedException if the thread was interrupted during the operation
-     */
-    protected void closeConnection( ConnectionWrapper wrapper ) throws InterruptedException {
-        assert wrapper != null;
-        RepositoryConnection original = wrapper.getOriginal();
-        assert original != null;
-        try {
-            this.logger.debug("Closing repository connection to {0}", getName());
-            original.close();
-        } finally {
-            final ReentrantLock mainLock = this.mainLock;
-            try {
-                mainLock.lock();
-                // No matter what reduce the pool size count
-                --this.poolSize;
-                // And if shutting down and this was the last connection being used...
-                if (this.runState == SHUTDOWN && this.poolSize <= 0) {
-                    // then signal anybody that has called "awaitTermination(...)"
-                    this.logger.trace("Signalling termination of repository connection pool for {0}", getName());
-                    this.runState = TERMINATED;
-                    this.termination.signalAll();
-                    this.logger.trace("Terminated repository connection pool for {0}", getName());
-
-                    // fall through to call terminate() outside of lock.
-                }
-            } finally {
-                mainLock.unlock();
-            }
-        }
-    }
-
-    @GuardedBy( "mainLock" )
-    protected int drainUnusedConnections( int count ) {
-        if (count <= 0) return 0;
-        this.logger.trace("Draining up to {} unused repository connections to {0}", count, getName());
-        // Drain the extra connections from those available ...
-        Collection<ConnectionWrapper> extraConnections = new LinkedList<ConnectionWrapper>();
-        this.availableConnections.drainTo(extraConnections, count);
-        for (ConnectionWrapper connection : extraConnections) {
-            try {
-                this.logger.trace("Closing repository connection to {0}", getName());
-                connection.getOriginal().close();
-            } catch (InterruptedException e) {
-                // Ignore this ...
-            }
-        }
-        int numClosed = extraConnections.size();
-        this.poolSize -= numClosed;
-        this.logger.trace("Drained {0} unused connections", numClosed);
-        return numClosed;
-    }
-
-    @GuardedBy( "mainLock" )
-    protected boolean addConnectionIfUnderCorePoolSize() throws RepositorySourceException, InterruptedException {
-        // Add connection ...
-        if (this.poolSize < this.corePoolSize) {
-            this.availableConnections.offer(newWrappedConnection());
-            this.logger.trace("Added connection to {0} in undersized pool", getName());
-            return true;
-        }
-        return false;
-    }
-
-    @GuardedBy( "mainLock" )
-    protected int addConnectionsIfUnderCorePoolSize() throws RepositorySourceException, InterruptedException {
-        // Add connections ...
-        int n = 0;
-        while (this.poolSize < this.corePoolSize) {
-            this.availableConnections.offer(newWrappedConnection());
-            ++n;
-        }
-        this.logger.trace("Added {0} connection(s) to {1} in undersized pool", n, getName());
-        return n;
-    }
-
-    protected class ConnectionWrapper implements RepositoryConnection {
-
-        private final RepositoryConnection original;
-        private final long timeCreated;
-        private long lastUsed;
-        private boolean closed = false;
-
-        protected ConnectionWrapper( RepositoryConnection connection ) {
-            assert connection != null;
-            this.original = connection;
-            this.timeCreated = System.currentTimeMillis();
-        }
-
-        /**
-         * @return original
-         */
-        protected RepositoryConnection getOriginal() {
-            return this.original;
-        }
-
-        /**
-         * @return lastUsed
-         */
-        public long getTimeLastUsed() {
-            return this.lastUsed;
-        }
-
-        /**
-         * @return timeCreated
-         */
-        public long getTimeCreated() {
-            return this.timeCreated;
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        public String getSourceName() {
-            return this.original.getSourceName();
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        public XAResource getXAResource() {
-            if (closed) throw new IllegalStateException(SpiI18n.closedConnectionMayNotBeUsed.text());
-            return this.original.getXAResource();
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        public void execute( ExecutionEnvironment env, GraphCommand... commands ) throws RepositorySourceException, InterruptedException {
-            if (closed) throw new IllegalStateException(SpiI18n.closedConnectionMayNotBeUsed.text());
-            this.original.execute(env, commands);
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        public boolean ping( long time, TimeUnit unit ) throws InterruptedException {
-            if (closed) throw new IllegalStateException(SpiI18n.closedConnectionMayNotBeUsed.text());
-            return this.original.ping(time, unit);
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        public void close() throws InterruptedException {
-            if (!closed) {
-                this.lastUsed = System.currentTimeMillis();
-                this.original.close();
-                this.closed = true;
-                returnConnection(this);
-            }
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        public void setListener( RepositorySourceListener listener ) {
-            if (!closed) this.original.setListener(listener);
-        }
-
-    }
-
-}

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryConnectionPool.java (from rev 219, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryConnectionPool.java)
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryConnectionPool.java	                        (rev 0)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryConnectionPool.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,994 @@
+/*
+ * 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.graph.connection;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.Callable;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.ReentrantLock;
+import javax.transaction.xa.XAResource;
+import net.jcip.annotations.GuardedBy;
+import net.jcip.annotations.ThreadSafe;
+import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.LogContext;
+import org.jboss.dna.common.util.Logger;
+import org.jboss.dna.spi.SpiI18n;
+import org.jboss.dna.spi.graph.commands.GraphCommand;
+
+/**
+ * @author Randall Hauch
+ */
+ at ThreadSafe
+public class RepositoryConnectionPool implements RepositoryConnectionFactory {
+
+    /**
+     * Permission for checking shutdown
+     */
+    private static final RuntimePermission shutdownPerm = new RuntimePermission("modifyThread");
+
+    /**
+     * The factory that this pool uses to create new connections.
+     */
+    private final RepositoryConnectionFactory connectionFactory;
+
+    /**
+     * Lock held on updates to poolSize, corePoolSize, maximumPoolSize, and workers set.
+     */
+    private final ReentrantLock mainLock = new ReentrantLock();
+
+    /**
+     * Wait condition to support awaitTermination
+     */
+    private final Condition termination = mainLock.newCondition();
+
+    /**
+     * Set containing all connections that are available for use.
+     */
+    @GuardedBy( "mainLock" )
+    private final BlockingQueue<ConnectionWrapper> availableConnections = new LinkedBlockingQueue<ConnectionWrapper>();
+
+    /**
+     * The connections that are currently in use.
+     */
+    @GuardedBy( "mainLock" )
+    private final Set<ConnectionWrapper> inUseConnections = new HashSet<ConnectionWrapper>();
+
+    /**
+     * Timeout in nanoseconds for idle connections waiting to be used. Threads use this timeout only when there are more than
+     * corePoolSize present. Otherwise they wait forever to be used.
+     */
+    private volatile long keepAliveTime;
+
+    /**
+     * The target pool size, updated only while holding mainLock, but volatile to allow concurrent readability even during
+     * updates.
+     */
+    @GuardedBy( "mainLock" )
+    private volatile int corePoolSize;
+
+    /**
+     * Maximum pool size, updated only while holding mainLock but volatile to allow concurrent readability even during updates.
+     */
+    @GuardedBy( "mainLock" )
+    private volatile int maximumPoolSize;
+
+    /**
+     * Current pool size, updated only while holding mainLock but volatile to allow concurrent readability even during updates.
+     */
+    @GuardedBy( "mainLock" )
+    private volatile int poolSize;
+
+    /**
+     * Lifecycle state, updated only while holding mainLock but volatile to allow concurrent readability even during updates.
+     */
+    @GuardedBy( "mainLock" )
+    private volatile int runState;
+
+    // Special values for runState
+    /** Normal, not-shutdown mode */
+    static final int RUNNING = 0;
+    /** Controlled shutdown mode */
+    static final int SHUTDOWN = 1;
+    /** Immediate shutdown mode */
+    static final int STOP = 2;
+    /** Final state */
+    static final int TERMINATED = 3;
+
+    /**
+     * Flag specifying whether a connection should be validated before returning it from the {@link #getConnection()} method.
+     */
+    private final AtomicBoolean validateConnectionBeforeUse = new AtomicBoolean(false);
+
+    /**
+     * The time in nanoseconds that ping should wait before timing out and failing.
+     */
+    private final AtomicLong pingTimeout = new AtomicLong(0);
+
+    /**
+     * The number of times an attempt to obtain a connection should fail with invalid connections before throwing an exception.
+     */
+    private final AtomicInteger maxFailedAttemptsBeforeError = new AtomicInteger(10);
+
+    private final AtomicLong totalConnectionsCreated = new AtomicLong(0);
+
+    private final AtomicLong totalConnectionsUsed = new AtomicLong(0);
+
+    private final Logger logger = Logger.getLogger(this.getClass());
+
+    /**
+     * Create the pool to use the supplied connection factory, which is typically a {@link RepositorySource}.
+     * @param connectionFactory the factory 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
+     * connections will be kept before terminating.
+     * @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( RepositoryConnectionFactory connectionFactory, int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit ) {
+        ArgCheck.isNonNegative(corePoolSize, "corePoolSize");
+        ArgCheck.isPositive(maximumPoolSize, "maximumPoolSize");
+        ArgCheck.isNonNegative(keepAliveTime, "keepAliveTime");
+        ArgCheck.isNotNull(connectionFactory, "repository connection factory");
+        if (maximumPoolSize < corePoolSize) {
+            throw new IllegalArgumentException(SpiI18n.maximumPoolSizeMayNotBeSmallerThanCorePoolSize.text());
+        }
+        this.connectionFactory = connectionFactory;
+        this.corePoolSize = corePoolSize;
+        this.maximumPoolSize = maximumPoolSize;
+        this.keepAliveTime = unit.toNanos(keepAliveTime);
+        this.setPingTimeout(100, TimeUnit.MILLISECONDS);
+    }
+
+    public String getName() {
+        return this.connectionFactory.getName();
+    }
+
+    // -------------------------------------------------
+    // Property settings ...
+    // -------------------------------------------------
+
+    /**
+     * @return validateConnectionBeforeUse
+     */
+    public boolean getValidateConnectionBeforeUse() {
+        return this.validateConnectionBeforeUse.get();
+    }
+
+    /**
+     * @param validateConnectionBeforeUse Sets validateConnectionBeforeUse to the specified value.
+     */
+    public void setValidateConnectionBeforeUse( boolean validateConnectionBeforeUse ) {
+        this.validateConnectionBeforeUse.set(validateConnectionBeforeUse);
+    }
+
+    /**
+     * @return pingTimeout
+     */
+    public long getPingTimeoutInNanos() {
+        return this.pingTimeout.get();
+    }
+
+    /**
+     * @param pingTimeout the time to wait for a ping to complete
+     * @param unit the time unit of the time argument
+     */
+    public void setPingTimeout( long pingTimeout, TimeUnit unit ) {
+        ArgCheck.isNonNegative(pingTimeout, "time");
+        this.pingTimeout.set(unit.toNanos(pingTimeout));
+    }
+
+    /**
+     * @return maxFailedAttemptsBeforeError
+     */
+    public int getMaxFailedAttemptsBeforeError() {
+        return this.maxFailedAttemptsBeforeError.get();
+    }
+
+    /**
+     * @param maxFailedAttemptsBeforeError Sets maxFailedAttemptsBeforeError to the specified value.
+     */
+    public void setMaxFailedAttemptsBeforeError( int maxFailedAttemptsBeforeError ) {
+        this.maxFailedAttemptsBeforeError.set(maxFailedAttemptsBeforeError);
+    }
+
+    /**
+     * Sets the time limit for which connections may remain idle before being closed. If there are more than the core number of
+     * connections currently in the pool, after waiting this amount of time without being used, excess threads will be terminated.
+     * This overrides any value set in the constructor.
+     * @param time the time to wait. A time value of zero will cause excess connections to terminate immediately after being
+     * returned.
+     * @param unit the time unit of the time argument
+     * @throws IllegalArgumentException if time less than zero
+     * @see #getKeepAliveTime
+     */
+    public void setKeepAliveTime( long time, TimeUnit unit ) {
+        ArgCheck.isNonNegative(time, "time");
+        this.keepAliveTime = unit.toNanos(time);
+    }
+
+    /**
+     * Returns the connection keep-alive time, which is the amount of time which connections in excess of the core pool size may
+     * remain idle before being closed.
+     * @param unit the desired time unit of the result
+     * @return the time limit
+     * @see #setKeepAliveTime
+     */
+    public long getKeepAliveTime( TimeUnit unit ) {
+        assert unit != null;
+        return unit.convert(keepAliveTime, TimeUnit.NANOSECONDS);
+    }
+
+    /**
+     * @return maximumPoolSize
+     */
+    public int getMaximumPoolSize() {
+        return this.maximumPoolSize;
+    }
+
+    /**
+     * Sets the maximum allowed number of connections. This overrides any value set in the constructor. If the new value is
+     * smaller than the current value, excess existing but unused connections will be closed.
+     * @param maximumPoolSize the new maximum
+     * @throws IllegalArgumentException if maximumPoolSize less than zero or the {@link #getCorePoolSize() core pool size}
+     * @see #getMaximumPoolSize
+     */
+    public void setMaximumPoolSize( int maximumPoolSize ) {
+        ArgCheck.isPositive(maximumPoolSize, "maximum pool size");
+        if (maximumPoolSize < corePoolSize) {
+            throw new IllegalArgumentException(SpiI18n.maximumPoolSizeMayNotBeSmallerThanCorePoolSize.text());
+        }
+        final ReentrantLock mainLock = this.mainLock;
+        try {
+            mainLock.lock();
+            int extra = this.maximumPoolSize - maximumPoolSize;
+            this.maximumPoolSize = maximumPoolSize;
+            if (extra > 0 && poolSize > maximumPoolSize) {
+                // Drain the extra connections from those available ...
+                drainUnusedConnections(extra);
+            }
+        } finally {
+            mainLock.unlock();
+        }
+    }
+
+    /**
+     * Returns the core number of connections.
+     * @return the core number of connections
+     * @see #setCorePoolSize(int)
+     */
+    public int getCorePoolSize() {
+        return this.corePoolSize;
+    }
+
+    /**
+     * Sets the core number of connections. This overrides any value set in the constructor. If the new value is smaller than the
+     * current value, excess existing and unused connections will be closed. If larger, new connections will, if needed, be
+     * created.
+     * @param corePoolSize the new core size
+     * @throws RepositorySourceException if there was an error obtaining the new connection
+     * @throws InterruptedException if the thread was interrupted during the operation
+     * @throws IllegalArgumentException if <tt>corePoolSize</tt> less than zero
+     * @see #getCorePoolSize()
+     */
+    public void setCorePoolSize( int corePoolSize ) throws RepositorySourceException, InterruptedException {
+        ArgCheck.isNonNegative(corePoolSize, "core pool size");
+        if (maximumPoolSize < corePoolSize) {
+            throw new IllegalArgumentException(SpiI18n.maximumPoolSizeMayNotBeSmallerThanCorePoolSize.text());
+        }
+        final ReentrantLock mainLock = this.mainLock;
+        try {
+            mainLock.lock();
+            int extra = this.corePoolSize - corePoolSize;
+            this.corePoolSize = corePoolSize;
+            if (extra < 0) {
+                // Add connections ...
+                addConnectionsIfUnderCorePoolSize();
+            } else if (extra > 0 && poolSize > corePoolSize) {
+                // Drain the extra connections from those available ...
+                drainUnusedConnections(extra);
+            }
+        } finally {
+            mainLock.unlock();
+        }
+    }
+
+    // -------------------------------------------------
+    // Statistics ...
+    // -------------------------------------------------
+
+    /**
+     * Returns the current number of connections in the pool.
+     * @return the number of connections
+     */
+    public int getPoolSize() {
+        return poolSize;
+    }
+
+    /**
+     * Returns the approximate number of connections that have been checked out from the pool.
+     * @return the number of checked-out connections
+     */
+    public int getInUseCount() {
+        final ReentrantLock mainLock = this.mainLock;
+        try {
+            mainLock.lock();
+            return this.inUseConnections.size();
+        } finally {
+            mainLock.unlock();
+        }
+    }
+
+    /**
+     * Get the total number of connections that have been created by this pool.
+     * @return the total number of connections created by this pool
+     */
+    public long getTotalConnectionsCreated() {
+        return this.totalConnectionsCreated.get();
+    }
+
+    /**
+     * Get the total number of times connections have been {@link #getConnection()} used.
+     * @return the total number
+     */
+    public long getTotalConnectionsUsed() {
+        return this.totalConnectionsUsed.get();
+    }
+
+    // -------------------------------------------------
+    // Utility methods ...
+    // -------------------------------------------------
+
+    /**
+     * Call the supplied operation, using a connection from this pool.
+     * @param <T> the return type for the operation
+     * @param operation the operation to be run using a connection in this pool
+     * @return the results from the operation
+     * @throws RepositorySourceException if there was an error obtaining the new connection
+     * @throws InterruptedException if the thread was interrupted during the operation
+     * @throws IllegalArgumentException if the operation is null
+     * @see #callable(RepositoryOperation)
+     * @see #callables(Collection)
+     * @see #callables(RepositoryOperation...)
+     */
+    public <T> T call( RepositoryOperation<T> operation ) throws RepositorySourceException, InterruptedException {
+        ArgCheck.isNotNull(operation, "repository operation");
+        // Get a connection ...
+        T result = null;
+        LogContext.set("context", operation.getName());
+        RepositoryConnection conn = this.getConnection();
+        try {
+            // And run the client with the connection ...
+            result = operation.run(conn);
+        } finally {
+            conn.close();
+        }
+        LogContext.clear();
+        return result;
+    }
+
+    /**
+     * Return a callable object that, when run, performs the supplied repository operation against a connection in this pool.
+     * @param <T> the return type for the operation
+     * @param operation the operation to be run using a connection in this pool
+     * @return the callable
+     * @see #call(RepositoryOperation)
+     * @see #callables(Collection)
+     * @see #callables(RepositoryOperation...)
+     */
+    public <T> Callable<T> callable( final RepositoryOperation<T> operation ) {
+        ArgCheck.isNotNull(operation, "repository operation");
+        final RepositoryConnectionPool pool = this;
+        return new Callable<T>() {
+
+            /**
+             * Execute by getting a connection from this pool, running the client, and return the connection to the pool.
+             * @return the operation's result
+             * @throws Exception
+             */
+            public T call() throws Exception {
+                return pool.call(operation);
+            }
+        };
+    }
+
+    /**
+     * Return a collection of callable objects that, when run, perform the supplied repository operations against connections in
+     * this pool.
+     * @param <T> the return type for the operations
+     * @param operations the operations to be run using connection from this pool
+     * @return the collection of callables
+     * @see #call(RepositoryOperation)
+     * @see #callable(RepositoryOperation)
+     * @see #callables(Collection)
+     */
+    public <T> List<Callable<T>> callables( RepositoryOperation<T>... operations ) {
+        List<Callable<T>> callables = new ArrayList<Callable<T>>();
+        for (final RepositoryOperation<T> operation : operations) {
+            callables.add(callable(operation));
+        }
+        return callables;
+    }
+
+    /**
+     * Return a collection of callable objects that, when run, perform the supplied repository operations against connections in
+     * this pool.
+     * @param <T> the return type for the operations
+     * @param operations the operations to be run using connection from this pool
+     * @return the collection of callables
+     * @see #call(RepositoryOperation)
+     * @see #callable(RepositoryOperation)
+     * @see #callables(RepositoryOperation...)
+     */
+    public <T> List<Callable<T>> callables( Collection<RepositoryOperation<T>> operations ) {
+        List<Callable<T>> callables = new ArrayList<Callable<T>>();
+        for (final RepositoryOperation<T> operation : operations) {
+            callables.add(callable(operation));
+        }
+        return callables;
+    }
+
+    // -------------------------------------------------
+    // State management methods ...
+    // -------------------------------------------------
+
+    /**
+     * Starts a core connection, causing it to idly wait for use. This overrides the default policy of starting core connections
+     * only when they are {@link #getConnection() needed}. This method will return <tt>false</tt> if all core connections have
+     * already been started.
+     * @return true if a connection was started
+     * @throws RepositorySourceException if there was an error obtaining the new connection
+     * @throws InterruptedException if the thread was interrupted during the operation
+     */
+    public boolean prestartCoreConnection() throws RepositorySourceException, InterruptedException {
+        final ReentrantLock mainLock = this.mainLock;
+        try {
+            mainLock.lock();
+            return addConnectionIfUnderCorePoolSize();
+        } finally {
+            mainLock.unlock();
+        }
+    }
+
+    /**
+     * Starts all core connections, causing them to idly wait for use. This overrides the default policy of starting core
+     * connections only when they are {@link #getConnection() needed}.
+     * @return the number of connections started.
+     * @throws RepositorySourceException if there was an error obtaining the new connection
+     * @throws InterruptedException if the thread was interrupted during the operation
+     */
+    public int prestartAllCoreConnections() throws RepositorySourceException, InterruptedException {
+        final ReentrantLock mainLock = this.mainLock;
+        try {
+            mainLock.lock();
+            return addConnectionsIfUnderCorePoolSize();
+        } finally {
+            mainLock.unlock();
+        }
+    }
+
+    /**
+     * 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.
+     * @throws SecurityException if a security manager exists and shutting down this ConnectionPool 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.
+     */
+    public void shutdown() {
+        // Fail if caller doesn't have modifyThread permission. We
+        // explicitly check permissions directly because we can't trust
+        // implementations of SecurityManager to correctly override
+        // the "check access" methods such that our documented
+        // security policy is implemented.
+        SecurityManager security = System.getSecurityManager();
+        if (security != null) java.security.AccessController.checkPermission(shutdownPerm);
+
+        this.logger.debug("Shutting down repository connection pool for {0}", getName());
+        boolean fullyTerminated = false;
+        final ReentrantLock mainLock = this.mainLock;
+        try {
+            mainLock.lock();
+            int state = this.runState;
+            if (state == RUNNING) {
+                // don't override shutdownNow
+                this.runState = SHUTDOWN;
+            }
+
+            // Kill the maintenance thread ...
+
+            // Remove and close all available connections ...
+            if (!this.availableConnections.isEmpty()) {
+                // Drain the extra connections from those available ...
+                drainUnusedConnections(this.availableConnections.size());
+            }
+
+            // If there are no connections being used, trigger full termination now ...
+            if (this.inUseConnections.isEmpty()) {
+                fullyTerminated = true;
+                this.logger.trace("Signalling termination of repository connection pool for {0}", getName());
+                runState = TERMINATED;
+                termination.signalAll();
+                this.logger.debug("Terminated repository connection pool for {0}", getName());
+            }
+            // Otherwise the last connection that is closed will transition the runState to TERMINATED ...
+        } finally {
+            mainLock.unlock();
+        }
+        if (fullyTerminated) terminated();
+    }
+
+    /**
+     * Attempts to stop all actively executing tasks, halts the processing of waiting tasks, and returns a list of the tasks that
+     * were awaiting execution.
+     * <p>
+     * This implementation cancels tasks via {@link Thread#interrupt}, so if any tasks mask or fail to respond to interrupts,
+     * they may never terminate.
+     * @throws SecurityException if a security manager exists and shutting down this ExecutorService 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.
+     */
+    public void shutdownNow() {
+        // Almost the same code as shutdown()
+        SecurityManager security = System.getSecurityManager();
+        if (security != null) java.security.AccessController.checkPermission(shutdownPerm);
+
+        this.logger.debug("Shutting down (immediately) repository connection pool for {0}", getName());
+        boolean fullyTerminated = false;
+        final ReentrantLock mainLock = this.mainLock;
+        try {
+            mainLock.lock();
+            int state = this.runState;
+            if (state != TERMINATED) {
+                // don't override shutdownNow
+                this.runState = STOP;
+            }
+
+            // Kill the maintenance thread ...
+
+            // Remove and close all available connections ...
+            if (!this.availableConnections.isEmpty()) {
+                // Drain the extra connections from those available ...
+                drainUnusedConnections(this.availableConnections.size());
+            }
+
+            // If there are connections being used, close them now ...
+            if (!this.inUseConnections.isEmpty()) {
+                for (ConnectionWrapper connectionInUse : this.inUseConnections) {
+                    try {
+                        this.logger.trace("Closing repository connection to {0}", getName());
+                        connectionInUse.getOriginal().close();
+                    } catch (InterruptedException e) {
+                        // Ignore this ...
+                    }
+                }
+                this.poolSize -= this.inUseConnections.size();
+                // The last connection that is closed will transition the runState to TERMINATED ...
+            } else {
+                // There are no connections in use, so trigger full termination now ...
+                fullyTerminated = true;
+                this.logger.trace("Signalling termination of repository connection pool for {0}", getName());
+                runState = TERMINATED;
+                termination.signalAll();
+                this.logger.debug("Terminated repository connection pool for {0}", getName());
+            }
+
+        } finally {
+            mainLock.unlock();
+        }
+        if (fullyTerminated) terminated();
+    }
+
+    public boolean isShutdown() {
+        return runState != RUNNING;
+    }
+
+    /**
+     * Returns true if this executor is in the process of terminating after <tt>shutdown</tt> or <tt>shutdownNow</tt> 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.
+     */
+    public boolean isTerminating() {
+        return runState == STOP;
+    }
+
+    public boolean isTerminated() {
+        return runState == TERMINATED;
+    }
+
+    public boolean awaitTermination( long timeout, TimeUnit unit ) throws InterruptedException {
+        long nanos = unit.toNanos(timeout);
+        final ReentrantLock mainLock = this.mainLock;
+        try {
+            mainLock.lock();
+            for (;;) {
+                // this.logger.debug("---> Run state = {}; condition = {}", runState, termination);
+                if (runState == TERMINATED) return true;
+                if (nanos <= 0) return false;
+                nanos = termination.awaitNanos(nanos);
+                // this.logger.debug("---> Done waiting: run state = {}; condition = {}", runState, termination);
+            }
+        } finally {
+            mainLock.unlock();
+        }
+    }
+
+    /**
+     * Method invoked when the Executor has terminated. Default implementation does nothing. Note: To properly nest multiple
+     * overridings, subclasses should generally invoke <tt>super.terminated</tt> within this method.
+     */
+    protected void terminated() {
+    }
+
+    /**
+     * Invokes <tt>shutdown</tt> when this executor is no longer referenced.
+     */
+    @Override
+    protected void finalize() {
+        shutdown();
+    }
+
+    // -------------------------------------------------
+    // Connection management methods ...
+    // -------------------------------------------------
+
+    /**
+     * {@inheritDoc}
+     */
+    @SuppressWarnings( "null" )
+    public RepositoryConnection getConnection() throws RepositorySourceException, InterruptedException {
+        int attemptsAllowed = this.maxFailedAttemptsBeforeError.get();
+        ConnectionWrapper connection = null;
+        try {
+            // Do this until we get a good connection ...
+            int attemptsRemaining = attemptsAllowed;
+            while (connection == null && attemptsRemaining > 0) {
+                --attemptsRemaining;
+                ReentrantLock mainLock = this.mainLock;
+                try {
+                    mainLock.lock();
+                    // If we're shutting down the pool, then just close the connection ...
+                    if (this.runState != RUNNING) {
+                        throw new IllegalStateException(SpiI18n.repositoryConnectionPoolIsNotRunning.text());
+                    }
+                    // If there are fewer total connections than the core size ...
+                    if (this.poolSize < this.corePoolSize) {
+                        // Immediately create a wrapped connection and return it ...
+                        connection = newWrappedConnection();
+                    }
+                    // Peek to see if there is a connection available ...
+                    else if (this.availableConnections.peek() != null) {
+                        // There is, so take it and return it ...
+                        connection = this.availableConnections.take();
+                    }
+                    // There is no connection available. If there are fewer total connections than the maximum size ...
+                    else if (this.poolSize < this.maximumPoolSize) {
+                        // Immediately create a wrapped connection and return it ...
+                        connection = newWrappedConnection();
+                    }
+                    if (connection != null) {
+                        this.inUseConnections.add(connection);
+                    }
+                } finally {
+                    mainLock.unlock();
+                }
+                if (connection == null) {
+                    // There are not enough connections, so wait in line for the next available connection ...
+                    this.logger.trace("Waiting for a repository connection from pool {0}", getName());
+                    connection = this.availableConnections.take();
+                    mainLock = this.mainLock;
+                    mainLock.lock();
+                    try {
+                        if (connection != null) {
+                            this.inUseConnections.add(connection);
+                        }
+                    } finally {
+                        mainLock.unlock();
+                    }
+                    this.logger.trace("Recieved a repository connection from pool {0}", getName());
+                }
+                if (connection != null && this.validateConnectionBeforeUse.get()) {
+                    connection = validateConnection(connection);
+                }
+            }
+        } catch (InterruptedException e) {
+            this.logger.trace("Thread interrupted while waiting for a repository connection from pool {0}", getName());
+
+            // If the thread has been interrupted after we've taken a connection from the pool ...
+            if (connection != null) {
+                // We need to return the connection back into the pool ...
+                returnConnection(connection);
+            }
+            // And rethrow ...
+            throw e;
+        }
+        if (connection == null) {
+            // We were unable to obtain a usable connection, so fail ...
+            throw new RepositorySourceException(SpiI18n.unableToObtainValidRepositoryAfterAttempts.text(attemptsAllowed));
+        }
+        this.totalConnectionsUsed.incrementAndGet();
+        return connection;
+    }
+
+    /**
+     * This method is automatically called by the {@link ConnectionWrapper} when it is {@link ConnectionWrapper#close() closed}.
+     * @param wrapper the wrapper to the connection that is being returned to the pool
+     */
+    protected void returnConnection( ConnectionWrapper wrapper ) {
+        assert wrapper != null;
+        ConnectionWrapper wrapperToClose = null;
+        final ReentrantLock mainLock = this.mainLock;
+        try {
+            mainLock.lock();
+            // Remove the connection from the in-use set ...
+            boolean removed = this.inUseConnections.remove(wrapper);
+            assert removed;
+
+            // If we're shutting down the pool, then just close the connection ...
+            if (this.runState != RUNNING) {
+                wrapperToClose = wrapper;
+            }
+            // If there are more connections than the maximum size...
+            else if (this.poolSize > this.maximumPoolSize) {
+                // Immediately close this connection ...
+                wrapperToClose = wrapper;
+            }
+            // Attempt to make the connection available (this should generally work, unless there is an upper limit
+            // to the number of available connections) ...
+            else if (!this.availableConnections.offer(new ConnectionWrapper(wrapper.getOriginal()))) {
+                // The pool of available connection is full, so release it ...
+                wrapperToClose = wrapper;
+            }
+        } finally {
+            mainLock.unlock();
+        }
+        // Close the connection if we're supposed to (do it outside of the main lock)...
+        if (wrapperToClose != null) {
+            try {
+                closeConnection(wrapper);
+            } catch (InterruptedException e) {
+                // catch this, as there's not much we can do and the caller doesn't care or know how to handle it
+                this.logger.trace(e, "Interrupted while closing a repository connection");
+            }
+        }
+    }
+
+    /**
+     * Validate the supplied connection, returning the connection if valid or null if the connection is not valid.
+     * @param connection the connection to be validated; may not be null
+     * @return the validated connection, or null if the connection did not validate and was removed from the pool
+     */
+    protected ConnectionWrapper validateConnection( ConnectionWrapper connection ) {
+        assert connection != null;
+        ConnectionWrapper invalidConnection = null;
+        try {
+            if (!connection.ping(this.pingTimeout.get(), TimeUnit.NANOSECONDS)) {
+                invalidConnection = connection;
+            }
+        } catch (InterruptedException e) {
+            // catch this, as there's not much we can do and the caller doesn't care or know how to handle it
+            this.logger.trace(e, "Interrupted while pinging a repository connection");
+            invalidConnection = connection;
+        } finally {
+            if (invalidConnection != null) {
+                connection = null;
+                returnConnection(invalidConnection);
+            }
+        }
+        return connection;
+    }
+
+    /**
+     * Obtain a new connection wrapped in a {@link ConnectionWrapper}. This method does not check whether creating the new
+     * connection would violate the {@link #maximumPoolSize maximum pool size} nor does it add the new connection to the
+     * {@link #availableConnections available connections} (as the caller may want it immediately), but it does increment the
+     * {@link #poolSize pool size}.
+     * @return the connection wrapper with a new connection
+     * @throws RepositorySourceException if there was an error obtaining the new connection
+     * @throws InterruptedException if the thread was interrupted during the operation
+     */
+    @GuardedBy( "mainLock" )
+    protected ConnectionWrapper newWrappedConnection() throws RepositorySourceException, InterruptedException {
+        RepositoryConnection connection = this.connectionFactory.getConnection();
+        ++this.poolSize;
+        this.totalConnectionsCreated.incrementAndGet();
+        return new ConnectionWrapper(connection);
+    }
+
+    /**
+     * Close a connection that is in the pool but no longer in the {@link #availableConnections available connections}. This
+     * method does decrement the {@link #poolSize pool size}.
+     * @param wrapper the wrapper for the connection to be closed
+     * @throws InterruptedException if the thread was interrupted during the operation
+     */
+    protected void closeConnection( ConnectionWrapper wrapper ) throws InterruptedException {
+        assert wrapper != null;
+        RepositoryConnection original = wrapper.getOriginal();
+        assert original != null;
+        try {
+            this.logger.debug("Closing repository connection to {0}", getName());
+            original.close();
+        } finally {
+            final ReentrantLock mainLock = this.mainLock;
+            try {
+                mainLock.lock();
+                // No matter what reduce the pool size count
+                --this.poolSize;
+                // And if shutting down and this was the last connection being used...
+                if (this.runState == SHUTDOWN && this.poolSize <= 0) {
+                    // then signal anybody that has called "awaitTermination(...)"
+                    this.logger.trace("Signalling termination of repository connection pool for {0}", getName());
+                    this.runState = TERMINATED;
+                    this.termination.signalAll();
+                    this.logger.trace("Terminated repository connection pool for {0}", getName());
+
+                    // fall through to call terminate() outside of lock.
+                }
+            } finally {
+                mainLock.unlock();
+            }
+        }
+    }
+
+    @GuardedBy( "mainLock" )
+    protected int drainUnusedConnections( int count ) {
+        if (count <= 0) return 0;
+        this.logger.trace("Draining up to {} unused repository connections to {0}", count, getName());
+        // Drain the extra connections from those available ...
+        Collection<ConnectionWrapper> extraConnections = new LinkedList<ConnectionWrapper>();
+        this.availableConnections.drainTo(extraConnections, count);
+        for (ConnectionWrapper connection : extraConnections) {
+            try {
+                this.logger.trace("Closing repository connection to {0}", getName());
+                connection.getOriginal().close();
+            } catch (InterruptedException e) {
+                // Ignore this ...
+            }
+        }
+        int numClosed = extraConnections.size();
+        this.poolSize -= numClosed;
+        this.logger.trace("Drained {0} unused connections", numClosed);
+        return numClosed;
+    }
+
+    @GuardedBy( "mainLock" )
+    protected boolean addConnectionIfUnderCorePoolSize() throws RepositorySourceException, InterruptedException {
+        // Add connection ...
+        if (this.poolSize < this.corePoolSize) {
+            this.availableConnections.offer(newWrappedConnection());
+            this.logger.trace("Added connection to {0} in undersized pool", getName());
+            return true;
+        }
+        return false;
+    }
+
+    @GuardedBy( "mainLock" )
+    protected int addConnectionsIfUnderCorePoolSize() throws RepositorySourceException, InterruptedException {
+        // Add connections ...
+        int n = 0;
+        while (this.poolSize < this.corePoolSize) {
+            this.availableConnections.offer(newWrappedConnection());
+            ++n;
+        }
+        this.logger.trace("Added {0} connection(s) to {1} in undersized pool", n, getName());
+        return n;
+    }
+
+    protected class ConnectionWrapper implements RepositoryConnection {
+
+        private final RepositoryConnection original;
+        private final long timeCreated;
+        private long lastUsed;
+        private boolean closed = false;
+
+        protected ConnectionWrapper( RepositoryConnection connection ) {
+            assert connection != null;
+            this.original = connection;
+            this.timeCreated = System.currentTimeMillis();
+        }
+
+        /**
+         * @return original
+         */
+        protected RepositoryConnection getOriginal() {
+            return this.original;
+        }
+
+        /**
+         * @return lastUsed
+         */
+        public long getTimeLastUsed() {
+            return this.lastUsed;
+        }
+
+        /**
+         * @return timeCreated
+         */
+        public long getTimeCreated() {
+            return this.timeCreated;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public String getSourceName() {
+            return this.original.getSourceName();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public XAResource getXAResource() {
+            if (closed) throw new IllegalStateException(SpiI18n.closedConnectionMayNotBeUsed.text());
+            return this.original.getXAResource();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void execute( ExecutionEnvironment env, GraphCommand... commands ) throws RepositorySourceException, InterruptedException {
+            if (closed) throw new IllegalStateException(SpiI18n.closedConnectionMayNotBeUsed.text());
+            this.original.execute(env, commands);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public boolean ping( long time, TimeUnit unit ) throws InterruptedException {
+            if (closed) throw new IllegalStateException(SpiI18n.closedConnectionMayNotBeUsed.text());
+            return this.original.ping(time, unit);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void close() throws InterruptedException {
+            if (!closed) {
+                this.lastUsed = System.currentTimeMillis();
+                this.original.close();
+                this.closed = true;
+                returnConnection(this);
+            }
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void setListener( RepositorySourceListener listener ) {
+            if (!closed) this.original.setListener(listener);
+        }
+
+    }
+
+}

Deleted: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryOperation.java
===================================================================
--- branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryOperation.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryOperation.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -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.graph.connection;
-
-/**
- * @author Randall Hauch
- * @param <T> the type of result returned by the client
- */
-public interface RepositoryOperation<T> {
-
-    String getName();
-
-    T run( RepositoryConnection connection ) throws RepositorySourceException, InterruptedException;
-
-    public static interface Factory<T> {
-
-        RepositoryOperation<T> create();
-    }
-
-}

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryOperation.java (from rev 219, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryOperation.java)
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryOperation.java	                        (rev 0)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryOperation.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,39 @@
+/*
+ * 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.graph.connection;
+
+/**
+ * @author Randall Hauch
+ * @param <T> the type of result returned by the client
+ */
+public interface RepositoryOperation<T> {
+
+    String getName();
+
+    T run( RepositoryConnection connection ) throws RepositorySourceException, InterruptedException;
+
+    public static interface Factory<T> {
+
+        RepositoryOperation<T> create();
+    }
+
+}

Deleted: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositorySource.java
===================================================================
--- branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositorySource.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositorySource.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -1,68 +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.graph.connection;
-
-import java.io.Serializable;
-import javax.naming.Referenceable;
-import org.jboss.dna.spi.cache.CachePolicy;
-
-/**
- * A repository source is a description of a resource that can be used to access or store repository information. This class
- * serves as a factory for {@link RepositoryConnection} instances and provides some basic configuration information.
- * <p>
- * Typically this interface is implemented by classes that provide standard-style getters and setters for the various properties
- * necessary for proper configuration via reflection or introspection. This interface expects nor defines any such properties,
- * leaving that entirely to the implementation classes.
- * </p>
- * <p>
- * Objects that implement this <code>RepositorySource</code> interface are typically registered with a naming service such as
- * Java Naming and Directory Interface<sup><font size=-3>TM</font></sup> (JNDI). This interface extends both
- * {@link Referenceable} and {@link Serializable} so that such objects can be stored in any JNDI naming context and enable proper
- * system recovery,
- * </p>
- * @author Randall Hauch
- */
-public interface RepositorySource extends RepositoryConnectionFactory, Referenceable, Serializable {
-
-    /**
-     * 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.
-     * @return the maximum number of allowable retries, or 0 if the source has no limit
-     */
-    int getRetryLimit();
-
-    /**
-     * Set 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.
-     * @param limit the maximum number of allowable retries, or 0 if the source has no limit
-     */
-    void setRetryLimit( int limit );
-
-    /**
-     * Get the default cache policy for this source. If none is provided, a global cache policy will be used.
-     * @return the default cache policy
-     */
-    CachePolicy getDefaultCachePolicy();
-
-}

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositorySource.java (from rev 219, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositorySource.java)
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositorySource.java	                        (rev 0)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositorySource.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,68 @@
+/*
+ * 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.graph.connection;
+
+import java.io.Serializable;
+import javax.naming.Referenceable;
+import org.jboss.dna.spi.cache.CachePolicy;
+
+/**
+ * A repository source is a description of a resource that can be used to access or store repository information. This class
+ * serves as a factory for {@link RepositoryConnection} instances and provides some basic configuration information.
+ * <p>
+ * Typically this interface is implemented by classes that provide standard-style getters and setters for the various properties
+ * necessary for proper configuration via reflection or introspection. This interface expects nor defines any such properties,
+ * leaving that entirely to the implementation classes.
+ * </p>
+ * <p>
+ * Objects that implement this <code>RepositorySource</code> interface are typically registered with a naming service such as
+ * Java Naming and Directory Interface<sup><font size=-3>TM</font></sup> (JNDI). This interface extends both
+ * {@link Referenceable} and {@link Serializable} so that such objects can be stored in any JNDI naming context and enable proper
+ * system recovery,
+ * </p>
+ * @author Randall Hauch
+ */
+public interface RepositorySource extends RepositoryConnectionFactory, Referenceable, Serializable {
+
+    /**
+     * 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.
+     * @return the maximum number of allowable retries, or 0 if the source has no limit
+     */
+    int getRetryLimit();
+
+    /**
+     * Set 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.
+     * @param limit the maximum number of allowable retries, or 0 if the source has no limit
+     */
+    void setRetryLimit( int limit );
+
+    /**
+     * Get the default cache policy for this source. If none is provided, a global cache policy will be used.
+     * @return the default cache policy
+     */
+    CachePolicy getDefaultCachePolicy();
+
+}

Deleted: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositorySourceException.java
===================================================================
--- branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositorySourceException.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositorySourceException.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -1,73 +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.graph.connection;
-
-/**
- * @author Randall Hauch
- */
-public class RepositorySourceException extends RuntimeException {
-
-    private final String sourceName;
-
-    /**
-     * @param sourceName the identifier of the source from which this exception eminates
-     */
-    public RepositorySourceException( String sourceName ) {
-        this.sourceName = sourceName;
-    }
-
-    /**
-     * @param sourceName the identifier of the source from which this exception eminates
-     * @param message
-     */
-    public RepositorySourceException( String sourceName, String message ) {
-        super(message);
-        this.sourceName = sourceName;
-    }
-
-    /**
-     * @param sourceName the identifier of the source from which this exception eminates
-     * @param cause
-     */
-    public RepositorySourceException( String sourceName, Throwable cause ) {
-        super(cause);
-        this.sourceName = sourceName;
-    }
-
-    /**
-     * @param sourceName the identifier of the source from which this exception eminates
-     * @param message
-     * @param cause
-     */
-    public RepositorySourceException( String sourceName, String message, Throwable cause ) {
-        super(message, cause);
-        this.sourceName = sourceName;
-    }
-
-    /**
-     * @return sourceName
-     */
-    public String getSourceName() {
-        return this.sourceName;
-    }
-
-}

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositorySourceException.java (from rev 219, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositorySourceException.java)
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositorySourceException.java	                        (rev 0)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositorySourceException.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,73 @@
+/*
+ * 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.graph.connection;
+
+/**
+ * @author Randall Hauch
+ */
+public class RepositorySourceException extends RuntimeException {
+
+    private final String sourceName;
+
+    /**
+     * @param sourceName the identifier of the source from which this exception eminates
+     */
+    public RepositorySourceException( String sourceName ) {
+        this.sourceName = sourceName;
+    }
+
+    /**
+     * @param sourceName the identifier of the source from which this exception eminates
+     * @param message
+     */
+    public RepositorySourceException( String sourceName, String message ) {
+        super(message);
+        this.sourceName = sourceName;
+    }
+
+    /**
+     * @param sourceName the identifier of the source from which this exception eminates
+     * @param cause
+     */
+    public RepositorySourceException( String sourceName, Throwable cause ) {
+        super(cause);
+        this.sourceName = sourceName;
+    }
+
+    /**
+     * @param sourceName the identifier of the source from which this exception eminates
+     * @param message
+     * @param cause
+     */
+    public RepositorySourceException( String sourceName, String message, Throwable cause ) {
+        super(message, cause);
+        this.sourceName = sourceName;
+    }
+
+    /**
+     * @return sourceName
+     */
+    public String getSourceName() {
+        return this.sourceName;
+    }
+
+}

Deleted: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositorySourceListener.java
===================================================================
--- branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositorySourceListener.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositorySourceListener.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -1,30 +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.graph.connection;
-
-/**
- * @author Randall Hauch
- */
-public interface RepositorySourceListener {
-
-    void notify( String sourceName, Object... events );
-}

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositorySourceListener.java (from rev 219, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositorySourceListener.java)
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositorySourceListener.java	                        (rev 0)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositorySourceListener.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,30 @@
+/*
+ * 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.graph.connection;
+
+/**
+ * @author Randall Hauch
+ */
+public interface RepositorySourceListener {
+
+    void notify( String sourceName, Object... events );
+}

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/impl/BasicEmptyProperty.java (from rev 219, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/impl/BasicEmptyProperty.java)
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/impl/BasicEmptyProperty.java	                        (rev 0)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/impl/BasicEmptyProperty.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,110 @@
+/*
+ * 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.graph.impl;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import net.jcip.annotations.Immutable;
+import org.jboss.dna.spi.graph.Name;
+import org.jboss.dna.spi.graph.PropertyType;
+import org.jboss.dna.spi.graph.ValueFactories;
+
+/**
+ * @author Randall Hauch
+ */
+ at Immutable
+public class BasicEmptyProperty extends BasicProperty {
+
+    /**
+     * @param name
+     * @param type
+     * @param definitionName
+     * @param valueFactories
+     */
+    public BasicEmptyProperty( Name name, PropertyType type, Name definitionName, ValueFactories valueFactories ) {
+        super(name, type, definitionName, valueFactories);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isEmpty() {
+        return true;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isMultiple() {
+        return false;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isSingle() {
+        return false;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public int size() {
+        return 0;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator<Object> iterator() {
+        return new EmptyIterator<Object>();
+    }
+
+    protected class EmptyIterator<T> implements Iterator<T> {
+
+        protected EmptyIterator() {
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public boolean hasNext() {
+            return false;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public T next() {
+            throw new NoSuchElementException();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void remove() {
+            throw new UnsupportedOperationException();
+        }
+
+    }
+
+}

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/impl/BasicMultiValueProperty.java (from rev 219, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/impl/BasicMultiValueProperty.java)
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/impl/BasicMultiValueProperty.java	                        (rev 0)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/impl/BasicMultiValueProperty.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,120 @@
+/*
+ * 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.graph.impl;
+
+import java.util.Iterator;
+import java.util.List;
+import net.jcip.annotations.Immutable;
+import org.jboss.dna.spi.graph.Name;
+import org.jboss.dna.spi.graph.PropertyType;
+import org.jboss.dna.spi.graph.ValueFactories;
+
+/**
+ * @author Randall Hauch
+ */
+ at Immutable
+public class BasicMultiValueProperty extends BasicProperty {
+
+    private final List<Object> values;
+
+    /**
+     * @param name
+     * @param type
+     * @param definitionName
+     * @param valueFactories
+     * @param values
+     */
+    public BasicMultiValueProperty( Name name, PropertyType type, Name definitionName, ValueFactories valueFactories, List<Object> values ) {
+        super(name, type, definitionName, valueFactories);
+        this.values = values;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isEmpty() {
+        assert values.isEmpty() == false;
+        return false;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isMultiple() {
+        assert values.size() > 1;
+        return true;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isSingle() {
+        assert values.size() == 1;
+        return false;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public int size() {
+        return values.size();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator<Object> iterator() {
+        return new ReadOnlyIterator(values.iterator());
+    }
+
+    protected class ReadOnlyIterator implements Iterator<Object> {
+
+        private final Iterator<Object> values;
+
+        protected ReadOnlyIterator( Iterator<Object> values ) {
+            assert values != null;
+            this.values = values;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public boolean hasNext() {
+            return values.hasNext();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public Object next() {
+            return values.next();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void remove() {
+            throw new UnsupportedOperationException();
+        }
+
+    }
+}

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/impl/BasicProperty.java (from rev 219, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/impl/BasicProperty.java)
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/impl/BasicProperty.java	                        (rev 0)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/impl/BasicProperty.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,293 @@
+/*
+ * 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.graph.impl;
+
+import java.math.BigDecimal;
+import java.net.URI;
+import java.util.Iterator;
+import net.jcip.annotations.Immutable;
+import org.jboss.dna.spi.graph.Binary;
+import org.jboss.dna.spi.graph.DateTime;
+import org.jboss.dna.spi.graph.Name;
+import org.jboss.dna.spi.graph.Path;
+import org.jboss.dna.spi.graph.Property;
+import org.jboss.dna.spi.graph.PropertyType;
+import org.jboss.dna.spi.graph.Reference;
+import org.jboss.dna.spi.graph.ValueFactories;
+import org.jboss.dna.spi.graph.ValueFactory;
+
+/**
+ * @author Randall Hauch
+ */
+ at Immutable
+public abstract class BasicProperty implements Property {
+
+    private final Name name;
+    private final Name definitionName;
+    private final PropertyType type;
+    private final ValueFactories factories;
+
+    /**
+     * @param name
+     * @param type
+     * @param definitionName
+     * @param valueFactories
+     */
+    public BasicProperty( Name name, PropertyType type, Name definitionName, ValueFactories valueFactories ) {
+        this.name = name;
+        this.type = type;
+        this.definitionName = definitionName;
+        this.factories = valueFactories;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Name getName() {
+        return name;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Name getDefinitionName() {
+        return definitionName;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public PropertyType getPropertyType() {
+        return type;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator<Binary> getBinaryValues() {
+        return new ValueIterator<Binary>(factories.getBinaryFactory(), iterator());
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator<Boolean> getBooleanValues() {
+        return new ValueIterator<Boolean>(factories.getBooleanFactory(), iterator());
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator<DateTime> getDateValues() {
+        return new ValueIterator<DateTime>(factories.getDateFactory(), iterator());
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator<BigDecimal> getDecimalValues() {
+        return new ValueIterator<BigDecimal>(factories.getDecimalFactory(), iterator());
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator<Double> getDoubleValues() {
+        return new ValueIterator<Double>(factories.getDoubleFactory(), iterator());
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator<Long> getLongValues() {
+        return new ValueIterator<Long>(factories.getLongFactory(), iterator());
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator<Name> getNameValues() {
+        return new ValueIterator<Name>(factories.getNameFactory(), iterator());
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator<Path> getPathValues() {
+        return new ValueIterator<Path>(factories.getPathFactory(), iterator());
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator<Reference> getReferenceValues() {
+        return new ValueIterator<Reference>(factories.getReferenceFactory(), iterator());
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator<String> getStringValues() {
+        return new ValueIterator<String>(factories.getStringFactory(), iterator());
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator<URI> getUriValues() {
+        return new ValueIterator<URI>(factories.getUriFactory(), iterator());
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator<?> getValues() {
+        return iterator();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator<?> getValues( PropertyType type ) {
+        switch (type) {
+            case BINARY:
+                return getBinaryValues();
+            case BOOLEAN:
+                return getBooleanValues();
+            case DATE:
+                return getDateValues();
+            case DECIMAL:
+                return getDecimalValues();
+            case DOUBLE:
+                return getDoubleValues();
+            case LONG:
+                return getLongValues();
+            case NAME:
+                return getNameValues();
+            case OBJECT:
+                return getValues();
+            case PATH:
+                return getPathValues();
+            case REFERENCE:
+                return getReferenceValues();
+            case STRING:
+                return getStringValues();
+            case URI:
+                return getUriValues();
+        }
+        return getValues(); // should never get here ...
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Object[] getValuesAsArray() {
+        if (size() == 0) return null;
+        Object[] results = new Object[size()];
+        Iterator<?> iter = iterator();
+        int index = 0;
+        while (iter.hasNext()) {
+            Object value = iter.next();
+            results[index++] = value;
+        }
+        return results;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public int compareTo( Property o ) {
+        return 0;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int hashCode() {
+        return name.hashCode();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean equals( Object obj ) {
+        if (this == obj) return true;
+        if (obj instanceof Property) {
+            Property that = (Property)obj;
+            if (!this.getName().equals(that.getName())) return false;
+            if (this.getPropertyType() != that.getPropertyType()) return false;
+            if (this.size() != that.size()) return false;
+            Iterator<?> thisIter = iterator();
+            Iterator<?> thatIter = that.iterator();
+            while (thisIter.hasNext()) { // && thatIter.hasNext()
+                Object thisValue = thisIter.next();
+                Object thatValue = thatIter.next();
+                if (thisValue == null) {
+                    if (thatValue != null) return false;
+                    // else both are null
+                } else {
+                    if (!thisValue.equals(thatValue)) return false;
+                }
+            }
+            return true;
+        }
+        return false;
+    }
+
+    protected class ValueIterator<T> implements Iterator<T> {
+
+        private final ValueFactory<T> factory;
+        private final Iterator<Object> values;
+
+        protected ValueIterator( ValueFactory<T> factory, Iterator<Object> values ) {
+            assert factory != null;
+            assert values != null;
+            this.factory = factory;
+            this.values = values;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public boolean hasNext() {
+            return values.hasNext();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public T next() {
+            return factory.create(values.next());
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void remove() {
+            throw new UnsupportedOperationException();
+        }
+
+    }
+
+}

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/impl/BasicPropertyFactory.java (from rev 219, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/impl/BasicPropertyFactory.java)
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/impl/BasicPropertyFactory.java	                        (rev 0)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/impl/BasicPropertyFactory.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,135 @@
+/*
+ * 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.graph.impl;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.spi.graph.Name;
+import org.jboss.dna.spi.graph.Property;
+import org.jboss.dna.spi.graph.PropertyFactory;
+import org.jboss.dna.spi.graph.PropertyType;
+import org.jboss.dna.spi.graph.ValueFactories;
+import org.jboss.dna.spi.graph.ValueFactory;
+
+/**
+ * @author Randall Hauch
+ */
+public class BasicPropertyFactory implements PropertyFactory {
+
+    private final ValueFactories factories;
+
+    /**
+     * @param valueFactories the value factories
+     * @throws IllegalArgumentException if the reference to the value factories is null
+     */
+    public BasicPropertyFactory( ValueFactories valueFactories ) {
+        ArgCheck.isNotNull(valueFactories, "value factories");
+        this.factories = valueFactories;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Property create( Name name, PropertyType type, Name definitionName, Object... values ) {
+        ArgCheck.isNotNull(name, "name");
+        ArgCheck.isNotNull(type, "type");
+        if (values == null || values.length == 0) {
+            return new BasicEmptyProperty(name, type, definitionName, this.factories);
+        }
+        final int len = values.length;
+        final ValueFactory<?> factory = factories.getValueFactory(type);
+        if (values.length == 1) {
+            Object value = values[0];
+            // Check whether the sole value was a collection ...
+            if (value instanceof Collection) {
+                // The single value is a collection, so create property with the collection's contents ...
+                return create(name, type, definitionName, (Collection<?>)value);
+            }
+            value = factory.create(values[0]);
+            return new BasicSingleValueProperty(name, type, definitionName, this.factories, value);
+        }
+        List<Object> valueList = new ArrayList<Object>(len);
+        for (int i = 0; i != len; ++i) {
+            Object value = factory.create(values[i]);
+            valueList.add(value);
+        }
+        return new BasicMultiValueProperty(name, type, definitionName, this.factories, valueList);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @SuppressWarnings( "unchecked" )
+    public Property create( Name name, PropertyType type, Name definitionName, Iterable<?> values ) {
+        ArgCheck.isNotNull(name, "name");
+        ArgCheck.isNotNull(type, "type");
+        List<Object> valueList = null;
+        if (values instanceof Collection) {
+            Collection<Object> originalValues = (Collection<Object>)values;
+            if (originalValues.isEmpty()) {
+                return new BasicEmptyProperty(name, type, definitionName, this.factories);
+            }
+            valueList = new ArrayList<Object>(originalValues.size());
+        } else {
+            // We don't know the size
+            valueList = new ArrayList<Object>();
+        }
+        // Copy the values, ensuring that the values are the correct type ...
+        final ValueFactory<?> factory = factories.getValueFactory(type);
+        for (Object value : values) {
+            valueList.add(factory.create(value));
+        }
+        if (valueList.isEmpty()) { // may not have been a collection earlier
+            return new BasicEmptyProperty(name, type, definitionName, this.factories);
+        }
+        if (valueList.size() == 1) {
+            return new BasicSingleValueProperty(name, type, definitionName, this.factories, valueList.get(0));
+        }
+        return new BasicMultiValueProperty(name, type, definitionName, this.factories, valueList);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Property create( Name name, PropertyType type, Name definitionName, Iterator<?> values ) {
+        ArgCheck.isNotNull(name, "name");
+        ArgCheck.isNotNull(type, "type");
+        final List<Object> valueList = new ArrayList<Object>();
+        final ValueFactory<?> factory = factories.getValueFactory(type);
+        while (values.hasNext()) {
+            Object value = values.next();
+            value = factory.create(value);
+            valueList.add(value);
+        }
+        if (valueList.isEmpty()) {
+            return new BasicEmptyProperty(name, type, definitionName, this.factories);
+        }
+        if (valueList.size() == 1) {
+            return new BasicSingleValueProperty(name, type, definitionName, this.factories, valueList.get(0));
+        }
+        return new BasicMultiValueProperty(name, type, definitionName, this.factories, valueList);
+    }
+
+}

Copied: trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/impl/BasicSingleValueProperty.java (from rev 219, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/impl/BasicSingleValueProperty.java)
===================================================================
--- trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/impl/BasicSingleValueProperty.java	                        (rev 0)
+++ trunk/dna-spi/src/main/java/org/jboss/dna/spi/graph/impl/BasicSingleValueProperty.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,120 @@
+/*
+ * 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.graph.impl;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import net.jcip.annotations.Immutable;
+import org.jboss.dna.spi.graph.Name;
+import org.jboss.dna.spi.graph.PropertyType;
+import org.jboss.dna.spi.graph.ValueFactories;
+
+/**
+ * @author Randall Hauch
+ */
+ at Immutable
+public class BasicSingleValueProperty extends BasicProperty {
+
+    protected final Object value;
+
+    /**
+     * @param name
+     * @param type
+     * @param definitionName
+     * @param valueFactories
+     * @param value
+     */
+    public BasicSingleValueProperty( Name name, PropertyType type, Name definitionName, ValueFactories valueFactories, Object value ) {
+        super(name, type, definitionName, valueFactories);
+        this.value = value;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isEmpty() {
+        return false;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isMultiple() {
+        return false;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isSingle() {
+        return true;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public int size() {
+        return 1;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator<Object> iterator() {
+        return new ValueIterator();
+    }
+
+    protected class ValueIterator implements Iterator<Object> {
+
+        private boolean done = false;
+
+        protected ValueIterator() {
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public boolean hasNext() {
+            return !done;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public Object next() {
+            if (!done) {
+                done = true;
+                return BasicSingleValueProperty.this.value;
+            }
+            throw new NoSuchElementException();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void remove() {
+            throw new UnsupportedOperationException();
+        }
+
+    }
+
+}

Modified: trunk/dna-spi/src/main/resources/org/jboss/dna/spi/SpiI18n.properties
===================================================================
--- trunk/dna-spi/src/main/resources/org/jboss/dna/spi/SpiI18n.properties	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-spi/src/main/resources/org/jboss/dna/spi/SpiI18n.properties	2008-06-02 17:13:20 UTC (rev 220)
@@ -16,4 +16,9 @@
 unbleToCreateSubpathBeginIndexGreaterThanOrEqualToSize = Unable to create subpath: fromIndex({0}) >= size({1})
 unbleToCreateSubpathBeginIndexGreaterThanOrEqualToEndingIndex = Unable to create subpath: fromIndex({0}) >= toIndex({1})
 
-invalidQualifiedNameString = Unable to parse qualified name from "{0}"
\ No newline at end of file
+invalidQualifiedNameString = Unable to parse qualified name from "{0}"
+
+maximumPoolSizeMayNotBeSmallerThanCorePoolSize = The maximum pool size may not be smaller than the core pool size
+repositoryConnectionPoolIsNotRunning = The repository connection pool is not running
+unableToObtainValidRepositoryAfterAttempts = Unable to obtain a valid repository after {0} attempts
+closedConnectionMayNotBeUsed = The connection has been closed an may not be used

Copied: trunk/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection (from rev 219, branches/federation/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection)

Deleted: trunk/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/MockRepositorySource.java
===================================================================
--- branches/federation/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/MockRepositorySource.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/MockRepositorySource.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -1,234 +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.graph.connection;
-
-import java.util.Set;
-import java.util.concurrent.CopyOnWriteArraySet;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.concurrent.atomic.AtomicReference;
-import javax.naming.Reference;
-import javax.transaction.xa.XAResource;
-import net.jcip.annotations.ThreadSafe;
-import org.jboss.dna.spi.cache.CachePolicy;
-import org.jboss.dna.spi.graph.commands.GraphCommand;
-import org.jmock.Mockery;
-
-/**
- * @author Randall Hauch
- */
- at ThreadSafe
-public class MockRepositorySource implements RepositorySource {
-
-    private final String identifier;
-    private final AtomicInteger retryLimit = new AtomicInteger(0);
-    private final Mockery context;
-    private final AtomicInteger connectionsOpenedCount = new AtomicInteger(0);
-    private final AtomicInteger connectionsClosedCount = new AtomicInteger(0);
-    private final Set<Connection> openConnections = new CopyOnWriteArraySet<Connection>();
-    private CachePolicy defaultCachePolicy;
-
-    public MockRepositorySource( String identifier, Mockery context ) {
-        this.identifier = identifier;
-        this.context = context;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public String getName() {
-        return this.identifier;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public int getRetryLimit() {
-        return this.retryLimit.get();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void setRetryLimit( int limit ) {
-        this.retryLimit.set(limit);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public CachePolicy getDefaultCachePolicy() {
-        return defaultCachePolicy;
-    }
-
-    public void setDefaultCachePolicy( CachePolicy defaultCachePolicy ) {
-        this.defaultCachePolicy = defaultCachePolicy;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public RepositoryConnection getConnection() throws RepositorySourceException {
-        int connectionNumber = this.connectionsOpenedCount.incrementAndGet();
-        String connectionName = "Connection " + connectionNumber;
-        XAResource xaResource = context != null ? context.mock(XAResource.class, connectionName) : null;
-        Connection c = newConnection(connectionName, xaResource);
-        this.openConnections.add(c);
-        return c;
-    }
-
-    protected Connection newConnection( String connectionName, XAResource xaResource ) throws RepositorySourceException {
-        Connection c = new Connection(connectionName);
-        c.setXaResource(xaResource);
-        return c;
-    }
-
-    protected void close( Connection conn ) {
-        if (conn != null && this.openConnections.remove(conn)) {
-            this.connectionsClosedCount.incrementAndGet();
-        }
-    }
-
-    public int getOpenConnectionCount() {
-        return this.openConnections.size();
-    }
-
-    public int getTotalConnectionsCreated() {
-        return this.connectionsOpenedCount.get();
-    }
-
-    public int getTotalConnectionsClosed() {
-        return this.connectionsClosedCount.get();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Reference getReference() {
-        throw new UnsupportedOperationException();
-    }
-
-    public class Connection implements RepositoryConnection {
-
-        private final String connectionName;
-        private final AtomicBoolean closed = new AtomicBoolean(false);
-        private final AtomicBoolean loadResponse = new AtomicBoolean(true);
-        private final AtomicBoolean pingResponse = new AtomicBoolean(true);
-        private final AtomicLong closeCount = new AtomicLong(0);
-        private final AtomicLong loadCount = new AtomicLong(0);
-        private final AtomicLong loadDelay = new AtomicLong(0);
-        private final AtomicLong pingCount = new AtomicLong(0);
-        private final AtomicLong pingDelay = new AtomicLong(0);
-        private final AtomicReference<XAResource> xaResource = new AtomicReference<XAResource>();
-
-        protected Connection( String connectionName ) {
-            assert connectionName != null && connectionName.trim().length() != 0;
-            this.connectionName = connectionName;
-        }
-
-        public String getConnectionName() {
-            return this.connectionName;
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        public void close() {
-            this.closeCount.incrementAndGet();
-            this.closed.set(true);
-            MockRepositorySource.this.close(this);
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        public String getSourceName() {
-            return MockRepositorySource.this.getName();
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        public XAResource getXAResource() {
-            return this.xaResource.get();
-        }
-
-        public void setXaResource( XAResource xaResource ) {
-            this.xaResource.set(xaResource);
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        public void execute( ExecutionEnvironment env, GraphCommand... commands ) throws RepositorySourceException, InterruptedException {
-            long delay = this.loadDelay.get();
-            if (delay > 0l) Thread.sleep(delay);
-            this.loadCount.incrementAndGet();
-        }
-
-        public void setLoadResponse( boolean response ) {
-            this.loadResponse.set(response);
-        }
-
-        public void setLoadDelay( long time, TimeUnit unit ) {
-            this.loadDelay.set(unit.toMillis(time));
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        public boolean ping( long time, TimeUnit unit ) throws InterruptedException {
-            Thread.sleep(this.pingDelay.get());
-            return this.pingResponse.get();
-        }
-
-        public void setPingResponse( boolean pingResponse ) {
-            this.pingResponse.set(pingResponse);
-        }
-
-        public void setPingDelay( long time, TimeUnit unit ) {
-            this.pingDelay.set(unit.toMillis(time));
-        }
-
-        public long getPingCount() {
-            return this.pingCount.get();
-        }
-
-        public long getLoadCount() {
-            return this.loadCount.get();
-        }
-
-        public long getCloseCount() {
-            return this.closeCount.get();
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        public void setListener( RepositorySourceListener listener ) {
-        }
-
-    }
-
-}

Copied: trunk/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/MockRepositorySource.java (from rev 219, branches/federation/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/MockRepositorySource.java)
===================================================================
--- trunk/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/MockRepositorySource.java	                        (rev 0)
+++ trunk/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/MockRepositorySource.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,234 @@
+/*
+ * 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.graph.connection;
+
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArraySet;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.atomic.AtomicReference;
+import javax.naming.Reference;
+import javax.transaction.xa.XAResource;
+import net.jcip.annotations.ThreadSafe;
+import org.jboss.dna.spi.cache.CachePolicy;
+import org.jboss.dna.spi.graph.commands.GraphCommand;
+import org.jmock.Mockery;
+
+/**
+ * @author Randall Hauch
+ */
+ at ThreadSafe
+public class MockRepositorySource implements RepositorySource {
+
+    private final String identifier;
+    private final AtomicInteger retryLimit = new AtomicInteger(0);
+    private final Mockery context;
+    private final AtomicInteger connectionsOpenedCount = new AtomicInteger(0);
+    private final AtomicInteger connectionsClosedCount = new AtomicInteger(0);
+    private final Set<Connection> openConnections = new CopyOnWriteArraySet<Connection>();
+    private CachePolicy defaultCachePolicy;
+
+    public MockRepositorySource( String identifier, Mockery context ) {
+        this.identifier = identifier;
+        this.context = context;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getName() {
+        return this.identifier;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public int getRetryLimit() {
+        return this.retryLimit.get();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setRetryLimit( int limit ) {
+        this.retryLimit.set(limit);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public CachePolicy getDefaultCachePolicy() {
+        return defaultCachePolicy;
+    }
+
+    public void setDefaultCachePolicy( CachePolicy defaultCachePolicy ) {
+        this.defaultCachePolicy = defaultCachePolicy;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public RepositoryConnection getConnection() throws RepositorySourceException {
+        int connectionNumber = this.connectionsOpenedCount.incrementAndGet();
+        String connectionName = "Connection " + connectionNumber;
+        XAResource xaResource = context != null ? context.mock(XAResource.class, connectionName) : null;
+        Connection c = newConnection(connectionName, xaResource);
+        this.openConnections.add(c);
+        return c;
+    }
+
+    protected Connection newConnection( String connectionName, XAResource xaResource ) throws RepositorySourceException {
+        Connection c = new Connection(connectionName);
+        c.setXaResource(xaResource);
+        return c;
+    }
+
+    protected void close( Connection conn ) {
+        if (conn != null && this.openConnections.remove(conn)) {
+            this.connectionsClosedCount.incrementAndGet();
+        }
+    }
+
+    public int getOpenConnectionCount() {
+        return this.openConnections.size();
+    }
+
+    public int getTotalConnectionsCreated() {
+        return this.connectionsOpenedCount.get();
+    }
+
+    public int getTotalConnectionsClosed() {
+        return this.connectionsClosedCount.get();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Reference getReference() {
+        throw new UnsupportedOperationException();
+    }
+
+    public class Connection implements RepositoryConnection {
+
+        private final String connectionName;
+        private final AtomicBoolean closed = new AtomicBoolean(false);
+        private final AtomicBoolean loadResponse = new AtomicBoolean(true);
+        private final AtomicBoolean pingResponse = new AtomicBoolean(true);
+        private final AtomicLong closeCount = new AtomicLong(0);
+        private final AtomicLong loadCount = new AtomicLong(0);
+        private final AtomicLong loadDelay = new AtomicLong(0);
+        private final AtomicLong pingCount = new AtomicLong(0);
+        private final AtomicLong pingDelay = new AtomicLong(0);
+        private final AtomicReference<XAResource> xaResource = new AtomicReference<XAResource>();
+
+        protected Connection( String connectionName ) {
+            assert connectionName != null && connectionName.trim().length() != 0;
+            this.connectionName = connectionName;
+        }
+
+        public String getConnectionName() {
+            return this.connectionName;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void close() {
+            this.closeCount.incrementAndGet();
+            this.closed.set(true);
+            MockRepositorySource.this.close(this);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public String getSourceName() {
+            return MockRepositorySource.this.getName();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public XAResource getXAResource() {
+            return this.xaResource.get();
+        }
+
+        public void setXaResource( XAResource xaResource ) {
+            this.xaResource.set(xaResource);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void execute( ExecutionEnvironment env, GraphCommand... commands ) throws RepositorySourceException, InterruptedException {
+            long delay = this.loadDelay.get();
+            if (delay > 0l) Thread.sleep(delay);
+            this.loadCount.incrementAndGet();
+        }
+
+        public void setLoadResponse( boolean response ) {
+            this.loadResponse.set(response);
+        }
+
+        public void setLoadDelay( long time, TimeUnit unit ) {
+            this.loadDelay.set(unit.toMillis(time));
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public boolean ping( long time, TimeUnit unit ) throws InterruptedException {
+            Thread.sleep(this.pingDelay.get());
+            return this.pingResponse.get();
+        }
+
+        public void setPingResponse( boolean pingResponse ) {
+            this.pingResponse.set(pingResponse);
+        }
+
+        public void setPingDelay( long time, TimeUnit unit ) {
+            this.pingDelay.set(unit.toMillis(time));
+        }
+
+        public long getPingCount() {
+            return this.pingCount.get();
+        }
+
+        public long getLoadCount() {
+            return this.loadCount.get();
+        }
+
+        public long getCloseCount() {
+            return this.closeCount.get();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void setListener( RepositorySourceListener listener ) {
+        }
+
+    }
+
+}

Deleted: trunk/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/RepositoryConnectionPoolTest.java
===================================================================
--- branches/federation/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/RepositoryConnectionPoolTest.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/RepositoryConnectionPoolTest.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -1,197 +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.graph.connection;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNull.notNullValue;
-import static org.junit.Assert.assertThat;
-import static org.jboss.dna.spi.graph.connection.RepositorySourceLoadHarness.runLoadTest;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-import org.jmock.Mockery;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-/**
- * @author Randall Hauch
- */
-public class RepositoryConnectionPoolTest {
-
-    private RepositoryConnectionPool pool;
-    private MockRepositorySource repositorySource;
-    private ExecutionEnvironment env;
-    private Mockery context;
-
-    @Before
-    public void beforeEach() throws Exception {
-        this.context = new Mockery();
-        this.repositorySource = new MockRepositorySource("source 1", this.context);
-        this.pool = new RepositoryConnectionPool(this.repositorySource, 1, 1, 100, TimeUnit.SECONDS);
-        this.env = null;
-    }
-
-    @After
-    public void afterEach() throws Exception {
-        pool.shutdown();
-        pool.awaitTermination(2, TimeUnit.SECONDS);
-    }
-
-    @Test
-    public void shouldBeCreatedInRunningState() {
-        assertThat(pool.isShutdown(), is(false));
-        assertThat(pool.isTerminating(), is(false));
-        assertThat(pool.isTerminated(), is(false));
-        assertThat(pool.getTotalConnectionsCreated(), is(0l));
-        assertThat(pool.getTotalConnectionsUsed(), is(0l));
-    }
-
-    @Test
-    public void shouldShutdownWhenNoConnectionsWereCreatedOrUsed() throws InterruptedException {
-        assertThat(pool.isShutdown(), is(false));
-        assertThat(pool.isTerminating(), is(false));
-        assertThat(pool.isTerminated(), is(false));
-        assertThat(pool.getTotalConnectionsCreated(), is(0l));
-        assertThat(pool.getTotalConnectionsUsed(), is(0l));
-
-        for (int i = 0; i != 4; ++i) {
-            pool.shutdown();
-            assertThat(pool.isShutdown() || pool.isTerminating() || pool.isTerminated(), is(true));
-            pool.awaitTermination(2, TimeUnit.SECONDS);
-            assertThat(pool.isTerminated(), is(true));
-            assertThat(pool.getTotalConnectionsCreated(), is(0l));
-            assertThat(pool.getTotalConnectionsUsed(), is(0l));
-        }
-    }
-
-    @Test
-    public void shouldCreateConnectionAndRecoverWhenClosed() throws RepositorySourceException, InterruptedException {
-        assertThat(pool.getTotalConnectionsCreated(), is(0l));
-        assertThat(pool.getTotalConnectionsUsed(), is(0l));
-
-        RepositoryConnection conn = pool.getConnection();
-        assertThat(conn, is(notNullValue()));
-        assertThat(pool.getTotalConnectionsCreated(), is(1l));
-        assertThat(pool.getTotalConnectionsUsed(), is(1l));
-        assertThat(pool.getPoolSize(), is(1));
-
-        conn.close();
-
-        assertThat(pool.getTotalConnectionsCreated(), is(1l));
-        assertThat(pool.getTotalConnectionsUsed(), is(1l));
-        assertThat(pool.getPoolSize(), is(1));
-    }
-
-    @Test
-    public void shouldAllowShutdownToBeCalledMultipleTimesEvenWhenShutdown() throws RepositorySourceException, InterruptedException {
-        assertThat(pool.getTotalConnectionsCreated(), is(0l));
-        assertThat(pool.getTotalConnectionsUsed(), is(0l));
-
-        RepositoryConnection conn = pool.getConnection();
-        assertThat(conn, is(notNullValue()));
-        assertThat(pool.getTotalConnectionsCreated(), is(1l));
-        assertThat(pool.getTotalConnectionsUsed(), is(1l));
-        assertThat(pool.getPoolSize(), is(1));
-
-        conn.close();
-
-        assertThat(pool.getTotalConnectionsCreated(), is(1l));
-        assertThat(pool.getTotalConnectionsUsed(), is(1l));
-        assertThat(pool.getPoolSize(), is(1));
-
-        pool.shutdown();
-        pool.shutdown();
-        pool.awaitTermination(2, TimeUnit.SECONDS);
-        assertThat(pool.isTerminated(), is(true));
-        assertThat(pool.getTotalConnectionsCreated(), is(1l));
-        assertThat(pool.getTotalConnectionsUsed(), is(1l));
-        pool.shutdown();
-        pool.awaitTermination(2, TimeUnit.SECONDS);
-        pool.shutdown();
-        pool.awaitTermination(2, TimeUnit.SECONDS);
-    }
-
-    @Test( expected = IllegalStateException.class )
-    public void shouldNotCreateConnectionIfPoolIsNotRunning() throws RepositorySourceException, InterruptedException {
-        pool.shutdown();
-        pool.awaitTermination(2, TimeUnit.SECONDS);
-        assertThat(pool.isTerminated(), is(true));
-        assertThat(pool.getTotalConnectionsCreated(), is(0l));
-        assertThat(pool.getTotalConnectionsUsed(), is(0l));
-        pool.getConnection(); // this should fail with illegal state
-    }
-
-    @Test
-    public void shouldAllowConnectionsToBeClosedMoreThanOnceWithNoIllEffects() throws RepositorySourceException, InterruptedException {
-        assertThat(pool.getTotalConnectionsCreated(), is(0l));
-        assertThat(pool.getTotalConnectionsUsed(), is(0l));
-
-        RepositoryConnection conn = pool.getConnection();
-        assertThat(conn, is(notNullValue()));
-        assertThat(pool.getTotalConnectionsCreated(), is(1l));
-        assertThat(pool.getTotalConnectionsUsed(), is(1l));
-        assertThat(pool.getPoolSize(), is(1));
-
-        conn.close();
-        conn.close();
-    }
-
-    @Test
-    public void shouldBlockClientsWhenNotEnoughConnections() throws Exception {
-        int numConnectionsInPool = 1;
-        int numClients = 2;
-        RepositoryOperation.Factory<Integer> operationFactory = RepositoryTestOperations.createMultipleLoadOperationFactory(env, 10);
-        runLoadTest(repositorySource, numConnectionsInPool, numClients, 4, TimeUnit.SECONDS, operationFactory);
-    }
-
-    @Test
-    public void shouldLimitClientsToRunSequentiallyWithOneConnectionInPool() throws Exception {
-        int numConnectionsInPool = 1;
-        int numClients = 3;
-        RepositoryOperation.Factory<Integer> operationFactory = RepositoryTestOperations.createMultipleLoadOperationFactory(env, 10);
-        runLoadTest(repositorySource, numConnectionsInPool, numClients, 4, TimeUnit.SECONDS, operationFactory);
-    }
-
-    @Test
-    public void shouldClientsToRunConncurrentlyWithTwoConnectionsInPool() throws Exception {
-        int numConnectionsInPool = 2;
-        int numClients = 10;
-        RepositoryOperation.Factory<Integer> operationFactory = RepositoryTestOperations.createMultipleLoadOperationFactory(env, 10);
-        runLoadTest(repositorySource, numConnectionsInPool, numClients, 4, TimeUnit.SECONDS, operationFactory);
-    }
-
-    @Ignore( "doesn't run on hudson" )
-    @Test
-    public void shouldClientsToRunConncurrentlyWithMultipleConnectionInPool() throws Exception {
-        int numConnectionsInPool = 10;
-        int numClients = 50;
-        RepositoryOperation.Factory<Integer> operationFactory = RepositoryTestOperations.createMultipleLoadOperationFactory(env, 20);
-        List<Integer> results = runLoadTest(repositorySource, numConnectionsInPool, numClients, 10, TimeUnit.SECONDS, operationFactory);
-        int total = 0;
-        for (Integer integer : results) {
-            if (integer != null) total += integer;
-        }
-        assertThat(total, is(20 * numClients));
-    }
-
-}

Copied: trunk/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/RepositoryConnectionPoolTest.java (from rev 219, branches/federation/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/RepositoryConnectionPoolTest.java)
===================================================================
--- trunk/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/RepositoryConnectionPoolTest.java	                        (rev 0)
+++ trunk/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/RepositoryConnectionPoolTest.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,197 @@
+/*
+ * 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.graph.connection;
+
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsNull.notNullValue;
+import static org.junit.Assert.assertThat;
+import static org.jboss.dna.spi.graph.connection.RepositorySourceLoadHarness.runLoadTest;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+import org.jmock.Mockery;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * @author Randall Hauch
+ */
+public class RepositoryConnectionPoolTest {
+
+    private RepositoryConnectionPool pool;
+    private MockRepositorySource repositorySource;
+    private ExecutionEnvironment env;
+    private Mockery context;
+
+    @Before
+    public void beforeEach() throws Exception {
+        this.context = new Mockery();
+        this.repositorySource = new MockRepositorySource("source 1", this.context);
+        this.pool = new RepositoryConnectionPool(this.repositorySource, 1, 1, 100, TimeUnit.SECONDS);
+        this.env = null;
+    }
+
+    @After
+    public void afterEach() throws Exception {
+        pool.shutdown();
+        pool.awaitTermination(2, TimeUnit.SECONDS);
+    }
+
+    @Test
+    public void shouldBeCreatedInRunningState() {
+        assertThat(pool.isShutdown(), is(false));
+        assertThat(pool.isTerminating(), is(false));
+        assertThat(pool.isTerminated(), is(false));
+        assertThat(pool.getTotalConnectionsCreated(), is(0l));
+        assertThat(pool.getTotalConnectionsUsed(), is(0l));
+    }
+
+    @Test
+    public void shouldShutdownWhenNoConnectionsWereCreatedOrUsed() throws InterruptedException {
+        assertThat(pool.isShutdown(), is(false));
+        assertThat(pool.isTerminating(), is(false));
+        assertThat(pool.isTerminated(), is(false));
+        assertThat(pool.getTotalConnectionsCreated(), is(0l));
+        assertThat(pool.getTotalConnectionsUsed(), is(0l));
+
+        for (int i = 0; i != 4; ++i) {
+            pool.shutdown();
+            assertThat(pool.isShutdown() || pool.isTerminating() || pool.isTerminated(), is(true));
+            pool.awaitTermination(2, TimeUnit.SECONDS);
+            assertThat(pool.isTerminated(), is(true));
+            assertThat(pool.getTotalConnectionsCreated(), is(0l));
+            assertThat(pool.getTotalConnectionsUsed(), is(0l));
+        }
+    }
+
+    @Test
+    public void shouldCreateConnectionAndRecoverWhenClosed() throws RepositorySourceException, InterruptedException {
+        assertThat(pool.getTotalConnectionsCreated(), is(0l));
+        assertThat(pool.getTotalConnectionsUsed(), is(0l));
+
+        RepositoryConnection conn = pool.getConnection();
+        assertThat(conn, is(notNullValue()));
+        assertThat(pool.getTotalConnectionsCreated(), is(1l));
+        assertThat(pool.getTotalConnectionsUsed(), is(1l));
+        assertThat(pool.getPoolSize(), is(1));
+
+        conn.close();
+
+        assertThat(pool.getTotalConnectionsCreated(), is(1l));
+        assertThat(pool.getTotalConnectionsUsed(), is(1l));
+        assertThat(pool.getPoolSize(), is(1));
+    }
+
+    @Test
+    public void shouldAllowShutdownToBeCalledMultipleTimesEvenWhenShutdown() throws RepositorySourceException, InterruptedException {
+        assertThat(pool.getTotalConnectionsCreated(), is(0l));
+        assertThat(pool.getTotalConnectionsUsed(), is(0l));
+
+        RepositoryConnection conn = pool.getConnection();
+        assertThat(conn, is(notNullValue()));
+        assertThat(pool.getTotalConnectionsCreated(), is(1l));
+        assertThat(pool.getTotalConnectionsUsed(), is(1l));
+        assertThat(pool.getPoolSize(), is(1));
+
+        conn.close();
+
+        assertThat(pool.getTotalConnectionsCreated(), is(1l));
+        assertThat(pool.getTotalConnectionsUsed(), is(1l));
+        assertThat(pool.getPoolSize(), is(1));
+
+        pool.shutdown();
+        pool.shutdown();
+        pool.awaitTermination(2, TimeUnit.SECONDS);
+        assertThat(pool.isTerminated(), is(true));
+        assertThat(pool.getTotalConnectionsCreated(), is(1l));
+        assertThat(pool.getTotalConnectionsUsed(), is(1l));
+        pool.shutdown();
+        pool.awaitTermination(2, TimeUnit.SECONDS);
+        pool.shutdown();
+        pool.awaitTermination(2, TimeUnit.SECONDS);
+    }
+
+    @Test( expected = IllegalStateException.class )
+    public void shouldNotCreateConnectionIfPoolIsNotRunning() throws RepositorySourceException, InterruptedException {
+        pool.shutdown();
+        pool.awaitTermination(2, TimeUnit.SECONDS);
+        assertThat(pool.isTerminated(), is(true));
+        assertThat(pool.getTotalConnectionsCreated(), is(0l));
+        assertThat(pool.getTotalConnectionsUsed(), is(0l));
+        pool.getConnection(); // this should fail with illegal state
+    }
+
+    @Test
+    public void shouldAllowConnectionsToBeClosedMoreThanOnceWithNoIllEffects() throws RepositorySourceException, InterruptedException {
+        assertThat(pool.getTotalConnectionsCreated(), is(0l));
+        assertThat(pool.getTotalConnectionsUsed(), is(0l));
+
+        RepositoryConnection conn = pool.getConnection();
+        assertThat(conn, is(notNullValue()));
+        assertThat(pool.getTotalConnectionsCreated(), is(1l));
+        assertThat(pool.getTotalConnectionsUsed(), is(1l));
+        assertThat(pool.getPoolSize(), is(1));
+
+        conn.close();
+        conn.close();
+    }
+
+    @Test
+    public void shouldBlockClientsWhenNotEnoughConnections() throws Exception {
+        int numConnectionsInPool = 1;
+        int numClients = 2;
+        RepositoryOperation.Factory<Integer> operationFactory = RepositoryTestOperations.createMultipleLoadOperationFactory(env, 10);
+        runLoadTest(repositorySource, numConnectionsInPool, numClients, 4, TimeUnit.SECONDS, operationFactory);
+    }
+
+    @Test
+    public void shouldLimitClientsToRunSequentiallyWithOneConnectionInPool() throws Exception {
+        int numConnectionsInPool = 1;
+        int numClients = 3;
+        RepositoryOperation.Factory<Integer> operationFactory = RepositoryTestOperations.createMultipleLoadOperationFactory(env, 10);
+        runLoadTest(repositorySource, numConnectionsInPool, numClients, 4, TimeUnit.SECONDS, operationFactory);
+    }
+
+    @Test
+    public void shouldClientsToRunConncurrentlyWithTwoConnectionsInPool() throws Exception {
+        int numConnectionsInPool = 2;
+        int numClients = 10;
+        RepositoryOperation.Factory<Integer> operationFactory = RepositoryTestOperations.createMultipleLoadOperationFactory(env, 10);
+        runLoadTest(repositorySource, numConnectionsInPool, numClients, 4, TimeUnit.SECONDS, operationFactory);
+    }
+
+    @Ignore( "doesn't run on hudson" )
+    @Test
+    public void shouldClientsToRunConncurrentlyWithMultipleConnectionInPool() throws Exception {
+        int numConnectionsInPool = 10;
+        int numClients = 50;
+        RepositoryOperation.Factory<Integer> operationFactory = RepositoryTestOperations.createMultipleLoadOperationFactory(env, 20);
+        List<Integer> results = runLoadTest(repositorySource, numConnectionsInPool, numClients, 10, TimeUnit.SECONDS, operationFactory);
+        int total = 0;
+        for (Integer integer : results) {
+            if (integer != null) total += integer;
+        }
+        assertThat(total, is(20 * numClients));
+    }
+
+}

Deleted: trunk/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/RepositorySourceLoadHarness.java
===================================================================
--- branches/federation/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/RepositorySourceLoadHarness.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/RepositorySourceLoadHarness.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -1,165 +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.graph.connection;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.concurrent.Callable;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.TimeUnit;
-import org.jboss.dna.common.i18n.MockI18n;
-import org.jboss.dna.common.util.Logger;
-
-/**
- * A test harness for using repository connections under load.
- * @author Randall Hauch
- */
-public class RepositorySourceLoadHarness {
-
-    public static <T> List<T> runLoadTest( RepositoryConnectionFactory connectionFactory, int numConnectionsInPool, int numClients, long maxTime, TimeUnit maxTimeUnit,
-                                           RepositoryOperation.Factory<T> clientFactory ) throws InterruptedException, ExecutionException {
-        // Create the clients ...
-        Collection<RepositoryOperation<T>> clients = new ArrayList<RepositoryOperation<T>>();
-        for (int i = 0; i != numClients; ++i) {
-            clients.add(clientFactory.create());
-        }
-
-        // and run the test ...
-        return runLoadTest(connectionFactory, numConnectionsInPool, maxTime, maxTimeUnit, clients);
-    }
-
-    public static <T> List<T> runLoadTest( RepositoryConnectionFactory connectionFactory, int numConnectionsInPool, long maxTime, TimeUnit maxTimeUnit, RepositoryOperation<T>... clients )
-        throws InterruptedException, ExecutionException {
-        // Create the client collection ...
-        Collection<RepositoryOperation<T>> clientCollection = new ArrayList<RepositoryOperation<T>>();
-        for (RepositoryOperation<T> client : clients) {
-            if (client != null) clientCollection.add(client);
-        }
-        // and run the test ...
-        return runLoadTest(connectionFactory, numConnectionsInPool, maxTime, maxTimeUnit, clientCollection);
-    }
-
-    public static <T> List<T> runLoadTest( RepositoryConnectionFactory connectionFactory, int numConnectionsInPool, long maxTime, TimeUnit maxTimeUnit, Collection<RepositoryOperation<T>> clients )
-        throws InterruptedException, ExecutionException {
-        assert connectionFactory != null;
-        assert numConnectionsInPool > 0;
-        assert clients != null;
-        assert clients.size() > 0;
-
-        // Create a connection pool ...
-        final RepositoryConnectionPool connectionPool = new RepositoryConnectionPool(connectionFactory, numConnectionsInPool, numConnectionsInPool, 10, TimeUnit.SECONDS);
-
-        // Create an Executor Service, using a thread factory that makes the first 'n' thread all wait for each other ...
-        final ThreadFactory threadFactory = new TestThreadFactory(clients.size(), connectionPool);
-        final ExecutorService clientPool = Executors.newFixedThreadPool(clients.size(), threadFactory);
-
-        try {
-            // Wrap each client by a callable and by another that uses a latch ...
-            List<Callable<T>> callables = connectionPool.callables(clients);
-
-            // Run the tests ...
-            List<Future<T>> futures = clientPool.invokeAll(callables, maxTime, maxTimeUnit);
-
-            // Whether or not all clients completed, process the results ...
-            List<T> results = new ArrayList<T>();
-            for (Future<T> future : futures) {
-                if (future.isDone() && !future.isCancelled()) {
-                    // Record the results ...
-                    results.add(future.get());
-                } else {
-                    // Record the results as null
-                    results.add(null);
-                    // Cancell any operation that is not completed
-                    future.cancel(true);
-                }
-            }
-            // Return the results ...
-            return results;
-        } finally {
-            try {
-                // Shut down the pool of clients ...
-                clientPool.shutdown();
-                if (!clientPool.awaitTermination(5, TimeUnit.SECONDS)) {
-                    String msg = "Unable to shutdown clients after 5 seconds";
-                    Logger.getLogger(RepositorySourceLoadHarness.class).error(MockI18n.passthrough, msg);
-                }
-            } finally {
-                // Shut down the connections ...
-                connectionPool.shutdown();
-                if (!connectionPool.awaitTermination(5, TimeUnit.SECONDS)) {
-                    String msg = "Unable to shutdown connections after 5 seconds";
-                    Logger.getLogger(RepositorySourceLoadHarness.class).error(MockI18n.passthrough, msg);
-                }
-            }
-        }
-
-    }
-
-    /**
-     * A thread factory that makes an initial set of threads wait until all of those threads are created and ready. This is useful
-     * in testing to ensure that the first threads created don't get a jump start.
-     * @author Randall Hauch
-     */
-    protected static class TestThreadFactory implements ThreadFactory {
-
-        protected final CountDownLatch latch;
-        protected final RepositoryConnectionPool pool;
-
-        public TestThreadFactory( int numberOfThreadsToWait, RepositoryConnectionPool pool ) {
-            this.latch = new CountDownLatch(numberOfThreadsToWait);
-            this.pool = pool;
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        public Thread newThread( Runnable runnable ) {
-            return new Thread(runnable) {
-
-                /**
-                 * {@inheritDoc}
-                 */
-                @Override
-                public void run() {
-                    try {
-                        // Count down the thread count (if 0, this doesn't do anything)
-                        latch.countDown();
-                        // Wait for all threads to reach this point ...
-                        latch.await();
-                    } catch (InterruptedException e) {
-                        throw new RuntimeException(e);
-                    }
-                    // Check that the number of connections-in-use is smaller than the maximum pool size
-                    if (pool != null) assert pool.getInUseCount() <= pool.getMaximumPoolSize();
-                    super.run();
-                }
-            };
-        }
-    }
-
-}

Copied: trunk/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/RepositorySourceLoadHarness.java (from rev 219, branches/federation/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/RepositorySourceLoadHarness.java)
===================================================================
--- trunk/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/RepositorySourceLoadHarness.java	                        (rev 0)
+++ trunk/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/RepositorySourceLoadHarness.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,165 @@
+/*
+ * 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.graph.connection;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.Callable;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.TimeUnit;
+import org.jboss.dna.common.i18n.MockI18n;
+import org.jboss.dna.common.util.Logger;
+
+/**
+ * A test harness for using repository connections under load.
+ * @author Randall Hauch
+ */
+public class RepositorySourceLoadHarness {
+
+    public static <T> List<T> runLoadTest( RepositoryConnectionFactory connectionFactory, int numConnectionsInPool, int numClients, long maxTime, TimeUnit maxTimeUnit,
+                                           RepositoryOperation.Factory<T> clientFactory ) throws InterruptedException, ExecutionException {
+        // Create the clients ...
+        Collection<RepositoryOperation<T>> clients = new ArrayList<RepositoryOperation<T>>();
+        for (int i = 0; i != numClients; ++i) {
+            clients.add(clientFactory.create());
+        }
+
+        // and run the test ...
+        return runLoadTest(connectionFactory, numConnectionsInPool, maxTime, maxTimeUnit, clients);
+    }
+
+    public static <T> List<T> runLoadTest( RepositoryConnectionFactory connectionFactory, int numConnectionsInPool, long maxTime, TimeUnit maxTimeUnit, RepositoryOperation<T>... clients )
+        throws InterruptedException, ExecutionException {
+        // Create the client collection ...
+        Collection<RepositoryOperation<T>> clientCollection = new ArrayList<RepositoryOperation<T>>();
+        for (RepositoryOperation<T> client : clients) {
+            if (client != null) clientCollection.add(client);
+        }
+        // and run the test ...
+        return runLoadTest(connectionFactory, numConnectionsInPool, maxTime, maxTimeUnit, clientCollection);
+    }
+
+    public static <T> List<T> runLoadTest( RepositoryConnectionFactory connectionFactory, int numConnectionsInPool, long maxTime, TimeUnit maxTimeUnit, Collection<RepositoryOperation<T>> clients )
+        throws InterruptedException, ExecutionException {
+        assert connectionFactory != null;
+        assert numConnectionsInPool > 0;
+        assert clients != null;
+        assert clients.size() > 0;
+
+        // Create a connection pool ...
+        final RepositoryConnectionPool connectionPool = new RepositoryConnectionPool(connectionFactory, numConnectionsInPool, numConnectionsInPool, 10, TimeUnit.SECONDS);
+
+        // Create an Executor Service, using a thread factory that makes the first 'n' thread all wait for each other ...
+        final ThreadFactory threadFactory = new TestThreadFactory(clients.size(), connectionPool);
+        final ExecutorService clientPool = Executors.newFixedThreadPool(clients.size(), threadFactory);
+
+        try {
+            // Wrap each client by a callable and by another that uses a latch ...
+            List<Callable<T>> callables = connectionPool.callables(clients);
+
+            // Run the tests ...
+            List<Future<T>> futures = clientPool.invokeAll(callables, maxTime, maxTimeUnit);
+
+            // Whether or not all clients completed, process the results ...
+            List<T> results = new ArrayList<T>();
+            for (Future<T> future : futures) {
+                if (future.isDone() && !future.isCancelled()) {
+                    // Record the results ...
+                    results.add(future.get());
+                } else {
+                    // Record the results as null
+                    results.add(null);
+                    // Cancell any operation that is not completed
+                    future.cancel(true);
+                }
+            }
+            // Return the results ...
+            return results;
+        } finally {
+            try {
+                // Shut down the pool of clients ...
+                clientPool.shutdown();
+                if (!clientPool.awaitTermination(5, TimeUnit.SECONDS)) {
+                    String msg = "Unable to shutdown clients after 5 seconds";
+                    Logger.getLogger(RepositorySourceLoadHarness.class).error(MockI18n.passthrough, msg);
+                }
+            } finally {
+                // Shut down the connections ...
+                connectionPool.shutdown();
+                if (!connectionPool.awaitTermination(5, TimeUnit.SECONDS)) {
+                    String msg = "Unable to shutdown connections after 5 seconds";
+                    Logger.getLogger(RepositorySourceLoadHarness.class).error(MockI18n.passthrough, msg);
+                }
+            }
+        }
+
+    }
+
+    /**
+     * A thread factory that makes an initial set of threads wait until all of those threads are created and ready. This is useful
+     * in testing to ensure that the first threads created don't get a jump start.
+     * @author Randall Hauch
+     */
+    protected static class TestThreadFactory implements ThreadFactory {
+
+        protected final CountDownLatch latch;
+        protected final RepositoryConnectionPool pool;
+
+        public TestThreadFactory( int numberOfThreadsToWait, RepositoryConnectionPool pool ) {
+            this.latch = new CountDownLatch(numberOfThreadsToWait);
+            this.pool = pool;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public Thread newThread( Runnable runnable ) {
+            return new Thread(runnable) {
+
+                /**
+                 * {@inheritDoc}
+                 */
+                @Override
+                public void run() {
+                    try {
+                        // Count down the thread count (if 0, this doesn't do anything)
+                        latch.countDown();
+                        // Wait for all threads to reach this point ...
+                        latch.await();
+                    } catch (InterruptedException e) {
+                        throw new RuntimeException(e);
+                    }
+                    // Check that the number of connections-in-use is smaller than the maximum pool size
+                    if (pool != null) assert pool.getInUseCount() <= pool.getMaximumPoolSize();
+                    super.run();
+                }
+            };
+        }
+    }
+
+}

Deleted: trunk/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/RepositoryTestOperations.java
===================================================================
--- branches/federation/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/RepositoryTestOperations.java	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/RepositoryTestOperations.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -1,102 +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.graph.connection;
-
-import org.jboss.dna.common.util.Logger;
-
-/**
- * @author Randall Hauch
- */
-public class RepositoryTestOperations {
-
-    /**
-     * Return an operation factory that produces {@link RepositoryOperation} instances that each call
-     * {@link RepositoryConnection#execute(ExecutionEnvironment, org.jboss.dna.spi.graph.commands.GraphCommand...)} the supplied
-     * number of times, intermixed with random math operations and {@link Thread#yield() yielding}.
-     * @param env the environment
-     * @param callsPerOperation the number of <code>load</code> calls per RepositoryOperation
-     * @return the factory
-     */
-    public static RepositoryOperation.Factory<Integer> createMultipleLoadOperationFactory( final ExecutionEnvironment env, final int callsPerOperation ) {
-        return new RepositoryOperation.Factory<Integer>() {
-
-            public RepositoryOperation<Integer> create() {
-                return new CallLoadMultipleTimes(env, callsPerOperation);
-            }
-        };
-    }
-
-    public static class CallLoadMultipleTimes implements RepositoryOperation<Integer> {
-
-        private final int count;
-        private final ExecutionEnvironment env;
-
-        public CallLoadMultipleTimes( ExecutionEnvironment env, int count ) {
-            this.count = count;
-            this.env = env;
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        public String getName() {
-            return Thread.currentThread().getName() + "-CallLoadMultipleTimes";
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        public Integer run( RepositoryConnection connection ) throws InterruptedException {
-            Logger.getLogger(RepositoryTestOperations.class).debug("Running {} operation", this.getClass().getSimpleName());
-            int total = count;
-            for (int i = 0; i != count; ++i) {
-                // Add two random numbers ...
-                int int1 = random(this.hashCode() ^ (int)System.nanoTime() * i);
-                if (i % 2 == 0) {
-                    Thread.yield();
-                }
-                connection.execute(env);
-                int int2 = random(this.hashCode() ^ (int)System.nanoTime() + i);
-                total += Math.min(Math.abs(Math.max(int1, int2) + int1 * int2 / 3), count);
-            }
-            Logger.getLogger(RepositoryTestOperations.class).debug("Finishing {} operation", this.getClass().getSimpleName());
-            return total < count ? total : count; // should really always return count
-        }
-    }
-
-    /**
-     * A "random-enough" number generator that is cheap and that has no synchronization issues (like some other random number
-     * generators).
-     * <p>
-     * This was taken from <a href="http://wwww.jcip.org">Java Concurrency In Practice</a> (page 253).
-     * </p>
-     * @param seed the seed, typically based on a hash code and nanoTime
-     * @return a number that is "random enough"
-     */
-    public static int random( int seed ) {
-        seed ^= (seed << 6);
-        seed ^= (seed >>> 21);
-        seed ^= (seed << 7);
-        return seed;
-    }
-
-}

Copied: trunk/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/RepositoryTestOperations.java (from rev 219, branches/federation/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/RepositoryTestOperations.java)
===================================================================
--- trunk/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/RepositoryTestOperations.java	                        (rev 0)
+++ trunk/dna-spi/src/test/java/org/jboss/dna/spi/graph/connection/RepositoryTestOperations.java	2008-06-02 17:13:20 UTC (rev 220)
@@ -0,0 +1,102 @@
+/*
+ * 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.graph.connection;
+
+import org.jboss.dna.common.util.Logger;
+
+/**
+ * @author Randall Hauch
+ */
+public class RepositoryTestOperations {
+
+    /**
+     * Return an operation factory that produces {@link RepositoryOperation} instances that each call
+     * {@link RepositoryConnection#execute(ExecutionEnvironment, org.jboss.dna.spi.graph.commands.GraphCommand...)} the supplied
+     * number of times, intermixed with random math operations and {@link Thread#yield() yielding}.
+     * @param env the environment
+     * @param callsPerOperation the number of <code>load</code> calls per RepositoryOperation
+     * @return the factory
+     */
+    public static RepositoryOperation.Factory<Integer> createMultipleLoadOperationFactory( final ExecutionEnvironment env, final int callsPerOperation ) {
+        return new RepositoryOperation.Factory<Integer>() {
+
+            public RepositoryOperation<Integer> create() {
+                return new CallLoadMultipleTimes(env, callsPerOperation);
+            }
+        };
+    }
+
+    public static class CallLoadMultipleTimes implements RepositoryOperation<Integer> {
+
+        private final int count;
+        private final ExecutionEnvironment env;
+
+        public CallLoadMultipleTimes( ExecutionEnvironment env, int count ) {
+            this.count = count;
+            this.env = env;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public String getName() {
+            return Thread.currentThread().getName() + "-CallLoadMultipleTimes";
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public Integer run( RepositoryConnection connection ) throws InterruptedException {
+            Logger.getLogger(RepositoryTestOperations.class).debug("Running {} operation", this.getClass().getSimpleName());
+            int total = count;
+            for (int i = 0; i != count; ++i) {
+                // Add two random numbers ...
+                int int1 = random(this.hashCode() ^ (int)System.nanoTime() * i);
+                if (i % 2 == 0) {
+                    Thread.yield();
+                }
+                connection.execute(env);
+                int int2 = random(this.hashCode() ^ (int)System.nanoTime() + i);
+                total += Math.min(Math.abs(Math.max(int1, int2) + int1 * int2 / 3), count);
+            }
+            Logger.getLogger(RepositoryTestOperations.class).debug("Finishing {} operation", this.getClass().getSimpleName());
+            return total < count ? total : count; // should really always return count
+        }
+    }
+
+    /**
+     * A "random-enough" number generator that is cheap and that has no synchronization issues (like some other random number
+     * generators).
+     * <p>
+     * This was taken from <a href="http://wwww.jcip.org">Java Concurrency In Practice</a> (page 253).
+     * </p>
+     * @param seed the seed, typically based on a hash code and nanoTime
+     * @return a number that is "random enough"
+     */
+    public static int random( int seed ) {
+        seed ^= (seed << 6);
+        seed ^= (seed >>> 21);
+        seed ^= (seed << 7);
+        return seed;
+    }
+
+}

Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml	2008-06-02 16:45:45 UTC (rev 219)
+++ trunk/pom.xml	2008-06-02 17:13:20 UTC (rev 220)
@@ -61,7 +61,8 @@
 		<module>dna-maven-classloader</module>
 		<module>sequencers/dna-sequencer-images</module>
 		<module>sequencers/dna-sequencer-mp3</module>
-        <module>dna-integration-tests</module>
+		<module>connectors/dna-connector-jbosscache</module>
+    	<module>dna-integration-tests</module>
 	</modules>
 
 	<properties>




More information about the dna-commits mailing list