[dna-commits] DNA SVN: r923 - in trunk: dna-common/src/test/java/org/jboss/dna/common/jcr and 11 other directories.

dna-commits at lists.jboss.org dna-commits at lists.jboss.org
Thu May 21 22:15:20 EDT 2009


Author: rhauch
Date: 2009-05-21 22:15:19 -0400 (Thu, 21 May 2009)
New Revision: 923

Added:
   trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/JcrTools.java
   trunk/extensions/dna-classloader-maven/src/test/java/org/jboss/dna/maven/AbstractJcrRepositoryTest.java
   trunk/extensions/dna-classloader-maven/src/test/java/org/jboss/dna/maven/TestAbstractJcrRepositoryTest.java
Removed:
   trunk/dna-common/src/test/java/org/jboss/dna/common/jcr/AbstractJcrRepositoryTest.java
   trunk/dna-common/src/test/java/org/jboss/dna/common/jcr/TestAbstractJcrRepositoryTest.java
   trunk/dna-repository/src/main/java/org/jboss/dna/repository/observation/NodeChange.java
   trunk/dna-repository/src/main/java/org/jboss/dna/repository/observation/NodeChangeListener.java
   trunk/dna-repository/src/main/java/org/jboss/dna/repository/observation/NodeChanges.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/InvalidRuleSetException.java
   trunk/dna-repository/src/main/java/org/jboss/dna/repository/rules/RuleService.java
   trunk/dna-repository/src/main/java/org/jboss/dna/repository/rules/RuleSet.java
   trunk/dna-repository/src/main/java/org/jboss/dna/repository/rules/RuleSetRepositoryMonitor.java
   trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/JcrExecutionContext.java
   trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/JcrNamespaceRegistry.java
   trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/JcrTools.java
   trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/JndiSessionFactory.java
   trunk/dna-repository/src/test/java/org/jboss/dna/repository/observation/NodeChangeTest.java
   trunk/dna-repository/src/test/java/org/jboss/dna/repository/rules/RuleInput.java
   trunk/dna-repository/src/test/java/org/jboss/dna/repository/rules/RuleResult.java
   trunk/dna-repository/src/test/java/org/jboss/dna/repository/rules/RuleServiceTest.java
   trunk/dna-repository/src/test/java/org/jboss/dna/repository/rules/RuleSetTest.java
   trunk/dna-repository/src/test/java/org/jboss/dna/repository/util/JndiSessionFactoryTest.java
Modified:
   trunk/dna-common/pom.xml
   trunk/dna-repository/pom.xml
   trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/Sequencer.java
   trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/SequencingService.java
   trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/SequencingClient.java
   trunk/extensions/dna-classloader-maven/src/test/java/org/jboss/dna/maven/MavenRepositoryTest.java
   trunk/extensions/dna-classloader-maven/src/test/java/org/jboss/dna/maven/spi/JcrMavenUrlProviderTest.java
Log:
DNA-404 Remove ObservationService, migrate usage to observe RepositoryLibrary

Removed the ObservationService and the 'org.jboss.dna.repository.observation' package. Also removed the JCR API, since the ObservationService (and a few leftover JCR utility classes) were the only remaining use of JCR API in 'dna-repository'. Also removed the 'o.j.d.r.rules' package, since we're still not using JSR-92 rules for sequencers (path expressions are still very adequate, and we can always resurrect the code if needed). And finally, 'dna-repository' no longer needs the JCR unit test utilities that are in 'dna-common', so they were removed (actually copied into the 'dna-classloader-maven' project, which still uses JCR API), allowing 'dna-common' to no longer rely upon JCR API and Jackrabbit for test scope.

Modified: trunk/dna-common/pom.xml
===================================================================
--- trunk/dna-common/pom.xml	2009-05-21 22:26:25 UTC (rev 922)
+++ trunk/dna-common/pom.xml	2009-05-22 02:15:19 UTC (rev 923)
@@ -54,24 +54,6 @@
 	  <groupId>net.jcip</groupId>
 	  <artifactId>jcip-annotations</artifactId>
 	</dependency>
-    <!-- 
-      Java Content Repository API and Apache Jackrabbit for the JCR unit test infrastructure
-    -->
-    <dependency>
-      <groupId>javax.jcr</groupId>
-      <artifactId>jcr</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.jackrabbit</groupId>
-      <artifactId>jackrabbit-api</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.jackrabbit</groupId>
-      <artifactId>jackrabbit-core</artifactId>
-      <scope>test</scope>
-    </dependency>
   </dependencies>
   <reporting>
     <plugins>

Deleted: trunk/dna-common/src/test/java/org/jboss/dna/common/jcr/AbstractJcrRepositoryTest.java
===================================================================
--- trunk/dna-common/src/test/java/org/jboss/dna/common/jcr/AbstractJcrRepositoryTest.java	2009-05-21 22:26:25 UTC (rev 922)
+++ trunk/dna-common/src/test/java/org/jboss/dna/common/jcr/AbstractJcrRepositoryTest.java	2009-05-22 02:15:19 UTC (rev 923)
@@ -1,178 +0,0 @@
-/*
- * JBoss DNA (http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of 
- * individual contributors. 
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you 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.
- *
- * JBoss DNA 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.common.jcr;
-
-import java.io.IOException;
-import javax.jcr.Credentials;
-import javax.jcr.Repository;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.SimpleCredentials;
-import org.apache.jackrabbit.api.JackrabbitRepository;
-import org.apache.jackrabbit.core.TransientRepository;
-import org.jboss.dna.common.util.FileUtil;
-import org.jboss.dna.common.util.Logger;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-
-/**
- * An abstract base class for any unit test class that needs a JCR repository during one or more (but not necessarily all) of its
- * unit tests.
- * <p>
- * Typically, unit test classes need a repository for just some of it's unit tests (other unit tests don't need the repository
- * because they are just testing other functionality of the class under test), and this class was designed for this scenario. A
- * unit test method that needs a repository should call {@link #startRepository()}, and then may proceed to use the
- * {@link #getRepository() repository}. The test method need not call {@link #shutdownRepository()}, as it is called automatically
- * after every test (and does nothing if the repository was not started in the first place).
- * </p>
- * <p>
- * Some unit test methods may have a need to repeatedly start and stop the repository, and this can be done by calling
- * {@link #startRepository()} and {@link #shutdownRepository()} as many times as required.
- * </p>
- * <p>
- * Because the {@link TransientRepository transient repository} implementation used by this class automatically cleans itself up
- * whenever all {@link Session sessions} are closed, this class maintains an open session between the time the repository is
- * started and stopped. Therefore, unit tests can persist information in one session and see the information in other sessions.
- * </p>
- * 
- * @author Randall Hauch
- */
-public abstract class AbstractJcrRepositoryTest {
-
-    public static final String TESTDATA_PATH = "./src/test/resources/";
-    public static final String JACKRABBIT_DATA_PATH = "./target/testdata/jackrabbittest/";
-    public static final String REPOSITORY_DIRECTORY_PATH = JACKRABBIT_DATA_PATH + "repository";
-    public static final String REPOSITORY_CONFIG_PATH = TESTDATA_PATH + "jackrabbitInMemoryTestRepositoryConfig.xml";
-
-    public static final String WORKSPACE_NAME = "default";
-
-    private static Repository repository;
-
-    @BeforeClass
-    public static void beforeAll() throws Exception {
-        // Clean up the test data ...
-        FileUtil.delete(JACKRABBIT_DATA_PATH);
-
-        // Set up the transient repository (this shouldn't do anything yet)...
-        repository = new TransientRepository(REPOSITORY_CONFIG_PATH, REPOSITORY_DIRECTORY_PATH);
-    }
-
-    @AfterClass
-    public static void afterAll() {
-        if (repository != null) {
-            try {
-                JackrabbitRepository jackrabbit = (JackrabbitRepository)repository;
-                jackrabbit.shutdown();
-            } finally {
-                repository = null;
-                // Clean up the test data ...
-                FileUtil.delete(JACKRABBIT_DATA_PATH);
-            }
-        }
-    }
-
-    /** Used to keep at least one session open during each test; when last session is closed, all data is cleaned up */
-    private Session keepAliveSession;
-
-    protected Credentials simpleCredentials = new SimpleCredentials("jsmith", "secret".toCharArray());
-
-    /**
-     * Call this method during a test that needs the repository. It only needs to be called once during a test, although calling
-     * it more than once does not hurt.
-     * <p>
-     * The repository can be started and {@link #shutdownRepository() shutdown} repeatedly during a single test.
-     * </p>
-     * 
-     * @throws RepositoryException if there is a problem starting the repository
-     * @throws IOException if there's a problem reading the repository configuration
-     * @see #shutdownRepository()
-     */
-    public synchronized void startRepository() throws RepositoryException, IOException {
-        if (repository == null) {
-            // Clean up the test data ...
-            FileUtil.delete(JACKRABBIT_DATA_PATH);
-
-            // Set up the transient repository (this shouldn't do anything yet)...
-            repository = new TransientRepository(REPOSITORY_CONFIG_PATH, REPOSITORY_DIRECTORY_PATH);
-
-        }
-        if (keepAliveSession == null) {
-            keepAliveSession = repository.login();
-        }
-    }
-
-    /**
-     * Shutdown the repository. This method is automatically called after every test, and does nothing if the repository has not
-     * yet been started.
-     */
-    @After
-    public synchronized void shutdownRepository() {
-        if (keepAliveSession != null) {
-            try {
-                Logger.getLogger(this.getClass()).debug("Shutting down repository");
-                keepAliveSession.logout();
-            } finally {
-                keepAliveSession = null;
-                if (repository != null) {
-                    try {
-                        JackrabbitRepository jackrabbit = (JackrabbitRepository)repository;
-                        jackrabbit.shutdown();
-                    } finally {
-                        repository = null;
-                        // Clean up the test data ...
-                        FileUtil.delete(JACKRABBIT_DATA_PATH);
-                    }
-                }
-            }
-        }
-    }
-
-    public boolean isRepositoryStarted() {
-        return this.keepAliveSession != null;
-    }
-
-    /**
-     * Get the repository. This will start the repository if necessary.
-     * 
-     * @return repository
-     * @throws RepositoryException if there is a problem obtaining the repository
-     * @throws IOException if the repository has not yet been {@link #startRepository() started} and there's a problem reading the
-     *         repository configuration
-     */
-    public Repository getRepository() throws RepositoryException, IOException {
-        startRepository();
-        return repository;
-    }
-
-    /**
-     * Get credentials that can be used to log into the repository.
-     * 
-     * @return credentials
-     */
-    public Credentials getTestCredentials() {
-        return this.simpleCredentials;
-    }
-
-}

Deleted: trunk/dna-common/src/test/java/org/jboss/dna/common/jcr/TestAbstractJcrRepositoryTest.java
===================================================================
--- trunk/dna-common/src/test/java/org/jboss/dna/common/jcr/TestAbstractJcrRepositoryTest.java	2009-05-21 22:26:25 UTC (rev 922)
+++ trunk/dna-common/src/test/java/org/jboss/dna/common/jcr/TestAbstractJcrRepositoryTest.java	2009-05-22 02:15:19 UTC (rev 923)
@@ -1,89 +0,0 @@
-/*
- * JBoss DNA (http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of 
- * individual contributors. 
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you 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.
- *
- * JBoss DNA 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.common.jcr;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNull.notNullValue;
-import static org.junit.Assert.assertThat;
-import javax.jcr.Node;
-import javax.jcr.Session;
-import org.junit.Test;
-
-/**
- * @author Randall Hauch
- */
-public class TestAbstractJcrRepositoryTest extends AbstractJcrRepositoryTest {
-
-    @Test
-    public void shouldBeAbleToStartAndShutdownRepository() throws Exception {
-        for (int i = 0; i != 3; ++i) {
-            startRepository();
-            Session session = getRepository().login(getTestCredentials());
-            assertThat(session, is(notNullValue()));
-            assertThat(session.getRootNode(), is(notNullValue()));
-            // Create a child node ...
-            Node node = session.getRootNode().addNode("testnode", "nt:unstructured");
-            assertThat(node, is(notNullValue()));
-            assertThat(node.getName(), is("testnode"));
-            assertThat(node.getPath(), is("/testnode"));
-            // Save and close the session ...
-            session.save();
-            session.logout();
-            shutdownRepository();
-        }
-    }
-
-    @Test
-    public void shouldAllowDataPersistedInOneSessionBeAccessibleInOtherSessions() throws Exception {
-        startRepository();
-        Session session = getRepository().login(getTestCredentials());
-        assertThat(session, is(notNullValue()));
-        assertThat(session.getRootNode(), is(notNullValue()));
-        // Create a child node ...
-        Node node = session.getRootNode().addNode("testnode", "nt:unstructured");
-        assertThat(node, is(notNullValue()));
-        assertThat(node.getName(), is("testnode"));
-        assertThat(node.getPath(), is("/testnode"));
-        // Save and close the session ...
-        session.save();
-        session.logout();
-
-        for (int i = 0; i != 3; ++i) {
-            // Create another session ...
-            session = getRepository().login(getTestCredentials());
-            assertThat(session, is(notNullValue()));
-            assertThat(session.getRootNode(), is(notNullValue()));
-            // Look for the child node ...
-            node = session.getRootNode().getNode("testnode");
-            assertThat(node, is(notNullValue()));
-            assertThat(node.getName(), is("testnode"));
-            assertThat(node.getPath(), is("/testnode"));
-            // Close the session ...
-            session.logout();
-        }
-
-    }
-
-}

Modified: trunk/dna-repository/pom.xml
===================================================================
--- trunk/dna-repository/pom.xml	2009-05-21 22:26:25 UTC (rev 922)
+++ trunk/dna-repository/pom.xml	2009-05-22 02:15:19 UTC (rev 923)
@@ -51,23 +51,6 @@
       <scope>test</scope>
     </dependency>
     <!-- 
-    Rules
-    -->
-    <dependency>
-      <groupId>jsr94</groupId>
-      <artifactId>jsr94</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.drools</groupId>
-      <artifactId>drools-jsr94</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.drools</groupId>
-      <artifactId>drools-compiler</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <!-- 
     Testing (note the scope)
     -->
     <dependency>
@@ -110,16 +93,5 @@
       <groupId>javax.jcr</groupId>
       <artifactId>jcr</artifactId>
     </dependency>
-    <!-- 
-      Apache Jackrabbit (JCR Implementation) for testing purposes
-    -->
-    <dependency>
-      <groupId>org.apache.jackrabbit</groupId>
-      <artifactId>jackrabbit-api</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.jackrabbit</groupId>
-      <artifactId>jackrabbit-core</artifactId>
-    </dependency>
   </dependencies>
 </project>
\ No newline at end of file

Deleted: trunk/dna-repository/src/main/java/org/jboss/dna/repository/observation/NodeChange.java
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/observation/NodeChange.java	2009-05-21 22:26:25 UTC (rev 922)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/observation/NodeChange.java	2009-05-22 02:15:19 UTC (rev 923)
@@ -1,188 +0,0 @@
-/*
- * JBoss DNA (http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of 
- * individual contributors. 
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you 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.
- *
- * JBoss DNA 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.observation;
-
-import java.util.Collections;
-import java.util.Set;
-import net.jcip.annotations.Immutable;
-import org.jboss.dna.common.util.HashCode;
-
-/**
- * A notification of changes to a node.
- * @author Randall Hauch
- */
- at Immutable
-public class NodeChange {
-
-    private final String repositorySourceName;
-    private final String repositoryWorkspaceName;
-    private final String absolutePath;
-    private final int eventTypes;
-    private final Set<String> modifiedProperties;
-    private final Set<String> removedProperties;
-    private final int hc;
-
-    public NodeChange( String repositorySourceName, String repositoryWorkspaceName, String absolutePath, int eventTypes, Set<String> modifiedProperties, Set<String> removedProperties ) {
-        assert repositorySourceName != null;
-        assert repositoryWorkspaceName != null;
-        assert absolutePath != null;
-        this.repositorySourceName = repositorySourceName;
-        this.repositoryWorkspaceName = repositoryWorkspaceName;
-        this.absolutePath = absolutePath.trim();
-        this.hc = HashCode.compute(this.repositoryWorkspaceName, this.absolutePath);
-        this.eventTypes = eventTypes;
-        if (modifiedProperties == null) modifiedProperties = Collections.emptySet();
-        if (removedProperties == null) removedProperties = Collections.emptySet();
-        this.modifiedProperties = Collections.unmodifiableSet(modifiedProperties);
-        this.removedProperties = Collections.unmodifiableSet(removedProperties);
-    }
-
-    /**
-     * @return absolutePath
-     */
-    public String getAbsolutePath() {
-        return this.absolutePath;
-    }
-
-    /**
-     * @return repositorySourceName
-     */
-    public String getRepositorySourceName() {
-        return this.repositorySourceName;
-    }
-    
-    /**
-     * @return repositoryWorkspaceName
-     */
-    public String getRepositoryWorkspaceName() {
-        return this.repositoryWorkspaceName;
-    }
-
-    /**
-     * @return modifiedProperties
-     */
-    public Set<String> getModifiedProperties() {
-        return this.modifiedProperties;
-    }
-
-    /**
-     * @return removedProperties
-     */
-    public Set<String> getRemovedProperties() {
-        return this.removedProperties;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public int hashCode() {
-        return this.hc;
-    }
-
-    public boolean includesAllEventTypes( int... jcrEventTypes ) {
-        for (int jcrEventType : jcrEventTypes) {
-            if ((this.eventTypes & jcrEventType) == 0) return false;
-        }
-        return true;
-    }
-
-    public boolean includesEventTypes( int... jcrEventTypes ) {
-        for (int jcrEventType : jcrEventTypes) {
-            if ((this.eventTypes & jcrEventType) != 0) return true;
-        }
-        return false;
-    }
-
-    public boolean isSameNode( NodeChange that ) {
-        if (that == this) return true;
-        if (this.hc != that.hc) return false;
-        if (!this.repositoryWorkspaceName.equals(that.repositoryWorkspaceName)) return false;
-        if (!this.absolutePath.equals(that.absolutePath)) return false;
-        return true;
-    }
-
-    /**
-     * Return whether this node change occurs on a node on the supplied path.
-     * @param absolutePath the path
-     * @return true if the node is on the supplied absolute path, or false otherwise
-     * @see #isNotOnPath(String)
-     */
-    public boolean isOnPath( String absolutePath ) {
-        if (absolutePath == null) return false;
-        if (this.getAbsolutePath().startsWith(absolutePath)) return true;
-        return false;
-    }
-
-    /**
-     * Return whether this node change occurs on a node on a different path than that supplied.
-     * @param absolutePath the path
-     * @return true if the node is on a different path, or false if it is on the same path
-     * @see #isOnPath(String)
-     */
-    public boolean isNotOnPath( String absolutePath ) {
-        return !isOnPath(absolutePath);
-    }
-
-    /**
-     * Determine whether this node change includes the setting of new value(s) for the supplied property.
-     * @param property the name of the property
-     * @return true if the named property has a new value on this node, or false otherwise
-     */
-    public boolean isPropertyModified( String property ) {
-        return this.modifiedProperties.contains(property);
-    }
-
-    /**
-     * Determine whether this node change includes the removal of the supplied property.
-     * @param property the name of the property
-     * @return true if the named property was removed from this node, or false otherwise
-     */
-    public boolean isPropertyRemoved( String property ) {
-        return this.removedProperties.contains(property);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public boolean equals( Object obj ) {
-        if (obj == this) return true;
-        if (obj instanceof NodeChange) {
-            NodeChange that = (NodeChange)obj;
-            if (!this.isSameNode(that)) return false;
-            if (this.eventTypes != that.eventTypes) return false;
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String toString() {
-        return this.repositoryWorkspaceName + "=>" + this.absolutePath;
-    }
-}

Deleted: trunk/dna-repository/src/main/java/org/jboss/dna/repository/observation/NodeChangeListener.java
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/observation/NodeChangeListener.java	2009-05-21 22:26:25 UTC (rev 922)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/observation/NodeChangeListener.java	2009-05-22 02:15:19 UTC (rev 923)
@@ -1,33 +0,0 @@
-/*
- * JBoss DNA (http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of 
- * individual contributors. 
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you 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.
- *
- * JBoss DNA 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.observation;
-
-/**
- * @author Randall Hauch
- */
-public interface NodeChangeListener {
-
-    void onNodeChanges( NodeChanges changes );
-
-}

Deleted: trunk/dna-repository/src/main/java/org/jboss/dna/repository/observation/NodeChanges.java
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/observation/NodeChanges.java	2009-05-21 22:26:25 UTC (rev 922)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/observation/NodeChanges.java	2009-05-22 02:15:19 UTC (rev 923)
@@ -1,197 +0,0 @@
-/*
- * JBoss DNA (http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of 
- * individual contributors. 
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you 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.
- *
- * JBoss DNA 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.observation;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import javax.jcr.RepositoryException;
-import javax.jcr.observation.Event;
-import org.jboss.dna.common.i18n.I18n;
-import org.jboss.dna.common.util.Logger;
-import org.jboss.dna.repository.RepositoryI18n;
-
-/**
- * A utility class that builds node changes from a sequence of events.
- * @author Randall Hauch
- */
-public class NodeChanges implements Iterable<NodeChange> {
-
-    public static NodeChanges create( final String repositorySourceName, final String repositoryWorkspaceName, Iterable<Event> events ) throws RepositoryException {
-        Map<String, NodeChangeDetails> detailsByNodePath = new HashMap<String, NodeChangeDetails>();
-        // Process each of the events, extracting the node path and property details for each ...
-        for (Event event : events) {
-            final int eventType = event.getType();
-            final String eventPath = event.getPath();
-            if (eventType == Event.PROPERTY_ADDED || eventType == Event.PROPERTY_CHANGED || eventType == Event.PROPERTY_REMOVED) {
-                // Extract the node's path and property name from the even path ...
-                int lastDelim = eventPath.lastIndexOf('/');
-                if (lastDelim < 1 || lastDelim == (eventPath.length() - 1)) {
-                    // The last delimiter doesn't exist, is the first character, or is the last character...
-                    I18n msg =
-                        eventType == Event.PROPERTY_ADDED ? RepositoryI18n.errorFindingPropertyNameInPropertyAddedEvent : eventType == Event.PROPERTY_CHANGED ? RepositoryI18n.errorFindingPropertyNameInPropertyChangedEvent : RepositoryI18n.errorFindingPropertyNameInPropertyRemovedEvent;
-                    Logger.getLogger(NodeChanges.class).error(msg, eventPath);
-                    continue;
-                }
-                String nodePath = eventPath.substring(0, lastDelim); // excludes the last delim
-                String propertyName = eventPath.substring(lastDelim + 1);
-                // Record the details ...
-                NodeChangeDetails details = detailsByNodePath.get(nodePath);
-                if (details == null) {
-                    details = new NodeChangeDetails(nodePath);
-                    detailsByNodePath.put(nodePath, details);
-                }
-                switch (eventType) {
-                    case Event.PROPERTY_ADDED: {
-                        details.addProperty(propertyName);
-                        break;
-                    }
-                    case Event.PROPERTY_CHANGED: {
-                        details.changeProperty(propertyName);
-                        break;
-                    }
-                    case Event.PROPERTY_REMOVED: {
-                        details.removeProperty(propertyName);
-                        break;
-                    }
-                }
-            } else if (eventType == Event.NODE_ADDED || eventType == Event.NODE_REMOVED) {
-                // Remove the last delimiter if it appears at the end of the path ...
-                String nodePath = eventPath;
-                if (nodePath.length() > 1 && nodePath.charAt(nodePath.length() - 1) == '/') {
-                    nodePath = nodePath.substring(0, nodePath.length() - 1);
-                }
-                // Record the details ...
-                NodeChangeDetails details = detailsByNodePath.get(nodePath);
-                if (details == null) {
-                    details = new NodeChangeDetails(nodePath);
-                    detailsByNodePath.put(nodePath, details);
-                }
-                details.addEventType(eventType);
-            }
-        }
-
-        // Create the node changes ...
-        List<NodeChange> result = new ArrayList<NodeChange>(detailsByNodePath.size());
-        for (NodeChangeDetails detail : detailsByNodePath.values()) {
-            NodeChange change = new NodeChange(repositorySourceName, repositoryWorkspaceName, detail.getNodePath(), detail.getEventTypes(), detail.getModifiedProperties(), detail.getRemovedProperties());
-            result.add(change);
-        }
-        return new NodeChanges(result);
-    }
-
-    protected static class NodeChangeDetails {
-
-        private final String nodePath;
-        private final Set<String> modifiedProperties = new HashSet<String>();
-        private final Set<String> removedProperties = new HashSet<String>();
-        private int eventTypes;
-
-        protected NodeChangeDetails( String nodePath ) {
-            this.nodePath = nodePath;
-        }
-
-        public void addEventType( int eventType ) {
-            this.eventTypes |= eventType;
-        }
-
-        public void addProperty( String propertyName ) {
-            this.modifiedProperties.add(propertyName);
-            this.eventTypes |= Event.PROPERTY_ADDED;
-        }
-
-        public void changeProperty( String propertyName ) {
-            this.modifiedProperties.add(propertyName);
-            this.eventTypes |= Event.PROPERTY_CHANGED;
-        }
-
-        public void removeProperty( String propertyName ) {
-            this.removedProperties.add(propertyName);
-            this.eventTypes |= Event.PROPERTY_REMOVED;
-        }
-
-        /**
-         * @return nodeAction
-         */
-        public int getEventTypes() {
-            return this.eventTypes;
-        }
-
-        /**
-         * @return nodePath
-         */
-        public String getNodePath() {
-            return this.nodePath;
-        }
-
-        /**
-         * @return addedProperties
-         */
-        public Set<String> getModifiedProperties() {
-            return this.modifiedProperties;
-        }
-
-        /**
-         * @return removedProperties
-         */
-        public Set<String> getRemovedProperties() {
-            return this.removedProperties;
-        }
-    }
-
-    protected static final Comparator<NodeChange> PRE_ORDER = new Comparator<NodeChange>() {
-
-        public int compare( NodeChange change1, NodeChange change2 ) {
-            return change1.getAbsolutePath().compareTo(change2.getAbsolutePath());
-        }
-    };
-
-    private final List<NodeChange> changesInPreOrder;
-
-    protected NodeChanges( List<NodeChange> changes ) {
-        this.changesInPreOrder = Collections.unmodifiableList(changes);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Iterator<NodeChange> iterator() {
-        return this.changesInPreOrder.iterator();
-    }
-
-    public Iterator<NodeChange> getPreOrder() {
-        return this.changesInPreOrder.iterator();
-    }
-
-    public int size() {
-        return this.changesInPreOrder.size();
-    }
-
-}

Deleted: 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	2009-05-21 22:26:25 UTC (rev 922)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/observation/ObservationService.java	2009-05-22 02:15:19 UTC (rev 923)
@@ -1,822 +0,0 @@
-/*
- * JBoss DNA (http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of 
- * individual contributors. 
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you 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.
- *
- * JBoss DNA 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.observation;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.concurrent.locks.ReadWriteLock;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.UnsupportedRepositoryOperationException;
-import javax.jcr.observation.Event;
-import javax.jcr.observation.EventIterator;
-import javax.jcr.observation.EventListener;
-import javax.jcr.observation.ObservationManager;
-import net.jcip.annotations.GuardedBy;
-import net.jcip.annotations.ThreadSafe;
-import org.jboss.dna.common.util.CheckArg;
-import org.jboss.dna.common.util.Logger;
-import org.jboss.dna.repository.RepositoryI18n;
-import org.jboss.dna.repository.service.AbstractServiceAdministrator;
-import org.jboss.dna.repository.service.AdministeredService;
-import org.jboss.dna.repository.service.ServiceAdministrator;
-import org.jboss.dna.repository.util.SessionFactory;
-
-/**
- * @author Randall Hauch
- */
-public class ObservationService implements AdministeredService {
-
-    /**
-     * Interface to which problems with particular events are logged.
-     * 
-     * @author Randall Hauch
-     */
-    public static interface ProblemLog {
-
-        void error( String repositoryWorkspaceName,
-                    Throwable t );
-    }
-
-    /**
-     * Problem log implementation that records problems in the log.
-     * 
-     * @author Randall Hauch
-     */
-    public class DefaultProblemLog implements ProblemLog {
-
-        /**
-         * {@inheritDoc}
-         */
-        public void error( String repositoryWorkspaceName,
-                           Throwable t ) {
-            getLogger().error(t, RepositoryI18n.errorProcessingEvents, repositoryWorkspaceName);
-        }
-    }
-
-    protected static class NoOpProblemLog implements ProblemLog {
-
-        /**
-         * {@inheritDoc}
-         */
-        public void error( String repositoryWorkspaceName,
-                           Throwable t ) {
-        }
-    }
-
-    public static final ProblemLog NO_OP_PROBLEM_LOG = new NoOpProblemLog();
-
-    /**
-     * The administrative component for this service.
-     * 
-     * @author Randall Hauch
-     */
-    protected class Administrator extends AbstractServiceAdministrator {
-
-        protected Administrator() {
-            super(RepositoryI18n.observationServiceName, State.STARTED);
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        protected void doShutdown( State fromState ) {
-            super.doShutdown(fromState);
-            shutdownService();
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        public boolean awaitTermination( long timeout,
-                                         TimeUnit unit ) {
-            return true;
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        protected boolean doCheckIsTerminated() {
-            return true;
-        }
-
-    }
-
-    private Logger logger = Logger.getLogger(this.getClass());
-    private ProblemLog problemLog = new DefaultProblemLog();
-    private final Statistics statistics = new Statistics();
-    private final SessionFactory sessionFactory;
-    private final CopyOnWriteArrayList<WorkspaceListener> workspaceListeners = new CopyOnWriteArrayList<WorkspaceListener>();
-    private final CopyOnWriteArrayList<EventListener> eventListeners = new CopyOnWriteArrayList<EventListener>();
-    private final CopyOnWriteArrayList<NodeChangeListener> nodeChangeListeners = new CopyOnWriteArrayList<NodeChangeListener>();
-    private final Administrator administrator = new Administrator();
-
-    public ObservationService( SessionFactory sessionFactory ) {
-        CheckArg.isNotNull(sessionFactory, "session factory");
-        this.sessionFactory = sessionFactory;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public ServiceAdministrator getAdministrator() {
-        return this.administrator;
-    }
-
-    /**
-     * @return sessionFactory
-     */
-    public SessionFactory getSessionFactory() {
-        return this.sessionFactory;
-    }
-
-    /**
-     * Get the statistics for this system.
-     * 
-     * @return the statistics, which are updated as the system is used
-     */
-    public Statistics getStatistics() {
-        return this.statistics;
-    }
-
-    /**
-     * Get the logger for this system
-     * 
-     * @return the logger
-     */
-    public Logger getLogger() {
-        return this.logger;
-    }
-
-    /**
-     * Set the logger for this system.
-     * 
-     * @param logger the logger, or null if the standard logging should be used
-     */
-    public void setLogger( Logger logger ) {
-        this.logger = logger != null ? logger : Logger.getLogger(this.getClass());
-    }
-
-    /**
-     * @return problemLog
-     */
-    public ProblemLog getProblemLog() {
-        return this.problemLog;
-    }
-
-    /**
-     * Set the problem log that will be notified of problems handling events. By default, such problems are sent to the log.
-     * 
-     * @param problemLog the new problem log implementation; if null, then the default problem log is used
-     */
-    public void setProblemLog( ProblemLog problemLog ) {
-        this.problemLog = problemLog != null ? problemLog : new DefaultProblemLog();
-    }
-
-    public boolean addListener( EventListener listener ) {
-        if (listener == null) return false;
-        return this.eventListeners.addIfAbsent(listener);
-    }
-
-    public boolean removeListener( EventListener listener ) {
-        if (listener == null) return false;
-        return this.eventListeners.remove(listener);
-    }
-
-    public boolean addListener( NodeChangeListener listener ) {
-        return this.nodeChangeListeners.addIfAbsent(listener);
-    }
-
-    public boolean removeListener( NodeChangeListener listener ) {
-        if (listener == null) return false;
-        return this.nodeChangeListeners.remove(listener);
-    }
-
-    protected void shutdownService() {
-        // Unregister all listeners ...
-        for (WorkspaceListener listener : this.workspaceListeners) {
-            try {
-                listener.unregister();
-            } catch (RepositoryException e) {
-                this.logger.error(e, RepositoryI18n.errorUnregisteringWorkspaceListenerWhileShuttingDownObservationService);
-            }
-        }
-    }
-
-    /**
-     * Monitor the supplied workspace in the given repository for events of the given type on any node at or under the supplied
-     * path.
-     * <p>
-     * Monitoring is accomplished by registering a listener on the workspace, so this monitoring only has access to the
-     * information that is available in the given repository and workspace name.
-     * </p>
-     * <p>
-     * The listener returned from this method is not managed by this SequencingService instance. If the listener is no longer
-     * needed, it simply must be {@link ObservationManager#removeEventListener(EventListener) removed} as a listener of the
-     * workspace and garbage collected. If this service is {@link ServiceAdministrator#shutdown() shutdown} while there are still
-     * active listeners, those listeners will disconnect themselves from this service and the workspace with which they're
-     * registered when they attempt to forward the next events.
-     * </p>
-     * <p>
-     * The set of events that are monitored can be filtered by specifying restrictions based on characteristics of the node
-     * associated with the event. In the case of event types {@link Event#NODE_ADDED NODE_ADDED} and {@link Event#NODE_REMOVED
-     * NODE_REMOVED}, the node associated with an event is the node at (or formerly at) the path returned by
-     * {@link Event#getPath() Event.getPath()}. In the case of event types {@link Event#PROPERTY_ADDED PROPERTY_ADDED},
-     * {@link Event#PROPERTY_REMOVED PROPERTY_REMOVED} and {@link Event#PROPERTY_CHANGED PROPERTY_CHANGED}, the node associated
-     * with an event is the parent node of the property at (or formerly at) the path returned by <code>Event.getPath</code>:
-     * <ul>
-     * <li> <code>absolutePath</code>, <code>isDeep</code>: Only events whose associated node is at <code>absolutePath</code> (or
-     * within its subtree, if <code>isDeep</code> is <code>true</code>) will be received. It is permissible to register a listener
-     * for a path where no node currently exists.</li>
-     * <li> <code>uuids</code>: Only events whose associated node has one of the UUIDs in this list will be received. If his
-     * parameter is <code>null</code> then no UUID-related restriction is placed on events received.</li>
-     * <li> <code>nodeTypeNames</code>: Only events whose associated node has one of the node types (or a subtype of one of the
-     * node types) in this list will be received. If this parameter is <code>null</code> then no node type-related restriction is
-     * placed on events received.</li>
-     * </ul>
-     * The restrictions are "ANDed" together. In other words, for a particular node to be "listened to" it must meet all the
-     * restrictions.
-     * </p>
-     * <p>
-     * Additionally, if <code>noLocal</code> is <code>true</code>, then events generated by the session through which the listener
-     * was registered are ignored. Otherwise, they are not ignored.
-     * </p>
-     * <p>
-     * The filters of an already-registered {@link WorkspaceListener} can be changed at runtime by changing the attributes and
-     * {@link WorkspaceListener#reregister() registering}.
-     * </p>
-     * 
-     * @param repositorySourceName the name of the repository source to be monitored
-     * @param repositoryWorkspaceName the name of the workspace within the monitored repository
-     * @param absolutePath the absolute path of the node at or below which changes are to be monitored; may be null if all nodes
-     *        in the workspace are to be monitored
-     * @param eventTypes the bitmask of the {@link Event} types that are to be monitored
-     * @param isDeep true if events below the node given by the <code>absolutePath</code> or by the <code>uuids</code> are to be
-     *        processed, or false if only the events at the node
-     * @param uuids array of UUIDs of nodes that are to be monitored; may be null or empty if the UUIDs are not known
-     * @param nodeTypeNames array of node type names that are to be monitored; may be null or empty if the monitoring has no node
-     *        type restrictions
-     * @param noLocal true if the events originating in the supplied workspace are to be ignored, or false if they are also to be
-     *        processed.
-     * @return the listener that was created and registered to perform the monitoring
-     * @throws RepositoryException if there is a problem registering the listener
-     */
-    public WorkspaceListener monitor( String repositorySourceName,
-                                      String repositoryWorkspaceName,
-                                      String absolutePath,
-                                      int eventTypes,
-                                      boolean isDeep,
-                                      String[] uuids,
-                                      String[] nodeTypeNames,
-                                      boolean noLocal ) throws RepositoryException {
-        WorkspaceListener listener = new WorkspaceListener(repositorySourceName, repositoryWorkspaceName, eventTypes,
-                                                           absolutePath, isDeep, uuids, nodeTypeNames, noLocal);
-        listener.register();
-        this.workspaceListeners.add(listener);
-        return listener;
-    }
-
-    /**
-     * Monitor the supplied workspace for {@link WorkspaceListener#DEFAULT_EVENT_TYPES default event types} on any node at or
-     * under the supplied path in the named repository.
-     * <p>
-     * Monitoring is accomplished by registering a listener on the workspace, so this monitoring only has access to the
-     * information that is available in the given repository and workspace name.
-     * </p>
-     * <p>
-     * The listener returned from this method is not managed by this SequencingService instance. If the listener is no longer
-     * needed, it simply must be {@link ObservationManager#removeEventListener(EventListener) removed} as a listener of the
-     * workspace and garbage collected.
-     * </p>
-     * 
-     * @param repositorySourceName the name of the repository source to be monitored
-     * @param repositoryWorkspaceName the name of the workspace within the monitored repository
-     * @param absolutePath the absolute path of the node at or below which changes are to be monitored; may be null if all nodes
-     *        in the workspace are to be monitored
-     * @param nodeTypeNames the names of the node types that are to be monitored; may be null or empty if the monitoring has no
-     *        node type restrictions
-     * @return the listener that was created and registered to perform the monitoring
-     * @throws RepositoryException if there is a problem registering the listener
-     */
-    public WorkspaceListener monitor( String repositorySourceName,
-                                      String repositoryWorkspaceName,
-                                      String absolutePath,
-                                      String... nodeTypeNames ) throws RepositoryException {
-        return monitor(repositorySourceName,
-                       repositoryWorkspaceName,
-                       absolutePath,
-                       WorkspaceListener.DEFAULT_EVENT_TYPES,
-                       WorkspaceListener.DEFAULT_IS_DEEP,
-                       null,
-                       nodeTypeNames,
-                       WorkspaceListener.DEFAULT_NO_LOCAL);
-    }
-
-    /**
-     * Monitor the supplied workspace in the named repository for the supplied event types on any node in the workspace.
-     * <p>
-     * Monitoring is accomplished by registering a listener on the workspace, so this monitoring only has access to the
-     * information that is available in the given repository and workspace name.
-     * </p>
-     * <p>
-     * The listener returned from this method is not managed by this SequencingService instance. If the listener is no longer
-     * needed, it simply must be {@link ObservationManager#removeEventListener(EventListener) removed} as a listener of the
-     * workspace and garbage collected.
-     * </p>
-     * 
-     * @param repositorySourceName the name of the repository source to be monitored
-     * @param repositoryWorkspaceName the name of the workspace within the monitored repository
-     * @param eventTypes the bitmask of the {@link Event} types that are to be monitored
-     * @param nodeTypeNames the names of the node types that are to be monitored; may be null or empty if the monitoring has no
-     *        node type restrictions
-     * @return the listener that was created and registered to perform the monitoring
-     * @throws RepositoryException if there is a problem registering the listener
-     */
-    public WorkspaceListener monitor( String repositorySourceName, 
-                                      String repositoryWorkspaceName,
-                                      int eventTypes,
-                                      String... nodeTypeNames ) throws RepositoryException {
-        return monitor(repositorySourceName,
-                       repositoryWorkspaceName,
-                       WorkspaceListener.DEFAULT_ABSOLUTE_PATH,
-                       eventTypes,
-                       WorkspaceListener.DEFAULT_IS_DEEP,
-                       null,
-                       nodeTypeNames,
-                       WorkspaceListener.DEFAULT_NO_LOCAL);
-    }
-
-    protected void unregisterListener( WorkspaceListener listener ) {
-        if (listener != null) this.workspaceListeners.remove(listener);
-    }
-
-    /**
-     * From section 2.8.8 of the JSR-170 specification:
-     * <p>
-     * On each persistent change, those listeners that are entitled to receive one or more events will have their onEvent method
-     * called and be passed an EventIterator. The EventIterator will contain the event bundle reflecting the persistent changes
-     * made but excluding those to which that particular listener is not entitled, according to the listeners access permissions
-     * and filters.
-     * </p>
-     * 
-     * @param eventIterator
-     * @param listener
-     */
-    protected void processEvents( EventIterator eventIterator,
-                                  WorkspaceListener listener ) {
-        if (eventIterator == null) return;
-        List<Event> events = new ArrayList<Event>();
-        // Copy the events ...
-        while (eventIterator.hasNext()) {
-            events.add((Event)eventIterator.next());
-        }
-        if (!getAdministrator().isStarted()) {
-            this.statistics.recordIgnoredEventSet(events.size());
-            return;
-        }
-
-        // Notify the event listeners ...
-        boolean notifiedSomebody = false;
-        List<EventListener> eventListeners = this.eventListeners; // use one consistent snapshot
-        if (!eventListeners.isEmpty()) {
-            DelegatingEventIterator eventIter = new DelegatingEventIterator(events.iterator(), events.size());
-            for (EventListener eventListener : eventListeners) {
-                eventListener.onEvent(eventIter);
-            }
-            notifiedSomebody = true;
-        }
-
-        // Now create the node change events ...
-        List<NodeChangeListener> nodeChangeListeners = this.nodeChangeListeners; // use one consistent snapshot
-        if (!nodeChangeListeners.isEmpty()) {
-            final String repositorySourceName = listener.getRepositorySourceName();
-            final String repositoryWorkspaceName = listener.getRepositoryWorkspaceName();
-            try {
-                NodeChanges nodeChanges = NodeChanges.create(repositorySourceName, repositoryWorkspaceName, events);
-
-                // And notify the node change listeners ...
-                int nodeChangeCount = nodeChanges.size();
-                this.statistics.recordNodesChanged(nodeChangeCount);
-                for (NodeChangeListener nodeChangeListener : nodeChangeListeners) {
-                    nodeChangeListener.onNodeChanges(nodeChanges);
-                }
-            } catch (Throwable t) {
-                getProblemLog().error(repositoryWorkspaceName, t);
-            }
-            notifiedSomebody = true;
-        }
-
-        if (notifiedSomebody) {
-            this.statistics.recordEventSet(events.size());
-        } else {
-            this.statistics.recordIgnoredEventSet(events.size());
-        }
-    }
-
-    protected class DelegatingEventIterator implements EventIterator {
-
-        private final Iterator<Event> events;
-        private final int size;
-        private int position = 0;
-
-        protected DelegatingEventIterator( Iterator<Event> events,
-                                           int size ) {
-            this.events = events;
-            this.size = size;
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        public Event nextEvent() {
-            ++position;
-            return events.next();
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        public long getPosition() {
-            return position;
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        public long getSize() {
-            return size;
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        public void skip( long skipNum ) {
-            for (int i = 0; i != skipNum; ++i) {
-                next();
-            }
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        public boolean hasNext() {
-            return events.hasNext();
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        public Object next() {
-            return events.next();
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        public void remove() {
-            // does nothing
-        }
-
-    }
-
-    /**
-     * Implementation of the {@link EventListener JCR EventListener} interface, returned by the sequencing system.
-     * 
-     * @author Randall Hauch
-     */
-    @ThreadSafe
-    public class WorkspaceListener implements EventListener {
-
-        public static final boolean DEFAULT_IS_DEEP = true;
-        public static final boolean DEFAULT_NO_LOCAL = false;
-        public static final int DEFAULT_EVENT_TYPES = Event.NODE_ADDED | /* Event.NODE_REMOVED| */Event.PROPERTY_ADDED
-                                                      | Event.PROPERTY_CHANGED /* |Event.PROPERTY_REMOVED */;
-        public static final String DEFAULT_ABSOLUTE_PATH = "/";
-
-        private final String repositorySourceName;
-        private final String repositoryWorkspaceName;
-        private final Set<String> uuids;
-        private final Set<String> nodeTypeNames;
-        private final int eventTypes;
-        private final String absolutePath;
-        private final boolean deep;
-        private final boolean noLocal;
-        @GuardedBy( "this" )
-        private transient Session session;
-
-        protected WorkspaceListener( String repositorySourceName,
-                                     String repositoryWorkspaceName,
-                                     int eventTypes,
-                                     String absPath,
-                                     boolean isDeep,
-                                     String[] uuids,
-                                     String[] nodeTypeNames,
-                                     boolean noLocal ) {
-            assert repositorySourceName != null;
-
-            this.repositorySourceName = repositorySourceName;
-            this.repositoryWorkspaceName = repositoryWorkspaceName;
-            this.eventTypes = eventTypes;
-            this.deep = isDeep;
-            this.noLocal = noLocal;
-            this.absolutePath = absPath != null && absPath.trim().length() != 0 ? absPath.trim() : null;
-            // Set the UUIDs ...
-            Set<String> newUuids = new HashSet<String>();
-            if (uuids != null) {
-                for (String uuid : uuids) {
-                    if (uuid != null && uuid.trim().length() != 0) newUuids.add(uuid.trim());
-                }
-            }
-            this.uuids = Collections.unmodifiableSet(newUuids);
-            // Set the node type names
-            Set<String> newNodeTypeNames = new HashSet<String>();
-            if (nodeTypeNames != null) {
-                for (String nodeTypeName : nodeTypeNames) {
-                    if (nodeTypeName != null && nodeTypeName.trim().length() != 0) newNodeTypeNames.add(nodeTypeName.trim());
-                }
-            }
-            this.nodeTypeNames = Collections.unmodifiableSet(newNodeTypeNames);
-        }
-
-        /**
-         * @return repositorySourceName
-         */
-        public String getRepositorySourceName() {
-            return this.repositorySourceName;
-        }
-
-        /**
-         * @return repositoryWorkspaceName
-         */
-        public String getRepositoryWorkspaceName() {
-            return this.repositoryWorkspaceName;
-        }
-
-        /**
-         * @return eventTypes
-         */
-        public int getEventTypes() {
-            return this.eventTypes;
-        }
-
-        /**
-         * @return absolutePath
-         */
-        public String getAbsolutePath() {
-            return this.absolutePath;
-        }
-
-        /**
-         * @return deep
-         */
-        public boolean isDeep() {
-            return this.deep;
-        }
-
-        /**
-         * @return noLocal
-         */
-        public boolean isNoLocal() {
-            return this.noLocal;
-        }
-
-        /**
-         * @return uuids
-         */
-        public Set<String> getUuids() {
-            return this.uuids;
-        }
-
-        /**
-         * @return nodeTypeNames
-         */
-        public Set<String> getNodeTypeNames() {
-            return this.nodeTypeNames;
-        }
-
-        public synchronized boolean isRegistered() {
-            if (this.session != null && getAdministrator().isShutdown()) {
-                // This sequencing system has been shutdown, so unregister this listener
-                try {
-                    unregister();
-                } catch (RepositoryException re) {
-                    String msg = "Error unregistering workspace listener after sequencing system has been shutdow.";
-                    Logger.getLogger(this.getClass()).debug(re, msg);
-                }
-            }
-            return this.session != null;
-        }
-
-        public synchronized WorkspaceListener register() throws UnsupportedRepositoryOperationException, RepositoryException {
-            if (this.session != null) return this;
-            this.session = ObservationService.this.getSessionFactory().createSession(this.repositoryWorkspaceName);
-            String[] uuids = this.uuids.isEmpty() ? null : this.uuids.toArray(new String[this.uuids.size()]);
-            String[] nodeTypeNames = this.nodeTypeNames.isEmpty() ? null : this.nodeTypeNames.toArray(new String[this.nodeTypeNames.size()]);
-            this.session.getWorkspace().getObservationManager().addEventListener(this,
-                                                                                 eventTypes,
-                                                                                 absolutePath,
-                                                                                 deep,
-                                                                                 uuids,
-                                                                                 nodeTypeNames,
-                                                                                 noLocal);
-            return this;
-        }
-
-        public synchronized WorkspaceListener unregister() throws UnsupportedRepositoryOperationException, RepositoryException {
-            if (this.session == null) return this;
-            try {
-                if (this.session.isLive()) {
-                    this.session.getWorkspace().getObservationManager().removeEventListener(this);
-                    this.session.logout();
-                }
-            } finally {
-                this.session = null;
-                unregisterListener(this);
-            }
-            return this;
-        }
-
-        public synchronized WorkspaceListener reregister() throws UnsupportedRepositoryOperationException, RepositoryException {
-            unregister();
-            register();
-            return this;
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        public void onEvent( EventIterator events ) {
-            if (events != null) {
-                if (getAdministrator().isShutdown()) {
-                    // This sequencing system has been shutdown, so unregister this listener
-                    try {
-                        unregister();
-                    } catch (RepositoryException re) {
-                        String msg = "Error unregistering workspace listener after sequencing system has been shutdow.";
-                        Logger.getLogger(this.getClass()).debug(re, msg);
-                    }
-                } else {
-                    ObservationService.this.processEvents(events, this);
-                }
-            }
-        }
-    }
-
-    /**
-     * The statistics for the system. Each sequencing system has an instance of this class that is updated.
-     * 
-     * @author Randall Hauch
-     */
-    @ThreadSafe
-    public class Statistics {
-
-        @GuardedBy( "lock" )
-        private long numberOfEventsIgnored;
-        @GuardedBy( "lock" )
-        private long numberOfEventsEnqueued;
-        @GuardedBy( "lock" )
-        private long numberOfEventSetsIgnored;
-        @GuardedBy( "lock" )
-        private long numberOfEventSetsEnqueued;
-        private final AtomicLong numberOfNodeChangesEnqueued = new AtomicLong(0);
-        private final ReadWriteLock lock = new ReentrantReadWriteLock();
-        private final AtomicLong startTime;
-
-        protected Statistics() {
-            startTime = new AtomicLong(System.currentTimeMillis());
-        }
-
-        public Statistics reset() {
-            try {
-                lock.writeLock().lock();
-                this.startTime.set(System.currentTimeMillis());
-                this.numberOfEventsIgnored = 0;
-                this.numberOfEventsEnqueued = 0;
-                this.numberOfEventSetsIgnored = 0;
-                this.numberOfEventSetsEnqueued = 0;
-                this.numberOfNodeChangesEnqueued.set(0);
-            } finally {
-                lock.writeLock().unlock();
-            }
-            return this;
-        }
-
-        /**
-         * @return the system time when the statistics were started
-         */
-        public long getStartTime() {
-            return this.startTime.get();
-        }
-
-        /**
-         * @return the number of node changes that were processed
-         */
-        public long getNumberOfNodeChangesEnqueued() {
-            return this.numberOfNodeChangesEnqueued.get();
-        }
-
-        /**
-         * @return the number of events that were ignored because the system was not running
-         */
-        public long getNumberOfEventsIgnored() {
-            try {
-                lock.readLock().lock();
-                return this.numberOfEventsIgnored;
-            } finally {
-                lock.readLock().unlock();
-            }
-        }
-
-        /**
-         * @return the number of events that were enqueued for processing
-         */
-        public long getNumberOfEventsEnqueued() {
-            try {
-                lock.readLock().lock();
-                return this.numberOfEventsEnqueued;
-            } finally {
-                lock.readLock().unlock();
-            }
-        }
-
-        /**
-         * @return the number of event sets (transactions) that were enqueued for processing
-         */
-        public long getNumberOfEventSetsEnqueued() {
-            try {
-                lock.readLock().lock();
-                return this.numberOfEventSetsEnqueued;
-            } finally {
-                lock.readLock().unlock();
-            }
-        }
-
-        /**
-         * @return the number of event sets (transactions) that were ignored because the system was not running
-         */
-        public long getNumberOfEventSetsIgnored() {
-            try {
-                lock.readLock().lock();
-                return this.numberOfEventSetsIgnored;
-            } finally {
-                lock.readLock().unlock();
-            }
-        }
-
-        protected void recordNodesChanged( long changeCount ) {
-            this.numberOfNodeChangesEnqueued.addAndGet(changeCount);
-        }
-
-        protected void recordEventSet( long eventsInSet ) {
-            try {
-                lock.writeLock().lock();
-                this.numberOfEventsEnqueued += eventsInSet;
-                ++this.numberOfEventSetsEnqueued;
-            } finally {
-                lock.writeLock().unlock();
-            }
-        }
-
-        protected void recordIgnoredEventSet( long eventsInSet ) {
-            try {
-                lock.writeLock().lock();
-                this.numberOfEventsIgnored += eventsInSet;
-                this.numberOfEventSetsIgnored += 1;
-                ++this.numberOfEventSetsEnqueued;
-            } finally {
-                lock.writeLock().unlock();
-            }
-        }
-    }
-}

Deleted: trunk/dna-repository/src/main/java/org/jboss/dna/repository/rules/InvalidRuleSetException.java
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/rules/InvalidRuleSetException.java	2009-05-21 22:26:25 UTC (rev 922)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/rules/InvalidRuleSetException.java	2009-05-22 02:15:19 UTC (rev 923)
@@ -1,66 +0,0 @@
-/*
- * JBoss DNA (http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of 
- * individual contributors. 
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you 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.
- *
- * JBoss DNA 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.rules;
-
-/**
- * @author Randall Hauch
- */
-public class InvalidRuleSetException extends RuntimeException {
-
-    /**
-     */
-    private static final long serialVersionUID = 6739445071678626125L;
-
-    /**
-     * 
-     */
-    public InvalidRuleSetException() {
-    }
-
-    /**
-     * @param message
-     */
-    public InvalidRuleSetException( String message ) {
-        super(message);
-
-    }
-
-    /**
-     * @param cause
-     */
-    public InvalidRuleSetException( Throwable cause ) {
-        super(cause);
-
-    }
-
-    /**
-     * @param message
-     * @param cause
-     */
-    public InvalidRuleSetException( String message, Throwable cause ) {
-        super(message, cause);
-
-    }
-
-}

Deleted: 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	2009-05-21 22:26:25 UTC (rev 922)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/rules/RuleService.java	2009-05-22 02:15:19 UTC (rev 923)
@@ -1,509 +0,0 @@
-/*
- * JBoss DNA (http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of 
- * individual contributors. 
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you 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.
- *
- * JBoss DNA 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.rules;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.io.StringReader;
-import java.rmi.RemoteException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.ReadWriteLock;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-import javax.rules.ConfigurationException;
-import javax.rules.RuleRuntime;
-import javax.rules.RuleServiceProvider;
-import javax.rules.RuleServiceProviderManager;
-import javax.rules.RuleSession;
-import javax.rules.StatelessRuleSession;
-import javax.rules.admin.LocalRuleExecutionSetProvider;
-import javax.rules.admin.RuleAdministrator;
-import javax.rules.admin.RuleExecutionSet;
-import javax.rules.admin.RuleExecutionSetCreateException;
-import javax.rules.admin.RuleExecutionSetDeregistrationException;
-import net.jcip.annotations.GuardedBy;
-import net.jcip.annotations.ThreadSafe;
-import org.jboss.dna.common.SystemFailureException;
-import org.jboss.dna.common.component.ClassLoaderFactory;
-import org.jboss.dna.common.component.StandardClassLoaderFactory;
-import org.jboss.dna.common.util.CheckArg;
-import org.jboss.dna.common.util.Logger;
-import org.jboss.dna.repository.RepositoryI18n;
-import org.jboss.dna.repository.service.AbstractServiceAdministrator;
-import org.jboss.dna.repository.service.AdministeredService;
-import org.jboss.dna.repository.service.ServiceAdministrator;
-
-/**
- * A rule service that is capable of executing rule sets using one or more JSR-94 rule engines. Sets of rules are
- * {@link #addRuleSet(RuleSet) added}, {@link #updateRuleSet(RuleSet) updated}, and {@link #removeRuleSet(String) removed}
- * (usually by some other component), and then these named rule sets can be {@link #executeRules(String, Map, Object...) run} with
- * inputs and facts to obtain output.
- * <p>
- * This service is thread safe. While multiple rule sets can be safely {@link #executeRules(String, Map, Object...) executed} at
- * the same time, all executions will be properly synchronized with methods to {@link #addRuleSet(RuleSet) add},
- * {@link #updateRuleSet(RuleSet) update}, and {@link #removeRuleSet(String) remove} rule sets.
- * </p>
- * 
- * @author Randall Hauch
- */
- at ThreadSafe
-public class RuleService implements AdministeredService {
-
-    protected static final ClassLoaderFactory DEFAULT_CLASSLOADER_FACTORY = new StandardClassLoaderFactory(
-                                                                                                           RuleService.class.getClassLoader());
-
-    /**
-     * The administrative component for this service.
-     * 
-     * @author Randall Hauch
-     */
-    protected class Administrator extends AbstractServiceAdministrator {
-
-        protected Administrator() {
-            super(RepositoryI18n.ruleServiceName, State.PAUSED);
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        protected void doShutdown( State fromState ) {
-            super.doShutdown(fromState);
-            // Remove all rule sets ...
-            removeAllRuleSets();
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        protected boolean doCheckIsTerminated() {
-            return RuleService.this.isTerminated();
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        public boolean awaitTermination( long timeout,
-                                         TimeUnit unit ) throws InterruptedException {
-            return doAwaitTermination(timeout, unit);
-        }
-
-    }
-
-    private Logger logger;
-    private ClassLoaderFactory classLoaderFactory = DEFAULT_CLASSLOADER_FACTORY;
-    private final Administrator administrator = new Administrator();
-    private final ReadWriteLock lock = new ReentrantReadWriteLock();
-    @GuardedBy( "lock" )
-    private final Map<String, RuleSet> ruleSets = new HashMap<String, RuleSet>();
-    private final CountDownLatch shutdownLatch = new CountDownLatch(1);
-
-    /**
-     * Create a new rule service, configured with no rule sets. Upon construction, the system is
-     * {@link ServiceAdministrator#isPaused() paused} and must be configured and then {@link ServiceAdministrator#start() started}
-     * .
-     */
-    public RuleService() {
-        this.logger = Logger.getLogger(this.getClass());
-    }
-
-    /**
-     * Return the administrative component for this service.
-     * 
-     * @return the administrative component; never null
-     */
-    public ServiceAdministrator getAdministrator() {
-        return this.administrator;
-    }
-
-    /**
-     * Get the class loader factory that should be used to load sequencers. By default, this service uses a factory that will
-     * return either the {@link Thread#getContextClassLoader() current thread's context class loader} (if not null) or the class
-     * loader that loaded this class.
-     * 
-     * @return the class loader factory; never null
-     * @see #setClassLoaderFactory(ClassLoaderFactory)
-     */
-    public ClassLoaderFactory getClassLoaderFactory() {
-        return this.classLoaderFactory;
-    }
-
-    /**
-     * Set the Maven Repository that should be used to load the sequencer classes. By default, this service uses a class loader
-     * factory that will return either the {@link Thread#getContextClassLoader() current thread's context class loader} (if not
-     * null) or the class loader that loaded this class.
-     * 
-     * @param classLoaderFactory the class loader factory reference, or null if the default class loader factory should be used.
-     * @see #getClassLoaderFactory()
-     */
-    public void setClassLoaderFactory( ClassLoaderFactory classLoaderFactory ) {
-        this.classLoaderFactory = classLoaderFactory != null ? classLoaderFactory : DEFAULT_CLASSLOADER_FACTORY;
-    }
-
-    /**
-     * Obtain the rule sets that are currently available in this service.
-     * 
-     * @return an unmodifiable copy of the rule sets; never null, but possibly empty ...
-     */
-    public Collection<RuleSet> getRuleSets() {
-        List<RuleSet> results = new ArrayList<RuleSet>();
-        try {
-            this.lock.readLock().lock();
-            // Make a copy of the rule sets ...
-            if (ruleSets.size() != 0) results.addAll(this.ruleSets.values());
-        } finally {
-            this.lock.readLock().unlock();
-        }
-        return Collections.unmodifiableList(results);
-    }
-
-    /**
-     * Add a rule set, or update any existing one that represents the {@link RuleSet#equals(Object) same rule set}
-     * 
-     * @param ruleSet the new rule set
-     * @return true if the rule set was added, or false if the rule set was not added (because it wasn't necessary)
-     * @throws IllegalArgumentException if <code>ruleSet</code> is null
-     * @throws InvalidRuleSetException if the supplied rule set is invalid, incomplete, incorrectly defined, or uses a JSR-94
-     *         service provider that cannot be found
-     * @see #updateRuleSet(RuleSet)
-     * @see #removeRuleSet(String)
-     */
-    public boolean addRuleSet( RuleSet ruleSet ) {
-        CheckArg.isNotNull(ruleSet, "rule set");
-        final String providerUri = ruleSet.getProviderUri();
-        final String ruleSetName = ruleSet.getName();
-        final String rules = ruleSet.getRules();
-        final Map<?, ?> properties = ruleSet.getExecutionSetProperties();
-        final Reader ruleReader = new StringReader(rules);
-        boolean updatedRuleSets = false;
-        try {
-            this.lock.writeLock().lock();
-
-            // Make sure the rule service provider is available ...
-            RuleServiceProvider ruleServiceProvider = findRuleServiceProvider(ruleSet);
-            assert ruleServiceProvider != null;
-
-            // Now register a new execution set ...
-            RuleAdministrator ruleAdmin = ruleServiceProvider.getRuleAdministrator();
-            if (ruleAdmin == null) {
-                throw new InvalidRuleSetException(
-                                                  RepositoryI18n.unableToObtainJsr94RuleAdministrator.text(providerUri,
-                                                                                                           ruleSet.getComponentClassname(),
-                                                                                                           ruleSetName));
-            }
-
-            // Is there is an existing rule set and, if so, whether it has changed ...
-            RuleSet existing = this.ruleSets.get(ruleSetName);
-
-            // Create the rule execution set (do this before deregistering, in case there is a problem)...
-            LocalRuleExecutionSetProvider ruleExecutionSetProvider = ruleAdmin.getLocalRuleExecutionSetProvider(null);
-            RuleExecutionSet executionSet = ruleExecutionSetProvider.createRuleExecutionSet(ruleReader, properties);
-
-            // We should add the execiting rule set if there wasn't one or if the rule set has changed ...
-            boolean shouldAdd = existing == null || ruleSet.hasChanged(existing);
-            if (existing != null && shouldAdd) {
-                // There is an existing execution set and it needs to be updated, so deregister it ...
-                ruleServiceProvider = deregister(ruleSet);
-            }
-            if (shouldAdd) {
-                boolean rollback = false;
-                try {
-                    // Now register the new execution set and update the rule set managed by this service ...
-                    ruleAdmin.registerRuleExecutionSet(ruleSetName, executionSet, null);
-                    this.ruleSets.remove(ruleSet.getName());
-                    this.ruleSets.put(ruleSet.getName(), ruleSet);
-                    updatedRuleSets = true;
-                } catch (Throwable t) {
-                    rollback = true;
-                    throw new InvalidRuleSetException(RepositoryI18n.errorAddingOrUpdatingRuleSet.text(ruleSet.getName()), t);
-                } finally {
-                    if (rollback) {
-                        try {
-                            // There was a problem, so re-register the original existing rule set ...
-                            if (existing != null) {
-                                final String oldRules = existing.getRules();
-                                final Map<?, ?> oldProperties = existing.getExecutionSetProperties();
-                                final Reader oldRuleReader = new StringReader(oldRules);
-                                ruleServiceProvider = findRuleServiceProvider(existing);
-                                assert ruleServiceProvider != null;
-                                executionSet = ruleExecutionSetProvider.createRuleExecutionSet(oldRuleReader, oldProperties);
-                                ruleAdmin.registerRuleExecutionSet(ruleSetName, executionSet, null);
-                                this.ruleSets.remove(ruleSetName);
-                                this.ruleSets.put(ruleSetName, existing);
-                            }
-                        } catch (Throwable rollbackError) {
-                            // There was a problem rolling back to the existing rule set, and we're going to throw the
-                            // exception associated with the updated/new rule set, so just log this problem
-                            this.logger.error(rollbackError, RepositoryI18n.errorRollingBackRuleSetAfterUpdateFailed, ruleSetName);
-                        }
-                    }
-                }
-            }
-        } catch (InvalidRuleSetException e) {
-            throw e;
-        } catch (ConfigurationException t) {
-            throw new InvalidRuleSetException(
-                                              RepositoryI18n.unableToObtainJsr94RuleAdministrator.text(providerUri,
-                                                                                                       ruleSet.getComponentClassname(),
-                                                                                                       ruleSetName));
-        } catch (RemoteException t) {
-            throw new InvalidRuleSetException(
-                                              RepositoryI18n.errorUsingJsr94RuleAdministrator.text(providerUri,
-                                                                                                   ruleSet.getComponentClassname(),
-                                                                                                   ruleSetName));
-        } catch (IOException t) {
-            throw new InvalidRuleSetException(RepositoryI18n.errorReadingRulesAndProperties.text(ruleSetName));
-        } catch (RuleExecutionSetDeregistrationException t) {
-            throw new InvalidRuleSetException(RepositoryI18n.errorDeregisteringRuleSetBeforeUpdatingIt.text(ruleSetName));
-        } catch (RuleExecutionSetCreateException t) {
-            throw new InvalidRuleSetException(RepositoryI18n.errorRecreatingRuleSet.text(ruleSetName));
-        } finally {
-            this.lock.writeLock().unlock();
-        }
-        return updatedRuleSets;
-    }
-
-    /**
-     * Update the configuration for a sequencer, or add it if there is no {@link RuleSet#equals(Object) matching configuration}.
-     * 
-     * @param ruleSet the rule set to be updated
-     * @return true if the rule set was updated, or false if the rule set was not updated (because it wasn't necessary)
-     * @throws InvalidRuleSetException if the supplied rule set is invalid, incomplete, incorrectly defined, or uses a JSR-94
-     *         service provider that cannot be found
-     * @see #addRuleSet(RuleSet)
-     * @see #removeRuleSet(String)
-     */
-    public boolean updateRuleSet( RuleSet ruleSet ) {
-        return addRuleSet(ruleSet);
-    }
-
-    /**
-     * Remove a rule set.
-     * 
-     * @param ruleSetName the name of the rule set to be removed
-     * @return true if the rule set was removed, or if it was not an existing rule set
-     * @throws IllegalArgumentException if <code>ruleSetName</code> is null or empty
-     * @throws SystemFailureException if the rule set was found but there was a problem removing it
-     * @see #addRuleSet(RuleSet)
-     * @see #updateRuleSet(RuleSet)
-     */
-    public boolean removeRuleSet( String ruleSetName ) {
-        CheckArg.isNotEmpty(ruleSetName, "rule set");
-        try {
-            this.lock.writeLock().lock();
-            RuleSet ruleSet = this.ruleSets.remove(ruleSetName);
-            if (ruleSet != null) {
-                try {
-                    deregister(ruleSet);
-                } catch (Throwable t) {
-                    // There was a problem deregistering the rule set, so put it back ...
-                    this.ruleSets.put(ruleSetName, ruleSet);
-                }
-                return true;
-            }
-        } catch (Throwable t) {
-            throw new SystemFailureException(RepositoryI18n.errorRemovingRuleSet.text(ruleSetName), t);
-        } finally {
-            this.lock.writeLock().unlock();
-        }
-        return false;
-    }
-
-    /**
-     * Get the logger for this system
-     * 
-     * @return the logger
-     */
-    public Logger getLogger() {
-        return this.logger;
-    }
-
-    /**
-     * Set the logger for this system.
-     * 
-     * @param logger the logger, or null if the standard logging should be used
-     */
-    public void setLogger( Logger logger ) {
-        this.logger = logger != null ? logger : Logger.getLogger(this.getClass());
-    }
-
-    /**
-     * Execute the set of rules defined by the supplied rule set name. This method is safe to be concurrently called by multiple
-     * threads, and is properly synchronized with the methods to {@link #addRuleSet(RuleSet) add}, {@link #updateRuleSet(RuleSet)
-     * update}, and {@link #removeRuleSet(String) remove} rule sets.
-     * 
-     * @param ruleSetName the {@link RuleSet#getName() name} of the {@link RuleSet} that should be used
-     * @param globals the global variables
-     * @param facts the facts
-     * @return the results of executing the rule set
-     * @throws IllegalArgumentException if the rule set name is null, empty or blank, or if there is no rule set with the given
-     *         name
-     * @throws SystemFailureException if there is no JSR-94 rule service provider with the {@link RuleSet#getProviderUri() 
-     *         RuleSet's provider URI}.
-     */
-    public List<?> executeRules( String ruleSetName,
-                                 Map<String, Object> globals,
-                                 Object... facts ) {
-        CheckArg.isNotEmpty(ruleSetName, "rule set name");
-        List<?> result = null;
-        List<?> factList = Arrays.asList(facts);
-        try {
-            this.lock.readLock().lock();
-
-            // Find the rule set ...
-            RuleSet ruleSet = this.ruleSets.get(ruleSetName);
-            if (ruleSet == null) {
-                throw new IllegalArgumentException(RepositoryI18n.unableToFindRuleSet.text(ruleSetName));
-            }
-
-            // Look up the provider ...
-            RuleServiceProvider ruleServiceProvider = findRuleServiceProvider(ruleSet);
-            assert ruleServiceProvider != null;
-
-            // Create the rule session ...
-            RuleRuntime ruleRuntime = ruleServiceProvider.getRuleRuntime();
-            String executionSetName = ruleSet.getRuleSetUri();
-            RuleSession session = ruleRuntime.createRuleSession(executionSetName, globals, RuleRuntime.STATELESS_SESSION_TYPE);
-            try {
-                StatelessRuleSession statelessSession = (StatelessRuleSession)session;
-                result = statelessSession.executeRules(factList);
-            } finally {
-                session.release();
-            }
-            if (this.logger.isTraceEnabled()) {
-                String msg = "Executed rule set '{1}' with globals {2} and facts {3} resulting in {4}";
-                this.logger.trace(msg, ruleSetName, globals, Arrays.asList(facts), result);
-            }
-        } catch (Throwable t) {
-            String msg = RepositoryI18n.errorExecutingRuleSetWithGlobalsAndFacts.text(ruleSetName, globals, Arrays.asList(facts));
-            throw new SystemFailureException(msg, t);
-        } finally {
-            this.lock.readLock().unlock();
-        }
-        return result;
-    }
-
-    protected void removeAllRuleSets() {
-        try {
-            lock.writeLock().lock();
-            for (RuleSet ruleSet : ruleSets.values()) {
-                try {
-                    deregister(ruleSet);
-                } catch (Throwable t) {
-                    logger.error(t, RepositoryI18n.errorRemovingRuleSetUponShutdown, ruleSet.getName());
-                }
-            }
-        } finally {
-            lock.writeLock().unlock();
-        }
-        this.shutdownLatch.countDown();
-    }
-
-    protected boolean doAwaitTermination( long timeout,
-                                          TimeUnit unit ) throws InterruptedException {
-        return this.shutdownLatch.await(timeout, unit);
-    }
-
-    protected boolean isTerminated() {
-        return this.shutdownLatch.getCount() == 0;
-    }
-
-    /**
-     * Finds the JSR-94 service provider instance and returns it. If it could not be found, this method attempts to load it.
-     * 
-     * @param ruleSet the rule set for which the service provider is to be found; may not be null
-     * @return the rule service provider; never null
-     * @throws ConfigurationException if there is a problem loading the service provider
-     * @throws InvalidRuleSetException if the service provider could not be found
-     */
-    private RuleServiceProvider findRuleServiceProvider( RuleSet ruleSet ) throws ConfigurationException {
-        assert ruleSet != null;
-        String providerUri = ruleSet.getProviderUri();
-        RuleServiceProvider ruleServiceProvider = null;
-        try {
-            // If the provider could not be found, then a ConfigurationException will be thrown ...
-            ruleServiceProvider = RuleServiceProviderManager.getRuleServiceProvider(providerUri);
-        } catch (ConfigurationException e) {
-            try {
-                // Use JSR-94 to load the RuleServiceProvider instance ...
-                ClassLoader loader = this.classLoaderFactory.getClassLoader(ruleSet.getComponentClasspathArray());
-                // Don't call ClassLoader.loadClass(String), as this doesn't initialize the class!!
-                Class.forName(ruleSet.getComponentClassname(), true, loader);
-                ruleServiceProvider = RuleServiceProviderManager.getRuleServiceProvider(providerUri);
-                this.logger.debug("Loaded the rule service provider {0} ({1})", providerUri, ruleSet.getComponentClassname());
-            } catch (ConfigurationException ce) {
-                throw ce;
-            } catch (Throwable t) {
-                throw new InvalidRuleSetException(
-                                                  RepositoryI18n.unableToObtainJsr94ServiceProvider.text(providerUri,
-                                                                                                         ruleSet.getComponentClassname()),
-                                                  t);
-            }
-        }
-        if (ruleServiceProvider == null) {
-            throw new InvalidRuleSetException(
-                                              RepositoryI18n.unableToObtainJsr94ServiceProvider.text(providerUri,
-                                                                                                     ruleSet.getComponentClassname()));
-        }
-        return ruleServiceProvider;
-    }
-
-    /**
-     * Deregister the supplied rule set, if it could be found. This method does nothing if any of the service provider components
-     * could not be found.
-     * 
-     * @param ruleSet the rule set to be deregistered; may not be null
-     * @return the service provider reference, or null if the service provider could not be found ...
-     * @throws ConfigurationException
-     * @throws RuleExecutionSetDeregistrationException
-     * @throws RemoteException
-     */
-    private RuleServiceProvider deregister( RuleSet ruleSet )
-        throws ConfigurationException, RuleExecutionSetDeregistrationException, RemoteException {
-        assert ruleSet != null;
-        // Look up the provider ...
-        String providerUri = ruleSet.getProviderUri();
-        assert providerUri != null;
-
-        // Look for the provider ...
-        RuleServiceProvider ruleServiceProvider = RuleServiceProviderManager.getRuleServiceProvider(providerUri);
-        if (ruleServiceProvider != null) {
-            // Deregister the rule set ...
-            RuleAdministrator ruleAdmin = ruleServiceProvider.getRuleAdministrator();
-            if (ruleAdmin != null) {
-                ruleAdmin.deregisterRuleExecutionSet(ruleSet.getRuleSetUri(), null);
-            }
-        }
-        return ruleServiceProvider;
-    }
-
-}

Deleted: trunk/dna-repository/src/main/java/org/jboss/dna/repository/rules/RuleSet.java
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/rules/RuleSet.java	2009-05-21 22:26:25 UTC (rev 922)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/rules/RuleSet.java	2009-05-22 02:15:19 UTC (rev 923)
@@ -1,154 +0,0 @@
-/*
- * JBoss DNA (http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
-* See the AUTHORS.txt file in the distribution for a full listing of 
-* individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you 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.
- *
- * JBoss DNA 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.rules;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.util.HashMap;
-import java.util.Map;
-import javax.rules.RuleServiceProvider;
-import javax.rules.admin.RuleExecutionSet;
-import javax.rules.admin.RuleExecutionSetProvider;
-import net.jcip.annotations.Immutable;
-import org.jboss.dna.common.component.ClassLoaderFactory;
-import org.jboss.dna.common.component.ComponentConfig;
-import org.jboss.dna.common.util.CheckArg;
-
-/**
- * A description of a set of rules compatible with a JSR-94 rule engine.
- * 
- * @author Randall Hauch
- */
- at Immutable
-public class RuleSet extends ComponentConfig implements Cloneable {
-
-    private final String providerUri;
-    private final String ruleSetUri;
-    private final String rules;
-
-    /**
-     * Create a JSR-94 rule set definition.
-     * 
-     * @param name the name of the rule set, which is considered the unique identifier
-     * @param description the description
-     * @param classname the name of the Java class used for the component
-     * @param classpath the optional classpath (defined in a way compatible with a {@link ClassLoaderFactory}
-     * @param providerUri the URI of the JSR-94 {@link RuleServiceProvider} implementation to use
-     * @param ruleSetUri the URI of the JSR-94 {@link RuleExecutionSet} represented by this object; if null, the name is used
-     * @param rules the string containing the rules in a provider-specific language
-     * @param properties the provider-specific properties, whose values should be strings or byte arrays (the latter if the
-     *        provider expects an {@link Reader} with the value)
-     * @throws IllegalArgumentException if any of the name, classname, provider URI, or rules parameters are null, empty or blank,
-     *         or if the classname is not a valid Java classname
-     */
-    public RuleSet( String name,
-                    String description,
-                    String classname,
-                    String[] classpath,
-                    String providerUri,
-                    String ruleSetUri,
-                    String rules,
-                    Map<String, Object> properties ) {
-        super(name, description, System.currentTimeMillis(), properties, classname, classpath);
-        if (ruleSetUri == null) ruleSetUri = name.trim();
-        CheckArg.isNotEmpty(ruleSetUri, "rule set URI");
-        CheckArg.isNotEmpty(providerUri, "provider URI");
-        CheckArg.isNotEmpty(rules, "rules");
-        this.providerUri = providerUri;
-        this.ruleSetUri = ruleSetUri;
-        this.rules = rules;
-    }
-
-    /**
-     * Get the URI of the JSR-94 {@link RuleServiceProvider} implementation that should be used.
-     * 
-     * @return the URI of the JSR-94 implementation; never null, empty or blank
-     */
-    public String getProviderUri() {
-        return this.providerUri;
-    }
-
-    /**
-     * Get the URI of this rule set. The value must be valid as defined by JSR-94 {@link RuleExecutionSet}.
-     * 
-     * @return the rule set's URI; never null, empty or blank
-     */
-    public String getRuleSetUri() {
-        return this.ruleSetUri;
-    }
-
-    /**
-     * Get the rules defined in terms of the language reqired by the {@link #getProviderUri() provider}.
-     * 
-     * @return the rules for this rule set
-     */
-    public String getRules() {
-        return this.rules;
-    }
-
-    /**
-     * Get the properties for this rule set that can be passed to an {@link RuleExecutionSetProvider}'s
-     * {@link RuleExecutionSetProvider#createRuleExecutionSet(String, Map) createRuleExecutionSet} method.
-     * <p>
-     * This method converts any byte array value in the {@link #getProperties() properties} into an {@link Reader}. Since
-     * {@link ByteArrayInputStream} is used, there is no need to close these stream.
-     * </p>
-     * 
-     * @return the properties; never null but possible empty
-     */
-    public Map<Object, Object> getExecutionSetProperties() {
-        Map<Object, Object> props = new HashMap<Object, Object>();
-        for (Map.Entry<String, Object> entry : getProperties().entrySet()) {
-            String key = entry.getKey();
-            Object value = entry.getValue();
-            if (value instanceof byte[]) {
-                value = new InputStreamReader(new ByteArrayInputStream((byte[])value));
-            }
-            props.put(key, value);
-        }
-        return props;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public boolean hasChanged( ComponentConfig obj ) {
-        if (super.hasChanged(obj)) return true;
-        RuleSet that = (RuleSet)obj;
-        if (!this.providerUri.equals(that.providerUri)) return true;
-        if (!this.ruleSetUri.equals(that.ruleSetUri)) return true;
-        return false;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public RuleSet clone() {
-        return new RuleSet(getName(), getDescription(), getComponentClassname(), getComponentClasspathArray(), this.providerUri,
-                           this.ruleSetUri, this.rules, getProperties());
-    }
-}

Deleted: trunk/dna-repository/src/main/java/org/jboss/dna/repository/rules/RuleSetRepositoryMonitor.java
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/rules/RuleSetRepositoryMonitor.java	2009-05-21 22:26:25 UTC (rev 922)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/rules/RuleSetRepositoryMonitor.java	2009-05-22 02:15:19 UTC (rev 923)
@@ -1,271 +0,0 @@
-/*
- * JBoss DNA (http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of 
- * individual contributors. 
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you 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.
- *
- * JBoss DNA 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.rules;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.util.regex.PatternSyntaxException;
-import javax.jcr.Node;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import net.jcip.annotations.ThreadSafe;
-import org.jboss.dna.common.collection.SimpleProblems;
-import org.jboss.dna.common.util.CheckArg;
-import org.jboss.dna.common.util.Logger;
-import org.jboss.dna.repository.RepositoryI18n;
-import org.jboss.dna.repository.observation.NodeChange;
-import org.jboss.dna.repository.observation.NodeChangeListener;
-import org.jboss.dna.repository.observation.NodeChanges;
-import org.jboss.dna.repository.observation.ObservationService;
-import org.jboss.dna.repository.util.JcrExecutionContext;
-import org.jboss.dna.repository.util.JcrTools;
-
-/**
- * A component that can listen to a JCR repository and keep the {@link RuleSet} instances of a {@link RuleService} synchronized
- * with that repository.
- * <p>
- * This class is a {@link NodeChangeListener} that can {@link ObservationService#addListener(NodeChangeListener) subscribe} to
- * changes in one or more JCR repositories being monitored by an {@link ObservationService}. As changes under the rule sets
- * branch are discovered, they are processed asynchronously. This ensure that the processing of the repository contents does not
- * block the other listeners of the {@link ObservationService}.
- * </p>
- * 
- * @author Randall Hauch
- */
- at ThreadSafe
-public class RuleSetRepositoryMonitor implements NodeChangeListener {
-
-    public static final String DEFAULT_JCR_ABSOLUTE_PATH = "/dna:system/dna:ruleSets/";
-
-    protected static final String JCR_PATH_DELIM = "/";
-
-    private final JcrExecutionContext executionContext;
-    private final RuleService ruleService;
-    private final String jcrAbsolutePath;
-    private final Pattern ruleSetNamePattern;
-    private final ExecutorService executorService;
-    private Logger logger;
-
-    /**
-     * Create an instance that can listen to the {@link RuleSet} definitions stored in a JCR repository and ensure that the
-     * {@link RuleSet} instances of a {@link RuleService} reflect the definitions in the repository.
-     * 
-     * @param ruleService the rule service that should be kept in sync with the JCR repository.
-     * @param jcrAbsolutePath the absolute path to the branch where the rule sets are defined; if null or empty, the
-     *        {@link #DEFAULT_JCR_ABSOLUTE_PATH default path} is used
-     * @param executionContext the context in which this monitor is to execute
-     * @throws IllegalArgumentException if the rule service or execution context is null, or if the supplied
-     *         <code>jcrAbsolutePath</code> is invalid
-     */
-    public RuleSetRepositoryMonitor( RuleService ruleService,
-                                     String jcrAbsolutePath,
-                                     JcrExecutionContext executionContext ) {
-        CheckArg.isNotNull(ruleService, "rule service");
-        CheckArg.isNotNull(executionContext, "execution context");
-        this.ruleService = ruleService;
-        this.executionContext = executionContext;
-        this.executorService = Executors.newSingleThreadExecutor();
-        this.logger = Logger.getLogger(this.getClass());
-        if (jcrAbsolutePath != null) jcrAbsolutePath = jcrAbsolutePath.trim();
-        this.jcrAbsolutePath = jcrAbsolutePath != null && jcrAbsolutePath.length() != 0 ? jcrAbsolutePath : DEFAULT_JCR_ABSOLUTE_PATH;
-        try {
-            // Create the pattern to extract the rule set name from the absolute path ...
-            String leadingPath = this.jcrAbsolutePath;
-            if (!leadingPath.endsWith(JCR_PATH_DELIM)) leadingPath = leadingPath + JCR_PATH_DELIM;
-            this.ruleSetNamePattern = Pattern.compile(leadingPath + "([^/]+)/?.*");
-        } catch (PatternSyntaxException e) {
-            throw new IllegalArgumentException(
-                                               RepositoryI18n.unableToBuildRuleSetRegularExpressionPattern.text(e.getPattern(),
-                                                                                                                jcrAbsolutePath,
-                                                                                                                e.getDescription()));
-        }
-    }
-
-    /**
-     * @return ruleService
-     */
-    public RuleService getRuleService() {
-        return this.ruleService;
-    }
-
-    /**
-     * @return jcrAbsolutePath
-     */
-    public String getAbsolutePathToRuleSets() {
-        return this.jcrAbsolutePath;
-    }
-
-    /**
-     * @return logger
-     */
-    public Logger getLogger() {
-        return this.logger;
-    }
-
-    /**
-     * @param logger Sets logger to the specified value.
-     */
-    public void setLogger( Logger logger ) {
-        this.logger = logger;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void onNodeChanges( NodeChanges changes ) {
-        final Map<String, Set<String>> ruleSetNamesByWorkspaceName = new HashMap<String, Set<String>>();
-        for (NodeChange nodeChange : changes) {
-            if (nodeChange.isNotOnPath(this.jcrAbsolutePath)) continue;
-            // Use a regular expression on the absolute path to get the name of the rule set that is affected ...
-            Matcher matcher = this.ruleSetNamePattern.matcher(nodeChange.getAbsolutePath());
-            if (!matcher.matches()) continue;
-            String ruleSetName = matcher.group(1);
-            // Record the repository name ...
-            String workspaceName = nodeChange.getRepositoryWorkspaceName();
-            Set<String> ruleSetNames = ruleSetNamesByWorkspaceName.get(workspaceName);
-            if (ruleSetNames == null) {
-                ruleSetNames = new HashSet<String>();
-                ruleSetNamesByWorkspaceName.put(workspaceName, ruleSetNames);
-            }
-            // Record the rule set name ...
-            ruleSetNames.add(ruleSetName);
-
-        }
-        if (ruleSetNamesByWorkspaceName.isEmpty()) return;
-        // Otherwise there are changes, so submit the names to the executor service ...
-        this.executorService.execute(new Runnable() {
-
-            public void run() {
-                processRuleSets(ruleSetNamesByWorkspaceName);
-            }
-        });
-    }
-
-    /**
-     * Process the rule sets given by the supplied names, keyed by the repository workspace name.
-     * 
-     * @param ruleSetNamesByWorkspaceName the set of rule set names keyed by the repository workspace name
-     */
-    protected void processRuleSets( Map<String, Set<String>> ruleSetNamesByWorkspaceName ) {
-        final JcrTools tools = this.executionContext.getTools();
-        final String relPathToRuleSets = getAbsolutePathToRuleSets().substring(1);
-        for (Map.Entry<String, Set<String>> entry : ruleSetNamesByWorkspaceName.entrySet()) {
-            String workspaceName = entry.getKey();
-            Session session = null;
-            try {
-                session = this.executionContext.getSessionFactory().createSession(workspaceName);
-                // Look up the node that represents the parent of the rule set nodes ...
-                Node ruleSetsNode = session.getRootNode().getNode(relPathToRuleSets);
-
-                for (String ruleSetName : entry.getValue()) {
-                    // Look up the node that represents the rule set...
-                    if (ruleSetsNode.hasNode(ruleSetName)) {
-                        // We don't handle multiple siblings with the same name, so this should grab the first one ...
-                        Node ruleSetNode = ruleSetsNode.getNode(ruleSetName);
-                        RuleSet ruleSet = buildRuleSet(ruleSetName, ruleSetNode, tools);
-                        if (ruleSet != null) {
-                            // Only do something if the RuleSet was instantiated ...
-                            getRuleService().addRuleSet(ruleSet);
-                        }
-                    } else {
-                        // The node doesn't exist, so remove the rule set ...
-                        getRuleService().removeRuleSet(ruleSetName);
-                    }
-                }
-            } catch (RepositoryException e) {
-                getLogger().error(e, RepositoryI18n.errorObtainingSessionToRepositoryWorkspace, workspaceName);
-            } finally {
-                if (session != null) session.logout();
-            }
-        }
-    }
-
-    /**
-     * Create a rule set from the supplied node. This is called whenever a branch of the repository is changed.
-     * <p>
-     * This implementation expects a node of type 'dna:ruleSet' and the following properties (expressed as XPath statements
-     * relative to the supplied node):
-     * <ul>
-     * <li>The {@link RuleSet#getDescription() description} is obtained from the "<code>./@jcr:description</code>" string
-     * property. This property is optional.</li>
-     * <li>The {@link RuleSet#getComponentClassname() classname} is obtained from the "<code>./@dna:classname</code>" string
-     * property. This property is required.</li>
-     * <li>The {@link RuleSet#getComponentClasspath() classpath} is obtained from the "<code>./@dna:classpath</code>" string
-     * property. This property is optional, and if abscent then the classpath will be assumed from the current context.</li>
-     * <li>The {@link RuleSet#getProviderUri() provider URI} is obtained from the "<code>./@dna:serviceProviderUri</code>"
-     * string property, and corresponds to the URI of the JSR-94 rules engine service provider. This property is required.</li>
-     * <li>The {@link RuleSet#getRuleSetUri() rule set URI} is obtained from the "<code>./@dna:ruleSetUri</code>" string
-     * property. This property is optional and defaults to the node name (e.g., "<code>./@jcr:name</code>").</li>
-     * <li>The {@link RuleSet#getRules() definition of the rules} is obtained from the "<code>./@dna:rules</code>" string
-     * property. This property is required and must be in a form suitable for the JSR-94 rules engine.</li>
-     * <li>The {@link RuleSet#getProperties() properties} are obtained from the "<code>./dna:properties[contains(@jcr:mixinTypes,'dna:propertyContainer')]/*[@jcr:nodeType='dna:property']</code>"
-     * property nodes, where the name of the property is extracted from the property node's "<code>./@jcr:name</code>" string
-     * property and the value of the property is extracted from the property node's "<code>./@dna:propertyValue</code>" string
-     * property. Rule set properties are optional.</li>
-     * </ul>
-     * </p>
-     * 
-     * @param name the name of the rule set; never null
-     * @param ruleSetNode the node representing the rule set; null if the rule set doesn't exist
-     * @param tools
-     * @return the rule set for the information stored in the repository, or null if the rule set does not exist or has errors
-     */
-    protected RuleSet buildRuleSet( String name,
-                                    Node ruleSetNode,
-                                    JcrTools tools ) {
-        if (ruleSetNode == null) return null;
-
-        SimpleProblems simpleProblems = new SimpleProblems();
-        String description = tools.getPropertyAsString(ruleSetNode, "jcr:description", false, simpleProblems);
-        String classname = tools.getPropertyAsString(ruleSetNode, "dna:classname", true, simpleProblems);
-        String[] classpath = tools.getPropertyAsStringArray(ruleSetNode, "dna:classpath", false, simpleProblems);
-        String providerUri = tools.getPropertyAsString(ruleSetNode, "dna:serviceProviderUri", true, simpleProblems);
-        String ruleSetUri = tools.getPropertyAsString(ruleSetNode, "dna:ruleSetUri", true, name, simpleProblems);
-        String rules = tools.getPropertyAsString(ruleSetNode, "dna:rules", true, simpleProblems);
-        Map<String, Object> properties = tools.loadProperties(ruleSetNode, simpleProblems);
-        if (simpleProblems.hasProblems()) {
-            // There are problems, so store and save them, and then return null ...
-            try {
-                if (tools.storeProblems(ruleSetNode, simpleProblems)) ruleSetNode.save();
-            } catch (RepositoryException e) {
-                this.logger.error(e, RepositoryI18n.errorWritingProblemsOnRuleSet, tools.getReadable(ruleSetNode));
-            }
-            return null;
-        }
-        // There are no problems with this rule set, so make sure that there are no persisted problems anymore ...
-        try {
-            if (tools.removeProblems(ruleSetNode)) ruleSetNode.save();
-        } catch (RepositoryException e) {
-            this.logger.error(e, RepositoryI18n.errorWritingProblemsOnRuleSet, tools.getReadable(ruleSetNode));
-        }
-        return new RuleSet(name, description, classname, classpath, providerUri, ruleSetUri, rules, properties);
-    }
-
-}

Modified: trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/Sequencer.java
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/Sequencer.java	2009-05-21 22:26:25 UTC (rev 922)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/Sequencer.java	2009-05-22 02:15:19 UTC (rev 923)
@@ -29,10 +29,9 @@
 import org.jboss.dna.common.component.Component;
 import org.jboss.dna.graph.Node;
 import org.jboss.dna.graph.io.Destination;
+import org.jboss.dna.graph.observe.Observer;
 import org.jboss.dna.graph.observe.NetChangeObserver.NetChange;
-import org.jboss.dna.repository.observation.NodeChange;
-import org.jboss.dna.repository.observation.NodeChanges;
-import org.jboss.dna.repository.observation.ObservationService;
+import org.jboss.dna.repository.RepositoryLibrary;
 import org.jboss.dna.repository.util.RepositoryNodePath;
 
 /**
@@ -54,10 +53,10 @@
      * this sequencer, and closing any other acquired resources, even in the case of exceptions.
      * <p>
      * The {@link SequencingService} determines the sequencers that should be executed by monitoring the changes to one or more
-     * workspaces (it is a listener registered with the {@link ObservationService}). Changes in those workspaces are aggregated
-     * for each transaction, and organized into {@link NodeChanges changes for each node}. The SequencingService then determines
-     * for each {@link NodeChange set of changes to a node} the set of full paths to the properties that have changed and whether
-     * those paths {@link SequencerPathExpression#matcher(String) match} the sequencer's
+     * workspaces (it registers an {@link Observer} with the {@link RepositoryLibrary}). Changes in those workspaces are
+     * aggregated for each transaction, and organized into {@link NetChange changes for each node}. The SequencingService then
+     * determines for each {@link NetChange set of changes to a node} the set of full paths to the properties that have changed
+     * and whether those paths {@link SequencerPathExpression#matcher(String) match} the sequencer's
      * {@link SequencerConfig#getPathExpressions() path expressions}. Each path expression produces the path to the output node,
      * and these output paths are accumulated and (with the original node that changed, the node change summary, and other
      * information) supplied to the sequencer via this method.

Modified: trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/SequencingService.java
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/SequencingService.java	2009-05-21 22:26:25 UTC (rev 922)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/SequencingService.java	2009-05-22 02:15:19 UTC (rev 923)
@@ -55,7 +55,6 @@
 import org.jboss.dna.graph.property.Property;
 import org.jboss.dna.repository.RepositoryI18n;
 import org.jboss.dna.repository.RepositoryLibrary;
-import org.jboss.dna.repository.observation.NodeChange;
 import org.jboss.dna.repository.service.AbstractServiceAdministrator;
 import org.jboss.dna.repository.service.AdministeredService;
 import org.jboss.dna.repository.service.ServiceAdministrator;
@@ -349,6 +348,9 @@
     }
 
     protected void shutdownService() {
+        // Unregister our observer ...
+        if (this.repositoryObserver != null) this.repositoryObserver.unregister();
+        // And shut down the executor service ..
         if (this.executorService != null) {
             this.executorService.shutdown();
         }
@@ -387,7 +389,7 @@
 
     /**
      * Do the work of processing by sequencing the node. This method is called by the {@link #executorService executor service}
-     * when it performs it's work on the enqueued {@link NodeChange NodeChange runnable objects}.
+     * when it performs it's work on the enqueued {@link NetChange NetChange runnable objects}.
      * 
      * @param change the change describing the node to be processed.
      */

Deleted: trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/JcrExecutionContext.java
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/JcrExecutionContext.java	2009-05-21 22:26:25 UTC (rev 922)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/JcrExecutionContext.java	2009-05-22 02:15:19 UTC (rev 923)
@@ -1,125 +0,0 @@
-/*
- * JBoss DNA (http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of 
- * individual contributors. 
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you 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.
- *
- * JBoss DNA 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.util;
-
-import java.util.HashSet;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicBoolean;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import org.jboss.dna.graph.ExecutionContext;
-import org.jboss.dna.repository.RepositoryI18n;
-
-/**
- * The context of an execution within a JCR environment.
- * 
- * @author Randall Hauch
- */
-public class JcrExecutionContext extends ExecutionContext {
-
-    private final String repositoryWorkspaceForNamespaceRegistry;
-    private final ClosableSessionFactory sessionFactory;
-    private final JcrTools jcrTools;
-
-    public JcrExecutionContext( ExecutionContext context,
-                                final SessionFactory sessionFactory,
-                                String repositoryWorkspaceForNamespaceRegistry ) {
-        super(context.with(new JcrNamespaceRegistry(sessionFactory, repositoryWorkspaceForNamespaceRegistry)));
-        this.sessionFactory = new ClosableSessionFactory(sessionFactory);
-        this.jcrTools = new JcrTools();
-        this.repositoryWorkspaceForNamespaceRegistry = repositoryWorkspaceForNamespaceRegistry;
-    }
-
-    public JcrExecutionContext( SessionFactory sessionFactory,
-                                String repositoryWorkspaceForNamespaceRegistry ) {
-        this(new ExecutionContext(), sessionFactory, repositoryWorkspaceForNamespaceRegistry);
-    }
-
-    /**
-     * Get the session factory, which can be used to obtain sessions temporarily for this context. Any session obtained from this
-     * factory should be {@link Session#logout() closed} before the execution finishes.
-     * 
-     * @return the session factory
-     */
-    public SessionFactory getSessionFactory() {
-        return this.sessionFactory;
-    }
-
-    /**
-     * Get a set of utilities for working with JCR.
-     * 
-     * @return the tools
-     */
-    public JcrTools getTools() {
-        return this.jcrTools;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see org.jboss.dna.graph.ExecutionContext#clone()
-     */
-    @Override
-    public JcrExecutionContext clone() {
-        return new JcrExecutionContext(this, this.sessionFactory.getDelegateFactory(),
-                                       this.repositoryWorkspaceForNamespaceRegistry);
-    }
-
-    /**
-     * This this context and release all resources (including any Session instances created).
-     */
-    public void close() {
-        this.sessionFactory.close();
-    }
-
-    protected static class ClosableSessionFactory implements SessionFactory {
-        private final SessionFactory delegateFactory;
-        private final Set<Session> sessions = new HashSet<Session>();
-        protected final AtomicBoolean closed = new AtomicBoolean(false);
-
-        protected ClosableSessionFactory( SessionFactory sessionFactory ) {
-            this.delegateFactory = sessionFactory;
-        }
-
-        public SessionFactory getDelegateFactory() {
-            return this.delegateFactory;
-        }
-
-        public Session createSession( String name ) throws RepositoryException {
-            if (closed.get()) throw new IllegalStateException(RepositoryI18n.executionContextHasBeenClosed.text());
-            Session session = delegateFactory.createSession(name);
-            if (session != null) sessions.add(session);
-            return session;
-        }
-
-        public synchronized void close() {
-            if (this.closed.get()) return;
-            this.closed.set(true);
-            for (Session session : sessions) {
-                if (session != null) session.logout();
-            }
-        }
-    }
-
-}

Deleted: trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/JcrNamespaceRegistry.java
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/JcrNamespaceRegistry.java	2009-05-21 22:26:25 UTC (rev 922)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/JcrNamespaceRegistry.java	2009-05-22 02:15:19 UTC (rev 923)
@@ -1,217 +0,0 @@
-/*
- * JBoss DNA (http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of 
- * individual contributors. 
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you 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.
- *
- * JBoss DNA 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.util;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import org.jboss.dna.common.util.CheckArg;
-import org.jboss.dna.graph.property.NamespaceException;
-import org.jboss.dna.graph.property.NamespaceRegistry;
-import org.jboss.dna.graph.property.basic.BasicNamespace;
-
-/**
- * @author Randall Hauch
- */
-public class JcrNamespaceRegistry implements NamespaceRegistry {
-
-    private final String repositoryWorkspaceName;
-    private final SessionFactory sessionFactory;
-
-    public JcrNamespaceRegistry( SessionFactory sessionFactory,
-                                 String repositoryWorkspaceName ) {
-        CheckArg.isNotNull(sessionFactory, "sessionFactory");
-        CheckArg.isNotNull(repositoryWorkspaceName, "repositoryWorkspaceName");
-        this.repositoryWorkspaceName = repositoryWorkspaceName;
-        this.sessionFactory = sessionFactory;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public String getDefaultNamespaceUri() {
-        Session session = null;
-        try {
-            session = this.sessionFactory.createSession(this.repositoryWorkspaceName);
-            return session.getNamespaceURI("");
-        } catch (RepositoryException e) {
-            throw new NamespaceException(e);
-        } finally {
-            if (session != null) {
-                session.logout();
-            }
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public String getNamespaceForPrefix( String prefix ) {
-        Session session = null;
-        try {
-            session = this.sessionFactory.createSession(this.repositoryWorkspaceName);
-            return session.getNamespaceURI(prefix);
-        } catch (RepositoryException e) {
-            throw new NamespaceException(e);
-        } finally {
-            if (session != null) {
-                session.logout();
-            }
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public String getPrefixForNamespaceUri( String namespaceUri,
-                                            boolean generateIfMissing ) {
-        Session session = null;
-        try {
-            session = this.sessionFactory.createSession(this.repositoryWorkspaceName);
-            return session.getNamespacePrefix(namespaceUri);
-        } catch (RepositoryException e) {
-            throw new NamespaceException(e);
-        } finally {
-            if (session != null) {
-                session.logout();
-            }
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean isRegisteredNamespaceUri( String namespaceUri ) {
-        Session session = null;
-        try {
-            session = this.sessionFactory.createSession(this.repositoryWorkspaceName);
-            session.getNamespacePrefix(namespaceUri);
-            return true;
-        } catch (javax.jcr.NamespaceException e) {
-            return false;
-        } catch (RepositoryException e) {
-            throw new NamespaceException(e);
-        } finally {
-            if (session != null) {
-                session.logout();
-            }
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public String register( String prefix,
-                            String namespaceUri ) {
-        String previousNamespaceUriForPrefix = null;
-        Session session = null;
-        try {
-            session = this.sessionFactory.createSession(this.repositoryWorkspaceName);
-            previousNamespaceUriForPrefix = session.getNamespacePrefix(namespaceUri);
-            javax.jcr.NamespaceRegistry registry = session.getWorkspace().getNamespaceRegistry();
-            registry.registerNamespace(prefix, namespaceUri);
-        } catch (RepositoryException e) {
-            throw new NamespaceException(e);
-        } finally {
-            if (session != null) {
-                session.logout();
-            }
-        }
-        return previousNamespaceUriForPrefix;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see org.jboss.dna.graph.property.NamespaceRegistry#unregister(java.lang.String)
-     */
-    public boolean unregister( String namespaceUri ) {
-        Session session = null;
-        try {
-            session = this.sessionFactory.createSession(this.repositoryWorkspaceName);
-            String prefix = session.getNamespacePrefix(namespaceUri);
-            javax.jcr.NamespaceRegistry registry = session.getWorkspace().getNamespaceRegistry();
-            registry.unregisterNamespace(prefix);
-        } catch (javax.jcr.NamespaceException e) {
-            return false;
-        } catch (RepositoryException e) {
-            throw new NamespaceException(e);
-        } finally {
-            if (session != null) {
-                session.logout();
-            }
-        }
-        return true;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Set<String> getRegisteredNamespaceUris() {
-        Session session = null;
-        try {
-            session = this.sessionFactory.createSession(this.repositoryWorkspaceName);
-            javax.jcr.NamespaceRegistry registry = session.getWorkspace().getNamespaceRegistry();
-            Set<String> result = new HashSet<String>();
-            for (String uri : registry.getURIs()) {
-                result.add(uri);
-            }
-            return Collections.unmodifiableSet(result);
-        } catch (RepositoryException e) {
-            throw new NamespaceException(e);
-        } finally {
-            if (session != null) {
-                session.logout();
-            }
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see org.jboss.dna.graph.property.NamespaceRegistry#getNamespaces()
-     */
-    public Set<Namespace> getNamespaces() {
-        Session session = null;
-        try {
-            session = this.sessionFactory.createSession(this.repositoryWorkspaceName);
-            javax.jcr.NamespaceRegistry registry = session.getWorkspace().getNamespaceRegistry();
-            Set<Namespace> result = new HashSet<Namespace>();
-            for (String uri : registry.getURIs()) {
-                String prefix = registry.getPrefix(uri);
-                result.add(new BasicNamespace(prefix, uri));
-            }
-            return Collections.unmodifiableSet(result);
-        } catch (RepositoryException e) {
-            throw new NamespaceException(e);
-        } finally {
-            if (session != null) {
-                session.logout();
-            }
-        }
-    }
-
-}

Deleted: trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/JcrTools.java
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/JcrTools.java	2009-05-21 22:26:25 UTC (rev 922)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/JcrTools.java	2009-05-22 02:15:19 UTC (rev 923)
@@ -1,329 +0,0 @@
-/*
- * JBoss DNA (http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of 
- * individual contributors. 
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you 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.
- *
- * JBoss DNA 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.util;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.HashMap;
-import java.util.Map;
-import javax.jcr.Node;
-import javax.jcr.NodeIterator;
-import javax.jcr.PathNotFoundException;
-import javax.jcr.Property;
-import javax.jcr.PropertyType;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.Value;
-import javax.jcr.ValueFormatException;
-import org.jboss.dna.common.collection.Problem;
-import org.jboss.dna.common.collection.Problems;
-import org.jboss.dna.common.util.IoUtil;
-import org.jboss.dna.common.util.Logger;
-import org.jboss.dna.common.util.StringUtil;
-import org.jboss.dna.repository.RepositoryI18n;
-
-/**
- * @author Randall Hauch
- */
-public class JcrTools {
-
-    public Map<String, Object> loadProperties( Node propertyContainer, Problems problems ) {
-        return loadProperties(propertyContainer, null, problems);
-    }
-
-    public Map<String, Object> loadProperties( Node propertyContainer, Map<String, Object> properties, Problems problems ) {
-        if (properties == null) properties = new HashMap<String, Object>();
-        if (propertyContainer != null) {
-            try {
-                NodeIterator iter = propertyContainer.getNodes();
-                while (iter.hasNext()) {
-                    Node propertyNode = iter.nextNode();
-                    if (propertyNode != null && propertyNode.getPrimaryNodeType().isNodeType("dna:property")) {
-                        String propertyName = propertyNode.getName();
-                        Object propertyValue = getPropertyValue(propertyNode, "dna:propertyValue", true, problems);
-                        properties.put(propertyName, propertyValue);
-                    }
-                }
-            } catch (RepositoryException e) {
-                problems.addError(e, RepositoryI18n.errorReadingPropertiesFromContainerNode, getReadable(propertyContainer));
-            }
-        }
-
-        return properties;
-    }
-
-    public boolean removeProblems( Node parent ) throws RepositoryException {
-        Node problemsNode = null;
-        if (parent.hasNode("dna:problems")) {
-            problemsNode = parent.getNode("dna:problems");
-            problemsNode.remove();
-            return true;
-        }
-        return false;
-    }
-
-    public boolean storeProblems( Node parent, Problems problems ) throws RepositoryException {
-        Node problemsNode = null;
-        if (parent.hasNode("dna:problems")) {
-            problemsNode = parent.getNode("dna:problems");
-            // Delete all problems ...
-            removeAllChildren(problemsNode);
-        }
-        if (problems.isEmpty()) {
-            return false;
-        }
-        if (problemsNode == null) {
-            problemsNode = parent.addNode("dna:problems"); // primary type dictated by child definition
-        }
-
-        // Add a child for each problem ...
-        for (Problem problem : problems) {
-            Node problemNode = problemsNode.addNode("problem", "dna:problem");
-            // - dna:status (string) mandatory copy
-            // < 'ERROR', 'WARNING', 'INFO'
-            // - dna:message (string) mandatory copy
-            // - dna:code (string) copy
-            // - dna:type (string) copy
-            // - dna:resource (string) copy
-            // - dna:location (string) copy
-            // - dna:trace (string) copy
-            problemNode.setProperty("dna:status", problem.getStatus().name());
-            problemNode.setProperty("dna:message", problem.getMessageString());
-            if (problem.getCode() != Problem.DEFAULT_CODE) {
-                problemNode.setProperty("dna:code", Integer.toString(problem.getCode()));
-            }
-            String resource = problem.getResource();
-            if (resource != null) {
-                problemNode.setProperty("dna:resource", resource);
-            }
-            String location = problem.getLocation();
-            if (location != null) {
-                problemNode.setProperty("dna:location", location);
-            }
-            Throwable t = problem.getThrowable();
-            if (t != null) {
-                String trace = StringUtil.getStackTrace(t);
-                problemNode.setProperty("dna:trace", trace);
-            }
-        }
-        return true;
-    }
-
-    public int removeAllChildren( Node node ) throws RepositoryException {
-        int childrenRemoved = 0;
-        NodeIterator iter = node.getNodes();
-        while (iter.hasNext()) {
-            Node child = iter.nextNode();
-            child.remove();
-            ++childrenRemoved;
-        }
-        return childrenRemoved;
-    }
-
-    public String getPropertyAsString( Node node, String propertyName, boolean required, Problems problems ) {
-        return getPropertyAsString(node, propertyName, required, null);
-    }
-
-    public String getPropertyAsString( Node node, String propertyName, boolean required, String defaultValue, Problems problems ) {
-        try {
-            Property property = node.getProperty(propertyName);
-            return property.getString();
-        } catch (ValueFormatException e) {
-            if (required) {
-                problems.addError(e, RepositoryI18n.requiredPropertyOnNodeWasExpectedToBeStringValue, propertyName, getReadable(node));
-            } else {
-                problems.addError(e, RepositoryI18n.optionalPropertyOnNodeWasExpectedToBeStringValue, propertyName, getReadable(node));
-            }
-        } catch (PathNotFoundException e) {
-            if (required) {
-                problems.addError(e, RepositoryI18n.requiredPropertyIsMissingFromNode, propertyName, getReadable(node));
-            }
-            if (!required) return defaultValue;
-        } catch (RepositoryException err) {
-            if (required) {
-                problems.addError(err, RepositoryI18n.errorGettingRequiredPropertyFromNode, propertyName, getReadable(node));
-            } else {
-                problems.addError(err, RepositoryI18n.errorGettingOptionalPropertyFromNode, propertyName, getReadable(node));
-            }
-        }
-        return null;
-    }
-
-    public Object getPropertyValue( Node node, String propertyName, boolean required, Problems problems ) {
-        try {
-            Property property = node.getProperty(propertyName);
-            switch (property.getType()) {
-                case PropertyType.BINARY: {
-                    InputStream stream = property.getStream();
-                    try {
-                        stream = property.getStream();
-                        return IoUtil.readBytes(stream);
-                    } finally {
-                        if (stream != null) {
-                            try {
-                                stream.close();
-                            } catch (IOException e) {
-                                // Log ...
-                                Logger.getLogger(this.getClass()).error(e, RepositoryI18n.errorClosingBinaryStreamForPropertyFromNode, propertyName, node.getPath());
-                            }
-                        }
-                    }
-                }
-                default: {
-                    return property.getString();
-                }
-            }
-        } catch (IOException e) {
-            if (required) {
-                problems.addError(e, RepositoryI18n.requiredPropertyOnNodeCouldNotBeRead, propertyName, getReadable(node));
-            } else {
-                problems.addError(e, RepositoryI18n.optionalPropertyOnNodeCouldNotBeRead, propertyName, getReadable(node));
-            }
-        } catch (PathNotFoundException e) {
-            if (required) {
-                problems.addError(e, RepositoryI18n.requiredPropertyIsMissingFromNode, propertyName, getReadable(node));
-            }
-        } catch (RepositoryException err) {
-            if (required) {
-                problems.addError(err, RepositoryI18n.errorGettingRequiredPropertyFromNode, propertyName, getReadable(node));
-            } else {
-                problems.addError(err, RepositoryI18n.errorGettingOptionalPropertyFromNode, propertyName, getReadable(node));
-            }
-        }
-        return null;
-    }
-
-    public String[] getPropertyAsStringArray( Node node, String propertyName, boolean required, Problems problems, String... defaultValues ) {
-        String[] result = defaultValues;
-        try {
-            Property property = node.getProperty(propertyName);
-            if (property.getDefinition().isMultiple()) {
-                Value[] values = property.getValues();
-                result = new String[values.length];
-                int i = 0;
-                for (Value value : values) {
-                    result[i++] = value.getString();
-                }
-            } else {
-                result = new String[] {property.getString()};
-            }
-        } catch (ValueFormatException e) {
-            if (required) {
-                problems.addError(e, RepositoryI18n.requiredPropertyOnNodeWasExpectedToBeStringArrayValue, propertyName, getReadable(node));
-            } else {
-                problems.addError(e, RepositoryI18n.optionalPropertyOnNodeWasExpectedToBeStringArrayValue, propertyName, getReadable(node));
-            }
-        } catch (PathNotFoundException e) {
-            if (required) {
-                problems.addError(e, RepositoryI18n.requiredPropertyIsMissingFromNode, propertyName, getReadable(node));
-            }
-        } catch (RepositoryException err) {
-            if (required) {
-                problems.addError(err, RepositoryI18n.errorGettingRequiredPropertyFromNode, propertyName, getReadable(node));
-            } else {
-                problems.addError(err, RepositoryI18n.errorGettingOptionalPropertyFromNode, propertyName, getReadable(node));
-            }
-        }
-        return result;
-    }
-
-    public Node getNode( Node node, String relativePath, boolean required, Problems problems ) {
-        Node result = null;
-        try {
-            result = node.getNode(relativePath);
-        } catch (PathNotFoundException e) {
-            if (required) problems.addError(e, RepositoryI18n.requiredNodeDoesNotExistRelativeToNode, relativePath, getReadable(node));
-        } catch (RepositoryException err) {
-            problems.addError(err, RepositoryI18n.errorGettingNodeRelativeToNode, relativePath, getReadable(node));
-        }
-        return result;
-    }
-
-    public String getReadable( Node node ) {
-        if (node == null) return "";
-        try {
-            return node.getPath();
-        } catch (RepositoryException err) {
-            return node.toString();
-        }
-    }
-
-    public Node findOrCreateNode( Session session, String path ) throws RepositoryException {
-        return findOrCreateNode(session, path, null, null);
-    }
-
-    public Node findOrCreateNode( Session session, String path, String nodeType ) throws RepositoryException {
-        return findOrCreateNode(session, path, nodeType, nodeType);
-    }
-
-    public Node findOrCreateNode( Session session, String path, String defaultNodeType, String finalNodeType ) throws RepositoryException {
-        Node root = session.getRootNode();
-        return findOrCreateNode(session, root, path, defaultNodeType, finalNodeType);
-    }
-
-    public Node findOrCreateNode( Session session, Node parentNode, String path, String defaultNodeType, String finalNodeType ) throws RepositoryException {
-        // Remove leading and trailing slashes ...
-        String relPath = path.replaceAll("^/+", "").replaceAll("/+$", "");
-
-        // Look for the node first ...
-        try {
-            return parentNode.getNode(relPath);
-        } catch (PathNotFoundException e) {
-            // continue
-        }
-        // Create the node, which has to be done segment by segment ...
-        String[] pathSegments = relPath.split("/");
-        Node node = parentNode;
-        for (int i = 0, len = pathSegments.length; i != len; ++i) {
-            String pathSegment = pathSegments[i];
-            pathSegment = pathSegment.trim();
-            if (pathSegment.length() == 0) continue;
-            if (node.hasNode(pathSegment)) {
-                // Find the existing node ...
-                node = node.getNode(pathSegment);
-            } else {
-                // Make sure there is no index on the final segment ...
-                String pathSegmentWithNoIndex = pathSegment.replaceAll("(\\[\\d+\\])+$", "");
-                // Create the node ...
-                String nodeType = defaultNodeType;
-                if (i == len - 1 && finalNodeType != null) nodeType = finalNodeType;
-                if (nodeType != null) {
-                    node = node.addNode(pathSegmentWithNoIndex, nodeType);
-                } else {
-                    node = node.addNode(pathSegmentWithNoIndex);
-                }
-            }
-        }
-        return node;
-    }
-
-    public Node findOrCreateChild( Session session, Node parent, String name ) throws RepositoryException {
-        return findOrCreateChild(session, parent, name, null);
-    }
-
-    public Node findOrCreateChild( Session session, Node parent, String name, String nodeType ) throws RepositoryException {
-        return findOrCreateNode(session, parent, name, nodeType, nodeType);
-    }
-
-}

Deleted: trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/JndiSessionFactory.java
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/JndiSessionFactory.java	2009-05-21 22:26:25 UTC (rev 922)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/JndiSessionFactory.java	2009-05-22 02:15:19 UTC (rev 923)
@@ -1,140 +0,0 @@
-/*
- * JBoss DNA (http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of 
- * individual contributors. 
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you 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.
- *
- * JBoss DNA 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.util;
-
-import javax.jcr.Credentials;
-import javax.jcr.Repository;
-import javax.jcr.Session;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import org.jboss.dna.common.SystemFailureException;
-import org.jboss.dna.common.util.CheckArg;
-import org.jboss.dna.repository.RepositoryI18n;
-
-/**
- * A SessionFactory implementation that creates {@link Session} instances using {@link Repository} instances registered in JNDI.
- * <p>
- * This factory using a naming convention where the name supplied to the {@link #createSession(String)} contains both the name of
- * the repository and the name of the workspace. Typically, this is <i><code>repositoryName/workspaceName</code></i>, where
- * <code>repositoryName</code> is the JNDI name under which the Repository instance was bound, and <code>workspaceName</code>
- * is the name of the workspace. Note that this method looks for the last delimiter in the whole name to distinguish between the
- * repository and workspace names.
- * </p>
- * <p>
- * For example, if "<code>java:comp/env/repository/dataRepository/myWorkspace</code>" is passed to the
- * {@link #createSession(String)} method, this factory will look for a {@link Repository} instance registered in JDNI with the
- * name "<code>java:comp/env/repository/dataRepository</code>" and use it to {@link Repository#login(String) create a session}
- * to the workspace named "<code>myWorkspace</code>".
- * </p>
- * <p>
- * By default, this factory creates an anonymous JCR session. To use sessions with specific {@link Credentials}, simply
- * {@link #registerCredentials(String, Credentials) register} credentials for the appropriate repository/workspace name. For
- * security reasons, it is not possible to retrieve the Credentials once registered with this factory.
- * </p>
- * @author Randall Hauch
- */
-public class JndiSessionFactory extends AbstractSessionFactory {
-
-    private final Context context;
-
-    /**
-     * Create an instance of the factory by creating a new {@link InitialContext}. This is equivalent to calling
-     * <code>new JndiSessionFactory(new InitialContext())</code>.
-     * @throws NamingException if there is a problem creating the InitialContext.
-     */
-    public JndiSessionFactory() throws NamingException {
-        this(new InitialContext());
-    }
-
-    /**
-     * Create an instance of the factory by supplying the characters that may be used to delimit the workspace name from the
-     * repository name. This constructor initializes the factory with a new {@link InitialContext}, and is equivalent to calling
-     * <code>new JndiSessionFactory(new InitialContext(),workspaceDelimiters)</code>.
-     * @param workspaceDelimiters the delimiters, or null/empty if the default delimiter of '/' should be used.
-     * @throws NamingException if there is a problem creating the InitialContext.
-     */
-    public JndiSessionFactory( char... workspaceDelimiters ) throws NamingException {
-        this(new InitialContext(), workspaceDelimiters);
-    }
-
-    /**
-     * Create an instance of the factory using the supplied JNDI context.
-     * @param context the naming context
-     * @throws IllegalArgumentException if the context parameter is null
-     */
-    public JndiSessionFactory( Context context ) {
-        this(context, DEFAULT_DELIMITERS);
-    }
-
-    /**
-     * Create an instance of the factory by supplying naming context and the characters that may be used to delimit the workspace
-     * name from the repository name.
-     * @param context the naming context
-     * @param workspaceDelimiters the delimiters, or null/empty if the default delimiter of '/' should be used.
-     * @throws IllegalArgumentException if the context parameter is null
-     */
-    public JndiSessionFactory( Context context, char... workspaceDelimiters ) {
-        super(workspaceDelimiters);
-        CheckArg.isNotNull(context, "initial context");
-        this.context = context;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    protected void doRegisterRepository( String name, Repository repository ) throws SystemFailureException {
-        try {
-            this.context.bind(name, repository);
-        } catch (NamingException e) {
-            throw new SystemFailureException(RepositoryI18n.unableToRegisterRepositoryInJndi.text(name));
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    protected void doUnregisterRepository( String name ) throws SystemFailureException {
-        try {
-            this.context.unbind(name);
-        } catch (NamingException e) {
-            throw new SystemFailureException(RepositoryI18n.unableToUnregisterRepositoryInJndi.text(name));
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    protected Repository findRegisteredRepository( String name ) throws SystemFailureException {
-        try {
-            return (Repository)this.context.lookup(name);
-        } catch (NamingException e) {
-            throw new SystemFailureException(RepositoryI18n.unableToFindRepositoryInJndi.text(name));
-        }
-    }
-}

Deleted: trunk/dna-repository/src/test/java/org/jboss/dna/repository/observation/NodeChangeTest.java
===================================================================
--- trunk/dna-repository/src/test/java/org/jboss/dna/repository/observation/NodeChangeTest.java	2009-05-21 22:26:25 UTC (rev 922)
+++ trunk/dna-repository/src/test/java/org/jboss/dna/repository/observation/NodeChangeTest.java	2009-05-22 02:15:19 UTC (rev 923)
@@ -1,67 +0,0 @@
-/*
- * JBoss DNA (http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of 
- * individual contributors. 
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you 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.
- *
- * JBoss DNA 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.observation;
-
-import java.util.HashSet;
-import java.util.Set;
-import javax.jcr.observation.Event;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author Randall Hauch
- */
-public class NodeChangeTest {
-
-    private String validRepositoryWorkspaceName;
-    private String validAbsolutePath;
-    private int validEventTypes;
-    private Set<String> validModifiedProperties;
-    private Set<String> validRemovedProperties;
-    private NodeChange nodeChange;
-
-    @Before
-    public void beforeEach() {
-        validRepositoryWorkspaceName = "repositoryX";
-        validAbsolutePath = "/a/b/c/d";
-        validEventTypes = Event.NODE_ADDED | Event.PROPERTY_ADDED | Event.PROPERTY_CHANGED | Event.PROPERTY_REMOVED;
-        validModifiedProperties = new HashSet<String>();
-        validRemovedProperties = new HashSet<String>();
-        validModifiedProperties.add("jcr:name");
-        validModifiedProperties.add("jcr:title");
-        validRemovedProperties.add("jcr:mime");
-        nodeChange = new NodeChange("", validRepositoryWorkspaceName, validAbsolutePath, validEventTypes, validModifiedProperties,
-                                    validRemovedProperties);
-    }
-
-    @Test( expected = UnsupportedOperationException.class )
-    public void shouldHaveUnmodifiableSetOfModifiedPropertyNames() {
-        nodeChange.getModifiedProperties().clear();
-    }
-
-    @Test( expected = UnsupportedOperationException.class )
-    public void shouldHaveUnmodifiableSetOfRemovedPropertyNames() {
-        nodeChange.getRemovedProperties().clear();
-    }
-}

Deleted: trunk/dna-repository/src/test/java/org/jboss/dna/repository/rules/RuleInput.java
===================================================================
--- trunk/dna-repository/src/test/java/org/jboss/dna/repository/rules/RuleInput.java	2009-05-21 22:26:25 UTC (rev 922)
+++ trunk/dna-repository/src/test/java/org/jboss/dna/repository/rules/RuleInput.java	2009-05-22 02:15:19 UTC (rev 923)
@@ -1,81 +0,0 @@
-/*
- * JBoss DNA (http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of 
- * individual contributors. 
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you 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.
- *
- * JBoss DNA 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.rules;
-
-public final class RuleInput {
-
-    String mimeType = "";
-    String header = "";
-    String fileName = "";
-
-    /**
-     * @return fileName
-     */
-    public String getFileName() {
-        return fileName;
-    }
-
-    /**
-     * @return header
-     */
-    public String getHeader() {
-        return header;
-    }
-
-    /**
-     * @return mimeType
-     */
-    public String getMimeType() {
-        return mimeType;
-    }
-
-    /**
-     * @param fileName Sets fileName to the specified value.
-     */
-    public void setFileName( String fileName ) {
-        this.fileName = fileName;
-    }
-
-    /**
-     * @param header Sets header to the specified value.
-     */
-    public void setHeader( String header ) {
-        this.header = header;
-    }
-
-    /**
-     * @param mimeType Sets mimeType to the specified value.
-     */
-    public void setMimeType( String mimeType ) {
-        this.mimeType = mimeType;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String toString() {
-        return this.fileName + " (" + this.mimeType + ") => " + this.header;
-    }
-}

Deleted: trunk/dna-repository/src/test/java/org/jboss/dna/repository/rules/RuleResult.java
===================================================================
--- trunk/dna-repository/src/test/java/org/jboss/dna/repository/rules/RuleResult.java	2009-05-21 22:26:25 UTC (rev 922)
+++ trunk/dna-repository/src/test/java/org/jboss/dna/repository/rules/RuleResult.java	2009-05-22 02:15:19 UTC (rev 923)
@@ -1,43 +0,0 @@
-/*
- * JBoss DNA (http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of 
- * individual contributors. 
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you 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.
- *
- * JBoss DNA 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.rules;
-
-/**
- * @author John Verhaeg
- */
-public final class RuleResult {
-
-    String name;
-
-    public RuleResult( String name ) {
-        this.name = name != null ? name : "";
-    }
-
-    /**
-     * @return name
-     */
-    public String getName() {
-        return name;
-    }
-}

Deleted: trunk/dna-repository/src/test/java/org/jboss/dna/repository/rules/RuleServiceTest.java
===================================================================
--- trunk/dna-repository/src/test/java/org/jboss/dna/repository/rules/RuleServiceTest.java	2009-05-21 22:26:25 UTC (rev 922)
+++ trunk/dna-repository/src/test/java/org/jboss/dna/repository/rules/RuleServiceTest.java	2009-05-22 02:15:19 UTC (rev 923)
@@ -1,244 +0,0 @@
-/*
- * JBoss DNA (http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of 
- * individual contributors. 
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you 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.
- *
- * JBoss DNA 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.rules;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsInstanceOf.instanceOf;
-import static org.hamcrest.core.IsNot.not;
-import static org.hamcrest.core.IsNull.notNullValue;
-import static org.hamcrest.core.IsSame.sameInstance;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import java.io.IOException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.jboss.dna.common.component.ClassLoaderFactory;
-import org.jboss.dna.common.component.StandardClassLoaderFactory;
-import org.jboss.dna.common.util.IoUtil;
-import org.jboss.dna.common.util.Logger;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author Randall Hauch
- */
-public class RuleServiceTest {
-
-    protected static final String DROOLS_PROVIDER_CLASSNAME = "org.drools.jsr94.rules.RuleServiceProviderImpl";
-    protected static final String DROOLS_PROVIDER_URI = "http://drools.org/";
-
-    private RuleService ruleService;
-    private ClassLoaderFactory classLoaderFactory;
-
-    protected RuleSet createDroolsRuleSet( String desc ) throws IOException {
-        String name = "SampleRuleSet";
-        String description = desc != null ? desc : "This is a sample rule set that uses Drools";
-        String providerClassname = DROOLS_PROVIDER_CLASSNAME;
-        String providerUri = DROOLS_PROVIDER_URI;
-        String[] providerClasspath = new String[] {};
-        String ruleSetUri = null;
-        URL ruleFile = this.getClass().getResource("/rule_test.dslr");
-        URL dslFile = this.getClass().getResource("/rule_test.dsl");
-        String rules = IoUtil.read(ruleFile.openStream());
-        byte[] dslBytes = IoUtil.readBytes(dslFile.openStream());
-        Map<String, Object> properties = new HashMap<String, Object>();
-        properties.put("javax.rules.admin.RuleExecutionSet.source", "drl"); // as opposed to "xml"
-        properties.put("javax.rules.admin.RuleExecutionSet.dsl", dslBytes);
-        return new RuleSet(name, description, providerClassname, providerClasspath, providerUri, ruleSetUri, rules, properties);
-    }
-
-    protected RuleSet createRuleSetWithInvalidProvider() throws IOException {
-        String name = "SampleRuleSet"; // same name as Drools rule set
-        String description = "This is a sample rule set that uses Drools";
-        String providerClassname = DROOLS_PROVIDER_CLASSNAME;
-        String providerUri = DROOLS_PROVIDER_URI + "this/is/incorrect";
-        String[] providerClasspath = new String[] {};
-        String ruleSetUri = null;
-        URL ruleFile = this.getClass().getResource("/rule_test.dslr");
-        URL dslFile = this.getClass().getResource("/rule_test.dsl");
-        String rules = IoUtil.read(ruleFile.openStream());
-        byte[] dslBytes = IoUtil.readBytes(dslFile.openStream());
-        Map<String, Object> properties = new HashMap<String, Object>();
-        properties.put("javax.rules.admin.RuleExecutionSet.source", "drl"); // as opposed to "xml"
-        properties.put("javax.rules.admin.RuleExecutionSet.dsl", dslBytes);
-        return new RuleSet(name, description, providerClassname, providerClasspath, providerUri, ruleSetUri, rules, properties);
-    }
-
-    @Before
-    public void beforeEach() {
-        this.ruleService = new RuleService();
-        this.classLoaderFactory = new StandardClassLoaderFactory();
-    }
-
-    @After
-    public void afterEach() {
-        this.ruleService.getAdministrator().shutdown();
-    }
-
-    @Test
-    public void shouldHaveDefaultClasspathFactoryUponConstruction() {
-        assertThat(ruleService.getClassLoaderFactory(), is(notNullValue()));
-        assertThat(ruleService.getClassLoaderFactory(), is(sameInstance(RuleService.DEFAULT_CLASSLOADER_FACTORY)));
-    }
-
-    @Test
-    public void shouldHaveLoggerUponConstruction() {
-        assertThat(ruleService.getLogger(), is(notNullValue()));
-    }
-
-    @Test
-    public void shouldHaveEmptyRuleSetCollectionUponConstruction() {
-        assertThat(ruleService.getRuleSets(), is(notNullValue()));
-        assertThat(ruleService.getRuleSets().isEmpty(), is(true));
-    }
-
-    @Test( expected = UnsupportedOperationException.class )
-    public void shouldReturnUnmodifiableCollectionOfRuleSets() {
-        ruleService.getRuleSets().add(null);
-    }
-
-    @Test
-    public void shouldSetClassLoaderFactoryToDefaultWhenPassedNull() {
-        assertThat(ruleService.getClassLoaderFactory(), is(sameInstance(RuleService.DEFAULT_CLASSLOADER_FACTORY)));
-        ruleService.setClassLoaderFactory(classLoaderFactory);
-        assertThat(ruleService.getClassLoaderFactory(), is(sameInstance(classLoaderFactory)));
-        ruleService.setClassLoaderFactory(null);
-        assertThat(ruleService.getClassLoaderFactory(), is(sameInstance(RuleService.DEFAULT_CLASSLOADER_FACTORY)));
-    }
-
-    @Test
-    public void shouldSetLoggerToDefaultWhenPassedNull() {
-        Logger defaultLogger = ruleService.getLogger();
-        assertThat(ruleService.getLogger(), is(notNullValue()));
-        Logger orgLogger = Logger.getLogger("org");
-        ruleService.setLogger(orgLogger);
-        assertThat(ruleService.getLogger().getName(), is(orgLogger.getName()));
-        assertThat(ruleService.getLogger(), is(sameInstance(orgLogger)));
-        ruleService.setLogger(null);
-        assertThat(ruleService.getLogger().getName(), is(defaultLogger.getName()));
-        assertThat(ruleService.getLogger(), is(not(orgLogger)));
-    }
-
-    @Test( expected = InvalidRuleSetException.class )
-    public void shouldNotAddInvalidRuleSet() throws Exception {
-        ruleService.addRuleSet(createRuleSetWithInvalidProvider());
-
-    }
-
-    @Test
-    public void shouldAddValidRuleSet() throws Exception {
-        int numRuleSetsBefore = ruleService.getRuleSets().size();
-        RuleSet validRuleSet = createDroolsRuleSet(null);
-        assertThat(ruleService.addRuleSet(validRuleSet), is(true));
-        assertThat(ruleService.getRuleSets().size(), is(numRuleSetsBefore + 1));
-    }
-
-    @Test
-    public void shouldNotUpdateValidRuleSetWithInvalidRuleSet() throws Exception {
-        RuleSet validRuleSet = createDroolsRuleSet(null);
-        final String ruleSetName = validRuleSet.getName();
-
-        assertThat(ruleService.addRuleSet(validRuleSet), is(true));
-        assertThat(ruleService.getRuleSets().size(), is(1));
-        assertThat(ruleService.getRuleSets().iterator().next(), is(validRuleSet));
-        // Verify this rule set works ...
-        executeRuleSet(ruleSetName);
-
-        // Try to update the rule set with something that's invalid ...
-        RuleSet invalidRuleSet = createRuleSetWithInvalidProvider();
-        assertThat(invalidRuleSet.getName(), is(ruleSetName));
-        assertThat(invalidRuleSet.getName(), is(validRuleSet.getName()));
-        try {
-            ruleService.addRuleSet(invalidRuleSet);
-            fail("Should not get here");
-        } catch (InvalidRuleSetException e) {
-            // This is expected since it was a bad rule set ...
-        }
-
-        // Verify the original rule set is still there and still works ...
-        assertThat(ruleService.getRuleSets().size(), is(1));
-        assertThat(ruleService.getRuleSets().iterator().next(), is(validRuleSet));
-        executeRuleSet(ruleSetName);
-    }
-
-    @Test
-    public void shouldModifyExistingRuleSetWhenAddedOnlyWhenChanged() throws Exception {
-        int numRuleSetsBefore = ruleService.getRuleSets().size();
-        RuleSet validRuleSet = createDroolsRuleSet(null);
-        assertThat(ruleService.addRuleSet(validRuleSet), is(true));
-        assertThat(ruleService.getRuleSets().size(), is(numRuleSetsBefore + 1));
-
-        // Try to add an unchanged rule set ...
-        RuleSet validRuleSet2 = createDroolsRuleSet(null);
-        assertThat(validRuleSet2.hasChanged(validRuleSet), is(false));
-        assertThat(ruleService.addRuleSet(validRuleSet2), is(false));
-        assertThat(ruleService.getRuleSets().size(), is(numRuleSetsBefore + 1));
-
-        // Try to add a changed rule set ...
-        RuleSet validRuleSet3 = createDroolsRuleSet("This is an alternative description that causes it to be changed");
-        assertThat(validRuleSet3.hasChanged(validRuleSet), is(true));
-        assertThat(ruleService.addRuleSet(validRuleSet3), is(true));
-        assertThat(ruleService.getRuleSets().size(), is(numRuleSetsBefore + 1));
-    }
-
-    @Test
-    public void shouldExecuteRuleSet() throws Exception {
-        RuleSet validRuleSet = createDroolsRuleSet(null);
-        assertThat(ruleService.addRuleSet(validRuleSet), is(true));
-
-        executeRuleSet(validRuleSet.getName());
-    }
-
-    protected void executeRuleSet( String ruleSetName ) {
-        // Create some simple fact objects ...
-        RuleInput info = new RuleInput();
-        info.setFileName("someOtherInput.dsl");
-        info.setHeader("This is the sequencer header");
-        info.setMimeType("text");
-
-        // Run the rules ...
-        Set<String> output = new LinkedHashSet<String>();
-        Map<String, Object> globals = new HashMap<String, Object>();
-        globals.put("output", output);
-
-        List<?> results = ruleService.executeRules(ruleSetName, globals, info);
-        assertThat(results, is(notNullValue()));
-        assertThat(results.isEmpty(), is(false));
-        assertThat(results.size(), is(2));
-        assertTrue(results.get(0) instanceof RuleResult || results.get(1) instanceof RuleResult);
-        // Object result = results.get(0);
-        // assertThat(result, is(instanceOf(RuleResult.class)));
-        assertThat(output.isEmpty(), is(false));
-        Object sequencer = output.iterator().next();
-        assertThat(sequencer, is(instanceOf(String.class)));
-        assertThat(((String)sequencer), is("A"));
-    }
-
-}

Deleted: trunk/dna-repository/src/test/java/org/jboss/dna/repository/rules/RuleSetTest.java
===================================================================
--- trunk/dna-repository/src/test/java/org/jboss/dna/repository/rules/RuleSetTest.java	2009-05-21 22:26:25 UTC (rev 922)
+++ trunk/dna-repository/src/test/java/org/jboss/dna/repository/rules/RuleSetTest.java	2009-05-22 02:15:19 UTC (rev 923)
@@ -1,341 +0,0 @@
-/*
- * JBoss DNA (http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of 
- * individual contributors. 
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you 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.
- *
- * JBoss DNA 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.rules;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsInstanceOf.instanceOf;
-import static org.hamcrest.core.IsNull.notNullValue;
-import static org.junit.Assert.assertThat;
-import java.io.Reader;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import org.jboss.dna.common.util.IoUtil;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author Randall Hauch
- */
-public class RuleSetTest {
-
-    private RuleSet ruleSet;
-    private String validName;
-    private String validDescription;
-    private String validClassname;
-    private String[] validClasspath;
-    private String validProviderUri;
-    private String validRuleSetUri;
-    private String validRules;
-    private Map<String, Object> validProperties;
-
-    @Before
-    public void beforeEach() {
-        this.validName = "This is a valid name";
-        this.validDescription = "This is a valid description";
-        this.validClassname = "com.acme.SuperDuper";
-        this.validClasspath = new String[] {"classpath1", "classpath2"};
-        this.validProviderUri = "http://www.acme.com/super/duper/rules_engine";
-        this.validRuleSetUri = "com.something.whatever doesn't really need to be a URI";
-        this.validRules = "when something is true then cheer";
-        this.validProperties = new HashMap<String, Object>();
-        this.validProperties.put("key1", "value1");
-        this.validProperties.put("key2", null);
-        this.validProperties.put("key3", "value3".getBytes());
-        this.ruleSet = new RuleSet(validName, validDescription, validClassname, validClasspath, validProviderUri,
-                                   validRuleSetUri, validRules, validProperties);
-    }
-
-    @Test( expected = IllegalArgumentException.class )
-    public void shouldNotAllowNullName() {
-        new RuleSet(null, validDescription, validClassname, validClasspath, validProviderUri, validRuleSetUri, validRules,
-                    validProperties);
-    }
-
-    @Test( expected = IllegalArgumentException.class )
-    public void shouldNotAllowEmptyName() {
-        new RuleSet("", validDescription, validClassname, validClasspath, validProviderUri, validRuleSetUri, validRules,
-                    validProperties);
-    }
-
-    @Test( expected = IllegalArgumentException.class )
-    public void shouldNotAllowBlankName() {
-        new RuleSet("  \t ", validDescription, validClassname, validClasspath, validProviderUri, validRuleSetUri, validRules,
-                    validProperties);
-    }
-
-    @Test
-    public void shouldTrimName() {
-        validName = "  this is a valid name with leading and trailing whitespace  ";
-        ruleSet = new RuleSet(validName, validDescription, validClassname, validClasspath, validProviderUri, validRuleSetUri,
-                              validRules, validProperties);
-        assertThat(ruleSet.getName(), is(validName.trim()));
-    }
-
-    @Test
-    public void shouldAllowNullOrEmptyOrBlankDescriptionAndShouldReplaceWithEmptyString() {
-        ruleSet = new RuleSet(validName, null, validClassname, validClasspath, validProviderUri, validRuleSetUri, validRules,
-                              validProperties);
-        assertThat(ruleSet.getDescription(), is(""));
-        ruleSet = new RuleSet(validName, "", validClassname, validClasspath, validProviderUri, validRuleSetUri, validRules,
-                              validProperties);
-        assertThat(ruleSet.getDescription(), is(""));
-        ruleSet = new RuleSet(validName, "  \t ", validClassname, validClasspath, validProviderUri, validRuleSetUri, validRules,
-                              validProperties);
-        assertThat(ruleSet.getDescription(), is(""));
-    }
-
-    @Test
-    public void shouldTrimDescription() {
-        ruleSet = new RuleSet(validName, "  valid ", validClassname, validClasspath, validProviderUri, validRuleSetUri,
-                              validRules, validProperties);
-        assertThat(ruleSet.getDescription(), is("valid"));
-    }
-
-    @Test( expected = IllegalArgumentException.class )
-    public void shouldNotAllowNullClassname() {
-        new RuleSet(validName, validDescription, null, validClasspath, validProviderUri, validRuleSetUri, validRules,
-                    validProperties);
-    }
-
-    @Test( expected = IllegalArgumentException.class )
-    public void shouldNotAllowEmptyClassname() {
-        new RuleSet(validName, validDescription, "", validClasspath, validProviderUri, validRuleSetUri, validRules,
-                    validProperties);
-    }
-
-    @Test( expected = IllegalArgumentException.class )
-    public void shouldNotAllowBlankClassname() {
-        new RuleSet(validName, validDescription, "   ", validClasspath, validProviderUri, validRuleSetUri, validRules,
-                    validProperties);
-    }
-
-    @Test( expected = IllegalArgumentException.class )
-    public void shouldNotAllowClassnameThatDoesNotFollowJavaNamingRules() {
-        new RuleSet(validName, validDescription, "not a valid classname", validClasspath, validProviderUri, validRuleSetUri,
-                    validRules, validProperties);
-    }
-
-    @Test
-    public void shouldAllowNullOrEmptyClasspath() {
-        new RuleSet(validName, validDescription, validClassname, null, validProviderUri, validRuleSetUri, validRules,
-                    validProperties);
-    }
-
-    @Test
-    public void shouldRemoveNullOrBlankClasspathItems() {
-        new RuleSet(validName, validDescription, validClassname, new String[] {}, validProviderUri, validRuleSetUri, validRules,
-                    validProperties);
-    }
-
-    @Test
-    public void shouldRemoveDuplicateClasspathItemsInCaseSensitiveManner() {
-        validClasspath = new String[] {"path1", "path2", "path1", "path3", "path2"};
-        ruleSet = new RuleSet(validName, validDescription, validClassname, validClasspath, validProviderUri, validRuleSetUri,
-                              validRules, validProperties);
-        assertThat(ruleSet.getComponentClasspathArray(), is(new String[] {"path1", "path2", "path3"}));
-
-        validClasspath = new String[] {"path1", "path2", "path1", "path3", "Path2"};
-        ruleSet = new RuleSet(validName, validDescription, validClassname, validClasspath, validProviderUri, validRuleSetUri,
-                              validRules, validProperties);
-        assertThat(ruleSet.getComponentClasspathArray(), is(new String[] {"path1", "path2", "path3", "Path2"}));
-    }
-
-    @Test( expected = IllegalArgumentException.class )
-    public void shouldNotAllowNullProviderUri() {
-        new RuleSet(validName, validDescription, validClassname, validClasspath, null, validRuleSetUri, validRules,
-                    validProperties);
-    }
-
-    @Test( expected = IllegalArgumentException.class )
-    public void shouldNotAllowEmptyProviderUri() {
-        new RuleSet(validName, validDescription, validClassname, validClasspath, "", validRuleSetUri, validRules, validProperties);
-    }
-
-    @Test( expected = IllegalArgumentException.class )
-    public void shouldNotAllowBlankProviderUri() {
-        new RuleSet(validName, validDescription, validClassname, validClasspath, "  \t  ", validRuleSetUri, validRules,
-                    validProperties);
-    }
-
-    @Test
-    public void shouldUseNameInPlaceOfNullRuleSetUri() {
-        ruleSet = new RuleSet(validName, validDescription, validClassname, validClasspath, validProviderUri, null, validRules,
-                              validProperties);
-        assertThat(ruleSet.getRuleSetUri(), is(ruleSet.getName()));
-    }
-
-    @Test( expected = IllegalArgumentException.class )
-    public void shouldNotAllowEmptyRuleSetUri() {
-        new RuleSet(validName, validDescription, validClassname, validClasspath, validProviderUri, "", validRules,
-                    validProperties);
-    }
-
-    @Test( expected = IllegalArgumentException.class )
-    public void shouldNotAllowBlankRuleSetUri() {
-        new RuleSet(validName, validDescription, validClassname, validClasspath, validProviderUri, "  \t  ", validRules,
-                    validProperties);
-    }
-
-    @Test( expected = IllegalArgumentException.class )
-    public void shouldNotAllowNullRules() {
-        new RuleSet(validName, validDescription, validClassname, validClasspath, validProviderUri, validRuleSetUri, null,
-                    validProperties);
-    }
-
-    @Test( expected = IllegalArgumentException.class )
-    public void shouldNotAllowEmptyRules() {
-        new RuleSet(validName, validDescription, validClassname, validClasspath, validProviderUri, validRuleSetUri, "",
-                    validProperties);
-    }
-
-    @Test( expected = IllegalArgumentException.class )
-    public void shouldNotAllowBlankRules() {
-        new RuleSet(validName, validDescription, validClassname, validClasspath, validProviderUri, validRuleSetUri, "   \t  ",
-                    validProperties);
-    }
-
-    @Test
-    public void shouldAllowNullOrEmptyProperties() {
-        validProperties = null;
-        ruleSet = new RuleSet(validName, validDescription, validClassname, validClasspath, validProviderUri, validRuleSetUri,
-                              validRules, validProperties);
-        assertThat(ruleSet.getProperties(), is(notNullValue()));
-    }
-
-    @Test
-    public void shouldWrapByteArrayPropertyValuesWithInputStreamInExecutionSetProperties() throws Exception {
-        Map<Object, Object> executionSetProps = ruleSet.getExecutionSetProperties();
-        assertThat(executionSetProps.size(), is(ruleSet.getProperties().size()));
-        assertThat(executionSetProps.keySet(), is((Set<Object>)new HashSet<Object>(ruleSet.getProperties().keySet())));
-        Iterator<Map.Entry<Object, Object>> executionSetPropIter = executionSetProps.entrySet().iterator();
-        Iterator<Map.Entry<String, Object>> propIter = ruleSet.getProperties().entrySet().iterator();
-        while (executionSetPropIter.hasNext() && propIter.hasNext()) {
-            Map.Entry<Object, Object> execSetEntry = executionSetPropIter.next();
-            Object execSetKey = execSetEntry.getKey();
-            Object execSetValue = execSetEntry.getValue();
-            Map.Entry<String, Object> propertyEntry = propIter.next();
-            String propertyKey = propertyEntry.getKey();
-            Object propertyValue = propertyEntry.getValue();
-            // Check the entries ...
-            assertThat(execSetKey, is((Object)propertyKey));
-            if (propertyValue instanceof byte[]) {
-                assertThat(execSetValue, is(instanceOf(Reader.class)));
-                String streamValueAsString = IoUtil.read((Reader)execSetValue);
-                String propertyValueAsString = new String((byte[])propertyValue);
-                assertThat(streamValueAsString, is(propertyValueAsString));
-            } else {
-                assertThat(execSetValue, is(propertyValue));
-            }
-        }
-        assertThat(executionSetPropIter.hasNext(), is(false));
-        assertThat(propIter.hasNext(), is(false));
-
-        new RuleSet(validName, validDescription, validClassname, validClasspath, validProviderUri, validRuleSetUri, validRules,
-                    validProperties);
-    }
-
-    @Test
-    public void shouldConsiderAnyAttributeDifferencesAsChange() {
-        RuleSet copy = ruleSet.clone();
-        assertThat(copy.hasChanged(ruleSet), is(false));
-        assertThat(copy.hasChanged(copy), is(false));
-
-        copy = new RuleSet(validName + "x", validDescription, validClassname, validClasspath, validProviderUri, validRuleSetUri,
-                           validRules, validProperties);
-        assertThat(copy.hasChanged(ruleSet), is(true));
-        assertThat(copy.hasChanged(copy), is(false));
-
-        copy = new RuleSet(validName, validDescription + "x", validClassname, validClasspath, validProviderUri, validRuleSetUri,
-                           validRules, validProperties);
-        assertThat(copy.hasChanged(ruleSet), is(true));
-        assertThat(copy.hasChanged(copy), is(false));
-
-        copy = new RuleSet(validName, validDescription, validClassname + "x", validClasspath, validProviderUri, validRuleSetUri,
-                           validRules, validProperties);
-        assertThat(copy.hasChanged(ruleSet), is(true));
-        assertThat(copy.hasChanged(copy), is(false));
-
-        copy = new RuleSet(validName, validDescription, validClassname, validClasspath, validProviderUri + "x", validRuleSetUri,
-                           validRules, validProperties);
-        assertThat(copy.hasChanged(ruleSet), is(true));
-        assertThat(copy.hasChanged(copy), is(false));
-
-        validClasspath = new String[] {"classpath1", "classpath2x"};
-        copy = new RuleSet(validName, validDescription, validClassname, validClasspath, validProviderUri, validRuleSetUri + "x",
-                           validRules, validProperties);
-        assertThat(copy.hasChanged(ruleSet), is(true));
-        assertThat(copy.hasChanged(copy), is(false));
-
-        copy = new RuleSet(validName, validDescription, validClassname, validClasspath, validProviderUri, validRuleSetUri,
-                           validRules + "x", validProperties);
-        assertThat(copy.hasChanged(ruleSet), is(true));
-        assertThat(copy.hasChanged(copy), is(false));
-
-        validProperties.remove("key1");
-        copy = new RuleSet(validName, validDescription, validClassname, validClasspath, validProviderUri, validRuleSetUri,
-                           validRules, validProperties);
-        assertThat(copy.hasChanged(ruleSet), is(true));
-        assertThat(copy.hasChanged(copy), is(false));
-    }
-
-    @Test
-    public void shouldConsiderOnlyNameWhenDeterminingIfSame() {
-        RuleSet copy = ruleSet.clone();
-        assertThat(copy.equals(ruleSet), is(true));
-
-        copy = new RuleSet(validName + "x", validDescription, validClassname, validClasspath, validProviderUri, validRuleSetUri,
-                           validRules, validProperties);
-        assertThat(copy.equals(ruleSet), is(false));
-
-        copy = new RuleSet(validName, validDescription + "x", validClassname, validClasspath, validProviderUri, validRuleSetUri,
-                           validRules, validProperties);
-        assertThat(copy.equals(ruleSet), is(true));
-
-        copy = new RuleSet(validName, validDescription, validClassname + "x", validClasspath, validProviderUri, validRuleSetUri,
-                           validRules, validProperties);
-        assertThat(copy.equals(ruleSet), is(true));
-
-        copy = new RuleSet(validName, validDescription, validClassname, validClasspath, validProviderUri + "x", validRuleSetUri,
-                           validRules, validProperties);
-        assertThat(copy.equals(ruleSet), is(true));
-
-        validClasspath = new String[] {"classpath1", "classpath2x"};
-        copy = new RuleSet(validName, validDescription, validClassname, validClasspath, validProviderUri, validRuleSetUri + "x",
-                           validRules, validProperties);
-        assertThat(copy.equals(ruleSet), is(true));
-
-        copy = new RuleSet(validName, validDescription, validClassname, validClasspath, validProviderUri, validRuleSetUri,
-                           validRules + "x", validProperties);
-        assertThat(copy.equals(ruleSet), is(true));
-
-        validProperties.remove("key1");
-        copy = new RuleSet(validName, validDescription, validClassname, validClasspath, validProviderUri, validRuleSetUri,
-                           validRules, validProperties);
-        assertThat(copy.equals(ruleSet), is(true));
-    }
-
-}

Deleted: trunk/dna-repository/src/test/java/org/jboss/dna/repository/util/JndiSessionFactoryTest.java
===================================================================
--- trunk/dna-repository/src/test/java/org/jboss/dna/repository/util/JndiSessionFactoryTest.java	2009-05-21 22:26:25 UTC (rev 922)
+++ trunk/dna-repository/src/test/java/org/jboss/dna/repository/util/JndiSessionFactoryTest.java	2009-05-22 02:15:19 UTC (rev 923)
@@ -1,168 +0,0 @@
-/*
- * JBoss DNA (http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of 
- * individual contributors. 
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you 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.
- *
- * JBoss DNA 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.util;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNull.notNullValue;
-import static org.hamcrest.core.IsNull.nullValue;
-import static org.hamcrest.core.IsSame.sameInstance;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
-import static org.mockito.Mockito.mock;
-import javax.jcr.Repository;
-import javax.jcr.Session;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import org.jboss.dna.common.SystemFailureException;
-import org.jboss.dna.common.jcr.AbstractJcrRepositoryTest;
-import org.jboss.dna.common.naming.MockInitialContext;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author Randall Hauch
- */
-public class JndiSessionFactoryTest extends AbstractJcrRepositoryTest {
-
-    public static final String MOCK_REPOSITORY_NAME = "java:jcr/unit/test/repository/1";
-    public static final String MOCK_REPOSITORY_NAME_ALT = "java:jcr/unit/test/repository/2";
-
-    private JndiSessionFactory factory;
-    private Repository mockRepository;
-    private Session session;
-
-    @Before
-    public void beforeEach() throws Exception {
-        this.mockRepository = mock(Repository.class);
-        MockInitialContext.register(MOCK_REPOSITORY_NAME, this.mockRepository);
-        this.factory = new JndiSessionFactory();
-    }
-
-    @After
-    public void afterEach() {
-        if (session != null) {
-            session.logout();
-        }
-        MockInitialContext.tearDown();
-    }
-
-    protected void assertNotRegistered( String name ) {
-        try {
-            new InitialContext().lookup(name);
-            fail("Unexpectedly found registered object");
-        } catch (NamingException e) {
-            // expected ...
-        }
-    }
-
-    protected void assertRegistered( String name,
-                                     Object obj ) {
-        try {
-            assertThat(new InitialContext().lookup(name), is(sameInstance(obj)));
-        } catch (NamingException e) {
-            fail("Failed to find registered object \"" + name + "\"");
-        }
-    }
-
-    @Test
-    public void shouldCreateSessionForRegisteredRepository() {
-
-    }
-
-    @Test( expected = SystemFailureException.class )
-    public void shouldThrowSystemFailureWhenUnableToFindRegisteredRepository() throws Exception {
-        factory.createSession(MOCK_REPOSITORY_NAME + "something_extra_that_can't_be_found");
-    }
-
-    @Test
-    public void shouldFindWorkspaceInRegisteredName() {
-        assertThat(factory.getWorkspaceName("java:jcr/path/to/repository/workspaceName"), is("workspaceName"));
-    }
-
-    @Test
-    public void shouldReturnNullWorkspaceIfRegisteredNameEndsInDelimiter() {
-        assertThat(factory.getWorkspaceName("java:jcr/path/to/repository/"), is(nullValue()));
-    }
-
-    @Test
-    public void shouldReturnNullWorkspaceIfRegisteredNameHasNoDelimiter() {
-        assertThat(factory.getWorkspaceName("java:jcr"), is(nullValue()));
-    }
-
-    @Test
-    public void shouldFindRepositoryInRegisteredName() {
-        assertThat(factory.getRepositoryName("java:jcr/path/to/repository/workspaceName"), is("java:jcr/path/to/repository"));
-    }
-
-    @Test
-    public void shouldConsiderWholeRegisteredNameToBeRepositoryNameIfRegisteredNameEndsInDelimiter() {
-        assertThat(factory.getRepositoryName("java:jcr/path/to/repository/"), is("java:jcr/path/to/repository"));
-    }
-
-    @Test
-    public void shouldConsiderWholeRegisteredNameToBeRepositoryNameIfRegisteredNameHasNoDelimiter() {
-        assertThat(factory.getRepositoryName("java:jcr"), is("java:jcr"));
-    }
-
-    @Test
-    public void shouldRegisterSuppliedRepositoryInJndi() {
-        assertNotRegistered(MOCK_REPOSITORY_NAME_ALT);
-        factory.registerRepository(MOCK_REPOSITORY_NAME_ALT, mockRepository);
-        assertRegistered(MOCK_REPOSITORY_NAME_ALT, mockRepository);
-    }
-
-    @Test
-    public void shouldUnregisterRepositoryInJndiIfNullRepositoryReference() {
-        assertRegistered(MOCK_REPOSITORY_NAME, mockRepository);
-        factory.registerRepository(MOCK_REPOSITORY_NAME, null);
-        assertNotRegistered(MOCK_REPOSITORY_NAME);
-    }
-
-    @Test
-    public void shouldRemoveAllTrailingDelimitersWhenRegisteringRepository() {
-        assertNotRegistered("java:jcr/unit/test/repository");
-        factory.registerRepository("java:jcr/unit/test/repository///", mockRepository);
-        assertRegistered("java:jcr/unit/test/repository", mockRepository);
-    }
-
-    @Test
-    public void shouldCreateAnonymousSessionInRepositoryIfNoCredentialsAreRegisterd() throws Exception {
-        Repository repository = getRepository();
-        factory.registerRepository("java:jcr/unit/test/repository/", repository);
-        session = factory.createSession("java:jcr/unit/test/repository/default");
-        assertThat(session, is(notNullValue()));
-        assertThat(session.getUserID(), is("anonymous")); // as defined in the Jackrabbit configuration file
-    }
-
-    @Test
-    public void shouldCreateNonAnonymousSessionInRepositoryIfCredentialsAreRegistered() throws Exception {
-        Repository repository = getRepository();
-        factory.registerRepository("java:jcr/unit/test/repository/", repository);
-        factory.registerCredentials("java:jcr/unit/test/repository/default", "jsmith", "secret".toCharArray());
-        session = factory.createSession("java:jcr/unit/test/repository/default");
-        assertThat(session, is(notNullValue()));
-        assertThat(session.getUserID(), is("jsmith")); // as defined in the Jackrabbit configuration file
-    }
-}

Copied: trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/JcrTools.java (from rev 922, trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/JcrTools.java)
===================================================================
--- trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/JcrTools.java	                        (rev 0)
+++ trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/JcrTools.java	2009-05-22 02:15:19 UTC (rev 923)
@@ -0,0 +1,329 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of 
+ * individual contributors. 
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you 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.
+ *
+ * JBoss DNA 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.example.dna.sequencer;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.Property;
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.Value;
+import javax.jcr.ValueFormatException;
+import org.jboss.dna.common.collection.Problem;
+import org.jboss.dna.common.collection.Problems;
+import org.jboss.dna.common.util.IoUtil;
+import org.jboss.dna.common.util.Logger;
+import org.jboss.dna.common.util.StringUtil;
+import org.jboss.dna.repository.RepositoryI18n;
+
+/**
+ * @author Randall Hauch
+ */
+public class JcrTools {
+
+    public Map<String, Object> loadProperties( Node propertyContainer, Problems problems ) {
+        return loadProperties(propertyContainer, null, problems);
+    }
+
+    public Map<String, Object> loadProperties( Node propertyContainer, Map<String, Object> properties, Problems problems ) {
+        if (properties == null) properties = new HashMap<String, Object>();
+        if (propertyContainer != null) {
+            try {
+                NodeIterator iter = propertyContainer.getNodes();
+                while (iter.hasNext()) {
+                    Node propertyNode = iter.nextNode();
+                    if (propertyNode != null && propertyNode.getPrimaryNodeType().isNodeType("dna:property")) {
+                        String propertyName = propertyNode.getName();
+                        Object propertyValue = getPropertyValue(propertyNode, "dna:propertyValue", true, problems);
+                        properties.put(propertyName, propertyValue);
+                    }
+                }
+            } catch (RepositoryException e) {
+                problems.addError(e, RepositoryI18n.errorReadingPropertiesFromContainerNode, getReadable(propertyContainer));
+            }
+        }
+
+        return properties;
+    }
+
+    public boolean removeProblems( Node parent ) throws RepositoryException {
+        Node problemsNode = null;
+        if (parent.hasNode("dna:problems")) {
+            problemsNode = parent.getNode("dna:problems");
+            problemsNode.remove();
+            return true;
+        }
+        return false;
+    }
+
+    public boolean storeProblems( Node parent, Problems problems ) throws RepositoryException {
+        Node problemsNode = null;
+        if (parent.hasNode("dna:problems")) {
+            problemsNode = parent.getNode("dna:problems");
+            // Delete all problems ...
+            removeAllChildren(problemsNode);
+        }
+        if (problems.isEmpty()) {
+            return false;
+        }
+        if (problemsNode == null) {
+            problemsNode = parent.addNode("dna:problems"); // primary type dictated by child definition
+        }
+
+        // Add a child for each problem ...
+        for (Problem problem : problems) {
+            Node problemNode = problemsNode.addNode("problem", "dna:problem");
+            // - dna:status (string) mandatory copy
+            // < 'ERROR', 'WARNING', 'INFO'
+            // - dna:message (string) mandatory copy
+            // - dna:code (string) copy
+            // - dna:type (string) copy
+            // - dna:resource (string) copy
+            // - dna:location (string) copy
+            // - dna:trace (string) copy
+            problemNode.setProperty("dna:status", problem.getStatus().name());
+            problemNode.setProperty("dna:message", problem.getMessageString());
+            if (problem.getCode() != Problem.DEFAULT_CODE) {
+                problemNode.setProperty("dna:code", Integer.toString(problem.getCode()));
+            }
+            String resource = problem.getResource();
+            if (resource != null) {
+                problemNode.setProperty("dna:resource", resource);
+            }
+            String location = problem.getLocation();
+            if (location != null) {
+                problemNode.setProperty("dna:location", location);
+            }
+            Throwable t = problem.getThrowable();
+            if (t != null) {
+                String trace = StringUtil.getStackTrace(t);
+                problemNode.setProperty("dna:trace", trace);
+            }
+        }
+        return true;
+    }
+
+    public int removeAllChildren( Node node ) throws RepositoryException {
+        int childrenRemoved = 0;
+        NodeIterator iter = node.getNodes();
+        while (iter.hasNext()) {
+            Node child = iter.nextNode();
+            child.remove();
+            ++childrenRemoved;
+        }
+        return childrenRemoved;
+    }
+
+    public String getPropertyAsString( Node node, String propertyName, boolean required, Problems problems ) {
+        return getPropertyAsString(node, propertyName, required, null);
+    }
+
+    public String getPropertyAsString( Node node, String propertyName, boolean required, String defaultValue, Problems problems ) {
+        try {
+            Property property = node.getProperty(propertyName);
+            return property.getString();
+        } catch (ValueFormatException e) {
+            if (required) {
+                problems.addError(e, RepositoryI18n.requiredPropertyOnNodeWasExpectedToBeStringValue, propertyName, getReadable(node));
+            } else {
+                problems.addError(e, RepositoryI18n.optionalPropertyOnNodeWasExpectedToBeStringValue, propertyName, getReadable(node));
+            }
+        } catch (PathNotFoundException e) {
+            if (required) {
+                problems.addError(e, RepositoryI18n.requiredPropertyIsMissingFromNode, propertyName, getReadable(node));
+            }
+            if (!required) return defaultValue;
+        } catch (RepositoryException err) {
+            if (required) {
+                problems.addError(err, RepositoryI18n.errorGettingRequiredPropertyFromNode, propertyName, getReadable(node));
+            } else {
+                problems.addError(err, RepositoryI18n.errorGettingOptionalPropertyFromNode, propertyName, getReadable(node));
+            }
+        }
+        return null;
+    }
+
+    public Object getPropertyValue( Node node, String propertyName, boolean required, Problems problems ) {
+        try {
+            Property property = node.getProperty(propertyName);
+            switch (property.getType()) {
+                case PropertyType.BINARY: {
+                    InputStream stream = property.getStream();
+                    try {
+                        stream = property.getStream();
+                        return IoUtil.readBytes(stream);
+                    } finally {
+                        if (stream != null) {
+                            try {
+                                stream.close();
+                            } catch (IOException e) {
+                                // Log ...
+                                Logger.getLogger(this.getClass()).error(e, RepositoryI18n.errorClosingBinaryStreamForPropertyFromNode, propertyName, node.getPath());
+                            }
+                        }
+                    }
+                }
+                default: {
+                    return property.getString();
+                }
+            }
+        } catch (IOException e) {
+            if (required) {
+                problems.addError(e, RepositoryI18n.requiredPropertyOnNodeCouldNotBeRead, propertyName, getReadable(node));
+            } else {
+                problems.addError(e, RepositoryI18n.optionalPropertyOnNodeCouldNotBeRead, propertyName, getReadable(node));
+            }
+        } catch (PathNotFoundException e) {
+            if (required) {
+                problems.addError(e, RepositoryI18n.requiredPropertyIsMissingFromNode, propertyName, getReadable(node));
+            }
+        } catch (RepositoryException err) {
+            if (required) {
+                problems.addError(err, RepositoryI18n.errorGettingRequiredPropertyFromNode, propertyName, getReadable(node));
+            } else {
+                problems.addError(err, RepositoryI18n.errorGettingOptionalPropertyFromNode, propertyName, getReadable(node));
+            }
+        }
+        return null;
+    }
+
+    public String[] getPropertyAsStringArray( Node node, String propertyName, boolean required, Problems problems, String... defaultValues ) {
+        String[] result = defaultValues;
+        try {
+            Property property = node.getProperty(propertyName);
+            if (property.getDefinition().isMultiple()) {
+                Value[] values = property.getValues();
+                result = new String[values.length];
+                int i = 0;
+                for (Value value : values) {
+                    result[i++] = value.getString();
+                }
+            } else {
+                result = new String[] {property.getString()};
+            }
+        } catch (ValueFormatException e) {
+            if (required) {
+                problems.addError(e, RepositoryI18n.requiredPropertyOnNodeWasExpectedToBeStringArrayValue, propertyName, getReadable(node));
+            } else {
+                problems.addError(e, RepositoryI18n.optionalPropertyOnNodeWasExpectedToBeStringArrayValue, propertyName, getReadable(node));
+            }
+        } catch (PathNotFoundException e) {
+            if (required) {
+                problems.addError(e, RepositoryI18n.requiredPropertyIsMissingFromNode, propertyName, getReadable(node));
+            }
+        } catch (RepositoryException err) {
+            if (required) {
+                problems.addError(err, RepositoryI18n.errorGettingRequiredPropertyFromNode, propertyName, getReadable(node));
+            } else {
+                problems.addError(err, RepositoryI18n.errorGettingOptionalPropertyFromNode, propertyName, getReadable(node));
+            }
+        }
+        return result;
+    }
+
+    public Node getNode( Node node, String relativePath, boolean required, Problems problems ) {
+        Node result = null;
+        try {
+            result = node.getNode(relativePath);
+        } catch (PathNotFoundException e) {
+            if (required) problems.addError(e, RepositoryI18n.requiredNodeDoesNotExistRelativeToNode, relativePath, getReadable(node));
+        } catch (RepositoryException err) {
+            problems.addError(err, RepositoryI18n.errorGettingNodeRelativeToNode, relativePath, getReadable(node));
+        }
+        return result;
+    }
+
+    public String getReadable( Node node ) {
+        if (node == null) return "";
+        try {
+            return node.getPath();
+        } catch (RepositoryException err) {
+            return node.toString();
+        }
+    }
+
+    public Node findOrCreateNode( Session session, String path ) throws RepositoryException {
+        return findOrCreateNode(session, path, null, null);
+    }
+
+    public Node findOrCreateNode( Session session, String path, String nodeType ) throws RepositoryException {
+        return findOrCreateNode(session, path, nodeType, nodeType);
+    }
+
+    public Node findOrCreateNode( Session session, String path, String defaultNodeType, String finalNodeType ) throws RepositoryException {
+        Node root = session.getRootNode();
+        return findOrCreateNode(session, root, path, defaultNodeType, finalNodeType);
+    }
+
+    public Node findOrCreateNode( Session session, Node parentNode, String path, String defaultNodeType, String finalNodeType ) throws RepositoryException {
+        // Remove leading and trailing slashes ...
+        String relPath = path.replaceAll("^/+", "").replaceAll("/+$", "");
+
+        // Look for the node first ...
+        try {
+            return parentNode.getNode(relPath);
+        } catch (PathNotFoundException e) {
+            // continue
+        }
+        // Create the node, which has to be done segment by segment ...
+        String[] pathSegments = relPath.split("/");
+        Node node = parentNode;
+        for (int i = 0, len = pathSegments.length; i != len; ++i) {
+            String pathSegment = pathSegments[i];
+            pathSegment = pathSegment.trim();
+            if (pathSegment.length() == 0) continue;
+            if (node.hasNode(pathSegment)) {
+                // Find the existing node ...
+                node = node.getNode(pathSegment);
+            } else {
+                // Make sure there is no index on the final segment ...
+                String pathSegmentWithNoIndex = pathSegment.replaceAll("(\\[\\d+\\])+$", "");
+                // Create the node ...
+                String nodeType = defaultNodeType;
+                if (i == len - 1 && finalNodeType != null) nodeType = finalNodeType;
+                if (nodeType != null) {
+                    node = node.addNode(pathSegmentWithNoIndex, nodeType);
+                } else {
+                    node = node.addNode(pathSegmentWithNoIndex);
+                }
+            }
+        }
+        return node;
+    }
+
+    public Node findOrCreateChild( Session session, Node parent, String name ) throws RepositoryException {
+        return findOrCreateChild(session, parent, name, null);
+    }
+
+    public Node findOrCreateChild( Session session, Node parent, String name, String nodeType ) throws RepositoryException {
+        return findOrCreateNode(session, parent, name, nodeType, nodeType);
+    }
+
+}


Property changes on: trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/JcrTools.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/SequencingClient.java
===================================================================
--- trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/SequencingClient.java	2009-05-21 22:26:25 UTC (rev 922)
+++ trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/SequencingClient.java	2009-05-22 02:15:19 UTC (rev 923)
@@ -47,10 +47,9 @@
 import org.apache.jackrabbit.api.JackrabbitNodeTypeManager;
 import org.apache.jackrabbit.core.TransientRepository;
 import org.jboss.dna.common.SystemFailureException;
+import org.jboss.dna.graph.ExecutionContext;
 import org.jboss.dna.repository.sequencer.SequencerConfig;
 import org.jboss.dna.repository.sequencer.SequencingService;
-import org.jboss.dna.repository.util.JcrExecutionContext;
-import org.jboss.dna.repository.util.JcrTools;
 import org.jboss.dna.repository.util.SessionFactory;
 import org.jboss.dna.repository.util.SimpleSessionFactory;
 
@@ -82,7 +81,7 @@
     private Repository repository;
     private SequencingService sequencingService;
     private UserInterface userInterface;
-    private JcrExecutionContext executionContext;
+    private ExecutionContext executionContext;
 
     public SequencingClient() {
         setJackrabbitConfigPath(DEFAULT_JACKRABBIT_CONFIG_PATH);
@@ -217,7 +216,7 @@
                 Credentials credentials = new SimpleCredentials(this.username, this.password);
                 sessionFactory.registerCredentials(repositoryWorkspaceName, credentials);
             }
-            this.executionContext = new JcrExecutionContext(sessionFactory, repositoryWorkspaceName);
+            this.executionContext = new ExecutionContext();
 
             // Create the sequencing service, passing in the execution context and the repository library ...
             this.sequencingService = new SequencingService();
@@ -307,7 +306,7 @@
 
         // Now use the JCR API to upload the file ...
         Session session = createSession();
-        JcrTools tools = this.executionContext.getTools();
+        JcrTools tools = new JcrTools();
         try {
             // Create the node at the supplied path ...
             Node node = tools.findOrCreateNode(session, nodePath, "nt:folder", "nt:file");
@@ -539,7 +538,7 @@
      * @throws RepositoryException
      */
     protected Session createSession() throws RepositoryException {
-        return this.executionContext.getSessionFactory().createSession(this.repositoryName + "/" + this.workspaceName);
+        throw new UnsupportedOperationException();
     }
 
     protected String getMimeType( URL file ) {

Copied: trunk/extensions/dna-classloader-maven/src/test/java/org/jboss/dna/maven/AbstractJcrRepositoryTest.java (from rev 922, trunk/dna-common/src/test/java/org/jboss/dna/common/jcr/AbstractJcrRepositoryTest.java)
===================================================================
--- trunk/extensions/dna-classloader-maven/src/test/java/org/jboss/dna/maven/AbstractJcrRepositoryTest.java	                        (rev 0)
+++ trunk/extensions/dna-classloader-maven/src/test/java/org/jboss/dna/maven/AbstractJcrRepositoryTest.java	2009-05-22 02:15:19 UTC (rev 923)
@@ -0,0 +1,178 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of 
+ * individual contributors. 
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you 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.
+ *
+ * JBoss DNA 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.maven;
+
+import java.io.IOException;
+import javax.jcr.Credentials;
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.SimpleCredentials;
+import org.apache.jackrabbit.api.JackrabbitRepository;
+import org.apache.jackrabbit.core.TransientRepository;
+import org.jboss.dna.common.util.FileUtil;
+import org.jboss.dna.common.util.Logger;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+/**
+ * An abstract base class for any unit test class that needs a JCR repository during one or more (but not necessarily all) of its
+ * unit tests.
+ * <p>
+ * Typically, unit test classes need a repository for just some of it's unit tests (other unit tests don't need the repository
+ * because they are just testing other functionality of the class under test), and this class was designed for this scenario. A
+ * unit test method that needs a repository should call {@link #startRepository()}, and then may proceed to use the
+ * {@link #getRepository() repository}. The test method need not call {@link #shutdownRepository()}, as it is called automatically
+ * after every test (and does nothing if the repository was not started in the first place).
+ * </p>
+ * <p>
+ * Some unit test methods may have a need to repeatedly start and stop the repository, and this can be done by calling
+ * {@link #startRepository()} and {@link #shutdownRepository()} as many times as required.
+ * </p>
+ * <p>
+ * Because the {@link TransientRepository transient repository} implementation used by this class automatically cleans itself up
+ * whenever all {@link Session sessions} are closed, this class maintains an open session between the time the repository is
+ * started and stopped. Therefore, unit tests can persist information in one session and see the information in other sessions.
+ * </p>
+ * 
+ * @author Randall Hauch
+ */
+public abstract class AbstractJcrRepositoryTest {
+
+    public static final String TESTDATA_PATH = "./src/test/resources/";
+    public static final String JACKRABBIT_DATA_PATH = "./target/testdata/jackrabbittest/";
+    public static final String REPOSITORY_DIRECTORY_PATH = JACKRABBIT_DATA_PATH + "repository";
+    public static final String REPOSITORY_CONFIG_PATH = TESTDATA_PATH + "jackrabbitInMemoryTestRepositoryConfig.xml";
+
+    public static final String WORKSPACE_NAME = "default";
+
+    private static Repository repository;
+
+    @BeforeClass
+    public static void beforeAll() throws Exception {
+        // Clean up the test data ...
+        FileUtil.delete(JACKRABBIT_DATA_PATH);
+
+        // Set up the transient repository (this shouldn't do anything yet)...
+        repository = new TransientRepository(REPOSITORY_CONFIG_PATH, REPOSITORY_DIRECTORY_PATH);
+    }
+
+    @AfterClass
+    public static void afterAll() {
+        if (repository != null) {
+            try {
+                JackrabbitRepository jackrabbit = (JackrabbitRepository)repository;
+                jackrabbit.shutdown();
+            } finally {
+                repository = null;
+                // Clean up the test data ...
+                FileUtil.delete(JACKRABBIT_DATA_PATH);
+            }
+        }
+    }
+
+    /** Used to keep at least one session open during each test; when last session is closed, all data is cleaned up */
+    private Session keepAliveSession;
+
+    protected Credentials simpleCredentials = new SimpleCredentials("jsmith", "secret".toCharArray());
+
+    /**
+     * Call this method during a test that needs the repository. It only needs to be called once during a test, although calling
+     * it more than once does not hurt.
+     * <p>
+     * The repository can be started and {@link #shutdownRepository() shutdown} repeatedly during a single test.
+     * </p>
+     * 
+     * @throws RepositoryException if there is a problem starting the repository
+     * @throws IOException if there's a problem reading the repository configuration
+     * @see #shutdownRepository()
+     */
+    public synchronized void startRepository() throws RepositoryException, IOException {
+        if (repository == null) {
+            // Clean up the test data ...
+            FileUtil.delete(JACKRABBIT_DATA_PATH);
+
+            // Set up the transient repository (this shouldn't do anything yet)...
+            repository = new TransientRepository(REPOSITORY_CONFIG_PATH, REPOSITORY_DIRECTORY_PATH);
+
+        }
+        if (keepAliveSession == null) {
+            keepAliveSession = repository.login();
+        }
+    }
+
+    /**
+     * Shutdown the repository. This method is automatically called after every test, and does nothing if the repository has not
+     * yet been started.
+     */
+    @After
+    public synchronized void shutdownRepository() {
+        if (keepAliveSession != null) {
+            try {
+                Logger.getLogger(this.getClass()).debug("Shutting down repository");
+                keepAliveSession.logout();
+            } finally {
+                keepAliveSession = null;
+                if (repository != null) {
+                    try {
+                        JackrabbitRepository jackrabbit = (JackrabbitRepository)repository;
+                        jackrabbit.shutdown();
+                    } finally {
+                        repository = null;
+                        // Clean up the test data ...
+                        FileUtil.delete(JACKRABBIT_DATA_PATH);
+                    }
+                }
+            }
+        }
+    }
+
+    public boolean isRepositoryStarted() {
+        return this.keepAliveSession != null;
+    }
+
+    /**
+     * Get the repository. This will start the repository if necessary.
+     * 
+     * @return repository
+     * @throws RepositoryException if there is a problem obtaining the repository
+     * @throws IOException if the repository has not yet been {@link #startRepository() started} and there's a problem reading the
+     *         repository configuration
+     */
+    public Repository getRepository() throws RepositoryException, IOException {
+        startRepository();
+        return repository;
+    }
+
+    /**
+     * Get credentials that can be used to log into the repository.
+     * 
+     * @return credentials
+     */
+    public Credentials getTestCredentials() {
+        return this.simpleCredentials;
+    }
+
+}


Property changes on: trunk/extensions/dna-classloader-maven/src/test/java/org/jboss/dna/maven/AbstractJcrRepositoryTest.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: trunk/extensions/dna-classloader-maven/src/test/java/org/jboss/dna/maven/MavenRepositoryTest.java
===================================================================
--- trunk/extensions/dna-classloader-maven/src/test/java/org/jboss/dna/maven/MavenRepositoryTest.java	2009-05-21 22:26:25 UTC (rev 922)
+++ trunk/extensions/dna-classloader-maven/src/test/java/org/jboss/dna/maven/MavenRepositoryTest.java	2009-05-22 02:15:19 UTC (rev 923)
@@ -37,7 +37,6 @@
 import java.util.List;
 import java.util.Properties;
 import javax.jcr.RepositoryException;
-import org.jboss.dna.common.jcr.AbstractJcrRepositoryTest;
 import org.jboss.dna.common.util.IoUtil;
 import org.jboss.dna.common.util.StringUtil;
 import org.jboss.dna.maven.spi.JcrMavenUrlProvider;
@@ -180,7 +179,10 @@
         loadTestLibrary("org.jboss.example:ProjectI:1.0", "test/dependency/case1/testProjectI.xml");
     }
 
-    protected void setRepositoryContent( MavenId mavenId, ArtifactType artifactType, SignatureType signatureType, InputStream content ) throws Exception {
+    protected void setRepositoryContent( MavenId mavenId,
+                                         ArtifactType artifactType,
+                                         SignatureType signatureType,
+                                         InputStream content ) throws Exception {
         // Set the content ...
         URL url = this.urlProvider.getUrl(mavenId, artifactType, signatureType, true);
         assertThat(url, is(notNullValue()));
@@ -199,7 +201,8 @@
 
     }
 
-    protected void loadTestLibrary( String mavenId, String pathToPomFile ) throws Exception {
+    protected void loadTestLibrary( String mavenId,
+                                    String pathToPomFile ) throws Exception {
         MavenId id = new MavenId(mavenId);
         setRepositoryContent(id, ArtifactType.POM, null, this.getClass().getClassLoader().getResourceAsStream(pathToPomFile));
         setRepositoryContent(id, ArtifactType.JAR, null, this.getClass().getClassLoader().getResourceAsStream(PATH_TO_EMPTY_JAR));
@@ -231,25 +234,41 @@
 
     @Test
     public void shouldReturnValidUrlForMavenIdAndArtifactTypeAndSignatureType() throws Exception {
-        assertThat(maven.getUrl(mavenId1, ArtifactType.JAR, null).toString(), is("jcr:/default/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.jar"));
-        assertThat(maven.getUrl(mavenId1, ArtifactType.JAR, SignatureType.MD5).toString(), is("jcr:/default/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.jar.md5"));
-        assertThat(maven.getUrl(mavenId1, ArtifactType.JAR, SignatureType.PGP).toString(), is("jcr:/default/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.jar.asc"));
-        assertThat(maven.getUrl(mavenId1, ArtifactType.JAR, SignatureType.SHA1).toString(), is("jcr:/default/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.jar.sha1"));
+        assertThat(maven.getUrl(mavenId1, ArtifactType.JAR, null).toString(),
+                   is("jcr:/default/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.jar"));
+        assertThat(maven.getUrl(mavenId1, ArtifactType.JAR, SignatureType.MD5).toString(),
+                   is("jcr:/default/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.jar.md5"));
+        assertThat(maven.getUrl(mavenId1, ArtifactType.JAR, SignatureType.PGP).toString(),
+                   is("jcr:/default/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.jar.asc"));
+        assertThat(maven.getUrl(mavenId1, ArtifactType.JAR, SignatureType.SHA1).toString(),
+                   is("jcr:/default/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.jar.sha1"));
 
-        assertThat(maven.getUrl(mavenId1, ArtifactType.SOURCE, null).toString(), is("jcr:/default/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT-sources.jar"));
-        assertThat(maven.getUrl(mavenId1, ArtifactType.SOURCE, SignatureType.MD5).toString(), is("jcr:/default/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT-sources.jar.md5"));
-        assertThat(maven.getUrl(mavenId1, ArtifactType.SOURCE, SignatureType.PGP).toString(), is("jcr:/default/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT-sources.jar.asc"));
-        assertThat(maven.getUrl(mavenId1, ArtifactType.SOURCE, SignatureType.SHA1).toString(), is("jcr:/default/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT-sources.jar.sha1"));
+        assertThat(maven.getUrl(mavenId1, ArtifactType.SOURCE, null).toString(),
+                   is("jcr:/default/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT-sources.jar"));
+        assertThat(maven.getUrl(mavenId1, ArtifactType.SOURCE, SignatureType.MD5).toString(),
+                   is("jcr:/default/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT-sources.jar.md5"));
+        assertThat(maven.getUrl(mavenId1, ArtifactType.SOURCE, SignatureType.PGP).toString(),
+                   is("jcr:/default/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT-sources.jar.asc"));
+        assertThat(maven.getUrl(mavenId1, ArtifactType.SOURCE, SignatureType.SHA1).toString(),
+                   is("jcr:/default/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT-sources.jar.sha1"));
 
-        assertThat(maven.getUrl(mavenId1, ArtifactType.POM, null).toString(), is("jcr:/default/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.pom"));
-        assertThat(maven.getUrl(mavenId1, ArtifactType.POM, SignatureType.MD5).toString(), is("jcr:/default/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.pom.md5"));
-        assertThat(maven.getUrl(mavenId1, ArtifactType.POM, SignatureType.PGP).toString(), is("jcr:/default/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.pom.asc"));
-        assertThat(maven.getUrl(mavenId1, ArtifactType.POM, SignatureType.SHA1).toString(), is("jcr:/default/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.pom.sha1"));
+        assertThat(maven.getUrl(mavenId1, ArtifactType.POM, null).toString(),
+                   is("jcr:/default/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.pom"));
+        assertThat(maven.getUrl(mavenId1, ArtifactType.POM, SignatureType.MD5).toString(),
+                   is("jcr:/default/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.pom.md5"));
+        assertThat(maven.getUrl(mavenId1, ArtifactType.POM, SignatureType.PGP).toString(),
+                   is("jcr:/default/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.pom.asc"));
+        assertThat(maven.getUrl(mavenId1, ArtifactType.POM, SignatureType.SHA1).toString(),
+                   is("jcr:/default/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.pom.sha1"));
 
-        assertThat(maven.getUrl(mavenId1, ArtifactType.METADATA, null).toString(), is("jcr:/default/org/jboss/dna/dna-maven/maven-metadata.xml"));
-        assertThat(maven.getUrl(mavenId1, ArtifactType.METADATA, SignatureType.MD5).toString(), is("jcr:/default/org/jboss/dna/dna-maven/maven-metadata.xml.md5"));
-        assertThat(maven.getUrl(mavenId1, ArtifactType.METADATA, SignatureType.PGP).toString(), is("jcr:/default/org/jboss/dna/dna-maven/maven-metadata.xml.asc"));
-        assertThat(maven.getUrl(mavenId1, ArtifactType.METADATA, SignatureType.SHA1).toString(), is("jcr:/default/org/jboss/dna/dna-maven/maven-metadata.xml.sha1"));
+        assertThat(maven.getUrl(mavenId1, ArtifactType.METADATA, null).toString(),
+                   is("jcr:/default/org/jboss/dna/dna-maven/maven-metadata.xml"));
+        assertThat(maven.getUrl(mavenId1, ArtifactType.METADATA, SignatureType.MD5).toString(),
+                   is("jcr:/default/org/jboss/dna/dna-maven/maven-metadata.xml.md5"));
+        assertThat(maven.getUrl(mavenId1, ArtifactType.METADATA, SignatureType.PGP).toString(),
+                   is("jcr:/default/org/jboss/dna/dna-maven/maven-metadata.xml.asc"));
+        assertThat(maven.getUrl(mavenId1, ArtifactType.METADATA, SignatureType.SHA1).toString(),
+                   is("jcr:/default/org/jboss/dna/dna-maven/maven-metadata.xml.sha1"));
     }
 
     @Test
@@ -422,8 +441,10 @@
         checkClasspath(new MavenId[] {projectE}, new MavenId[] {projectE, projectD, projectA, projectB});
         checkClasspath(new MavenId[] {projectF}, new MavenId[] {projectF, projectE, projectC, projectD, projectA, projectB});
         checkClasspath(new MavenId[] {projectG}, new MavenId[] {projectG, projectC, projectE, projectD, projectA});
-        checkClasspath(new MavenId[] {projectH}, new MavenId[] {projectH, projectG, projectB, projectC, projectE, projectD, projectA});
-        checkClasspath(new MavenId[] {projectI}, new MavenId[] {projectI, projectH, projectF, projectG, projectB, projectC, projectE, projectD, projectA});
+        checkClasspath(new MavenId[] {projectH}, new MavenId[] {projectH, projectG, projectB, projectC, projectE, projectD,
+            projectA});
+        checkClasspath(new MavenId[] {projectI}, new MavenId[] {projectI, projectH, projectF, projectG, projectB, projectC,
+            projectE, projectD, projectA});
     }
 
     @Test
@@ -439,7 +460,8 @@
         checkClasspath(new MavenId[] {projectG}, new MavenId[] {projectG, projectC, projectE, projectD, projectA, projectB});
     }
 
-    protected void checkClasspath( MavenId[] projectIds, MavenId[] classpathProjects ) {
+    protected void checkClasspath( MavenId[] projectIds,
+                                   MavenId[] classpathProjects ) {
         List<MavenId> idsExpectedOnClasspath = new ArrayList<MavenId>();
         for (int i = 0; i != classpathProjects.length; ++i) {
             idsExpectedOnClasspath.add(classpathProjects[i]);

Copied: trunk/extensions/dna-classloader-maven/src/test/java/org/jboss/dna/maven/TestAbstractJcrRepositoryTest.java (from rev 922, trunk/dna-common/src/test/java/org/jboss/dna/common/jcr/TestAbstractJcrRepositoryTest.java)
===================================================================
--- trunk/extensions/dna-classloader-maven/src/test/java/org/jboss/dna/maven/TestAbstractJcrRepositoryTest.java	                        (rev 0)
+++ trunk/extensions/dna-classloader-maven/src/test/java/org/jboss/dna/maven/TestAbstractJcrRepositoryTest.java	2009-05-22 02:15:19 UTC (rev 923)
@@ -0,0 +1,89 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of 
+ * individual contributors. 
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you 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.
+ *
+ * JBoss DNA 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.maven;
+
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsNull.notNullValue;
+import static org.junit.Assert.assertThat;
+import javax.jcr.Node;
+import javax.jcr.Session;
+import org.junit.Test;
+
+/**
+ * @author Randall Hauch
+ */
+public class TestAbstractJcrRepositoryTest extends AbstractJcrRepositoryTest {
+
+    @Test
+    public void shouldBeAbleToStartAndShutdownRepository() throws Exception {
+        for (int i = 0; i != 3; ++i) {
+            startRepository();
+            Session session = getRepository().login(getTestCredentials());
+            assertThat(session, is(notNullValue()));
+            assertThat(session.getRootNode(), is(notNullValue()));
+            // Create a child node ...
+            Node node = session.getRootNode().addNode("testnode", "nt:unstructured");
+            assertThat(node, is(notNullValue()));
+            assertThat(node.getName(), is("testnode"));
+            assertThat(node.getPath(), is("/testnode"));
+            // Save and close the session ...
+            session.save();
+            session.logout();
+            shutdownRepository();
+        }
+    }
+
+    @Test
+    public void shouldAllowDataPersistedInOneSessionBeAccessibleInOtherSessions() throws Exception {
+        startRepository();
+        Session session = getRepository().login(getTestCredentials());
+        assertThat(session, is(notNullValue()));
+        assertThat(session.getRootNode(), is(notNullValue()));
+        // Create a child node ...
+        Node node = session.getRootNode().addNode("testnode", "nt:unstructured");
+        assertThat(node, is(notNullValue()));
+        assertThat(node.getName(), is("testnode"));
+        assertThat(node.getPath(), is("/testnode"));
+        // Save and close the session ...
+        session.save();
+        session.logout();
+
+        for (int i = 0; i != 3; ++i) {
+            // Create another session ...
+            session = getRepository().login(getTestCredentials());
+            assertThat(session, is(notNullValue()));
+            assertThat(session.getRootNode(), is(notNullValue()));
+            // Look for the child node ...
+            node = session.getRootNode().getNode("testnode");
+            assertThat(node, is(notNullValue()));
+            assertThat(node.getName(), is("testnode"));
+            assertThat(node.getPath(), is("/testnode"));
+            // Close the session ...
+            session.logout();
+        }
+
+    }
+
+}


Property changes on: trunk/extensions/dna-classloader-maven/src/test/java/org/jboss/dna/maven/TestAbstractJcrRepositoryTest.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: trunk/extensions/dna-classloader-maven/src/test/java/org/jboss/dna/maven/spi/JcrMavenUrlProviderTest.java
===================================================================
--- trunk/extensions/dna-classloader-maven/src/test/java/org/jboss/dna/maven/spi/JcrMavenUrlProviderTest.java	2009-05-21 22:26:25 UTC (rev 922)
+++ trunk/extensions/dna-classloader-maven/src/test/java/org/jboss/dna/maven/spi/JcrMavenUrlProviderTest.java	2009-05-22 02:15:19 UTC (rev 923)
@@ -34,8 +34,8 @@
 import java.net.URLConnection;
 import java.util.Properties;
 import javax.jcr.SimpleCredentials;
-import org.jboss.dna.common.jcr.AbstractJcrRepositoryTest;
 import org.jboss.dna.common.util.StringUtil;
+import org.jboss.dna.maven.AbstractJcrRepositoryTest;
 import org.jboss.dna.maven.ArtifactType;
 import org.jboss.dna.maven.MavenId;
 import org.jboss.dna.maven.SignatureType;
@@ -124,25 +124,40 @@
 
     @Test
     public void shouldDetermineProperPathGivenMavenIdAndArtifactType() {
-        assertThat(provider.getUrlPath(mavenId1, ArtifactType.JAR, null), is("/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.jar"));
-        assertThat(provider.getUrlPath(mavenId1, ArtifactType.JAR, SignatureType.MD5), is("/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.jar.md5"));
-        assertThat(provider.getUrlPath(mavenId1, ArtifactType.JAR, SignatureType.PGP), is("/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.jar.asc"));
-        assertThat(provider.getUrlPath(mavenId1, ArtifactType.JAR, SignatureType.SHA1), is("/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.jar.sha1"));
+        assertThat(provider.getUrlPath(mavenId1, ArtifactType.JAR, null),
+                   is("/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.jar"));
+        assertThat(provider.getUrlPath(mavenId1, ArtifactType.JAR, SignatureType.MD5),
+                   is("/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.jar.md5"));
+        assertThat(provider.getUrlPath(mavenId1, ArtifactType.JAR, SignatureType.PGP),
+                   is("/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.jar.asc"));
+        assertThat(provider.getUrlPath(mavenId1, ArtifactType.JAR, SignatureType.SHA1),
+                   is("/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.jar.sha1"));
 
-        assertThat(provider.getUrlPath(mavenId1, ArtifactType.SOURCE, null), is("/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT-sources.jar"));
-        assertThat(provider.getUrlPath(mavenId1, ArtifactType.SOURCE, SignatureType.MD5), is("/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT-sources.jar.md5"));
-        assertThat(provider.getUrlPath(mavenId1, ArtifactType.SOURCE, SignatureType.PGP), is("/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT-sources.jar.asc"));
-        assertThat(provider.getUrlPath(mavenId1, ArtifactType.SOURCE, SignatureType.SHA1), is("/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT-sources.jar.sha1"));
+        assertThat(provider.getUrlPath(mavenId1, ArtifactType.SOURCE, null),
+                   is("/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT-sources.jar"));
+        assertThat(provider.getUrlPath(mavenId1, ArtifactType.SOURCE, SignatureType.MD5),
+                   is("/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT-sources.jar.md5"));
+        assertThat(provider.getUrlPath(mavenId1, ArtifactType.SOURCE, SignatureType.PGP),
+                   is("/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT-sources.jar.asc"));
+        assertThat(provider.getUrlPath(mavenId1, ArtifactType.SOURCE, SignatureType.SHA1),
+                   is("/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT-sources.jar.sha1"));
 
-        assertThat(provider.getUrlPath(mavenId1, ArtifactType.POM, null), is("/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.pom"));
-        assertThat(provider.getUrlPath(mavenId1, ArtifactType.POM, SignatureType.MD5), is("/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.pom.md5"));
-        assertThat(provider.getUrlPath(mavenId1, ArtifactType.POM, SignatureType.PGP), is("/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.pom.asc"));
-        assertThat(provider.getUrlPath(mavenId1, ArtifactType.POM, SignatureType.SHA1), is("/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.pom.sha1"));
+        assertThat(provider.getUrlPath(mavenId1, ArtifactType.POM, null),
+                   is("/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.pom"));
+        assertThat(provider.getUrlPath(mavenId1, ArtifactType.POM, SignatureType.MD5),
+                   is("/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.pom.md5"));
+        assertThat(provider.getUrlPath(mavenId1, ArtifactType.POM, SignatureType.PGP),
+                   is("/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.pom.asc"));
+        assertThat(provider.getUrlPath(mavenId1, ArtifactType.POM, SignatureType.SHA1),
+                   is("/org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.pom.sha1"));
 
         assertThat(provider.getUrlPath(mavenId1, ArtifactType.METADATA, null), is("/org/jboss/dna/dna-maven/maven-metadata.xml"));
-        assertThat(provider.getUrlPath(mavenId1, ArtifactType.METADATA, SignatureType.MD5), is("/org/jboss/dna/dna-maven/maven-metadata.xml.md5"));
-        assertThat(provider.getUrlPath(mavenId1, ArtifactType.METADATA, SignatureType.PGP), is("/org/jboss/dna/dna-maven/maven-metadata.xml.asc"));
-        assertThat(provider.getUrlPath(mavenId1, ArtifactType.METADATA, SignatureType.SHA1), is("/org/jboss/dna/dna-maven/maven-metadata.xml.sha1"));
+        assertThat(provider.getUrlPath(mavenId1, ArtifactType.METADATA, SignatureType.MD5),
+                   is("/org/jboss/dna/dna-maven/maven-metadata.xml.md5"));
+        assertThat(provider.getUrlPath(mavenId1, ArtifactType.METADATA, SignatureType.PGP),
+                   is("/org/jboss/dna/dna-maven/maven-metadata.xml.asc"));
+        assertThat(provider.getUrlPath(mavenId1, ArtifactType.METADATA, SignatureType.SHA1),
+                   is("/org/jboss/dna/dna-maven/maven-metadata.xml.sha1"));
     }
 
     @Test
@@ -152,25 +167,41 @@
 
     @Test
     public void shouldReturnValidUrlForMavenIdAndArtifactTypeAndSignatureType() throws Exception {
-        assertThat(provider.getUrl(mavenId1, ArtifactType.JAR, null, false).toString(), is("jcr://org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.jar"));
-        assertThat(provider.getUrl(mavenId1, ArtifactType.JAR, SignatureType.MD5, false).toString(), is("jcr://org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.jar.md5"));
-        assertThat(provider.getUrl(mavenId1, ArtifactType.JAR, SignatureType.PGP, false).toString(), is("jcr://org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.jar.asc"));
-        assertThat(provider.getUrl(mavenId1, ArtifactType.JAR, SignatureType.SHA1, false).toString(), is("jcr://org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.jar.sha1"));
+        assertThat(provider.getUrl(mavenId1, ArtifactType.JAR, null, false).toString(),
+                   is("jcr://org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.jar"));
+        assertThat(provider.getUrl(mavenId1, ArtifactType.JAR, SignatureType.MD5, false).toString(),
+                   is("jcr://org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.jar.md5"));
+        assertThat(provider.getUrl(mavenId1, ArtifactType.JAR, SignatureType.PGP, false).toString(),
+                   is("jcr://org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.jar.asc"));
+        assertThat(provider.getUrl(mavenId1, ArtifactType.JAR, SignatureType.SHA1, false).toString(),
+                   is("jcr://org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.jar.sha1"));
 
-        assertThat(provider.getUrl(mavenId1, ArtifactType.SOURCE, null, false).toString(), is("jcr://org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT-sources.jar"));
-        assertThat(provider.getUrl(mavenId1, ArtifactType.SOURCE, SignatureType.MD5, false).toString(), is("jcr://org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT-sources.jar.md5"));
-        assertThat(provider.getUrl(mavenId1, ArtifactType.SOURCE, SignatureType.PGP, false).toString(), is("jcr://org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT-sources.jar.asc"));
-        assertThat(provider.getUrl(mavenId1, ArtifactType.SOURCE, SignatureType.SHA1, false).toString(), is("jcr://org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT-sources.jar.sha1"));
+        assertThat(provider.getUrl(mavenId1, ArtifactType.SOURCE, null, false).toString(),
+                   is("jcr://org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT-sources.jar"));
+        assertThat(provider.getUrl(mavenId1, ArtifactType.SOURCE, SignatureType.MD5, false).toString(),
+                   is("jcr://org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT-sources.jar.md5"));
+        assertThat(provider.getUrl(mavenId1, ArtifactType.SOURCE, SignatureType.PGP, false).toString(),
+                   is("jcr://org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT-sources.jar.asc"));
+        assertThat(provider.getUrl(mavenId1, ArtifactType.SOURCE, SignatureType.SHA1, false).toString(),
+                   is("jcr://org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT-sources.jar.sha1"));
 
-        assertThat(provider.getUrl(mavenId1, ArtifactType.POM, null, false).toString(), is("jcr://org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.pom"));
-        assertThat(provider.getUrl(mavenId1, ArtifactType.POM, SignatureType.MD5, false).toString(), is("jcr://org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.pom.md5"));
-        assertThat(provider.getUrl(mavenId1, ArtifactType.POM, SignatureType.PGP, false).toString(), is("jcr://org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.pom.asc"));
-        assertThat(provider.getUrl(mavenId1, ArtifactType.POM, SignatureType.SHA1, false).toString(), is("jcr://org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.pom.sha1"));
+        assertThat(provider.getUrl(mavenId1, ArtifactType.POM, null, false).toString(),
+                   is("jcr://org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.pom"));
+        assertThat(provider.getUrl(mavenId1, ArtifactType.POM, SignatureType.MD5, false).toString(),
+                   is("jcr://org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.pom.md5"));
+        assertThat(provider.getUrl(mavenId1, ArtifactType.POM, SignatureType.PGP, false).toString(),
+                   is("jcr://org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.pom.asc"));
+        assertThat(provider.getUrl(mavenId1, ArtifactType.POM, SignatureType.SHA1, false).toString(),
+                   is("jcr://org/jboss/dna/dna-maven/1.0-SNAPSHOT/dna-maven-1.0-SNAPSHOT.pom.sha1"));
 
-        assertThat(provider.getUrl(mavenId1, ArtifactType.METADATA, null, false).toString(), is("jcr://org/jboss/dna/dna-maven/maven-metadata.xml"));
-        assertThat(provider.getUrl(mavenId1, ArtifactType.METADATA, SignatureType.MD5, false).toString(), is("jcr://org/jboss/dna/dna-maven/maven-metadata.xml.md5"));
-        assertThat(provider.getUrl(mavenId1, ArtifactType.METADATA, SignatureType.PGP, false).toString(), is("jcr://org/jboss/dna/dna-maven/maven-metadata.xml.asc"));
-        assertThat(provider.getUrl(mavenId1, ArtifactType.METADATA, SignatureType.SHA1, false).toString(), is("jcr://org/jboss/dna/dna-maven/maven-metadata.xml.sha1"));
+        assertThat(provider.getUrl(mavenId1, ArtifactType.METADATA, null, false).toString(),
+                   is("jcr://org/jboss/dna/dna-maven/maven-metadata.xml"));
+        assertThat(provider.getUrl(mavenId1, ArtifactType.METADATA, SignatureType.MD5, false).toString(),
+                   is("jcr://org/jboss/dna/dna-maven/maven-metadata.xml.md5"));
+        assertThat(provider.getUrl(mavenId1, ArtifactType.METADATA, SignatureType.PGP, false).toString(),
+                   is("jcr://org/jboss/dna/dna-maven/maven-metadata.xml.asc"));
+        assertThat(provider.getUrl(mavenId1, ArtifactType.METADATA, SignatureType.SHA1, false).toString(),
+                   is("jcr://org/jboss/dna/dna-maven/maven-metadata.xml.sha1"));
     }
 
     @Test




More information about the dna-commits mailing list