Switch to parent pom 29 and OSGi annotations

git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1769844 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/pom.xml b/pom.xml
index c942084..8e046fe 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
-        <version>26</version>
+        <version>29</version>
         <relativePath/>
     </parent>
 
@@ -81,20 +81,12 @@
             <scope>provided</scope>
         </dependency>
         <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.compendium</artifactId>
-        </dependency>
-        <dependency>
-        	<groupId>org.apache.felix</groupId>
-        	<artifactId>org.apache.felix.scr.annotations</artifactId>
-        </dependency>
-        <dependency>
         	<groupId>org.slf4j</groupId>
         	<artifactId>slf4j-api</artifactId>
         </dependency>
         <dependency>
         	<groupId>javax.servlet</groupId>
-        	<artifactId>servlet-api</artifactId>
+        	<artifactId>javax.servlet-api</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.commons</groupId>
diff --git a/src/main/java/org/apache/sling/resource/inventory/impl/ResourceInventoryPrinterFactory.java b/src/main/java/org/apache/sling/resource/inventory/impl/ResourceInventoryPrinterFactory.java
index 77148ad..a3618e4 100644
--- a/src/main/java/org/apache/sling/resource/inventory/impl/ResourceInventoryPrinterFactory.java
+++ b/src/main/java/org/apache/sling/resource/inventory/impl/ResourceInventoryPrinterFactory.java
@@ -19,50 +19,60 @@
 package org.apache.sling.resource.inventory.impl;
 
 import java.io.PrintWriter;
-import java.util.Map;
 
 import org.apache.felix.inventory.Format;
 import org.apache.felix.inventory.InventoryPrinter;
-import org.apache.felix.scr.annotations.Activate;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.ConfigurationPolicy;
-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.Service;
 import org.apache.sling.api.resource.LoginException;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ResourceResolver;
 import org.apache.sling.api.resource.ResourceResolverFactory;
 import org.apache.sling.commons.json.JSONException;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.ConfigurationPolicy;
+import org.osgi.service.component.annotations.Reference;
+import org.osgi.service.metatype.annotations.AttributeDefinition;
+import org.osgi.service.metatype.annotations.Designate;
+import org.osgi.service.metatype.annotations.ObjectClassDefinition;
 import org.slf4j.LoggerFactory;
 
-@Component(configurationFactory=true, policy=ConfigurationPolicy.REQUIRE, metatype=true)
-@Service(value=InventoryPrinter.class)
-@Properties({
-    @Property(name=InventoryPrinter.FORMAT, value="JSON", propertyPrivate=true),
-    @Property(name=InventoryPrinter.NAME),
-    @Property(name=InventoryPrinter.TITLE),
-    @Property(name=InventoryPrinter.WEBCONSOLE, boolValue=false, propertyPrivate=true)
-})
+@Component(service = InventoryPrinter.class,
+           configurationPolicy=ConfigurationPolicy.REQUIRE,
+           property = {
+                   InventoryPrinter.FORMAT + "=JSON",
+                   InventoryPrinter.WEBCONSOLE + ":Boolean=false"
+           })
+@Designate(ocd=ResourceInventoryPrinterFactory.Config.class, factory=true)
 public class ResourceInventoryPrinterFactory implements InventoryPrinter {
 
-    @Property(value = "")
-    private static final String PROP_PATH = "path";
+    @ObjectClassDefinition(name = "Apache Sling Resource Inventory Printer Factory",
+                           description = "This factory can be used to add " +
+                                         "resource trees to the inventory of the system.")
+    public @interface Config {
 
-    private String path;
+        @AttributeDefinition(name="Name", description="The unique name of the inventory printer.")
+        String felix_inventory_printer_name();
 
-    @Activate
-    protected void activate(final Map<String, Object> props) {
-        this.path = (String)props.get(PROP_PATH);
+        @AttributeDefinition(name="Title", description="The title of the inventory printer.")
+        String felix_inventory_printer_title();
+
+        @AttributeDefinition(name="Path", description="The resource path to include.")
+        String path() default "";
     }
+    private String path;
 
     @Reference
     private ResourceResolverFactory factory;
 
+    @Activate
+    protected void activate(final Config config) {
+        this.path = config.path();
+    }
+
     /**
      * @see org.apache.felix.inventory.InventoryPrinter#print(java.io.PrintWriter, org.apache.felix.inventory.Format, boolean)
      */
+    @Override
     public void print(PrintWriter printWriter, Format format, boolean isZip) {
         if ( this.path == null || !format.equals(Format.JSON) ) {
             return;
diff --git a/src/main/resources/OSGI-INF/metatype/metatype.properties b/src/main/resources/OSGI-INF/metatype/metatype.properties
deleted file mode 100644
index 7850046..0000000
--- a/src/main/resources/OSGI-INF/metatype/metatype.properties
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-#  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.
-#
-
-#
-# This file contains localization strings for configuration labels and
-# descriptions as used in the metatype.xml descriptor generated by the
-# the SCR plugin
-
-org.apache.sling.resource.inventory.impl.ResourceInventoryPrinterFactory.name=Apache Sling Resource Inventory Printer Factory
-org.apache.sling.resource.inventory.impl.ResourceInventoryPrinterFactory.desription=This factory can be used to add \
- resource trees to the inventory of the system.
-
-felix.inventory.printer.name.name=Name
-felix.inventory.printer.name.description=The unique name of the inventory printer.
-
-felix.inventory.printer.title.name=Title
-felix.inventory.printer.title.description=The title of the inventory printer.
-
-path.name=Path
-path.description=The resource path to include.