Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
165 changes: 165 additions & 0 deletions activation-bundle/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--

Copyright (c) 2025 Oracle and/or its affiliates. All rights reserved.

This program and the accompanying materials are made available under the
terms of the Eclipse Distribution License v. 1.0, which is available at
http://www.eclipse.org/org/documents/edl-v10.php.

SPDX-License-Identifier: BSD-3-Clause

-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<parent>
<groupId>org.eclipse.angus</groupId>
<artifactId>angus-activation-project</artifactId>
<version>2.1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<modelVersion>4.0.0</modelVersion>
<artifactId>jakarta.activation</artifactId>
<packaging>jar</packaging>
<name>Angus Activation OSGi Bundle (jakarta.activation)</name>

<dependencies>
<dependency>
<groupId>jakarta.activation</groupId>
<artifactId>jakarta.activation-api</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.angus</groupId>
<artifactId>angus-activation</artifactId>
</dependency>
<dependency>
<groupId>org.graalvm.sdk</groupId>
<artifactId>graal-sdk</artifactId>
<optional>true</optional>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-metadata</id>
<phase>process-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.eclipse.angus</groupId>
<artifactId>angus-activation</artifactId>
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
<!-- Native image too? -->
<includes>
META-INF/services/**
</includes>
<overWrite>true</overWrite>
</artifactItem>
<artifactItem>
<groupId>jakarta.activation</groupId>
<artifactId>jakarta.activation-api</artifactId>
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
<includes>
META-INF/jakarta.mailcap.default,META-INF/jakarta.mimetypes.default
</includes>
<overWrite>true</overWrite>
</artifactItem>
</artifactItems>
</configuration>
</execution>
<execution>
<id>unpack-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<includeArtifactIds>jakarta.activation-api,angus-activation</includeArtifactIds>
<classifier>sources</classifier>
<outputDirectory>${project.build.directory}/merged-sources</outputDirectory>
<!-- Exclude module-info because we use our own in this module -->
<excludes>
**/module-info.java
</excludes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-merged-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/merged-sources</source>
<source>src/main/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>jakarta.activation</Bundle-SymbolicName>
<Bundle-Name>Jakarta Activation (Angus Implementation)</Bundle-Name>
<Bundle-Description>
Combined bundle containing Jakarta Activation API and Angus Activation implementation.
</Bundle-Description>
<Export-Package>
jakarta.activation.*;version=${project.version},
com.sun.activation.*;version=${project.version}
</Export-Package>
<Private-Package>
org.eclipse.angus.activation.*
</Private-Package>
<Import-Package>*;resolution:=optional</Import-Package>
<Implementation-Title>Angus Activation</Implementation-Title>
<Implementation-Version>${project.version}</Implementation-Version>
<Implementation-Vendor>The Eclipse Foundation</Implementation-Vendor>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
<useModulePath>true</useModulePath>
<classpathDependencyExcludes>
jakarta.activation:jakarta.activation-api,org.eclipse.angus:angus-activation
</classpathDependencyExcludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
28 changes: 28 additions & 0 deletions activation-bundle/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright (c) 2025 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/

module jakarta.activation {

requires java.logging;
requires static org.graalvm.sdk;

exports jakarta.activation;
exports jakarta.activation.spi;
exports org.eclipse.angus.activation;

uses jakarta.activation.spi.MailcapRegistryProvider;
uses jakarta.activation.spi.MimeTypeRegistryProvider;

provides jakarta.activation.spi.MailcapRegistryProvider
with org.eclipse.angus.activation.MailcapRegistryProviderImpl;

provides jakarta.activation.spi.MimeTypeRegistryProvider
with org.eclipse.angus.activation.MimeTypeRegistryProviderImpl;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* Copyright (c) 2025 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/

package user.code.test;

import jakarta.activation.DataHandler;
import jakarta.activation.DataSource;
import jakarta.activation.MailcapCommandMap;
import jakarta.activation.MimeType;
import org.junit.jupiter.api.Test;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.OutputStream;

import static org.junit.jupiter.api.Assertions.*;

public class ActivationBundleTest {

@Test
void testDataHandlerCreation() throws Exception {
String content = "Hello, Angus Activation!";
DataSource ds = new DataSource() {
@Override
public InputStream getInputStream() {
return new ByteArrayInputStream(content.getBytes());
}

@Override
public OutputStream getOutputStream() {
throw new UnsupportedOperationException("write not supported");
}

@Override
public String getContentType() {
return "text/plain";
}

@Override
public String getName() {
return "test.txt";
}
};

DataHandler handler = new DataHandler(ds);
assertNotNull(handler);
assertEquals("text/plain", handler.getContentType());

// Test MIME type parsing
MimeType mt = new MimeType("text/plain");
assertEquals("text", mt.getPrimaryType());
assertEquals("plain", mt.getSubType());

// Test MailcapCommandMap default handling
MailcapCommandMap map = (MailcapCommandMap) MailcapCommandMap.getDefaultCommandMap();
assertNotNull(map);
}
}
19 changes: 19 additions & 0 deletions activation-bundle/src/test/java/user/code/test/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright (c) 2025 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/

module user.code.test {

requires jakarta.activation;
requires java.logging;
requires org.junit.jupiter.api;

exports user.code.test;
opens user.code.test to org.junit.platform.commons;
}
12 changes: 12 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<activation-api.version>2.2.0-M1</activation-api.version>
<angus-activation.version>${project.version}</angus-activation.version>
<graal.sdk.version>23.1.2</graal.sdk.version>
<junit.version>5.14.0</junit.version>

<maven.compiler.release>11</maven.compiler.release>
<maven.compiler.testRelease>${maven.compiler.release}</maven.compiler.testRelease>
Expand Down Expand Up @@ -101,6 +102,7 @@ Copyright &#169; 2019, ${current.year} Eclipse Foundation. All rights reserved.]

<modules>
<module>activation-registry</module>
<module>activation-bundle</module>
</modules>

<dependencyManagement>
Expand Down Expand Up @@ -142,6 +144,11 @@ Copyright &#169; 2019, ${current.year} Eclipse Foundation. All rights reserved.]
<artifactId>collections</artifactId>
<version>${graal.sdk.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down Expand Up @@ -248,6 +255,11 @@ Copyright &#169; 2019, ${current.year} Eclipse Foundation. All rights reserved.]
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.11</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.5.4</version>
</plugin>
</plugins>
</pluginManagement>

Expand Down