Author: fmeschbe
Date: Mon Aug 23 07:40:36 2010
New Revision: 988014

URL: http://svn.apache.org/viewvc?rev=988014&view=rev
Log:
SLING-1679 Use Apache Felix SCR Annotations (instead of @scr JavaDoc tags)

Modified:
    sling/trunk/bundles/auth/core/pom.xml
    
sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl/LoginServlet.java
    
sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl/LogoutServlet.java
    
sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl/engine/EngineSlingAuthenticator.java

Modified: sling/trunk/bundles/auth/core/pom.xml
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/auth/core/pom.xml?rev=988014&r1=988013&r2=988014&view=diff
==============================================================================
--- sling/trunk/bundles/auth/core/pom.xml (original)
+++ sling/trunk/bundles/auth/core/pom.xml Mon Aug 23 07:40:36 2010
@@ -146,6 +146,14 @@
             <scope>provided</scope>
         </dependency>
 
+        <!-- Declarative Services support annotations -->
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.scr.annotations</artifactId>
+            <version>1.3.0</version>
+            <scope>provided</scope>
+        </dependency>
+
         <!-- Test Dependencies -->
         <dependency>
             <groupId>junit</groupId>

Modified: 
sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl/LoginServlet.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl/LoginServlet.java?rev=988014&r1=988013&r2=988014&view=diff
==============================================================================
--- 
sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl/LoginServlet.java
 (original)
+++ 
sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl/LoginServlet.java
 Mon Aug 23 07:40:36 2010
@@ -20,25 +20,34 @@ package org.apache.sling.auth.core.impl;
 
 import java.io.IOException;
 
+import javax.servlet.Servlet;
 import javax.servlet.http.HttpServletResponse;
 
+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.ReferenceCardinality;
+import org.apache.felix.scr.annotations.ReferencePolicy;
+import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.api.SlingHttpServletRequest;
 import org.apache.sling.api.SlingHttpServletResponse;
 import org.apache.sling.api.auth.Authenticator;
 import org.apache.sling.api.auth.NoAuthenticationHandlerException;
 import org.apache.sling.api.servlets.SlingAllMethodsServlet;
+import org.osgi.framework.Constants;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
  * The <code>LoginServlet</code> lets the Authenticator do the login.
- *
- * @scr.component metatype="no"
- * @scr.service interface="javax.servlet.Servlet"
- * @scr.property name="service.description" value="Authenticator Login Servlet"
- * @scr.property name="service.vendor" value="The Apache Software Foundation"
- * @scr.property name="sling.servlet.methods" values.0="GET" values.1="POST"
  */
+...@component()
+...@service(value = Servlet.class)
+...@properties( {
+    @Property(name = Constants.SERVICE_DESCRIPTION, value = "Authenticator 
Login Servlet"),
+    @Property(name = Constants.SERVICE_VENDOR, value = "The Apache Software 
Foundation"),
+    @Property(name = "sling.servlet.methods", value = { "GET", "POST" }) })
 public class LoginServlet extends SlingAllMethodsServlet {
 
     /** serialization UID */
@@ -47,15 +56,14 @@ public class LoginServlet extends SlingA
     /** default log */
     private final Logger log = LoggerFactory.getLogger(getClass());
 
-    /** @scr.reference cardinality="0..1" policy="dynamic" */
+    @Reference(cardinality = ReferenceCardinality.OPTIONAL_UNARY, policy = 
ReferencePolicy.DYNAMIC)
     private Authenticator authenticator;
 
     /**
      * The servlet is registered on this path, and the authenticator allows any
      * requests to that path, without authentication
-     *
-     * @scr.property name="sling.servlet.paths"
      */
+    @Property(name = "sling.servlet.paths")
     public static final String SERVLET_PATH = "/system/sling/login";
 
     @Override

Modified: 
sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl/LogoutServlet.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl/LogoutServlet.java?rev=988014&r1=988013&r2=988014&view=diff
==============================================================================
--- 
sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl/LogoutServlet.java
 (original)
+++ 
sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl/LogoutServlet.java
 Mon Aug 23 07:40:36 2010
@@ -18,26 +18,34 @@
  */
 package org.apache.sling.auth.core.impl;
 
+import javax.servlet.Servlet;
 import javax.servlet.http.HttpServletResponse;
 
+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.ReferenceCardinality;
+import org.apache.felix.scr.annotations.ReferencePolicy;
+import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.api.SlingHttpServletRequest;
 import org.apache.sling.api.SlingHttpServletResponse;
 import org.apache.sling.api.auth.Authenticator;
 import org.apache.sling.api.servlets.SlingAllMethodsServlet;
+import org.osgi.framework.Constants;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
  * The <code>LogoutServlet</code> lets the Authenticator
  * do the logout.
- *
- * @scr.component metatype="no"
- * @scr.service interface="javax.servlet.Servlet"
- * @scr.property name="service.description" value="Authenticator Logout 
Servlet"
- * @scr.property name="service.vendor" value="The Apache Software Foundation"
- * @scr.property name="sling.servlet.methods" values.0="GET" values.1="POST"
- *
  */
+...@component()
+...@service(value = Servlet.class)
+...@properties( {
+    @Property(name = Constants.SERVICE_DESCRIPTION, value = "Authenticator 
Logout Servlet"),
+    @Property(name = Constants.SERVICE_VENDOR, value = "The Apache Software 
Foundation"),
+    @Property(name = "sling.servlet.methods", value = { "GET", "POST" }) })
 public class LogoutServlet extends SlingAllMethodsServlet {
 
     /** serialization UID */
@@ -46,11 +54,13 @@ public class LogoutServlet extends Sling
     /** default log */
     private final Logger log = LoggerFactory.getLogger(getClass());
 
-    /** @scr.reference cardinality="0..1" policy="dynamic" */
+    @Reference(cardinality = ReferenceCardinality.OPTIONAL_UNARY, policy = 
ReferencePolicy.DYNAMIC)
     private Authenticator authenticator;
 
-    /** The servlet is registered on this path.
-     *  @scr.property name="sling.servlet.paths" */
+    /**
+     * The servlet is registered on this path.
+     */
+    @Property(name = "sling.servlet.paths")
     public static final String SERVLET_PATH = "/system/sling/logout";
 
     @Override

Modified: 
sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl/engine/EngineSlingAuthenticator.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl/engine/EngineSlingAuthenticator.java?rev=988014&r1=988013&r2=988014&view=diff
==============================================================================
--- 
sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl/engine/EngineSlingAuthenticator.java
 (original)
+++ 
sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl/engine/EngineSlingAuthenticator.java
 Mon Aug 23 07:40:36 2010
@@ -21,27 +21,30 @@ package org.apache.sling.auth.core.impl.
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+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.engine.auth.Authenticator;
 import org.apache.sling.engine.auth.NoAuthenticationHandlerException;
+import org.osgi.framework.Constants;
 
 /**
  * The <code>EngineSlingAuthenticator</code> class is a simple proxy service
  * providing the old Sling Engine {...@link Authenticator} service calling 
into the
  * new standalone Apache Sling
  * {...@link org.apache.sling.auth.core.AuthenticationSupport} service.
- *
- * @scr.component metatype="no"
- * @scr.service interface="org.apache.sling.engine.auth.Authenticator"
- * @scr.property name="service.description"
- *               value="Apache Sling Request Authenticator (Legacy Bridge)"
- * @scr.property name="service.vendor" value="The Apache Software Foundation"
  */
+...@component()
+...@service(value = Authenticator.class)
+...@properties( {
+    @Property(name = Constants.SERVICE_DESCRIPTION, value = "Apache Sling 
Request Authenticator (Legacy Bridge)"),
+    @Property(name = Constants.SERVICE_VENDOR, value = "The Apache Software 
Foundation") })
 @SuppressWarnings("deprecation")
 public class EngineSlingAuthenticator implements Authenticator {
 
-    /**
-     * @scr.reference
-     */
+    @Reference
     private org.apache.sling.api.auth.Authenticator slingAuthenticator;
 
     public void login(HttpServletRequest request, HttpServletResponse 
response) {


Reply via email to