incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r1200289 - in /sling/trunk/bundles/commons/mime: ./ src/main/java/org/apache/sling/commons/mime/ src/main/java/org/apache/sling/commons/mime/internal/
Date Thu, 10 Nov 2011 12:22:02 GMT
Author: fmeschbe
Date: Thu Nov 10 12:22:01 2011
New Revision: 1200289

URL: http://svn.apache.org/viewvc?rev=1200289&view=rev
Log:
SLING-2278 Convert to Java annotations

Added:
    sling/trunk/bundles/commons/mime/src/main/java/org/apache/sling/commons/mime/package-info.java
Modified:
    sling/trunk/bundles/commons/mime/pom.xml
    sling/trunk/bundles/commons/mime/src/main/java/org/apache/sling/commons/mime/internal/MimeTypeServiceImpl.java
    sling/trunk/bundles/commons/mime/src/main/java/org/apache/sling/commons/mime/internal/TikaMimeTypeProvider.java

Modified: sling/trunk/bundles/commons/mime/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/mime/pom.xml?rev=1200289&r1=1200288&r2=1200289&view=diff
==============================================================================
--- sling/trunk/bundles/commons/mime/pom.xml (original)
+++ sling/trunk/bundles/commons/mime/pom.xml Thu Nov 10 12:22:01 2011
@@ -51,15 +51,13 @@
             <plugin>
                 <groupId>org.apache.felix</groupId>
                 <artifactId>maven-bundle-plugin</artifactId>
+                <version>2.3.4</version>
                 <extensions>true</extensions>
                 <configuration>
                     <instructions>
                         <Bundle-DocURL>
                             http://sling.apache.org/site/mime-type-support.html
                         </Bundle-DocURL>
-                        <Export-Package>
-                            org.apache.sling.commons.mime;version=${project.version}
-                        </Export-Package>
                         <Private-Package>
                             org.apache.sling.commons.mime.internal
                         </Private-Package>
@@ -113,6 +111,16 @@
             <artifactId>servlet-api</artifactId>
         </dependency>
         <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.scr.annotations</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>biz.aQute</groupId>
+            <artifactId>bndlib</artifactId>
+            <version>1.50.0</version>
+        </dependency>
+        
+        <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
         </dependency>

Modified: sling/trunk/bundles/commons/mime/src/main/java/org/apache/sling/commons/mime/internal/MimeTypeServiceImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/mime/src/main/java/org/apache/sling/commons/mime/internal/MimeTypeServiceImpl.java?rev=1200289&r1=1200288&r2=1200289&view=diff
==============================================================================
--- sling/trunk/bundles/commons/mime/src/main/java/org/apache/sling/commons/mime/internal/MimeTypeServiceImpl.java
(original)
+++ sling/trunk/bundles/commons/mime/src/main/java/org/apache/sling/commons/mime/internal/MimeTypeServiceImpl.java
Thu Nov 10 12:22:01 2011
@@ -29,12 +29,20 @@ import java.util.Hashtable;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.PropertyUnbounded;
+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.commons.mime.MimeTypeProvider;
 import org.apache.sling.commons.mime.MimeTypeService;
 import org.apache.sling.commons.osgi.OsgiUtil;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleEvent;
 import org.osgi.framework.BundleListener;
+import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.component.ComponentContext;
 import org.osgi.service.log.LogService;
@@ -42,17 +50,11 @@ import org.osgi.service.log.LogService;
 /**
  * The <code>MimeTypeServiceImpl</code> is the official implementation of the
  * {@link MimeTypeService} interface.
- *
- * @scr.component immediate="false" label="%mime.service.name"
- *                description="%mime.service.description"
- * @scr.property name="service.vendor" value="The Apache Software Foundation"
- * @scr.property name="service.description"
- *               value="Apache Sling MIME Type Service"
- * @scr.service interface="org.apache.sling.commons.mime.MimeTypeService"
- * @scr.reference name="MimeTypeProvider"
- *                interface="org.apache.sling.commons.mime.MimeTypeProvider"
- *                cardinality="0..n" policy="dynamic"
  */
+@Component(metatype = true, label = "%mime.service.name", description = "%mime.service.description")
+@Service(MimeTypeService.class)
+@Property(name = Constants.SERVICE_DESCRIPTION, value = "Apache Sling MIME Type Service")
+@Reference(name = "MimeTypeProvider", referenceInterface = MimeTypeProvider.class, cardinality
= ReferenceCardinality.OPTIONAL_MULTIPLE, policy = ReferencePolicy.DYNAMIC)
 public class MimeTypeServiceImpl implements MimeTypeService, BundleListener {
 
     public static final String CORE_MIME_TYPES = "/META-INF/core_mime.types";
@@ -60,9 +62,10 @@ public class MimeTypeServiceImpl impleme
     public static final String MIME_TYPES = "/META-INF/mime.types";
 
     /** @scr.property cardinality="-2147483647" type="String" */
+    @Property(unbounded = PropertyUnbounded.ARRAY)
     private static final String PROP_MIME_TYPES = "mime.types";
 
-    /** @scr.reference cardinality="0..1" policy="dynamic" */
+    @Reference(cardinality=ReferenceCardinality.OPTIONAL_UNARY, policy=ReferencePolicy.DYNAMIC)
     private LogService logService;
 
     private Map<String, String> mimeTab = new HashMap<String, String>();

Modified: sling/trunk/bundles/commons/mime/src/main/java/org/apache/sling/commons/mime/internal/TikaMimeTypeProvider.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/mime/src/main/java/org/apache/sling/commons/mime/internal/TikaMimeTypeProvider.java?rev=1200289&r1=1200288&r2=1200289&view=diff
==============================================================================
--- sling/trunk/bundles/commons/mime/src/main/java/org/apache/sling/commons/mime/internal/TikaMimeTypeProvider.java
(original)
+++ sling/trunk/bundles/commons/mime/src/main/java/org/apache/sling/commons/mime/internal/TikaMimeTypeProvider.java
Thu Nov 10 12:22:01 2011
@@ -16,20 +16,22 @@
  */
 package org.apache.sling.commons.mime.internal;
 
+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.commons.mime.MimeTypeProvider;
 import org.apache.tika.Tika;
 import org.apache.tika.mime.MimeType;
 import org.apache.tika.mime.MimeTypeException;
 import org.apache.tika.mime.MimeTypes;
+import org.osgi.framework.Constants;
 
 /**
  * MIME type provider based on Apache Tika.
- *
- * @scr.component
- * @scr.service interface="org.apache.sling.commons.mime.MimeTypeProvider"
- * @scr.property name="service.description"
- *               value="Apache Tika MIME Type Provider"
  */
+@Component
+@Service(MimeTypeProvider.class)
+@Property(name = Constants.SERVICE_DESCRIPTION, value = "Apache Tika MIME Type Provider")
 public class TikaMimeTypeProvider implements MimeTypeProvider {
 
     private final Tika tika = new Tika();

Added: sling/trunk/bundles/commons/mime/src/main/java/org/apache/sling/commons/mime/package-info.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/mime/src/main/java/org/apache/sling/commons/mime/package-info.java?rev=1200289&view=auto
==============================================================================
--- sling/trunk/bundles/commons/mime/src/main/java/org/apache/sling/commons/mime/package-info.java
(added)
+++ sling/trunk/bundles/commons/mime/src/main/java/org/apache/sling/commons/mime/package-info.java
Thu Nov 10 12:22:01 2011
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+
+/**
+ * Provides the {@link org.apache.sling.commons.mime.MimeTypeService}
+ * service used by client to resolve MIME type information as well as the
+ * {@link org.apache.sling.commons.mime.MimeTypeProvider} service
+ * interface for providers to extend the MIME type setup provided by the
+ * {@link org.apache.sling.commons.mime.MimeTypeService}.
+ *
+ * @version 2.1.4
+ */
+@Version("2.1.4")
+@Export(optional = "provide:=true")
+package org.apache.sling.commons.mime;
+
+import aQute.bnd.annotation.Export;
+import aQute.bnd.annotation.Version;
+



Mime
View raw message