[dna-commits] DNA SVN: r980 - trunk/dna-jcr/src/main/java/org/jboss/dna/jcr.

dna-commits at lists.jboss.org dna-commits at lists.jboss.org
Thu Jun 4 22:49:35 EDT 2009


Author: rhauch
Date: 2009-06-04 22:49:35 -0400 (Thu, 04 Jun 2009)
New Revision: 980

Modified:
   trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrEngine.java
Log:
DNA-389 Corrected how JcrEngine returns the names of the repositories, using the configuration to get all of them regardless of which Repository objects were used by the engine.

Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrEngine.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrEngine.java	2009-06-05 02:20:41 UTC (rev 979)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrEngine.java	2009-06-05 02:49:35 UTC (rev 980)
@@ -97,18 +97,22 @@
     }
 
     /**
-     * Get the names of the JCR repositories.
+     * Get the names of each of the JCR repositories.
      * 
      * @return the immutable names of the repositories that exist at the time this method is called
      */
     public Set<String> getRepositoryNames() {
         checkRunning();
-        try {
-            repositoriesLock.lock();
-            return Collections.unmodifiableSet(new HashSet<String>(repositories.keySet()));
-        } finally {
-            repositoriesLock.unlock();
+        Set<String> results = new HashSet<String>();
+        // Read the names of the JCR repositories from the configuration (not from the Repository objects used so far) ...
+        PathFactory pathFactory = getExecutionContext().getValueFactories().getPathFactory();
+        Path repositoriesPath = pathFactory.create(configuration.getPath(), DnaLexicon.REPOSITORIES);
+        Graph configuration = getConfigurationGraph();
+        for (Location child : configuration.getChildren().of(repositoriesPath)) {
+            Name repositoryName = child.getPath().getLastSegment().getName();
+            results.add(readable(repositoryName));
         }
+        return Collections.unmodifiableSet(results);
     }
 
     protected JcrRepository doCreateJcrRepository( String repositoryName ) throws RepositoryException, PathNotFoundException {




More information about the dna-commits mailing list