sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r938017 - in /sling/trunk/contrib/extensions/rewriter: ./ src/main/java/org/apache/sling/rewriter/impl/ src/main/java/org/apache/sling/rewriter/impl/components/
Date Mon, 26 Apr 2010 12:20:04 GMT
Author: cziegeler
Date: Mon Apr 26 12:20:03 2010
New Revision: 938017

URL: http://svn.apache.org/viewvc?rev=938017&view=rev
Log:
Use resource api - remove dependency to jcr api.

Modified:
    sling/trunk/contrib/extensions/rewriter/pom.xml
    sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/ProcessorManagerImpl.java
    sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/RewriterFilter.java
    sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/components/HtmlGeneratorFactory.java
    sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/components/HtmlSerializerFactory.java
    sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/components/TraxHtmlSerializerFactory.java
    sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/components/TraxXHtmlSerializerFactory.java
    sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/components/XHtmlSerializerFactory.java

Modified: sling/trunk/contrib/extensions/rewriter/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/rewriter/pom.xml?rev=938017&r1=938016&r2=938017&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/rewriter/pom.xml (original)
+++ sling/trunk/contrib/extensions/rewriter/pom.xml Mon Apr 26 12:20:03 2010
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
-        <version>8</version>
+        <version>9-SNAPSHOT</version>
     </parent>
 
     <artifactId>org.apache.sling.rewriter</artifactId>
@@ -81,6 +81,12 @@
 
     <dependencies>
         <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.scr.annotations</artifactId>
+            <version>1.2.0</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
             <groupId>commons-lang</groupId>
             <artifactId>commons-lang</artifactId>
             <version>2.4</version>
@@ -89,7 +95,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.api</artifactId>
-            <version>2.0.8</version>
+            <version>2.0.9-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
@@ -111,12 +117,6 @@
             <scope>provided</scope>
         </dependency>
         <dependency>
-            <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.jcr.resource</artifactId>
-            <version>2.0.6</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
             <groupId>org.apache.felix</groupId>
             <artifactId>org.apache.felix.webconsole</artifactId>
             <version>2.0.6</version>

Modified: sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/ProcessorManagerImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/ProcessorManagerImpl.java?rev=938017&r1=938016&r2=938017&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/ProcessorManagerImpl.java
(original)
+++ sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/ProcessorManagerImpl.java
Mon Apr 26 12:20:03 2010
@@ -21,24 +21,21 @@ import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
+import java.util.Dictionary;
 import java.util.HashMap;
-import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
-
-import javax.jcr.Item;
-import javax.jcr.Node;
-import javax.jcr.NodeIterator;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.observation.Event;
-import javax.jcr.observation.EventIterator;
-import javax.jcr.observation.EventListener;
 
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.sling.api.SlingConstants;
+import org.apache.sling.api.resource.LoginException;
+import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ResourceResolver;
-import org.apache.sling.jcr.api.SlingRepository;
-import org.apache.sling.jcr.resource.JcrResourceResolverFactory;
+import org.apache.sling.api.resource.ResourceResolverFactory;
+import org.apache.sling.api.resource.ResourceUtil;
 import org.apache.sling.rewriter.PipelineConfiguration;
 import org.apache.sling.rewriter.ProcessingContext;
 import org.apache.sling.rewriter.Processor;
@@ -46,17 +43,20 @@ import org.apache.sling.rewriter.Process
 import org.apache.sling.rewriter.ProcessorManager;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.component.ComponentContext;
+import org.osgi.service.event.EventHandler;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
  * This manager keeps track of configured processors.
  *
- * @scr.component metatype="no"
- * @scr.service interface="ProcessorManager"
  */
-public class ProcessorManagerImpl implements ProcessorManager {
+@Component
+@Service(value=ProcessorManager.class)
+public class ProcessorManagerImpl
+    implements ProcessorManager, EventHandler {
 
     private static final String CONFIG_REL_PATH = "config/rewriter";
     private static final String CONFIG_PATH = "/" + CONFIG_REL_PATH;
@@ -69,14 +69,8 @@ public class ProcessorManagerImpl implem
     /** The bundle context. */
     private BundleContext bundleContext;
 
-    /** The admin session. */
-    private Session adminSession;
-
-    /** @scr.reference */
-    private SlingRepository repository;
-
     /** @scr.reference */
-    private JcrResourceResolverFactory resourceResolverFactory;
+    private ResourceResolverFactory resourceResolverFactory;
 
     /** The resource resolver. */
     private ResourceResolver resourceResolver;
@@ -87,8 +81,8 @@ public class ProcessorManagerImpl implem
     /** Ordered processor configs. */
     private List<ProcessorConfiguration> orderedProcessors = new ArrayList<ProcessorConfiguration>();
 
-    /** Registered listeners */
-    private final List<EventListenerWrapper> listeners = new ArrayList<EventListenerWrapper>();
+    /** Event handler registration */
+    private ServiceRegistration eventHandlerRegistration;
 
     /** Search paths */
     private String[] searchPaths;
@@ -101,36 +95,25 @@ public class ProcessorManagerImpl implem
      * @param ctx
      */
     protected void activate(final ComponentContext ctx)
-    throws RepositoryException, InvalidSyntaxException {
+    throws LoginException, InvalidSyntaxException {
         this.bundleContext = ctx.getBundleContext();
         this.factoryCache = new FactoryCache(this.bundleContext);
-        this.adminSession = this.repository.loginAdministrative(null);
 
         // create array of search paths for actions and constraints
-        this.resourceResolver = this.resourceResolverFactory.getResourceResolver(adminSession);
+        this.resourceResolver = this.resourceResolverFactory.getAdministrativeResourceResolver(null);
         this.searchPaths = resourceResolver.getSearchPath();
 
-        // set up observation listener
-        for(final String p : searchPaths) {
-            // remove trailing slash
-            final String path = p.substring(0, p.length() - 1);
-            // we have to set up a listener for the whole search path
-            // as we support {searchPath}/{appName}/config/rewriter
-            EventListenerWrapper wrapper = new EventListenerWrapper(this, path);
-            adminSession.getWorkspace().getObservationManager()
-                       .addEventListener(wrapper,
-                               Event.NODE_ADDED|Event.NODE_REMOVED|Event.PROPERTY_CHANGED|Event.PROPERTY_ADDED|Event.PROPERTY_REMOVED,
-                               path,
-                               true /* isDeep */,
-                               null /* uuid */,
-                               null /* nodeTypeName */,
-                               true /* noLocal */
-                               );
-            this.listeners.add(wrapper);
-        }
-
         this.initProcessors();
 
+        // register event handler
+        final Dictionary<String, String> props = new Hashtable<String, String>();
+        props.put("event.topics","org/apache/sling/api/resource/*");
+        props.put("service.description","Processor Configuration/Modification Handler");
+        props.put("service.vendor","The Apache Software Foundation");
+
+        this.eventHandlerRegistration = ctx.getBundleContext()
+                  .registerService(EventHandler.class.getName(), this, props);
+
         this.factoryCache.start();
         try {
             WebConsoleConfigPrinter.register(this.bundleContext, this);
@@ -144,19 +127,15 @@ public class ProcessorManagerImpl implem
      * @param ctx
      */
     protected void deactivate(final ComponentContext ctx) {
+        if ( this.eventHandlerRegistration != null ) {
+            this.eventHandlerRegistration.unregister();
+            this.eventHandlerRegistration = null;
+        }
         this.factoryCache.stop();
         this.factoryCache = null;
-        if ( this.adminSession != null ) {
-            for(final EventListener listener : this.listeners) {
-                try {
-                    this.adminSession.getWorkspace().getObservationManager().removeEventListener(listener);
-                } catch (RepositoryException e) {
-                    this.log.error("Unable to unregister observation manager.", e);
-                }
-            }
-            listeners.clear();
-            this.adminSession.logout();
-            this.adminSession = null;
+        if ( this.resourceResolver != null ) {
+            this.resourceResolver.close();
+            this.resourceResolver = null;
         }
         try {
             WebConsoleConfigPrinter.unregister();
@@ -167,33 +146,72 @@ public class ProcessorManagerImpl implem
     }
 
     /**
+     * @see org.osgi.service.event.EventHandler#handleEvent(org.osgi.service.event.Event)
+     */
+    public void handleEvent(final org.osgi.service.event.Event event) {
+        // check if the event handles something in the search paths
+        String path = (String)event.getProperty(SlingConstants.PROPERTY_PATH);
+        int foundPos = -1;
+        for(final String sPath : this.searchPaths) {
+            if ( path.startsWith(sPath) ) {
+                foundPos = sPath.length();
+                break;
+            }
+        }
+        if ( foundPos != -1 ) {
+            // now check if this is a rewriter config
+            // relative path after the search path
+            final int firstSlash = path.indexOf('/', foundPos);
+            final int pattern = path.indexOf(CONFIG_PATH, foundPos);
+            // only if firstSlash and pattern are at the same position, this migt be a rewriter
config
+            if ( firstSlash == pattern && firstSlash != -1 ) {
+                // the node should be a child of CONFIG_PATH
+                if ( path.length() > pattern + CONFIG_PATH.length() && path.charAt(pattern
+ CONFIG_PATH.length()) == '/') {
+                    // if a child resource is changed, make sure we have the correct path
+                    final int slashPos = path.indexOf('/', pattern + CONFIG_PATH.length()
+ 1);
+                    if ( slashPos != -1 ) {
+                        path = path.substring(0, slashPos);
+                    }
+                }
+            }
+            // we should do the update async as we don't want to block the event delivery
+            final String configPath = path;
+            final Thread t = new Thread() {
+                public void run() {
+                    if ( event.getTopic().equals(SlingConstants.TOPIC_RESOURCE_REMOVED) )
{
+                        removeProcessor(configPath);
+                    } else {
+                        updateProcessor(configPath);
+                    }
+                }
+            };
+            t.start();
+        }
+    }
+
+    /**
      * Initializes the current processors
-     * @throws RepositoryException
      */
-    private synchronized void initProcessors()
-    throws RepositoryException {
+    private synchronized void initProcessors() {
         for(final String path : this.searchPaths ) {
             // check if the search path exists
-            if ( this.adminSession.itemExists(path) ) {
-                final Item item = this.adminSession.getItem(path);
-                if ( item.isNode() ) {
-                    // now iterate over the child nodes
-                    final Node searchPathNode = (Node)item;
-                    final NodeIterator spIter = searchPathNode.getNodes();
-                    while ( spIter.hasNext() ) {
-                        // check if the node has a rewriter config
-                        final Node appNode = spIter.nextNode();
-                        if ( appNode.hasNode(CONFIG_REL_PATH) ) {
-                            final Node parentNode = appNode.getNode(CONFIG_REL_PATH);
-                            // now read configs
-                            final NodeIterator iter = parentNode.getNodes();
-                            while ( iter.hasNext() ) {
-                                final Node configNode = iter.nextNode();
-                                final String key = configNode.getName();
-                                final ProcessorConfigurationImpl config = this.getProcessorConfiguration(configNode);
-                                this.log.debug("Found new processor configuration {}", config);
-                                this.addProcessor(key, configNode.getPath(), config);
-                            }
+            final Resource spResource = this.resourceResolver.getResource(path.substring(0,
path.length() - 1));
+            if ( spResource != null ) {
+                // now iterate over the child nodes
+                final Iterator<Resource> spIter = ResourceUtil.listChildren(spResource);
+                while ( spIter.hasNext() ) {
+                    // check if the node has a rewriter config
+                    final Resource appResource = spIter.next();
+                    final Resource parentResource = this.resourceResolver.getResource(appResource.getPath()
+ CONFIG_PATH);
+                    if ( parentResource != null ) {
+                        // now read configs
+                        final Iterator<Resource> iter = ResourceUtil.listChildren(parentResource);
+                        while ( iter.hasNext() ) {
+                            final Resource configResource = iter.next();
+                            final String key = ResourceUtil.getName(configResource);
+                            final ProcessorConfigurationImpl config = this.getProcessorConfiguration(configResource);
+                            this.log.debug("Found new processor configuration {}", config);
+                            this.addProcessor(key, configResource.getPath(), config);
                         }
                     }
                 }
@@ -204,10 +222,8 @@ public class ProcessorManagerImpl implem
     /**
      * Read the configuration for the processor from the repository.
      */
-    private ProcessorConfigurationImpl getProcessorConfiguration(Node configNode)
-    throws RepositoryException {
-        configNode.getSession().refresh(true);
-        final ProcessorConfigurationImpl config = new ProcessorConfigurationImpl(this.resourceResolver.getResource(configNode.getPath()));
+    private ProcessorConfigurationImpl getProcessorConfiguration(final Resource configResource)
{
+        final ProcessorConfigurationImpl config = new ProcessorConfigurationImpl(configResource);
         return config;
     }
 
@@ -233,72 +249,6 @@ public class ProcessorManagerImpl implem
         }
     }
 
-    /**
-     * This method is invoked by the event listener wrapper.
-     * The second argument is the search path - which is the prefix we have to strip
-     * to check if this is a rewriter configuration change.
-     */
-    public synchronized void onEvent(final EventIterator iter, final String searchPath) {
-        final Set<String>removedPaths = new HashSet<String>();
-        final Set<String>changedPaths = new HashSet<String>();
-        while ( iter.hasNext() ) {
-            final Event event = iter.nextEvent();
-            try {
-                String nodePath = event.getPath();
-                if ( event.getType() == Event.PROPERTY_ADDED
-                     || event.getType() == Event.PROPERTY_REMOVED
-                     || event.getType() == Event.PROPERTY_CHANGED ) {
-                    final int lastSlash = nodePath.lastIndexOf('/');
-                    nodePath = nodePath.substring(0, lastSlash);
-                }
-                // relative path after the search path
-                String checkPath = nodePath.substring(searchPath.length() + 1);
-                final int firstSlash = checkPath.indexOf('/');
-                final int pattern = checkPath.indexOf(CONFIG_PATH);
-                // only if firstSlash and pattern are at the same position, this migt be
a rewriter config
-                if ( firstSlash == pattern && firstSlash != -1 ) {
-                    // the node should be a direct child of CONFIG_PATH
-                    if ( checkPath.length() > pattern + CONFIG_PATH.length() ) {
-                        checkPath = checkPath.substring(pattern + CONFIG_PATH.length() +
1);
-                        if ( checkPath.indexOf('/') == -1 ) {
-                            switch (event.getType()) {
-                                case Event.NODE_ADDED:
-                                    changedPaths.add(nodePath);
-                                    break;
-
-                                case Event.PROPERTY_ADDED:
-                                case Event.PROPERTY_REMOVED:
-                                case Event.PROPERTY_CHANGED:
-                                    changedPaths.add(nodePath);
-                                    break;
-
-                                case Event.NODE_REMOVED:
-                                    // remove processor
-                                    removedPaths.add(nodePath);
-                                    break;
-                            }
-                        }
-                    }
-                }
-            } catch (RepositoryException e) {
-                log.error("Error during modification: {}", e.getMessage());
-            }
-        }
-        // handle removed first
-        changedPaths.removeAll(removedPaths);
-        for(final String path : removedPaths) {
-            this.removeProcessor(path);
-        }
-        // now update changed/added processors
-        for(final String path : changedPaths) {
-            try {
-                this.updateProcessor(path);
-            } catch (RepositoryException e) {
-                log.error("Error during modification: {}", e.getMessage());
-            }
-        }
-    }
-
     private void printConfiguration(final PrintWriter pw, final ConfigEntry entry) {
         if ( entry.config instanceof ProcessorConfigurationImpl ) {
             ((ProcessorConfigurationImpl)entry.config).printConfiguration(pw);
@@ -341,8 +291,7 @@ public class ProcessorManagerImpl implem
     /**
      * updates a processor
      */
-    private void updateProcessor(String path)
-    throws RepositoryException {
+    private synchronized void updateProcessor(String path) {
         final int pos = path.lastIndexOf('/');
         final String key = path.substring(pos + 1);
         int keyIndex = 0;
@@ -354,8 +303,11 @@ public class ProcessorManagerImpl implem
             keyIndex++;
         }
 
-        final Node configNode = (Node) this.adminSession.getItem(path);
-        final ProcessorConfigurationImpl config = this.getProcessorConfiguration(configNode);
+        final Resource configResource = this.resourceResolver.getResource(path);
+        if ( configResource == null ) {
+            return;
+        }
+        final ProcessorConfigurationImpl config = this.getProcessorConfiguration(configResource);
 
         final ConfigEntry[] configs = this.processors.get(key);
         if ( configs != null ) {
@@ -434,7 +386,7 @@ public class ProcessorManagerImpl implem
     /**
      * removes a pipeline
      */
-    private void removeProcessor(String path) {
+    private synchronized void removeProcessor(String path) {
         final int pos = path.lastIndexOf('/');
         final String key = path.substring(pos + 1);
         // we have to search the config
@@ -525,28 +477,6 @@ public class ProcessorManagerImpl implem
 
     }
 
-    /**
-     * Event listener wrapper to be able to add this service several times with different
paths.
-     */
-    public final static class EventListenerWrapper implements EventListener {
-
-        private final ProcessorManagerImpl delegatee;
-
-        private final String path;
-
-        public EventListenerWrapper(final ProcessorManagerImpl listener, final String path)
{
-            this.delegatee = listener;
-            this.path = path;
-        }
-
-        /**
-         * @see javax.jcr.observation.EventListener#onEvent(javax.jcr.observation.EventIterator)
-         */
-        public void onEvent(EventIterator i) {
-            this.delegatee.onEvent(i, path);
-        }
-    }
-
     public static final class ConfigEntry {
         public final String path;
         public final ProcessorConfiguration config;

Modified: sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/RewriterFilter.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/RewriterFilter.java?rev=938017&r1=938016&r2=938017&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/RewriterFilter.java
(original)
+++ sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/RewriterFilter.java
Mon Apr 26 12:20:03 2010
@@ -25,6 +25,11 @@ import javax.servlet.ServletException;
 import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
 
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Properties;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.api.SlingHttpServletRequest;
 import org.apache.sling.api.SlingHttpServletResponse;
 import org.apache.sling.rewriter.ProcessorManager;
@@ -32,14 +37,17 @@ import org.apache.sling.rewriter.Process
 /**
  * This filter activates the rewriter for the output.
  *
- * @scr.component metatype="no"
- * @scr.property name="filter.scope" value="request" private="true"
- * @scr.property name="filter.order" value="-2500" type="Integer" private="true"
- * @scr.service interface="javax.servlet.Filter"
  */
+@Component
+@Service(value=Filter.class)
+@Properties({
+    @Property(name="filter.scope",value="request",propertyPrivate=true),
+    @Property(name="filter.order",intValue=-2500,propertyPrivate=true)
+})
+
 public class RewriterFilter implements Filter {
 
-    /** @scr.reference */
+    @Reference
     private ProcessorManager pipelineManager;
 
     /**

Modified: sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/components/HtmlGeneratorFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/components/HtmlGeneratorFactory.java?rev=938017&r1=938016&r2=938017&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/components/HtmlGeneratorFactory.java
(original)
+++ sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/components/HtmlGeneratorFactory.java
Mon Apr 26 12:20:03 2010
@@ -21,6 +21,10 @@ import java.io.IOException;
 import java.io.PrintWriter;
 import java.io.StringWriter;
 
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.commons.html.HtmlParser;
 import org.apache.sling.rewriter.Generator;
 import org.apache.sling.rewriter.GeneratorFactory;
@@ -33,13 +37,13 @@ import org.xml.sax.SAXException;
  * On the fly HTML parser which can be used as the
  * starting point for html pipelines.
  *
- * @scr.component metatype="no"
- * @scr.service
- * @scr.property name="pipeline.type" value="html-generator"
  */
+@Component
+@Service(value=GeneratorFactory.class)
+@Property(name="pipeline.type",value="html-generator")
 public class HtmlGeneratorFactory implements GeneratorFactory {
 
-    /** @scr.reference */
+    @Reference
     private HtmlParser htmlParser;
 
     /**

Modified: sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/components/HtmlSerializerFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/components/HtmlSerializerFactory.java?rev=938017&r1=938016&r2=938017&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/components/HtmlSerializerFactory.java
(original)
+++ sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/components/HtmlSerializerFactory.java
Mon Apr 26 12:20:03 2010
@@ -19,6 +19,9 @@ package org.apache.sling.rewriter.impl.c
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.rewriter.ProcessingComponentConfiguration;
 import org.apache.sling.rewriter.ProcessingContext;
 import org.apache.sling.rewriter.Serializer;
@@ -26,10 +29,10 @@ import org.apache.sling.rewriter.Seriali
 
 /**
  * This sax serializer serializes html-
- * @scr.component metatype="no"
- * @scr.service
- * @scr.property name="pipeline.type" value="html-serializer"
  */
+@Component
+@Service(value=SerializerFactory.class)
+@Property(name="pipeline.type",value="html-serializer")
 public class HtmlSerializerFactory implements SerializerFactory {
 
     /**

Modified: sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/components/TraxHtmlSerializerFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/components/TraxHtmlSerializerFactory.java?rev=938017&r1=938016&r2=938017&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/components/TraxHtmlSerializerFactory.java
(original)
+++ sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/components/TraxHtmlSerializerFactory.java
Mon Apr 26 12:20:03 2010
@@ -16,13 +16,18 @@
  */
 package org.apache.sling.rewriter.impl.components;
 
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.sling.rewriter.SerializerFactory;
+
 
 /**
  * This sax serializer serializes html-
- * @scr.component metatype="no"
- * @scr.service
- * @scr.property name="pipeline.type" value="trax-html-serializer"
  */
+@Component
+@Service(value=SerializerFactory.class)
+@Property(name="pipeline.type",value="trax-html-serializer")
 public class TraxHtmlSerializerFactory extends AbstractTraxSerializerFactory {
 
     @Override

Modified: sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/components/TraxXHtmlSerializerFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/components/TraxXHtmlSerializerFactory.java?rev=938017&r1=938016&r2=938017&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/components/TraxXHtmlSerializerFactory.java
(original)
+++ sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/components/TraxXHtmlSerializerFactory.java
Mon Apr 26 12:20:03 2010
@@ -16,13 +16,18 @@
  */
 package org.apache.sling.rewriter.impl.components;
 
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.sling.rewriter.SerializerFactory;
+
 
 /**
  * This sax serializer serializes xhtml-
- * @scr.component metatype="no"
- * @scr.service
- * @scr.property name="pipeline.type" value="trax-xhtml-serializer"
  */
+@Component
+@Service(value=SerializerFactory.class)
+@Property(name="pipeline.type",value="trax-xhtml-serializer")
 public class TraxXHtmlSerializerFactory extends AbstractTraxSerializerFactory {
 
     @Override

Modified: sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/components/XHtmlSerializerFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/components/XHtmlSerializerFactory.java?rev=938017&r1=938016&r2=938017&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/components/XHtmlSerializerFactory.java
(original)
+++ sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/components/XHtmlSerializerFactory.java
Mon Apr 26 12:20:03 2010
@@ -19,6 +19,9 @@ package org.apache.sling.rewriter.impl.c
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.rewriter.ProcessingComponentConfiguration;
 import org.apache.sling.rewriter.ProcessingContext;
 import org.apache.sling.rewriter.Serializer;
@@ -26,10 +29,10 @@ import org.apache.sling.rewriter.Seriali
 
 /**
  * This sax serializer serializes xhtml-
- * @scr.component metatype="no"
- * @scr.service
- * @scr.property name="pipeline.type" value="xhtml-serializer"
  */
+@Component
+@Service(value=SerializerFactory.class)
+@Property(name="pipeline.type",value="xhtml-serializer")
 public class XHtmlSerializerFactory implements SerializerFactory {
 
     /**



Mime
View raw message