Author: justin
Date: Thu Aug 16 02:03:49 2012
New Revision: 1373694
URL: http://svn.apache.org/viewvc?rev=1373694&view=rev
Log:
SLING-2561 - adding a configuration printer for repository descriptors
Added:
sling/trunk/bundles/jcr/webconsole/src/main/java/org/apache/sling/jcr/webconsole/internal/DescriptorsConfigurationPrinter.java
(with props)
Modified:
sling/trunk/bundles/jcr/webconsole/src/main/resources/OSGI-INF/metatype/metatype.properties
Added:
sling/trunk/bundles/jcr/webconsole/src/main/java/org/apache/sling/jcr/webconsole/internal/DescriptorsConfigurationPrinter.java
URL:
http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/webconsole/src/main/java/org/apache/sling/jcr/webconsole/internal/DescriptorsConfigurationPrinter.java?rev=1373694&view=auto
==============================================================================
---
sling/trunk/bundles/jcr/webconsole/src/main/java/org/apache/sling/jcr/webconsole/internal/DescriptorsConfigurationPrinter.java
(added)
+++
sling/trunk/bundles/jcr/webconsole/src/main/java/org/apache/sling/jcr/webconsole/internal/DescriptorsConfigurationPrinter.java
Thu Aug 16 02:03:49 2012
@@ -0,0 +1,74 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.jcr.webconsole.internal;
+
+import java.io.PrintWriter;
+
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Properties;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferencePolicy;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.felix.webconsole.ConfigurationPrinter;
+import org.apache.sling.jcr.api.SlingRepository;
+
+/**
+ * A Felix WebConsole ConfigurationPrinter which outputs the current JCR
+ * repository descriptors.
+ */
+@Component(label = "%descriptors.printer.name", description =
"%descriptors.printer.description", metatype = false)
+@Service(ConfigurationPrinter.class)
+@Properties({
+ @Property(name = "service.description", value = "JCR Descriptors
Configuration Printer"),
+ @Property(name = "service.vendor", value = "The Apache Software
Foundation")
+})
+public class DescriptorsConfigurationPrinter implements ConfigurationPrinter {
+
+
+ @Reference(policy=ReferencePolicy.DYNAMIC)
+ private SlingRepository slingRepository;
+
+ /**
+ * Get the title of the configuration status page.
+ *
+ * @return the title
+ */
+ public String getTitle() {
+ return "JCR Descriptors";
+ }
+
+ /**
+ * Output a list of repository descriptors.
+ *
+ * @param pw a PrintWriter
+ */
+ public void printConfiguration(PrintWriter pw) {
+ if (slingRepository != null) {
+ final String[] descriptorKeys =
slingRepository.getDescriptorKeys();
+ for (final String key : descriptorKeys) {
+ pw.printf("%s = %s\n", key,
slingRepository.getDescriptor(key));
+ }
+ } else {
+ pw.println("SlingRepository is not available.");
+ }
+
+ }
+
+}
Propchange:
sling/trunk/bundles/jcr/webconsole/src/main/java/org/apache/sling/jcr/webconsole/internal/DescriptorsConfigurationPrinter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
sling/trunk/bundles/jcr/webconsole/src/main/java/org/apache/sling/jcr/webconsole/internal/DescriptorsConfigurationPrinter.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision Rev URL
Modified:
sling/trunk/bundles/jcr/webconsole/src/main/resources/OSGI-INF/metatype/metatype.properties
URL:
http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/webconsole/src/main/resources/OSGI-INF/metatype/metatype.properties?rev=1373694&r1=1373693&r2=1373694&view=diff
==============================================================================
---
sling/trunk/bundles/jcr/webconsole/src/main/resources/OSGI-INF/metatype/metatype.properties
(original)
+++
sling/trunk/bundles/jcr/webconsole/src/main/resources/OSGI-INF/metatype/metatype.properties
Thu Aug 16 02:03:49 2012
@@ -29,3 +29,6 @@ namespace.printer.description = Namespac
nodetype.printer.name = NodeType Configuration Printer
nodetype.printer.description = NodeType Configuration Printer
+descriptors.printer.name = Repository Descriptors Configuration Printer
+nodetype.printer.description = Repository Descriptors Configuration Printer
+