You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by da...@apache.org on 2020/07/28 15:05:56 UTC

[sling-org-apache-sling-javax-activation] 32/34: SLING-9612 Tune the nodeps javax.activation bundle to Java 8

This is an automated email from the ASF dual-hosted git repository.

davidb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-javax-activation.git

commit eddd03f5135980b2627eb6ece0b17dc1b54b17d9
Author: David Bosschaert <bo...@adobe.com>
AuthorDate: Tue Jul 28 10:48:26 2020 +0100

    SLING-9612 Tune the nodeps javax.activation bundle to Java 8
---
 pom.xml                                                      | 12 ++++++++++--
 .../apache/sling/javax/activation/internal/Activator.java    |  9 +++------
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/pom.xml b/pom.xml
index af42cab..d72ea8d 100755
--- a/pom.xml
+++ b/pom.xml
@@ -58,8 +58,13 @@
                         </goals>
                         <configuration>
                             <bnd><![CDATA[
-Bundle-Name: ${project.name} (No embedded dependencies)
+Bundle-Name: ${project.name} (Framework Fragment, No embedded dependencies)
 Bundle-SymbolicName: ${project.artifactId}.nodeps
+ExtensionBundle-Activator: org.apache.sling.javax.activation.internal.Activator
+Export-Package: javax.activation;version="0.0.0",com.sun.activation.registries;version="0.0.0",com.sun.activation.viewers;version="0.0.0"
+Import-Package: !javax.activation,!com.sun.activation.registries,!com.sun.activation.viewers
+Provide-Capability: osgi.contract;osgi.contract=JavaActivation;version:List<Version>="1.1.1";uses:="javax.activation"
+Fragment-Host: system.bundle;extension:=framework
 ]]>
                             </bnd>
                             <manifestPath>${project.build.directory}/nodeps-classes/META-INF/MANIFEST.MF</manifestPath>
@@ -72,7 +77,9 @@ Bundle-SymbolicName: ${project.artifactId}.nodeps
                             <bnd><![CDATA[
 -includeresource:@jakarta.activation-[0-9.]*(-SNAPSHOT)?.jar
 # version automatically determined from the MANIFEST.MF of the jakarta.activation.jar
+Bundle-Activator: org.apache.sling.javax.activation.internal.Activator
 Export-Package: javax.activation,com.sun.activation.registries,com.sun.activation.viewers
+Provide-Capability: osgi.contract;osgi.contract=JavaActivation;version:List<Version>="1.2";uses:="javax.activation"
 ]]>
                             </bnd>
                             <manifestPath>${project.build.directory}/deps-classes/META-INF/MANIFEST.MF</manifestPath>
@@ -101,7 +108,7 @@ Export-Package: javax.activation,com.sun.activation.registries,com.sun.activatio
                         </goals>
                         <configuration>
                             <classifier>nodeps</classifier>
-                            <classesDirectory>${project.build.directory}/nodeps-classes</classesDirectory>
+                            <classesDirectory>${project.build.directory}/classes</classesDirectory>
                             <archive>
                                 <manifestFile>${project.build.directory}/nodeps-classes/META-INF/MANIFEST.MF</manifestFile>
                             </archive>
@@ -117,6 +124,7 @@ Export-Package: javax.activation,com.sun.activation.registries,com.sun.activatio
             <groupId>com.sun.activation</groupId>
             <artifactId>jakarta.activation</artifactId>
             <version>${javax.activation.version}</version>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
diff --git a/src/main/java/org/apache/sling/javax/activation/internal/Activator.java b/src/main/java/org/apache/sling/javax/activation/internal/Activator.java
index 751abeb..862dc2e 100755
--- a/src/main/java/org/apache/sling/javax/activation/internal/Activator.java
+++ b/src/main/java/org/apache/sling/javax/activation/internal/Activator.java
@@ -25,12 +25,10 @@ import java.net.URL;
 import javax.activation.CommandMap;
 import javax.activation.MailcapCommandMap;
 
-import org.osgi.annotation.bundle.Header;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleEvent;
-import org.osgi.framework.Constants;
 import org.osgi.util.tracker.BundleTracker;
 import org.osgi.util.tracker.BundleTrackerCustomizer;
 import org.slf4j.Logger;
@@ -39,17 +37,16 @@ import org.slf4j.LoggerFactory;
 /**
  * The <tt>Activator</tt> locates <tt>activation</tt>-related services defined in <tt>mailcap</tt> files and registers
  * them so they can be used by the Java Activation Framework
- * 
+ *
  * <p>
  * The mailcap entries are expected to be found in a <tt>/META-INF/mailcap</tt> file inside the bundle.
  * </p>
- * 
+ *
  * <p>
  * This implementation does not support the full lookup algorithm specified by the {@link MailcapCommandMap}.
  * </p>
- * 
+ *
  */
-@Header(name = Constants.BUNDLE_ACTIVATOR, value = "${@class}")
 public class Activator implements BundleActivator {
 
     private static final String MAILCAP_FILE_NAME = "/META-INF/mailcap";