diff --git a/scrplugin/annotations/NOTICE b/scrplugin/annotations/NOTICE
index cf782a9..d342d0e 100644
--- a/scrplugin/annotations/NOTICE
+++ b/scrplugin/annotations/NOTICE
@@ -1,5 +1,5 @@
 Apache Felix SCR Annotations
-Copyright 2007-2011 The Apache Software Foundation
+Copyright 2007-2012 The Apache Software Foundation
 
 This product includes software developed at
 The Apache Software Foundation (http://www.apache.org/).
diff --git a/scrplugin/annotations/pom.xml b/scrplugin/annotations/pom.xml
index b9a16e0..c6b4ed8 100644
--- a/scrplugin/annotations/pom.xml
+++ b/scrplugin/annotations/pom.xml
@@ -29,7 +29,7 @@
     <groupId>org.apache.felix</groupId>
     <artifactId>org.apache.felix.scr.annotations</artifactId>
 
-    <version>1.6.1-SNAPSHOT</version>
+    <version>1.7.0-SNAPSHOT</version>
     <packaging>jar</packaging>
 
     <name>Annotations for SCR</name>
@@ -47,7 +47,7 @@
         <dependency>
             <groupId>org.apache.felix</groupId>
             <artifactId>org.apache.felix.scr.generator</artifactId>
-            <version>1.1.2</version>
+            <version>1.2.0-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
     </dependencies>
diff --git a/scrplugin/annotations/src/main/java/org/apache/felix/scr/annotations/Component.java b/scrplugin/annotations/src/main/java/org/apache/felix/scr/annotations/Component.java
index 20035fd..32bc929 100644
--- a/scrplugin/annotations/src/main/java/org/apache/felix/scr/annotations/Component.java
+++ b/scrplugin/annotations/src/main/java/org/apache/felix/scr/annotations/Component.java
@@ -18,7 +18,10 @@
  */
 package org.apache.felix.scr.annotations;
 
-import java.lang.annotation.*;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
 
 /**
  * The <code>Component</code> annotation is the only required annotation. If
diff --git a/scrplugin/annotations/src/main/java/org/apache/felix/scr/annotations/PropertyOption.java b/scrplugin/annotations/src/main/java/org/apache/felix/scr/annotations/PropertyOption.java
index ff3397a..eba8dbd 100644
--- a/scrplugin/annotations/src/main/java/org/apache/felix/scr/annotations/PropertyOption.java
+++ b/scrplugin/annotations/src/main/java/org/apache/felix/scr/annotations/PropertyOption.java
@@ -18,12 +18,15 @@
  */
 package org.apache.felix.scr.annotations;
 
-import java.lang.annotation.*;
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
 
 /**
  * Defines a {@link Property} option.
  */
-@Property(options=@PropertyOption(name="you",value="something"))
 @Target(ElementType.ANNOTATION_TYPE)
 @Retention(RetentionPolicy.CLASS)
 @Documented
diff --git a/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/SCRAnnotationProcessor.java b/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/SCRAnnotationProcessor.java
new file mode 100644
index 0000000..4cf9678
--- /dev/null
+++ b/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/SCRAnnotationProcessor.java
@@ -0,0 +1,438 @@
+/*
+ * 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.felix.scrplugin;
+
+import java.lang.reflect.Array;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.AutoDetect;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Modified;
+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.felix.scr.annotations.Services;
+import org.apache.felix.scrplugin.description.ClassDescription;
+import org.apache.felix.scrplugin.description.ComponentConfigurationPolicy;
+import org.apache.felix.scrplugin.description.ComponentDescription;
+import org.apache.felix.scrplugin.description.MethodDescription;
+import org.apache.felix.scrplugin.description.PropertyDescription;
+import org.apache.felix.scrplugin.description.PropertyType;
+import org.apache.felix.scrplugin.description.PropertyUnbounded;
+import org.apache.felix.scrplugin.description.ReferenceCardinality;
+import org.apache.felix.scrplugin.description.ReferenceDescription;
+import org.apache.felix.scrplugin.description.ReferencePolicy;
+import org.apache.felix.scrplugin.description.ReferenceStrategy;
+import org.apache.felix.scrplugin.description.ServiceDescription;
+import org.apache.felix.scrplugin.description.SpecVersion;
+import org.apache.felix.scrplugin.scanner.ClassAnnotation;
+import org.apache.felix.scrplugin.scanner.FieldAnnotation;
+import org.apache.felix.scrplugin.scanner.MethodAnnotation;
+import org.apache.felix.scrplugin.scanner.ScannedAnnotation;
+import org.apache.felix.scrplugin.scanner.ScannedClass;
+
+/**
+ * This is the processor for the Apache Felix SCR annotations.
+ */
+public class SCRAnnotationProcessor implements AnnotationProcessor {
+
+    /**
+     * @throws SCRDescriptorException
+     * @throws SCRDescriptorFailureException
+     * @see org.apache.felix.scrplugin.AnnotationProcessor#process(ScannedClass, ClassDescription)
+     */
+    public void process(final ScannedClass scannedClass, final ClassDescription describedClass)
+                    throws SCRDescriptorFailureException, SCRDescriptorException {
+
+        final List<ClassAnnotation> componentTags = scannedClass.getClassAnnotations(Component.class.getName());
+        scannedClass.processed(componentTags);
+
+        for (final ClassAnnotation cad : componentTags) {
+            describedClass.add(createComponent(cad, scannedClass));
+        }
+
+        // search for the component descriptions and use the first one
+        final List<ComponentDescription> componentDescs = describedClass.getDescriptions(ComponentDescription.class);
+        ComponentDescription found = null;
+        if (!componentDescs.isEmpty()) {
+            found = componentDescs.get(0);
+        }
+
+        if (found != null) {
+            final ComponentDescription cd = found;
+
+            // search for methods
+            final List<MethodAnnotation> methodTags = scannedClass.getMethodAnnotations(null);
+            for (final MethodAnnotation m : methodTags) {
+                if (m.getName().equals(Activate.class.getName())) {
+                    cd.setActivate(new MethodDescription(m.getAnnotatedMethod()));
+                    scannedClass.processed(m);
+                } else if (m.getName().equals(Deactivate.class.getName())) {
+                    cd.setDeactivate(new MethodDescription(m.getAnnotatedMethod()));
+                    scannedClass.processed(m);
+                } else if (m.getName().equals(Modified.class.getName())) {
+                    cd.setModified(new MethodDescription(m.getAnnotatedMethod()));
+                    scannedClass.processed(m);
+                }
+            }
+
+        }
+
+        // service tags
+        final List<ClassAnnotation> allServiceTags = new ArrayList<ClassAnnotation>();
+        final List<ClassAnnotation> serviceTags = scannedClass.getClassAnnotations(Service.class.getName());
+        if (serviceTags.size() > 0) {
+            scannedClass.processed(serviceTags);
+            allServiceTags.addAll(serviceTags);
+        }
+        // services tags - class level
+        final List<ClassAnnotation> servicesTags = scannedClass.getClassAnnotations(Services.class.getName());
+        if (servicesTags.size() > 0) {
+            scannedClass.processed(servicesTags);
+            for (final ClassAnnotation cad : servicesTags) {
+                final ClassAnnotation[] values = (ClassAnnotation[]) cad.getValue("value");
+                if (values != null) {
+                    allServiceTags.addAll(Arrays.asList(values));
+                }
+            }
+        }
+        if (allServiceTags.size() > 0) {
+            describedClass.add(createService(allServiceTags, scannedClass));
+        }
+
+        // reference - class level
+        final List<ClassAnnotation> refClassTags = scannedClass.getClassAnnotations(Reference.class.getName());
+        scannedClass.processed(refClassTags);
+        createReferences(refClassTags, describedClass);
+
+        // reference - field level
+        final List<FieldAnnotation> refFieldTags = scannedClass.getFieldAnnotations(Reference.class.getName());
+        scannedClass.processed(refFieldTags);
+        createReferences(refFieldTags, describedClass);
+
+        // properties - class level
+        final List<ClassAnnotation> propsClassTags = scannedClass.getClassAnnotations(Properties.class.getName());
+        scannedClass.processed(propsClassTags);
+        for (final ClassAnnotation cad : propsClassTags) {
+            final ClassAnnotation[] values = (ClassAnnotation[]) cad.getValue("value");
+            if (values != null) {
+                createProperties(Arrays.asList(values), describedClass);
+            }
+        }
+
+        // property - class level
+        final List<ClassAnnotation> propClassTags = scannedClass.getClassAnnotations(Property.class.getName());
+        scannedClass.processed(propClassTags);
+        createProperties(propClassTags, describedClass);
+
+        // property - field level
+        final List<FieldAnnotation> propFieldTags = scannedClass.getFieldAnnotations(Property.class.getName());
+        scannedClass.processed(propFieldTags);
+        createProperties(propFieldTags, describedClass);
+    }
+
+    /**
+     * @see org.apache.felix.scrplugin.AnnotationProcessor#getRanking()
+     */
+    public int getRanking() {
+        return 1000;
+    }
+
+    /**
+     * Create a component description.
+     *
+     * @param cad
+     *            The component annotation for the class.
+     * @param scannedClass
+     *            The scanned class.
+     */
+    private ComponentDescription createComponent(final ClassAnnotation cad, final ScannedClass scannedClass) {
+        final ComponentDescription component = new ComponentDescription(cad);
+
+        final boolean classIsAbstract = Modifier.isAbstract(scannedClass.getClass().getModifiers());
+        component.setAbstract(cad.getBooleanValue("componentAbstract", classIsAbstract));
+
+        component.setCreatePid(cad.getBooleanValue("createPid", true));
+
+        component.setName(cad.getStringValue("name", scannedClass.getScannedClass().getName()));
+
+        component.setLabel(cad.getStringValue("label", null));
+        component.setDescription(cad.getStringValue("description", null));
+
+        component.setCreateDs(cad.getBooleanValue("ds", true));
+
+        component.setCreateMetatype(cad.getBooleanValue("metatype", false));
+
+        if (cad.getValue("enabled") != null) {
+            component.setEnabled(cad.getBooleanValue("enabled", true));
+        }
+        if (cad.getValue("specVersion") != null) {
+            component.setSpecVersion(SpecVersion.fromName(cad.getValue("specVersion").toString()));
+        }
+        component.setFactory(cad.getStringValue("factory", null));
+        // FELIX-593: immediate attribute does not default to true all the
+        // times hence we only set it if declared in the tag
+        if (cad.getValue("immediate") != null) {
+            component.setEnabled(cad.getBooleanValue("immediate", false));
+        }
+        component.setInherit(cad.getBooleanValue("inherit", true));
+        component.setConfigurationPolicy(ComponentConfigurationPolicy.valueOf(cad.getEnumValue("policy",
+                        ComponentConfigurationPolicy.OPTIONAL.name())));
+        component.setSetMetatypeFactoryPid(cad.getBooleanValue("configurationFactory", false));
+
+        return component;
+    }
+
+    /**
+     * Create a service description
+     *
+     * @param descs
+     *            The service annotations.
+     * @param scannedClass
+     *            The scanned class
+     */
+    private ServiceDescription createService(final List<ClassAnnotation> descs, final ScannedClass scannedClass) {
+        final ServiceDescription service = new ServiceDescription(descs.get(0));
+
+        final List<String> listedInterfaces = new ArrayList<String>();
+        for (final ClassAnnotation d : descs) {
+            if (d.getBooleanValue("serviceFactory", false)) {
+                service.setServiceFactory(true);
+            }
+            if (d.getValue("value") != null) {
+                final String[] interfaces = (String[]) d.getValue("value");
+                for (String t : interfaces) {
+                    listedInterfaces.add(t);
+                }
+            }
+        }
+
+        if (listedInterfaces.size() > 0 && !listedInterfaces.contains(AutoDetect.class.getName())) {
+            for (final String i : listedInterfaces) {
+                service.addInterface(i);
+            }
+        } else {
+            // auto detection
+            addInterfaces(service, scannedClass.getScannedClass());
+        }
+
+        return service;
+    }
+
+    /**
+     * Recursively add interfaces to the service.
+     */
+    private void addInterfaces(final ServiceDescription service, final Class<?> javaClass) {
+        if (javaClass != null) {
+            final Class<?>[] interfaces = javaClass.getInterfaces();
+            for (final Class<?> i : interfaces) {
+                service.addInterface(i.getName());
+                // recursivly add interfaces implemented by this interface
+                this.addInterfaces(service, i);
+            }
+
+            // try super class
+            this.addInterfaces(service, javaClass.getSuperclass());
+        }
+    }
+
+    /**
+     * Create a method description if a name is provided.
+     *
+     * @param methodName
+     *            The name of the method or <code>null</code>
+     * @return A method description if the name is not null.
+     */
+    private MethodDescription getMethodDescription(final String methodName) {
+        if (methodName != null) {
+            return new MethodDescription(methodName);
+        }
+        return null;
+    }
+
+    /**
+     * Create reference descriptions
+     *
+     * @param descs
+     *            List of reference annotations.s
+     * @param describedClass
+     *            The described class.
+     */
+    private void createReferences(final List<? extends ScannedAnnotation> descs, final ClassDescription describedClass) {
+        for (final ScannedAnnotation ad : descs) {
+            final ReferenceDescription ref = new ReferenceDescription(ad);
+
+            // check for field annotation
+            final FieldAnnotation fieldAnnotation;
+            if (ad instanceof FieldAnnotation) {
+                fieldAnnotation = (FieldAnnotation) ad;
+                ref.setField(fieldAnnotation.getAnnotatedField());
+            } else {
+                fieldAnnotation = null;
+            }
+
+            ref.setName(ad.getStringValue("name",
+                            (fieldAnnotation != null ? fieldAnnotation.getAnnotatedField().getName() : null)));
+            ref.setInterfaceName(ad.getStringValue("referenceInterface", (fieldAnnotation != null ? fieldAnnotation
+                            .getAnnotatedField().getType().getName() : null)));
+            ref.setTarget(ad.getStringValue("target", null));
+            ref.setCardinality(ReferenceCardinality.valueOf(ad.getEnumValue("cardinality",
+                            ReferenceCardinality.MANDATORY_UNARY.name())));
+            ref.setPolicy(ReferencePolicy.valueOf(ad.getEnumValue("policy", ReferencePolicy.STATIC.name())));
+            ref.setStrategy(ReferenceStrategy.valueOf(ad.getEnumValue("strategy", ReferenceStrategy.EVENT.name())));
+
+            ref.setBind(getMethodDescription(ad.getStringValue("bind", null)));
+            ref.setUnbind(getMethodDescription(ad.getStringValue("unbind", null)));
+            ref.setUpdated(getMethodDescription(ad.getStringValue("updated", null)));
+
+            describedClass.add(ref);
+        }
+    }
+
+    private static final String[] PROPERTY_VALUE_PROCESSING = new String[] { "String", "value", "String", "classValue", "Long",
+            "longValue", "Double", "doubleValue", "Float", "floatValue", "Integer", "intValue", "Byte", "byteValue", "Char",
+            "charValue", "Boolean", "boolValue", "Short", "shortValue" };
+
+    /**
+     * Create properties descriptions
+     *
+     * @throws SCRDescriptorException
+     * @throws SCRDescriptorFailureException
+     */
+    private void createProperties(final List<? extends ScannedAnnotation> descs, final ClassDescription describedClass)
+                    throws SCRDescriptorFailureException, SCRDescriptorException {
+        for (final ScannedAnnotation ad : descs) {
+            final PropertyDescription prop = new PropertyDescription(ad);
+
+            // check for field annotation
+            final FieldAnnotation fieldAnnotation;
+            if (ad instanceof FieldAnnotation) {
+                fieldAnnotation = (FieldAnnotation) ad;
+            } else {
+                fieldAnnotation = null;
+            }
+
+            // Detect values from annotation
+            String type = null;
+            String[] values = null;
+            int index = 0;
+            while (type == null && index < PROPERTY_VALUE_PROCESSING.length) {
+                final String propType = PROPERTY_VALUE_PROCESSING[index];
+                final String propName = PROPERTY_VALUE_PROCESSING[index + 1];
+                final Object propValue = ad.getValue(propName);
+                if (propValue != null && propValue.getClass().isArray()) {
+                    type = propType;
+                    values = new String[Array.getLength(propValue)];
+                    for (int i = 0; i < values.length; i++) {
+                        values[i] = Array.get(propValue, i).toString();
+                    }
+                }
+                index += 2;
+            }
+
+            if (values != null) {
+                prop.setType(PropertyType.valueOf(type));
+                if (values.length == 1) {
+                    prop.setValue(values[0]);
+                } else {
+                    prop.setMultiValue(values);
+                }
+            } else if (fieldAnnotation != null) {
+
+                // Detect values from field
+                final Object value = fieldAnnotation.getAnnotatedFieldValue();
+                if (value != null) {
+                    if (value.getClass().isArray()) {
+                        values = new String[Array.getLength(value)];
+                        for (int i = 0; i < values.length; i++) {
+                            values[i] = Array.get(value, i).toString();
+                        }
+                        prop.setMultiValue(values);
+                        prop.setType(PropertyType.from(Array.get(value, 0).getClass()));
+                    } else {
+                        prop.setType(PropertyType.from(value.getClass()));
+                        prop.setValue(value.toString());
+                    }
+                }
+            }
+
+            final String defaultName;
+            if (fieldAnnotation != null) {
+                if (values == null) {
+                    defaultName = fieldAnnotation.getAnnotatedField().getName();
+                } else {
+                    final Object value = fieldAnnotation.getAnnotatedFieldValue();
+                    if (value != null) {
+                        defaultName = value.toString();
+                    } else {
+                        defaultName = null;
+                    }
+                }
+            } else {
+                defaultName = null;
+            }
+            prop.setName(ad.getStringValue("name", defaultName));
+            prop.setLabel(ad.getStringValue("label", null));
+            prop.setDescription(ad.getStringValue("description", null));
+
+            // check type
+            if ( prop.getType() == null ) {
+                prop.setType(PropertyType.String);
+            }
+
+            // private
+            if ( ad.getValue("propertyPrivate") != null ) {
+                prop.setPrivate(ad.getBooleanValue("propertyPrivate", false));
+            }
+
+            // cardinality handling
+            final PropertyUnbounded pu = PropertyUnbounded
+                            .valueOf(ad.getEnumValue("unbounded", PropertyUnbounded.DEFAULT.name()));
+            prop.setUnbounded(pu);
+
+            if (pu == PropertyUnbounded.DEFAULT) {
+                prop.setCardinality(ad.getIntegerValue("cardinality", 0));
+                if (prop.getMultiValue() != null && prop.getCardinality() == 0) {
+                    prop.setUnbounded(PropertyUnbounded.ARRAY);
+                }
+            } else {
+                prop.setCardinality(0);
+            }
+
+            // options
+            final ClassAnnotation[] options = (ClassAnnotation[])ad.getValue("options");
+            if (options != null) {
+                final List<String> propertyOptions = new ArrayList<String>();
+                for(final ClassAnnotation po : options) {
+                    propertyOptions.add(po.getStringValue("name", ""));
+                    propertyOptions.add(po.getStringValue("value", ""));
+                }
+                prop.setOptions(propertyOptions.toArray(new String[propertyOptions.size()]));
+            }
+
+            describedClass.add(prop);
+        }
+    }
+}
diff --git a/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/SlingAnnotationProcessor.java b/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/SlingAnnotationProcessor.java
new file mode 100644
index 0000000..19c08af
--- /dev/null
+++ b/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/SlingAnnotationProcessor.java
@@ -0,0 +1,200 @@
+/*
+ * 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.felix.scrplugin;
+
+import java.util.List;
+
+import org.apache.felix.scr.annotations.sling.SlingFilter;
+import org.apache.felix.scr.annotations.sling.SlingFilterScope;
+import org.apache.felix.scr.annotations.sling.SlingServlet;
+import org.apache.felix.scrplugin.description.ClassDescription;
+import org.apache.felix.scrplugin.description.ComponentConfigurationPolicy;
+import org.apache.felix.scrplugin.description.ComponentDescription;
+import org.apache.felix.scrplugin.description.PropertyDescription;
+import org.apache.felix.scrplugin.description.PropertyType;
+import org.apache.felix.scrplugin.description.ServiceDescription;
+import org.apache.felix.scrplugin.scanner.ClassAnnotation;
+import org.apache.felix.scrplugin.scanner.ScannedClass;
+
+/**
+ * This is the processor for the Apache Felix Sling annotations.
+ */
+public class SlingAnnotationProcessor implements AnnotationProcessor {
+
+    /**
+     * @see org.apache.felix.scrplugin.AnnotationProcessor#process(ScannedClass, ClassDescription)
+     */
+    public void process(final ScannedClass scannedClass,
+                        final ClassDescription describedClass)
+    throws SCRDescriptorFailureException, SCRDescriptorException {
+
+        final List<ClassAnnotation> servlets = scannedClass.getClassAnnotations(SlingServlet.class.getName());
+        scannedClass.processed(servlets);
+
+        for(final ClassAnnotation cad : servlets) {
+            processSlingServlet(cad, describedClass);
+        }
+
+        final List<ClassAnnotation> filters = scannedClass.getClassAnnotations(SlingFilter.class.getName());
+        scannedClass.processed(filters);
+
+        for(final ClassAnnotation cad : filters) {
+            processSlingFilter(cad, describedClass);
+        }
+
+    }
+
+    /**
+     * @see org.apache.felix.scrplugin.AnnotationProcessor#getRanking()
+     */
+    public int getRanking() {
+        return 500;
+    }
+
+    /**
+     * Process SlingServlet
+     */
+    private void processSlingServlet(final ClassAnnotation cad, final ClassDescription classDescription) {
+        // generate ComponentDescription if required
+        final boolean generateComponent = cad.getBooleanValue("generateComponent", true);
+        if (generateComponent) {
+            final ComponentDescription cd = new ComponentDescription(cad);
+            cd.setName(cad.getStringValue("name", classDescription.getDescribedClass().getName()));
+            cd.setConfigurationPolicy(ComponentConfigurationPolicy.OPTIONAL);
+
+            cd.setLabel(cad.getStringValue("label", null));
+            cd.setDescription(cad.getStringValue("description", null));
+
+            cd.setCreateMetatype(cad.getBooleanValue("metatype", false));
+
+            classDescription.add(cd);
+        }
+
+        // generate ServiceDescription if required
+        final boolean generateService = cad.getBooleanValue("generateService", true);
+        if (generateService) {
+            final ServiceDescription sd = new ServiceDescription(cad);
+            sd.addInterface("javax.servlet.Servlet");
+            classDescription.add(sd);
+        }
+
+        // generate PropertyDescriptions
+        // {@see org.apache.sling.servlets.resolver.internal.ServletResolverConstants.SLING_SERVLET_PATHS}
+        final String[] paths = (String[])cad.getValue("paths");
+        if ( paths != null ) {
+            final PropertyDescription pd = new PropertyDescription(cad);
+            pd.setName("sling.servlet.paths");
+            pd.setMultiValue(paths);
+            pd.setType(PropertyType.String);
+            pd.setPrivate(true);
+            classDescription.add(pd);
+        }
+
+        // {@see org.apache.sling.servlets.resolver.internal.ServletResolverConstants.SLING_SERVLET_RESOURCE_TYPES}
+        final String[] resourceTypes = (String[])cad.getValue("resourceTypes");
+        if ( resourceTypes != null ) {
+            final PropertyDescription pd = new PropertyDescription(cad);
+            pd.setName("sling.servlet.resourceTypes");
+            pd.setMultiValue(resourceTypes);
+            pd.setType(PropertyType.String);
+            pd.setPrivate(true);
+            classDescription.add(pd);
+        }
+
+        // {@see org.apache.sling.servlets.resolver.internal.ServletResolverConstants.SLING_SERVLET_SELECTORS}
+        final String[] selectors = (String[])cad.getValue("selectors");
+        if (selectors != null ) {
+            final PropertyDescription pd = new PropertyDescription(cad);
+            pd.setName("sling.servlet.selectors");
+            pd.setMultiValue(selectors);
+            pd.setType(PropertyType.String);
+            pd.setPrivate(true);
+            classDescription.add(pd);
+        }
+
+        // {@see org.apache.sling.servlets.resolver.internal.ServletResolverConstants.SLING_SERVLET_EXTENSIONS}
+        final String[] extensions = (String[])cad.getValue("extensions");
+        if (extensions != null ) {
+            final PropertyDescription pd = new PropertyDescription(cad);
+            pd.setName("sling.servlet.extensions");
+            pd.setMultiValue(extensions);
+            pd.setType(PropertyType.String);
+            pd.setPrivate(true);
+            classDescription.add(pd);
+        }
+
+        // {@see org.apache.sling.servlets.resolver.internal.ServletResolverConstants.SLING_SERVLET_METHODS}
+        final String[] methods = (String[])cad.getValue("methods");
+        if (methods != null ) {
+            final PropertyDescription pd = new PropertyDescription(cad);
+            pd.setName("sling.servlet.methods");
+            pd.setMultiValue(methods);
+            pd.setType(PropertyType.String);
+            pd.setPrivate(true);
+            classDescription.add(pd);
+        }
+    }
+
+    /**
+     * Process SlingFilter
+     */
+    private void processSlingFilter(final ClassAnnotation cad, final ClassDescription classDescription) {
+        // generate ComponentDescription if required
+        final boolean generateComponent = cad.getBooleanValue("generateComponent", true);
+        if (generateComponent) {
+            final ComponentDescription cd = new ComponentDescription(cad);
+            cd.setName(cad.getStringValue("name", classDescription.getDescribedClass().getName()));
+            cd.setConfigurationPolicy(ComponentConfigurationPolicy.OPTIONAL);
+
+            cd.setLabel(cad.getStringValue("label", null));
+            cd.setDescription(cad.getStringValue("description", null));
+
+            cd.setCreateMetatype(cad.getBooleanValue("metatype", false));
+
+            classDescription.add(cd);
+        }
+
+        // generate ServiceDescription if required
+        final boolean generateService = cad.getBooleanValue("generateService", true);
+        if (generateService) {
+            final ServiceDescription sd = new ServiceDescription(cad);
+            sd.addInterface("javax.servlet.Filter");
+            classDescription.add(sd);
+        }
+
+        // generate PropertyDescriptions
+        // property order = service.ranking
+        final int order = cad.getIntegerValue("order", 0);
+        final PropertyDescription pd = new PropertyDescription(cad);
+        pd.setName("service.ranking");
+        pd.setValue(String.valueOf(order));
+        pd.setType(PropertyType.Integer);
+        pd.setPrivate(true);
+        classDescription.add(pd);
+
+        // property scope
+        final String scope = cad.getEnumValue("scope", SlingFilterScope.REQUEST.getScope());
+        final PropertyDescription pd2 = new PropertyDescription(cad);
+        pd2.setName("sling.filter.scope");
+        pd2.setValue(scope);
+        pd2.setType(PropertyType.String);
+        pd.setPrivate(true);
+        classDescription.add(pd2);
+    }
+}
diff --git a/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/ComponentTag.java b/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/ComponentTag.java
deleted file mode 100644
index 669e45a..0000000
--- a/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/ComponentTag.java
+++ /dev/null
@@ -1,179 +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.
- */
-package org.apache.felix.scrplugin.tags.annotation.defaulttag;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.felix.scr.annotations.*;
-import org.apache.felix.scrplugin.Constants;
-import org.apache.felix.scrplugin.tags.JavaClassDescription;
-import org.apache.felix.scrplugin.tags.annotation.AbstractTag;
-import org.apache.felix.scrplugin.tags.annotation.Util;
-
-import com.thoughtworks.qdox.model.Annotation;
-import com.thoughtworks.qdox.model.JavaMethod;
-
-/**
- * Description of a java tag for components.
- */
-public class ComponentTag extends AbstractTag {
-
-    protected final Component annotation;
-
-    /**
-     * @param annotation Annotation
-     * @param desc Description
-     */
-    public ComponentTag(final Annotation annotation, final JavaClassDescription desc) {
-        super(annotation, desc, null);
-        this.annotation = new Component() {
-
-            public boolean componentAbstract() {
-                final String[] sValues = Util.getAnnotationValues(annotation, "componentAbstract", desc);
-                if ( sValues != null )
-                {
-                    return Boolean.valueOf(sValues[0]);
-                }
-                return desc.isAbstract();
-            }
-
-            public boolean createPid() {
-                return Util.getBooleanValue(annotation, desc, "createPid", Component.class);
-            }
-
-            public String description() {
-                return Util.getStringValue(annotation, desc, "description", Component.class);
-            }
-
-            public boolean ds() {
-                return Util.getBooleanValue(annotation, desc, "ds", Component.class);
-            }
-
-            public String specVersion() {
-                return Util.getStringValue( annotation, desc, "specVersion", Component.class );
-            }
-
-            public boolean enabled() {
-                return Util.getBooleanValue(annotation, desc, "enabled", Component.class);
-            }
-
-            public String factory() {
-                return Util.getStringValue(annotation, desc, "factory", Component.class);
-            }
-
-            public boolean immediate() {
-                return Util.getBooleanValue(annotation, desc, "immediate", Component.class);
-            }
-
-            public boolean inherit() {
-                return Util.getBooleanValue(annotation, desc, "inherit", Component.class);
-            }
-
-            public String label() {
-                return Util.getStringValue(annotation, desc, "label", Component.class);
-            }
-
-            public boolean metatype() {
-                return Util.getBooleanValue(annotation, desc, "metatype", Component.class);
-            }
-
-            public String name() {
-                return Util.getStringValue(annotation, desc, "name", Component.class);
-            }
-
-            public ConfigurationPolicy policy() {
-                return Util.getEnumValue(annotation, "policy", ConfigurationPolicy.class, Component.class, false);
-            }
-
-            public boolean getConfigurationFactory() {
-                return Util.getBooleanValue(annotation, desc, "getConfigurationFactory", Component.class);
-            }
-
-            public boolean configurationFactory() {
-                final Object obj = annotation.getNamedParameter("configurationFactory");
-                if ( obj != null ) {
-                    return Boolean.valueOf(obj.toString());
-                }
-                return getConfigurationFactory();
-            }
-
-            public Class<? extends java.lang.annotation.Annotation> annotationType() {
-                return null;
-            }
-        };
-    }
-
-    @Override
-    public String getName() {
-        return Constants.COMPONENT;
-    }
-
-    @Override
-    public String getSourceName() {
-        return "Component";
-    }
-
-    @Override
-    public Map<String, String> createNamedParameterMap() {
-        final Map<String, String> map = new HashMap<String, String>();
-
-        map.put(Constants.COMPONENT_NAME, emptyToNull(this.annotation.name()));
-        map.put(Constants.COMPONENT_LABEL, emptyToNull(this.annotation.label()));
-        map.put(Constants.COMPONENT_DESCRIPTION, emptyToNull(this.annotation.description()));
-        map.put(Constants.COMPONENT_ENABLED, String.valueOf(this.annotation.enabled()));
-        map.put(Constants.COMPONENT_FACTORY, emptyToNull(this.annotation.factory()));
-        map.put(Constants.COMPONENT_SET_METATYPE_FACTORY_PID, String.valueOf(this.annotation.configurationFactory()));
-
-        // FELIX-593: immediate attribute does not default to true all the
-        // times hence we only set it if declared in the tag
-        if ( this.sourceAnnotation.getNamedParameter("immediate") != null) {
-            map.put(Constants.COMPONENT_IMMEDIATE, this.sourceAnnotation.getNamedParameter("immediate").toString());
-        }
-        map.put(Constants.COMPONENT_INHERIT, String.valueOf(this.annotation.inherit()));
-        map.put(Constants.COMPONENT_METATYPE, String.valueOf(this.annotation.metatype()));
-        map.put(Constants.COMPONENT_ABSTRACT, String.valueOf(this.annotation.componentAbstract()));
-        map.put(Constants.COMPONENT_DS, String.valueOf(this.annotation.ds()));
-        map.put(Constants.COMPONENT_DS_SPEC_VERSION, String.valueOf(this.annotation.specVersion()));
-        map.put(Constants.COMPONENT_CREATE_PID, String.valueOf(this.annotation.createPid()));
-
-        // version 1.1
-        if ( this.annotation.policy() != null ) {
-            map.put(Constants.COMPONENT_CONFIG_POLICY, this.annotation.policy().getPolicyString());
-        }
-        final JavaMethod[] jms = this.sourceAnnotation.getContext().getParent().getParentSource().getClasses()[0].getMethods();
-        for(final JavaMethod jm : jms) {
-            final Annotation[] annotations = jm.getAnnotations();
-            for(final Annotation a : annotations) {
-                if ( a.getType().getJavaClass().getFullyQualifiedName().equals(Activate.class.getName()) ) {
-                    map.put(Constants.COMPONENT_ACTIVATE, jm.getName());
-                }
-                if ( a.getType().getJavaClass().getFullyQualifiedName().equals(Deactivate.class.getName()) ) {
-                    map.put(Constants.COMPONENT_DEACTIVATE, jm.getName());
-                }
-                if ( a.getType().getJavaClass().getFullyQualifiedName().equals(Modified.class.getName()) ) {
-                    map.put(Constants.COMPONENT_MODIFIED, jm.getName());
-                }
-            }
-        }
-
-        return map;
-    }
-
-}
diff --git a/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/DefaultAnnotationTagProvider.java b/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/DefaultAnnotationTagProvider.java
deleted file mode 100644
index 0bd7ad1..0000000
--- a/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/DefaultAnnotationTagProvider.java
+++ /dev/null
@@ -1,79 +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.
- */
-package org.apache.felix.scrplugin.tags.annotation.defaulttag;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.felix.scr.annotations.*;
-import org.apache.felix.scrplugin.tags.JavaField;
-import org.apache.felix.scrplugin.tags.JavaTag;
-import org.apache.felix.scrplugin.tags.annotation.AnnotationJavaClassDescription;
-import org.apache.felix.scrplugin.tags.annotation.AnnotationTagProvider;
-
-import com.thoughtworks.qdox.model.Annotation;
-
-/**
- * Provides mapping of default SCR annotations to tag implementations.
- */
-public class DefaultAnnotationTagProvider implements AnnotationTagProvider {
-
-    /**
-     * @see org.apache.felix.scrplugin.tags.annotation.AnnotationTagProvider#getTags(Annotation, org.apache.felix.scrplugin.tags.annotation.AnnotationJavaClassDescription, org.apache.felix.scrplugin.tags.JavaField)
-     */
-    public List<JavaTag> getTags(Annotation annotation,
-                                 AnnotationJavaClassDescription description, JavaField field) {
-        List<JavaTag> tags = new ArrayList<JavaTag>();
-
-        // check for single annotations
-        if (annotation.getType().getJavaClass().getFullyQualifiedName().equals(Component.class.getName())) {
-            tags.add(new ComponentTag(annotation, description));
-        } else if (annotation.getType().getJavaClass().getFullyQualifiedName().equals(Property.class.getName())) {
-            tags.add(new PropertyTag(annotation, description, field));
-        } else if (annotation.getType().getJavaClass().getFullyQualifiedName().equals(Service.class.getName())) {
-            tags.addAll(ServiceTag.createServiceTags(annotation, description));
-        } else if (annotation.getType().getJavaClass().getFullyQualifiedName().equals(Reference.class.getName())) {
-            tags.add(new ReferenceTag(annotation, description, field));
-        }
-
-        // check for multi-annotations
-        else if (annotation.getType().getJavaClass().getFullyQualifiedName().equals(Properties.class.getName())) {
-            @SuppressWarnings("unchecked")
-            final List<Annotation> properties = (List<Annotation>)annotation.getNamedParameter("value");
-            for (Annotation property : properties) {
-                tags.add(new PropertyTag(property, description, field));
-            }
-        } else if (annotation.getType().getJavaClass().getFullyQualifiedName().equals(Services.class.getName())) {
-            @SuppressWarnings("unchecked")
-            final List<Annotation> services = (List<Annotation>)annotation.getNamedParameter("value");
-            for (Annotation service : services) {
-                tags.addAll(ServiceTag.createServiceTags(service, description));
-            }
-        } else if (annotation.getType().getJavaClass().getFullyQualifiedName().equals(References.class.getName())) {
-            @SuppressWarnings("unchecked")
-            final List<Annotation> references = (List<Annotation>)annotation.getNamedParameter("value");
-            for (Annotation reference : references) {
-                tags.add(new ReferenceTag(reference, description, field));
-            }
-        }
-
-        return tags;
-    }
-
-}
diff --git a/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/PropertyTag.java b/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/PropertyTag.java
deleted file mode 100644
index 5b71f01..0000000
--- a/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/PropertyTag.java
+++ /dev/null
@@ -1,336 +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.
- */
-package org.apache.felix.scrplugin.tags.annotation.defaulttag;
-
-import java.util.*;
-
-import org.apache.felix.scr.annotations.*;
-import org.apache.felix.scrplugin.Constants;
-import org.apache.felix.scrplugin.tags.JavaClassDescription;
-import org.apache.felix.scrplugin.tags.JavaField;
-import org.apache.felix.scrplugin.tags.annotation.*;
-
-import com.thoughtworks.qdox.model.Annotation;
-
-/**
- * Description of a java tag for components.
- */
-public class PropertyTag extends AbstractTag {
-
-    protected final Property annotation;
-
-    /**
-     * @param annotation Annotation
-     * @param desc Description
-     */
-    public PropertyTag(final Annotation annotation, final AnnotationJavaClassDescription desc, JavaField field) {
-        super(annotation, desc, field);
-        this.annotation = new Property() {
-
-            public int cardinality() {
-                return Util.getIntValue(annotation, desc, "cardinality", Property.class);
-            }
-
-            public String description() {
-                return Util.getStringValue(annotation, desc, "description", Property.class);
-            }
-
-            public String label() {
-                return Util.getStringValue(annotation, desc, "label", Property.class);
-            }
-
-            public String name() {
-                return Util.getStringValue(annotation, desc, "name", Property.class);
-            }
-
-            public PropertyOption[] options() {
-                final Object obj = annotation.getNamedParameter("options");
-                if ( obj != null ) {
-                    if ( obj instanceof Annotation ) {
-                        final Annotation annotation = (Annotation)obj;
-                        return new PropertyOption[] {new PropertyOptionImpl(annotation, desc)};
-                    }
-                    @SuppressWarnings("unchecked")
-                    final List<Annotation> annotations = (List<Annotation>) obj;
-                    PropertyOption[] options = new PropertyOption[annotations.size()];
-                    for (int index = 0; index < options.length; index++) {
-                        final Annotation propAnnotation = annotations.get(index);
-                        options[index] = new PropertyOptionImpl(propAnnotation, desc);
-                    }
-                    return options;
-                }
-                try {
-                    return (PropertyOption[]) Property.class.getMethod("options").getDefaultValue();
-                } catch( NoSuchMethodException mnfe) {
-                    // we ignore this
-                    return null;
-                }
-            }
-
-            public boolean propertyPrivate() {
-                return Util.getBooleanValue(annotation, desc, "propertyPrivate", Property.class);
-            }
-
-            public String[] value() {
-                // value property can be used as String[] or String property
-                return Util.getStringValues(annotation, desc, "value");
-            }
-
-            public Class<?>[] classValue() {
-                return Util.getClassArrayValue(annotation, "classValue", Property.class, desc.getClassLoader());
-            }
-
-            public boolean[] boolValue() {
-                return Util.getBooleanValues(annotation, desc, "boolValue");
-            }
-
-            public byte[] byteValue() {
-                return Util.getByteValues(annotation, desc, "byteValue");
-            }
-
-            public char[] charValue() {
-                return Util.getCharValues(annotation, desc, "charValue");
-            }
-
-            public double[] doubleValue() {
-                return Util.getDoubleValues(annotation, desc, "doubleValue");
-            }
-
-            public float[] floatValue() {
-                return Util.getFloatValues(annotation, desc, "floatValue");
-            }
-
-            public int[] intValue() {
-                return Util.getIntValues(annotation, desc, "intValue");
-            }
-
-            public long[] longValue() {
-                return Util.getLongValues(annotation, desc, "longValue");
-            }
-
-            public short[] shortValue() {
-                return Util.getShortValues(annotation, desc, "shortValue");
-            }
-
-            public PropertyUnbounded unbounded() {
-                return Util.getEnumValue(annotation, "unbounded", PropertyUnbounded.class, Property.class);
-            }
-
-            public Class<? extends java.lang.annotation.Annotation> annotationType() {
-                return null;
-            }
-        };
-    }
-
-    @Override
-    public String getName() {
-        return Constants.PROPERTY;
-    }
-
-    @Override
-    public String getSourceName() {
-        return "Property";
-    }
-
-    @Override
-    public Map<String, String> createNamedParameterMap() {
-        final Map<String, String> map = new LinkedHashMap<String, String>();
-
-        map.put(Constants.PROPERTY_NAME, emptyToNull(this.annotation.name()));
-        map.put(Constants.PROPERTY_LABEL, emptyToNull(this.annotation.label()));
-        map.put(Constants.PROPERTY_DESCRIPTION, emptyToNull(this.annotation.description()));
-
-
-        String type = null;
-        Object[] values = this.annotation.value();
-        // we now check all options
-        if (values == null || values.length == 0 ) {
-            final Class<?>[] classValues = this.annotation.classValue();
-            if ( classValues == null || classValues.length == 0 ) {
-                long[] lValues = this.annotation.longValue();
-                if ( lValues == null || lValues.length == 0 ) {
-                    double[] dValues = this.annotation.doubleValue();
-                    if ( dValues == null || dValues.length == 0 ) {
-                        float[] fValues = this.annotation.floatValue();
-                        if ( fValues == null || fValues.length == 0 ) {
-                            int[] iValues = this.annotation.intValue();
-                            if ( iValues == null || iValues.length == 0 ) {
-                                byte[] byteValues = this.annotation.byteValue();
-                                if ( byteValues == null || byteValues.length == 0 ) {
-                                    char[] cValues = this.annotation.charValue();
-                                    if ( cValues == null || cValues.length == 0 ) {
-                                        boolean[] boolValues = this.annotation.boolValue();
-                                        if ( boolValues == null || boolValues.length == 0 ) {
-                                            short[] sValues  = this.annotation.shortValue();
-                                            if ( sValues != null && sValues.length != 0 ) {
-                                                values = new Object[sValues.length];
-                                                for(int i=0;i<sValues.length;i++) {
-                                                    values[i] = sValues[i];
-                                                }
-                                                type = "Short";
-                                            }
-                                        } else {
-                                            values = new Object[boolValues.length];
-                                            for(int i=0;i<boolValues.length;i++) {
-                                                values[i] = boolValues[i];
-                                            }
-                                            type = "Boolean";
-                                        }
-                                    } else {
-                                        values = new Object[cValues.length];
-                                        for(int i=0;i<cValues.length;i++) {
-                                            values[i] = cValues[i];
-                                        }
-                                        type = "Char";
-                                    }
-                                } else {
-                                    values = new Object[byteValues.length];
-                                    for(int i=0;i<byteValues.length;i++) {
-                                        values[i] = byteValues[i];
-                                    }
-                                    type = "Byte";
-                                }
-                            } else {
-                                values = new Object[iValues.length];
-                                for(int i=0;i<iValues.length;i++) {
-                                    values[i] = iValues[i];
-                                }
-                                type = "Integer";
-                            }
-                        } else {
-                            values = new Object[fValues.length];
-                            for(int i=0;i<fValues.length;i++) {
-                                values[i] = fValues[i];
-                            }
-                            type = "Float";
-                        }
-                    } else {
-                        values = new Object[dValues.length];
-                        for(int i=0;i<dValues.length;i++) {
-                            values[i] = dValues[i];
-                        }
-                        type = "Double";
-                    }
-                } else {
-                    values = new Object[lValues.length];
-                    for(int i=0;i<lValues.length;i++) {
-                        values[i] = lValues[i];
-                    }
-                    type = "Long";
-                }
-            } else {
-                values = new Object[classValues.length];
-                for(int i=0;i<classValues.length;i++) {
-                    values[i] = classValues[i].getName();
-                }
-                type = "String";
-            }
-        } else {
-            type = "String";
-        }
-
-        if ( values != null && values.length > 0 ) {
-            map.put(Constants.PROPERTY_TYPE, type);
-            if (values.length == 1) {
-                map.put(Constants.PROPERTY_VALUE, values[0].toString());
-            } else {
-                for (int i = 0; i < values.length; i++) {
-                    map.put(Constants.PROPERTY_MULTIVALUE_PREFIX + '.' + i, values[i].toString());
-                }
-            }
-        }
-
-        // cardinality handling
-        final PropertyUnbounded pu = this.annotation.unbounded();
-        if ( pu != PropertyUnbounded.DEFAULT ) {
-            if ( pu == PropertyUnbounded.ARRAY ) {
-                map.put(Constants.PROPERTY_CARDINALITY, "+");
-            } else {
-                map.put(Constants.PROPERTY_CARDINALITY, "-");
-            }
-        } else if (this.annotation.cardinality() != 0) {
-            if ( this.annotation.cardinality() == Integer.MAX_VALUE ) {
-                map.put(Constants.PROPERTY_CARDINALITY, "+");
-            } else if ( this.annotation.cardinality() == Integer.MIN_VALUE ) {
-                map.put(Constants.PROPERTY_CARDINALITY, "-");
-            } else {
-                map.put(Constants.PROPERTY_CARDINALITY, String.valueOf(this.annotation.cardinality()));
-            }
-        }
-
-        map.put(Constants.PROPERTY_PRIVATE, String.valueOf(this.annotation.propertyPrivate()));
-
-        return map;
-    }
-
-    @Override
-    public String[] getParameters() {
-        List<String> parameters = new ArrayList<String>();
-
-        String[] defaultParameters = super.getParameters();
-        if (defaultParameters != null) {
-            parameters.addAll(Arrays.asList(defaultParameters));
-        }
-
-        // if defined: add options as parameters to the end of parameter list
-        // (strange parsing due to qdox tag restrictions...)
-        if (this.annotation.options().length > 0) {
-            parameters.add(Constants.PROPERTY_OPTIONS);
-            for (PropertyOption option : this.annotation.options()) {
-                parameters.add(option.name());
-                parameters.add("=");
-                parameters.add(option.value());
-            }
-        }
-
-        return parameters.toArray(new String[parameters.size()]);
-    }
-
-    protected static class PropertyOptionImpl implements PropertyOption {
-
-        private final Annotation annotation;
-        private final JavaClassDescription description;
-
-        public PropertyOptionImpl(final Annotation annotation,
-                final JavaClassDescription desc) {
-            this.annotation = annotation;
-            this.description = desc;
-        }
-
-        public String name() {
-            final String[] names = Util.getAnnotationValues(annotation, "name", description);
-            if ( names != null && names.length > 0 ) {
-                return names[0];
-            }
-            return null;
-        }
-
-        public String value() {
-            final String[] values = Util.getAnnotationValues(annotation, "value", description);
-            if ( values != null && values.length > 0 ) {
-                return values[0];
-            }
-            return null;
-        }
-
-        public Class<? extends java.lang.annotation.Annotation> annotationType() {
-            return PropertyOption.class;
-        }
-    }
-}
diff --git a/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/ReferenceTag.java b/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/ReferenceTag.java
deleted file mode 100644
index 8319692..0000000
--- a/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/ReferenceTag.java
+++ /dev/null
@@ -1,121 +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.
- */
-package org.apache.felix.scrplugin.tags.annotation.defaulttag;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.felix.scr.annotations.*;
-import org.apache.felix.scrplugin.Constants;
-import org.apache.felix.scrplugin.tags.JavaField;
-import org.apache.felix.scrplugin.tags.annotation.*;
-
-import com.thoughtworks.qdox.model.Annotation;
-
-/**
- * Description of a java tag for components.
- */
-public class ReferenceTag extends AbstractTag {
-
-    protected final Reference annotation;
-
-    /**
-     * @param annotation Annotation
-     * @param desc Description
-     */
-    public ReferenceTag(final Annotation annotation, final AnnotationJavaClassDescription desc, JavaField field) {
-        super(annotation, desc, field);
-
-        this.annotation = new Reference() {
-
-            public String bind() {
-                return Util.getStringValue(annotation, desc, "bind", Reference.class);
-            }
-
-            public ReferenceCardinality cardinality() {
-                return Util.getEnumValue(annotation, "cardinality", ReferenceCardinality.class, Reference.class);
-            }
-
-            public String name() {
-                return Util.getStringValue(annotation, desc, "name", Reference.class);
-            }
-
-            public ReferencePolicy policy() {
-                return Util.getEnumValue(annotation, "policy", ReferencePolicy.class, Reference.class);
-            }
-
-            public Class<?> referenceInterface() {
-                return Util.getClassValue(annotation, "referenceInterface", Reference.class, desc.getClassLoader());
-            }
-
-            public ReferenceStrategy strategy() {
-                return Util.getEnumValue(annotation, "strategy", ReferenceStrategy.class, Reference.class);
-            }
-
-            public String target() {
-                return Util.getStringValue(annotation, desc, "target", Reference.class);
-            }
-
-            public String unbind() {
-                return Util.getStringValue(annotation, desc, "unbind", Reference.class);
-            }
-
-            public String updated() {
-                return Util.getStringValue(annotation, desc, "updated", Reference.class);
-            }
-
-            public Class<? extends java.lang.annotation.Annotation> annotationType() {
-                return null;
-            }
-        };
-    }
-
-    @Override
-    public String getName() {
-        return Constants.REFERENCE;
-    }
-
-    @Override
-    public String getSourceName() {
-        return "Reference";
-    }
-
-    @Override
-    public Map<String, String> createNamedParameterMap() {
-        final Map<String, String> map = new HashMap<String, String>();
-
-        map.put(Constants.REFERENCE_NAME, emptyToNull(this.annotation.name()));
-
-        if (this.annotation.referenceInterface() != AutoDetect.class) {
-            String referenceInterface = this.annotation.referenceInterface().getName();
-            map.put(Constants.REFERENCE_INTERFACE, referenceInterface);
-        }
-
-        map.put(Constants.REFERENCE_CARDINALITY, this.annotation.cardinality().getCardinalityString());
-        map.put(Constants.REFERENCE_POLICY, this.annotation.policy().getPolicyString());
-        map.put(Constants.REFERENCE_TARGET, emptyToNull(this.annotation.target()));
-        map.put(Constants.REFERENCE_BIND, emptyToNull(this.annotation.bind()));
-        map.put(Constants.REFERENCE_UNDBIND, emptyToNull(this.annotation.unbind()));
-        map.put(Constants.REFERENCE_UPDATED, emptyToNull(this.annotation.updated()));
-        map.put(Constants.REFERENCE_STRATEGY, this.annotation.strategy().getStrategyString());
-
-        return map;
-    }
-
-}
diff --git a/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/ServiceTag.java b/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/ServiceTag.java
deleted file mode 100644
index 5f84215..0000000
--- a/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/ServiceTag.java
+++ /dev/null
@@ -1,98 +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.
- */
-package org.apache.felix.scrplugin.tags.annotation.defaulttag;
-
-import java.util.*;
-
-import org.apache.felix.scr.annotations.AutoDetect;
-import org.apache.felix.scr.annotations.Service;
-import org.apache.felix.scrplugin.Constants;
-import org.apache.felix.scrplugin.tags.annotation.*;
-
-import com.thoughtworks.qdox.model.Annotation;
-
-/**
- * Description of a java tag for components.
- */
-public class ServiceTag extends AbstractTag {
-
-    protected final Service annotation;
-
-    protected final String serviceInterface;
-
-    /**
-     * @param annotation Annotation
-     * @param desc Description
-     */
-    public ServiceTag(final Annotation annotation,
-            final AnnotationJavaClassDescription desc,
-            final Service tag,
-            final String serviceInterface) {
-        super(annotation, desc, null);
-        this.annotation = tag;
-        this.serviceInterface = serviceInterface;
-    }
-
-    @Override
-    public String getName() {
-        return Constants.SERVICE;
-    }
-
-    @Override
-    public String getSourceName() {
-        return "Service";
-    }
-
-    @Override
-    public Map<String, String> createNamedParameterMap() {
-        final Map<String, String> map = new HashMap<String, String>();
-
-        map.put(Constants.SERVICE_INTERFACE, this.serviceInterface);
-        map.put(Constants.SERVICE_FACTORY, String.valueOf(this.annotation.serviceFactory()));
-
-        return map;
-    }
-
-    public static List<ServiceTag> createServiceTags(final Annotation annotation, final AnnotationJavaClassDescription desc) {
-        final Service tag = new Service() {
-
-            public boolean serviceFactory() {
-                return Util.getBooleanValue(annotation, desc, "serviceFactory", Service.class);
-            }
-
-            public Class<?>[] value() {
-                return Util.getClassArrayValue(annotation, "value", Service.class, desc.getClassLoader());
-            }
-
-            public Class<? extends java.lang.annotation.Annotation> annotationType() {
-                return null;
-            }
-        };
-        final Class<?>[] classes = tag.value();
-        if ( classes != null && classes.length > 0
-             && (classes.length != 1 || !classes[0].getName().equals(AutoDetect.class.getName()))) {
-            final List<ServiceTag> tags = new ArrayList<ServiceTag>();
-            for(final Class<?> c : classes ) {
-                tags.add(new ServiceTag(annotation, desc, tag, c.getName()));
-            }
-            return tags;
-        }
-        return Collections.singletonList(new ServiceTag(annotation, desc, tag, null));
-    }
-}
diff --git a/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/package-info.java b/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/package-info.java
deleted file mode 100644
index 67c4673..0000000
--- a/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/package-info.java
+++ /dev/null
@@ -1,24 +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.
- */
-/**
- * SCR plugin annotation tag provider default implementation for annotations provided in package
- * <code>org.apache.felix.scrplugin.annotations</code>.
- */
-package org.apache.felix.scrplugin.tags.annotation.defaulttag;
-
diff --git a/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/sling/SlingAnnotationTagProvider.java b/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/sling/SlingAnnotationTagProvider.java
deleted file mode 100644
index 13d616c..0000000
--- a/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/sling/SlingAnnotationTagProvider.java
+++ /dev/null
@@ -1,155 +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.
- */
-package org.apache.felix.scrplugin.tags.annotation.sling;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.felix.scr.annotations.sling.SlingFilter;
-import org.apache.felix.scr.annotations.sling.SlingServlet;
-import org.apache.felix.scrplugin.tags.JavaField;
-import org.apache.felix.scrplugin.tags.JavaTag;
-import org.apache.felix.scrplugin.tags.annotation.*;
-
-/**
- * Annotation tag provider for sling-specific SCR annotations.
- */
-public class SlingAnnotationTagProvider implements AnnotationTagProvider {
-
-    /**
-     * @see org.apache.felix.scrplugin.tags.annotation.AnnotationTagProvider#getTags(com.thoughtworks.qdox.model.Annotation, org.apache.felix.scrplugin.tags.annotation.AnnotationJavaClassDescription, org.apache.felix.scrplugin.tags.JavaField)
-     */
-    public List<JavaTag> getTags(final com.thoughtworks.qdox.model.Annotation annotation,
-            final AnnotationJavaClassDescription description,
-            final JavaField field)
-   {
-        final String annotationName = annotation.getType().getJavaClass().getFullyQualifiedName();
-        final List<JavaTag> tags = new ArrayList<JavaTag>();
-
-        // SlingServlet annotation
-        if (annotationName.equals(SlingServlet.class.getName()))
-        {
-
-            // generate @Component tag if required
-            boolean generateComponent = Util.getBooleanValue(annotation, description, "generateComponent", SlingServlet.class);
-            if (generateComponent)
-            {
-                String name = Util.getStringValue(annotation, description, "name", SlingServlet.class);
-                if ( name != null && name.trim().length() == 0 ) {
-                    name = null;
-                }
-                String label = Util.getStringValue(annotation, description, "label", SlingServlet.class);
-                if ( label != null && label.trim().length() == 0 ) {
-                    label = null;
-                }
-                String desc = Util.getStringValue(annotation, description, "description", SlingServlet.class);
-                if ( desc != null && desc.trim().length() == 0 ) {
-                    desc = null;
-                }
-                final boolean createMetatype = Util.getBooleanValue(annotation, description, "metatype", SlingServlet.class);
-                tags.add(new SlingServletComponentTag(annotation, description, createMetatype, name, label, desc));
-            }
-
-            // generate @Service tag if required
-            boolean generateService = Util.getBooleanValue(annotation, description, "generateService", SlingServlet.class);
-            if (generateService)
-            {
-                tags.add(new SlingServletServiceTag(annotation, description));
-            }
-
-            // generate @Property tags
-            // {@see org.apache.sling.servlets.resolver.internal.ServletResolverConstants.SLING_SERVLET_PATHS}
-            String[] paths = Util.getStringValues(annotation, description, "paths");
-            if (paths != null && paths.length != 0)
-            {
-                tags.add(new SlingServletPropertyTag(annotation, "sling.servlet.paths", paths, description));
-            }
-
-            // {@see org.apache.sling.servlets.resolver.internal.ServletResolverConstants.SLING_SERVLET_RESOURCE_TYPES}
-            String[] resourceTypes = Util.getStringValues(annotation, description, "resourceTypes");
-            if (resourceTypes != null && resourceTypes.length != 0)
-            {
-                tags.add(new SlingServletPropertyTag(annotation, "sling.servlet.resourceTypes", resourceTypes, description));
-            }
-
-            // {@see org.apache.sling.servlets.resolver.internal.ServletResolverConstants.SLING_SERVLET_SELECTORS}
-            String[] selectors = Util.getStringValues(annotation, description, "selectors");
-            if (selectors != null && selectors.length != 0)
-            {
-                tags.add(new SlingServletPropertyTag(annotation, "sling.servlet.selectors", selectors, description));
-            }
-
-            // {@see org.apache.sling.servlets.resolver.internal.ServletResolverConstants.SLING_SERVLET_EXTENSIONS}
-            String[] extensions = Util.getStringValues(annotation, description, "extensions");
-            if (extensions != null && extensions.length != 0)
-            {
-                tags.add(new SlingServletPropertyTag(annotation, "sling.servlet.extensions", extensions, description));
-            }
-
-            // {@see org.apache.sling.servlets.resolver.internal.ServletResolverConstants.SLING_SERVLET_METHODS}
-            String[] methods = Util.getStringValues(annotation, description, "methods");
-            if (methods != null && methods.length != 0)
-            {
-                tags.add(new SlingServletPropertyTag(annotation, "sling.servlet.methods", methods, description));
-            }
-
-        }
-        // Filter annotation
-        else if ( annotationName.equals(SlingFilter.class.getName()) )
-        {
-            // generate @Component tag if required
-            boolean generateComponent = Util.getBooleanValue(annotation, description, "generateComponent", SlingFilter.class);
-            if (generateComponent)
-            {
-                String name = Util.getStringValue(annotation, description, "name", SlingFilter.class);
-                if ( name != null && name.trim().length() == 0 ) {
-                    name = null;
-                }
-                String label = Util.getStringValue(annotation, description, "label", SlingFilter.class);
-                if ( label != null && label.trim().length() == 0 ) {
-                    label = null;
-                }
-                String desc = Util.getStringValue(annotation, description, "description", SlingFilter.class);
-                if ( desc != null && desc.trim().length() == 0 ) {
-                    desc = null;
-                }
-                final boolean createMetatype = Util.getBooleanValue(annotation, description, "metatype", SlingFilter.class);
-                tags.add(new SlingFilterComponentTag(annotation, description, createMetatype, name, label, desc));
-            }
-
-            // generate @Service tag if required
-            boolean generateService = Util.getBooleanValue(annotation, description, "generateService", SlingFilter.class);
-            if (generateService)
-            {
-                tags.add(new SlingFilterServiceTag(annotation, description));
-            }
-
-            // property order = service.ranking
-            final int order = Util.getIntValue(annotation, description, "order", SlingFilter.class);
-            tags.add(new SlingServletPropertyTag(annotation, "service.ranking", String.valueOf(order), description, "Integer", true));
-
-            // property scope
-            final String[] scopes = Util.getAnnotationValues(annotation, "scope", description);
-            tags.add(new SlingServletPropertyTag(annotation, "sling.filter.scope", scopes, description, true));
-        }
-
-        return tags;
-    }
-
-}
diff --git a/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/sling/SlingFilterComponentTag.java b/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/sling/SlingFilterComponentTag.java
deleted file mode 100644
index f9b0638..0000000
--- a/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/sling/SlingFilterComponentTag.java
+++ /dev/null
@@ -1,82 +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.
- */
-package org.apache.felix.scrplugin.tags.annotation.sling;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.felix.scrplugin.Constants;
-import org.apache.felix.scrplugin.tags.JavaClassDescription;
-import org.apache.felix.scrplugin.tags.annotation.AbstractTag;
-
-import com.thoughtworks.qdox.model.Annotation;
-
-/**
- * Description of a java tag for components.
- */
-public class SlingFilterComponentTag extends AbstractTag {
-
-    private final boolean createMetatype;
-    private final String name;
-    private final String label;
-    private final String description;
-
-    /**
-     * @param desc Description
-     */
-    public SlingFilterComponentTag(final Annotation annotation,
-            final JavaClassDescription desc,
-            final boolean createMetatype,
-            final String name,
-            final String label,
-            final String description) {
-        super(annotation, desc, null);
-        this.createMetatype = createMetatype;
-        this.name = name;
-        this.label = label;
-        this.description = description;
-    }
-
-    @Override
-    public String getName() {
-        return Constants.COMPONENT;
-    }
-
-    @Override
-    public String getSourceName() {
-        return "SlingFilter";
-    }
-
-    @Override
-    public Map<String, String> createNamedParameterMap() {
-        final Map<String, String> params = new HashMap<String, String>();
-        if ( this.name != null ) {
-            params.put(Constants.COMPONENT_NAME, this.name);
-        }
-        if ( this.label != null ) {
-            params.put(Constants.COMPONENT_LABEL, this.label);
-        }
-        if ( this.description != null ) {
-            params.put(Constants.COMPONENT_DESCRIPTION, this.description);
-        }
-        params.put(Constants.COMPONENT_METATYPE, String.valueOf(this.createMetatype));
-        return params;
-    }
-
-}
diff --git a/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/sling/SlingFilterServiceTag.java b/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/sling/SlingFilterServiceTag.java
deleted file mode 100644
index 8991482..0000000
--- a/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/sling/SlingFilterServiceTag.java
+++ /dev/null
@@ -1,60 +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.
- */
-package org.apache.felix.scrplugin.tags.annotation.sling;
-
-import java.util.Collections;
-import java.util.Map;
-
-import org.apache.felix.scrplugin.Constants;
-import org.apache.felix.scrplugin.tags.JavaClassDescription;
-import org.apache.felix.scrplugin.tags.annotation.AbstractTag;
-
-import com.thoughtworks.qdox.model.Annotation;
-
-/**
- * Description of a java tag for components.
- */
-public class SlingFilterServiceTag extends AbstractTag {
-
-    private static final Map<String, String> INTERFACE_MAP =
-        Collections.singletonMap(Constants.SERVICE_INTERFACE, "javax.servlet.Filter");
-
-    /**
-     * @param desc Description
-     */
-    public SlingFilterServiceTag(Annotation annotation, JavaClassDescription desc) {
-        super(annotation, desc, null);
-    }
-
-    @Override
-    public String getName() {
-        return Constants.SERVICE;
-    }
-
-    @Override
-    public String getSourceName() {
-        return "SlingFilter";
-    }
-
-    @Override
-    public Map<String, String> createNamedParameterMap() {
-        return INTERFACE_MAP;
-    }
-
-}
diff --git a/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/sling/SlingServletComponentTag.java b/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/sling/SlingServletComponentTag.java
deleted file mode 100644
index 5fa4ae1..0000000
--- a/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/sling/SlingServletComponentTag.java
+++ /dev/null
@@ -1,81 +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.
- */
-package org.apache.felix.scrplugin.tags.annotation.sling;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.felix.scrplugin.Constants;
-import org.apache.felix.scrplugin.tags.JavaClassDescription;
-import org.apache.felix.scrplugin.tags.annotation.AbstractTag;
-
-import com.thoughtworks.qdox.model.Annotation;
-
-/**
- * Description of a java tag for components.
- */
-public class SlingServletComponentTag extends AbstractTag {
-
-    private final boolean createMetatype;
-    private final String name;
-    private final String label;
-    private final String description;
-
-    /**
-     * @param desc Description
-     */
-    public SlingServletComponentTag(final Annotation annotation,
-            final JavaClassDescription desc,
-            final boolean createMetatype,
-            final String name,
-            final String label,
-            final String description) {
-        super(annotation, desc, null);
-        this.createMetatype = createMetatype;
-        this.name = name;
-        this.label = label;
-        this.description = description;
-    }
-
-    @Override
-    public String getName() {
-        return Constants.COMPONENT;
-    }
-
-    @Override
-    public String getSourceName() {
-        return "SlingServlet";
-    }
-
-    @Override
-    public Map<String, String> createNamedParameterMap() {
-        final Map<String, String> params = new HashMap<String, String>();
-        if ( this.name != null ) {
-            params.put(Constants.COMPONENT_NAME, this.name);
-        }
-        if ( this.label != null ) {
-            params.put(Constants.COMPONENT_LABEL, this.label);
-        }
-        if ( this.description != null ) {
-            params.put(Constants.COMPONENT_DESCRIPTION, this.description);
-        }
-        params.put(Constants.COMPONENT_METATYPE, String.valueOf(this.createMetatype));
-        return params;
-    }
-}
diff --git a/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/sling/SlingServletPropertyTag.java b/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/sling/SlingServletPropertyTag.java
deleted file mode 100644
index 4064911..0000000
--- a/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/sling/SlingServletPropertyTag.java
+++ /dev/null
@@ -1,122 +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.
- */
-package org.apache.felix.scrplugin.tags.annotation.sling;
-
-import java.util.*;
-
-import org.apache.felix.scrplugin.Constants;
-import org.apache.felix.scrplugin.helper.StringUtils;
-import org.apache.felix.scrplugin.tags.JavaClassDescription;
-import org.apache.felix.scrplugin.tags.annotation.AbstractTag;
-
-import com.thoughtworks.qdox.model.Annotation;
-
-/**
- * A property tag.
- */
-public class SlingServletPropertyTag extends AbstractTag {
-
-    protected final String name;
-    protected final String[] values;
-    protected final String type;
-    protected final Boolean isPrivate;
-
-    /**
-     * @param name Property name
-     * @param values Property values
-     * @param desc Description
-     */
-    public SlingServletPropertyTag(Annotation annotation, String name, String[] values, JavaClassDescription desc) {
-        super(annotation, desc, null);
-        this.name = name;
-        this.values = values;
-        this.type = null;
-        this.isPrivate = null;
-    }
-
-    /**
-     * @param name Property name
-     * @param values Property values
-     * @param desc Description
-     */
-    public SlingServletPropertyTag(Annotation annotation, String name, String[] values, JavaClassDescription desc, final boolean isPrivate) {
-        super(annotation, desc, null);
-        this.name = name;
-        this.values = values;
-        this.type = null;
-        this.isPrivate = isPrivate;
-    }
-
-    /**
-     * @param name Property name
-     * @param value Property value
-     * @param desc Description
-     */
-    public SlingServletPropertyTag(final Annotation annotation,
-            final String name,
-            final String value,
-            final JavaClassDescription desc,
-            final String type,
-            final boolean isPrivate) {
-        super(annotation, desc, null);
-        this.name = name;
-        this.values = new String[] {value};
-        this.type = type;
-        this.isPrivate = isPrivate;
-    }
-
-    @Override
-    public String getName() {
-        return Constants.PROPERTY;
-    }
-
-    @Override
-    public String getSourceName() {
-        return "SlingServlet";
-    }
-
-    @Override
-    public Map<String, String> createNamedParameterMap() {
-        final SortedMap<String, String> map = new TreeMap<String, String>();
-
-        map.put(Constants.PROPERTY_NAME, this.name);
-
-        if (this.values == null || this.values.length == 0) {
-            map.put(Constants.PROPERTY_VALUE, "");
-        } else if (this.values.length == 1) {
-            map.put(Constants.PROPERTY_VALUE, this.values[0]);
-        } else {
-            for (int i = 0; i < this.values.length; i++) {
-                // generate index number with trailing zeros to ensure correct sort order in map
-                String index = StringUtils.leftPad(Integer.toString(i), 10, "0");
-                map.put(Constants.PROPERTY_MULTIVALUE_PREFIX + '.' + index, this.values[i]);
-            }
-        }
-
-        if ( this.type != null ) {
-            map.put(Constants.PROPERTY_TYPE, type);
-        }
-        if ( this.isPrivate != null ) {
-            map.put(Constants.PROPERTY_PRIVATE, String.valueOf(this.isPrivate));
-        }
-
-        return map;
-    }
-
-}
diff --git a/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/sling/SlingServletServiceTag.java b/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/sling/SlingServletServiceTag.java
deleted file mode 100644
index da9944b..0000000
--- a/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/sling/SlingServletServiceTag.java
+++ /dev/null
@@ -1,60 +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.
- */
-package org.apache.felix.scrplugin.tags.annotation.sling;
-
-import java.util.Collections;
-import java.util.Map;
-
-import org.apache.felix.scrplugin.Constants;
-import org.apache.felix.scrplugin.tags.JavaClassDescription;
-import org.apache.felix.scrplugin.tags.annotation.AbstractTag;
-
-import com.thoughtworks.qdox.model.Annotation;
-
-/**
- * Description of a java tag for components.
- */
-public class SlingServletServiceTag extends AbstractTag {
-
-    private static final Map<String, String> INTERFACE_MAP =
-        Collections.singletonMap(Constants.SERVICE_INTERFACE, "javax.servlet.Servlet");
-
-    /**
-     * @param desc Description
-     */
-    public SlingServletServiceTag(Annotation annotation, JavaClassDescription desc) {
-        super(annotation, desc, null);
-    }
-
-    @Override
-    public String getName() {
-        return Constants.SERVICE;
-    }
-
-    @Override
-    public String getSourceName() {
-        return "SlingServlet";
-    }
-
-    @Override
-    public Map<String, String> createNamedParameterMap() {
-        return INTERFACE_MAP;
-    }
-
-}
diff --git a/scrplugin/annotations/src/main/resources/META-INF/services/org.apache.felix.scrplugin.tags.annotation.AnnotationTagProvider b/scrplugin/annotations/src/main/resources/META-INF/services/org.apache.felix.scrplugin.tags.annotation.AnnotationTagProvider
index a9f2add..ab7e308 100644
--- a/scrplugin/annotations/src/main/resources/META-INF/services/org.apache.felix.scrplugin.tags.annotation.AnnotationTagProvider
+++ b/scrplugin/annotations/src/main/resources/META-INF/services/org.apache.felix.scrplugin.tags.annotation.AnnotationTagProvider
@@ -1,2 +1,2 @@
-org.apache.felix.scrplugin.tags.annotation.defaulttag.DefaultAnnotationTagProvider
-org.apache.felix.scrplugin.tags.annotation.sling.SlingAnnotationTagProvider
+org.apache.felix.scrplugin.SCRAnnotationProcessor
+org.apache.felix.scrplugin.SlingAnnotationProcessor
