incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r1088909 - in /sling/trunk/contrib/extensions/i18n: pom.xml src/main/java/org/apache/sling/i18n/impl/I18NFilter.java
Date Tue, 05 Apr 2011 07:06:15 GMT
Author: fmeschbe
Date: Tue Apr  5 07:06:15 2011
New Revision: 1088909

URL: http://svn.apache.org/viewvc?rev=1088909&view=rev
Log:
SLING-2046 Convert to SCR annotations and use constants where possible

Modified:
    sling/trunk/contrib/extensions/i18n/pom.xml
    sling/trunk/contrib/extensions/i18n/src/main/java/org/apache/sling/i18n/impl/I18NFilter.java

Modified: sling/trunk/contrib/extensions/i18n/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/i18n/pom.xml?rev=1088909&r1=1088908&r2=1088909&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/i18n/pom.xml (original)
+++ sling/trunk/contrib/extensions/i18n/pom.xml Tue Apr  5 07:06:15 2011
@@ -84,6 +84,12 @@
             <version>2.1.0</version>
             <scope>provided</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.engine</artifactId>
+            <version>2.2.0</version>
+            <scope>provided</scope>
+        </dependency>
 
         <dependency>
             <groupId>org.apache.sling</groupId>

Modified: sling/trunk/contrib/extensions/i18n/src/main/java/org/apache/sling/i18n/impl/I18NFilter.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/i18n/src/main/java/org/apache/sling/i18n/impl/I18NFilter.java?rev=1088909&r1=1088908&r2=1088909&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/i18n/src/main/java/org/apache/sling/i18n/impl/I18NFilter.java
(original)
+++ sling/trunk/contrib/extensions/i18n/src/main/java/org/apache/sling/i18n/impl/I18NFilter.java
Tue Apr  5 07:06:15 2011
@@ -34,24 +34,33 @@ 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.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.wrappers.SlingHttpServletRequestWrapper;
+import org.apache.sling.engine.EngineConstants;
 import org.apache.sling.i18n.LocaleResolver;
 import org.apache.sling.i18n.ResourceBundleProvider;
+import org.osgi.framework.Constants;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
  * The <code>I18NFilter</code> class is a request level filter, which provides
  * the resource bundle for the current request.
- * 
- * @scr.component immediate="true" metatype="no"
- * @scr.property name="service.description" value="Internationalization Support Filter"
- * @scr.property name="service.vendor" value="The Apache Software Foundation"
- * @scr.property name="filter.scope" value="request" private="true"
- * @scr.property name="filter.order" value="-700" type="Integer" private="true"
- * @scr.service
  */
+@Component(immediate = true, metatype = false)
+@Properties({
+    @Property(name = Constants.SERVICE_DESCRIPTION, value = "Internationalization Support
Filter"),
+    @Property(name = Constants.SERVICE_VENDOR, value = "The Apache Software Foundation"),
+    @Property(name = EngineConstants.SLING_FILTER_SCOPE, value = EngineConstants.FILTER_SCOPE_REQUEST,
propertyPrivate = true),
+    @Property(name = Constants.SERVICE_RANKING, intValue = -700, propertyPrivate = true)
})
+@Service
 public class I18NFilter implements Filter {
 
     /** default log */
@@ -73,13 +82,11 @@ public class I18NFilter implements Filte
         }
     };
 
-    /**
-     * @scr.reference cardinality="0..1" policy="dynamic"
-     */
+    @Reference(cardinality = ReferenceCardinality.OPTIONAL_UNARY, policy = ReferencePolicy.DYNAMIC)
     private LocaleResolver localeResolver = DEFAULT_LOCALE_RESOLVER;
 
-    /** @scr.reference cardinality="0..1" policy="dynamic" */
-    ResourceBundleProvider resourceBundleProvider;
+    @Reference(cardinality = ReferenceCardinality.OPTIONAL_UNARY, policy = ReferencePolicy.DYNAMIC)
+    private ResourceBundleProvider resourceBundleProvider;
 
     public void init(FilterConfig filterConfig) {
         // nothing to do
@@ -160,7 +167,7 @@ public class I18NFilter implements Filte
 
             return super.getResourceBundle(baseName, locale);
         }
-        
+
         @Override
         public Locale getLocale() {
             if (locale == null) {



Mime
View raw message