incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jus...@apache.org
Subject svn commit: r908099 - /sling/trunk/bundles/jcr/webconsole/src/main/java/org/apache/sling/jcr/webconsole/internal/NamespaceConfigurationPrinter.java
Date Tue, 09 Feb 2010 16:12:54 GMT
Author: justin
Date: Tue Feb  9 16:12:54 2010
New Revision: 908099

URL: http://svn.apache.org/viewvc?rev=908099&view=rev
Log:
SLING-1362 - adding [global] or [local] to printed lines

Modified:
    sling/trunk/bundles/jcr/webconsole/src/main/java/org/apache/sling/jcr/webconsole/internal/NamespaceConfigurationPrinter.java

Modified: sling/trunk/bundles/jcr/webconsole/src/main/java/org/apache/sling/jcr/webconsole/internal/NamespaceConfigurationPrinter.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/webconsole/src/main/java/org/apache/sling/jcr/webconsole/internal/NamespaceConfigurationPrinter.java?rev=908099&r1=908098&r2=908099&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/webconsole/src/main/java/org/apache/sling/jcr/webconsole/internal/NamespaceConfigurationPrinter.java
(original)
+++ sling/trunk/bundles/jcr/webconsole/src/main/java/org/apache/sling/jcr/webconsole/internal/NamespaceConfigurationPrinter.java
Tue Feb  9 16:12:54 2010
@@ -19,9 +19,12 @@
 package org.apache.sling.jcr.webconsole.internal;
 
 import java.io.PrintWriter;
+import java.util.Arrays;
+import java.util.List;
 
 import javax.jcr.NamespaceRegistry;
 import javax.jcr.RepositoryException;
+import javax.jcr.Session;
 
 import org.apache.felix.webconsole.ConfigurationPrinter;
 import org.apache.sling.jcr.api.SlingRepository;
@@ -63,11 +66,17 @@
     public void printConfiguration(PrintWriter pw) {
         if (slingRepository != null) {
             try {
-                NamespaceRegistry reg = slingRepository.loginAdministrative(slingRepository.getDefaultWorkspace()).getWorkspace()
-                        .getNamespaceRegistry();
-                for (String prefix : reg.getPrefixes()) {
+                Session session = slingRepository.loginAdministrative(null);
+                NamespaceRegistry reg = session.getWorkspace().getNamespaceRegistry();
+                List<String> globalPrefixes = Arrays.asList(reg.getPrefixes());
+                for (String prefix : session.getNamespacePrefixes()) {
                     if (prefix.length() > 0) {
-                        pw.printf("%10s = %s", prefix, reg.getURI(prefix));
+                        pw.printf("%10s = %s", prefix, session.getNamespaceURI(prefix));
+                        if (globalPrefixes.contains(prefix)) {
+                            pw.print(" [global]");
+                        } else {
+                            pw.print(" [local]");
+                        }
                         pw.println();
                     }
                 }



Mime
View raw message