Repository: tika Updated Branches: refs/heads/2.x 322b1c9f0 -> 8a5923dd6
TIKA-1860 - Added Bundle config to advanced, cad, code, crypto Project: http://git-wip-us.apache.org/repos/asf/tika/repo Commit: http://git-wip-us.apache.org/repos/asf/tika/commit/8a5923dd Tree: http://git-wip-us.apache.org/repos/asf/tika/tree/8a5923dd Diff: http://git-wip-us.apache.org/repos/asf/tika/diff/8a5923dd Branch: refs/heads/2.x Commit: 8a5923dd6a42f4b4c09ec186ef357f446e9ae599 Parents: 322b1c9 Author: Bob Paulin <[email protected]> Authored: Sat Feb 27 00:09:24 2016 -0600 Committer: Bob Paulin <[email protected]> Committed: Sat Feb 27 00:09:24 2016 -0600 ---------------------------------------------------------------------- tika-parser-modules/pom.xml | 43 ++++++++++ .../tika-parser-advanced-module/pom.xml | 41 ++++++++++ .../module/advanced/internal/Activator.java | 20 +++++ .../java/org/apache/tika/module/BundleIT.java | 86 ++++++++++++++++++++ .../tika-parser-cad-module/pom.xml | 31 +++++++ .../tika/module/cad/internal/Activator.java | 20 +++++ .../java/org/apache/tika/module/BundleIT.java | 86 ++++++++++++++++++++ .../tika-parser-code-module/pom.xml | 38 +++++++++ .../tika/module/code/internal/Activator.java | 20 +++++ .../java/org/apache/tika/module/BundleIT.java | 86 ++++++++++++++++++++ .../tika-parser-crypto-module/pom.xml | 41 ++++++++++ .../tika/module/crypto/internal/Activator.java | 20 +++++ .../java/org/apache/tika/module/BundleIT.java | 86 ++++++++++++++++++++ .../tika-parser-multimedia-module/pom.xml | 38 +-------- 14 files changed, 619 insertions(+), 37 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tika/blob/8a5923dd/tika-parser-modules/pom.xml ---------------------------------------------------------------------- diff --git a/tika-parser-modules/pom.xml b/tika-parser-modules/pom.xml index 9d5b5e5..49371aa 100644 --- a/tika-parser-modules/pom.xml +++ b/tika-parser-modules/pom.xml @@ -173,6 +173,49 @@ </execution> </executions> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <executions> + <execution> + <phase>package</phase> + <goals> + <goal>jar</goal> + </goals> + <configuration> + <useDefaultManifestFile>true</useDefaultManifestFile> + <includes> + <include>org/apache/tika/**</include> + <include>META-INF/**</include> + </includes> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-failsafe-plugin</artifactId> + <executions> + <execution> + <goals> + <goal>integration-test</goal> + <goal>verify</goal> + </goals> + </execution> + </executions> + <configuration> + <systemPropertyVariables> + <org.ops4j.pax.logging.DefaultServiceLog.level> + WARN + </org.ops4j.pax.logging.DefaultServiceLog.level> + </systemPropertyVariables> + <systemProperties> + <property> + <name>project.bundle.file</name> + <value>target/${project.build.finalName}-bundle.jar</value> + </property> + </systemProperties> + </configuration> + </plugin> </plugins> </pluginManagement> </build> http://git-wip-us.apache.org/repos/asf/tika/blob/8a5923dd/tika-parser-modules/tika-parser-advanced-module/pom.xml ---------------------------------------------------------------------- diff --git a/tika-parser-modules/tika-parser-advanced-module/pom.xml b/tika-parser-modules/tika-parser-advanced-module/pom.xml index 2e02904..b9d27ca 100644 --- a/tika-parser-modules/tika-parser-advanced-module/pom.xml +++ b/tika-parser-modules/tika-parser-advanced-module/pom.xml @@ -20,6 +20,7 @@ </parent> <artifactId>tika-parser-advanced-module</artifactId> + <packaging>bundle</packaging> <name>Apache Tika parser advanced module</name> <url>http://tika.apache.org/</url> @@ -63,6 +64,46 @@ <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> </plugin> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <classifier>bundle</classifier> + <instructions> + <Bundle-Activator>org.apache.tika.module.advanced.internal.Activator</Bundle-Activator> + <Embed-Dependency> + opennlp-tools;inline=true, + opennlp-maxent;inline=true, + commons-io;inline=true, + jwnl;inline=true + </Embed-Dependency> + <Embed-Transitive>true</Embed-Transitive> + <Export-Package> + org.apache.tika.parser.ner.*, + org.apache.tika.parser.ner.corenlp.*, + org.apache.tika.parser.ner.opennlp.*, + org.apache.tika.parser.ner.regex.* + </Export-Package> + <Import-Package> + *, + opennlp.maxent;resolution:=optional, + opennlp.tools.namefind;resolution:=optional, + org.apache.commons.io;resolution:=optional, + org.json;resolution:=optional, + org.osgi.framework;resolution:=optional, + net.didion.jwnl;resolution:=optional + </Import-Package> + </instructions> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + </plugin> + <plugin> + <artifactId>maven-failsafe-plugin</artifactId> + </plugin> </plugins> </build> http://git-wip-us.apache.org/repos/asf/tika/blob/8a5923dd/tika-parser-modules/tika-parser-advanced-module/src/main/java/org/apache/tika/module/advanced/internal/Activator.java ---------------------------------------------------------------------- diff --git a/tika-parser-modules/tika-parser-advanced-module/src/main/java/org/apache/tika/module/advanced/internal/Activator.java b/tika-parser-modules/tika-parser-advanced-module/src/main/java/org/apache/tika/module/advanced/internal/Activator.java new file mode 100644 index 0000000..97edfd2 --- /dev/null +++ b/tika-parser-modules/tika-parser-advanced-module/src/main/java/org/apache/tika/module/advanced/internal/Activator.java @@ -0,0 +1,20 @@ +package org.apache.tika.module.advanced.internal; + +import org.apache.tika.osgi.TikaAbstractBundleActivator; +import org.osgi.framework.BundleContext; + +public class Activator extends TikaAbstractBundleActivator { + + @Override + public void start(BundleContext context) throws Exception { + + registerTikaParserServiceLoader(context, Activator.class.getClassLoader()); + + } + + @Override + public void stop(BundleContext context) throws Exception { + + } + +} http://git-wip-us.apache.org/repos/asf/tika/blob/8a5923dd/tika-parser-modules/tika-parser-advanced-module/src/test/java/org/apache/tika/module/BundleIT.java ---------------------------------------------------------------------- diff --git a/tika-parser-modules/tika-parser-advanced-module/src/test/java/org/apache/tika/module/BundleIT.java b/tika-parser-modules/tika-parser-advanced-module/src/test/java/org/apache/tika/module/BundleIT.java new file mode 100644 index 0000000..8b39d38 --- /dev/null +++ b/tika-parser-modules/tika-parser-advanced-module/src/test/java/org/apache/tika/module/BundleIT.java @@ -0,0 +1,86 @@ +/* + * 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. + */ +package org.apache.tika.module; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertNotNull; +import static org.ops4j.pax.exam.CoreOptions.bundle; +import static org.ops4j.pax.exam.CoreOptions.junitBundles; +import static org.ops4j.pax.exam.CoreOptions.options; +import static org.ops4j.pax.exam.CoreOptions.mavenBundle; + +import javax.inject.Inject; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; +import java.io.Writer; +import java.net.URISyntaxException; +import java.util.Dictionary; + +import org.apache.tika.io.TikaInputStream; +import org.apache.tika.metadata.Metadata; +import org.apache.tika.metadata.TikaCoreProperties; +import org.apache.tika.mime.MediaType; +import org.apache.tika.osgi.TikaService; +import org.apache.tika.parser.ParseContext; +import org.apache.tika.sax.BodyContentHandler; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.ops4j.pax.exam.Configuration; +import org.ops4j.pax.exam.Option; +import org.ops4j.pax.exam.junit.PaxExam; +import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; +import org.ops4j.pax.exam.spi.reactors.PerMethod; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.xml.sax.ContentHandler; + +@RunWith(PaxExam.class) +@ExamReactorStrategy(PerMethod.class) +public class BundleIT { + + private static final String BUNDLE_JAR_SYS_PROP = "project.bundle.file"; + @Inject + private BundleContext bc; + + @Configuration + public Option[] configuration() throws IOException, URISyntaxException { + String bundleFileName = System.getProperty(BUNDLE_JAR_SYS_PROP); + return options(junitBundles(), mavenBundle("org.apache.tika", "tika-core"), + bundle(new File(bundleFileName).toURI().toString())); + } + + @Test + public void testBundleLoaded() throws Exception { + boolean hasCore = false, hasBundle = false; + for (Bundle b : bc.getBundles()) { + if ("org.apache.tika.core".equals(b.getSymbolicName())) { + hasCore = true; + assertEquals("Core not activated", Bundle.ACTIVE, b.getState()); + } + if ("org.apache.tika.parser-advanced-module".equals(b.getSymbolicName())) { + hasBundle = true; + assertEquals("Bundle not activated", Bundle.ACTIVE, b.getState()); + } + } + assertTrue("Core bundle not found", hasCore); + assertTrue("Advanced bundle not found", hasBundle); + } +} http://git-wip-us.apache.org/repos/asf/tika/blob/8a5923dd/tika-parser-modules/tika-parser-cad-module/pom.xml ---------------------------------------------------------------------- diff --git a/tika-parser-modules/tika-parser-cad-module/pom.xml b/tika-parser-modules/tika-parser-cad-module/pom.xml index c606b06..7e81e6c 100644 --- a/tika-parser-modules/tika-parser-cad-module/pom.xml +++ b/tika-parser-modules/tika-parser-cad-module/pom.xml @@ -20,6 +20,7 @@ </parent> <artifactId>tika-parser-cad-module</artifactId> + <packaging>bundle</packaging> <name>Apache Tika parser CAD module</name> <url>http://tika.apache.org/</url> @@ -48,6 +49,36 @@ <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> </plugin> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <classifier>bundle</classifier> + <instructions> + <Bundle-Activator>org.apache.tika.module.cad.internal.Activator</Bundle-Activator> + <Embed-Dependency> + poi;inline=true, + commons-codec;inline=true + </Embed-Dependency> + <Embed-Transitive>true</Embed-Transitive> + <Export-Package> + org.apache.tika.parser.dwg.*, + org.apache.tika.parser.prt.* + </Export-Package> + <Import-Package> + * + </Import-Package> + </instructions> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + </plugin> + <plugin> + <artifactId>maven-failsafe-plugin</artifactId> + </plugin> </plugins> </build> http://git-wip-us.apache.org/repos/asf/tika/blob/8a5923dd/tika-parser-modules/tika-parser-cad-module/src/main/java/org/apache/tika/module/cad/internal/Activator.java ---------------------------------------------------------------------- diff --git a/tika-parser-modules/tika-parser-cad-module/src/main/java/org/apache/tika/module/cad/internal/Activator.java b/tika-parser-modules/tika-parser-cad-module/src/main/java/org/apache/tika/module/cad/internal/Activator.java new file mode 100644 index 0000000..6413cda --- /dev/null +++ b/tika-parser-modules/tika-parser-cad-module/src/main/java/org/apache/tika/module/cad/internal/Activator.java @@ -0,0 +1,20 @@ +package org.apache.tika.module.cad.internal; + +import org.apache.tika.osgi.TikaAbstractBundleActivator; +import org.osgi.framework.BundleContext; + +public class Activator extends TikaAbstractBundleActivator { + + @Override + public void start(BundleContext context) throws Exception { + + registerTikaParserServiceLoader(context, Activator.class.getClassLoader()); + + } + + @Override + public void stop(BundleContext context) throws Exception { + + } + +} http://git-wip-us.apache.org/repos/asf/tika/blob/8a5923dd/tika-parser-modules/tika-parser-cad-module/src/test/java/org/apache/tika/module/BundleIT.java ---------------------------------------------------------------------- diff --git a/tika-parser-modules/tika-parser-cad-module/src/test/java/org/apache/tika/module/BundleIT.java b/tika-parser-modules/tika-parser-cad-module/src/test/java/org/apache/tika/module/BundleIT.java new file mode 100644 index 0000000..778526e --- /dev/null +++ b/tika-parser-modules/tika-parser-cad-module/src/test/java/org/apache/tika/module/BundleIT.java @@ -0,0 +1,86 @@ +/* + * 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. + */ +package org.apache.tika.module; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertNotNull; +import static org.ops4j.pax.exam.CoreOptions.bundle; +import static org.ops4j.pax.exam.CoreOptions.junitBundles; +import static org.ops4j.pax.exam.CoreOptions.options; +import static org.ops4j.pax.exam.CoreOptions.mavenBundle; + +import javax.inject.Inject; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; +import java.io.Writer; +import java.net.URISyntaxException; +import java.util.Dictionary; + +import org.apache.tika.io.TikaInputStream; +import org.apache.tika.metadata.Metadata; +import org.apache.tika.metadata.TikaCoreProperties; +import org.apache.tika.mime.MediaType; +import org.apache.tika.osgi.TikaService; +import org.apache.tika.parser.ParseContext; +import org.apache.tika.sax.BodyContentHandler; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.ops4j.pax.exam.Configuration; +import org.ops4j.pax.exam.Option; +import org.ops4j.pax.exam.junit.PaxExam; +import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; +import org.ops4j.pax.exam.spi.reactors.PerMethod; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.xml.sax.ContentHandler; + +@RunWith(PaxExam.class) +@ExamReactorStrategy(PerMethod.class) +public class BundleIT { + + private static final String BUNDLE_JAR_SYS_PROP = "project.bundle.file"; + @Inject + private BundleContext bc; + + @Configuration + public Option[] configuration() throws IOException, URISyntaxException { + String bundleFileName = System.getProperty(BUNDLE_JAR_SYS_PROP); + return options(junitBundles(), mavenBundle("org.apache.tika", "tika-core"), + bundle(new File(bundleFileName).toURI().toString())); + } + + @Test + public void testBundleLoaded() throws Exception { + boolean hasCore = false, hasBundle = false; + for (Bundle b : bc.getBundles()) { + if ("org.apache.tika.core".equals(b.getSymbolicName())) { + hasCore = true; + assertEquals("Core not activated", Bundle.ACTIVE, b.getState()); + } + if ("org.apache.tika.parser-cad-module".equals(b.getSymbolicName())) { + hasBundle = true; + assertEquals("Bundle not activated", Bundle.ACTIVE, b.getState()); + } + } + assertTrue("Core bundle not found", hasCore); + assertTrue("Cad bundle not found", hasBundle); + } +} http://git-wip-us.apache.org/repos/asf/tika/blob/8a5923dd/tika-parser-modules/tika-parser-code-module/pom.xml ---------------------------------------------------------------------- diff --git a/tika-parser-modules/tika-parser-code-module/pom.xml b/tika-parser-modules/tika-parser-code-module/pom.xml index c74455a..8c46554 100644 --- a/tika-parser-modules/tika-parser-code-module/pom.xml +++ b/tika-parser-modules/tika-parser-code-module/pom.xml @@ -20,6 +20,7 @@ </parent> <artifactId>tika-parser-code-module</artifactId> + <packaging>bundle</packaging> <name>Apache Tika parser code module</name> <url>http://tika.apache.org/</url> @@ -68,6 +69,43 @@ <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> </plugin> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <classifier>bundle</classifier> + <instructions> + <Bundle-Activator>org.apache.tika.module.code.internal.Activator</Bundle-Activator> + <Embed-Dependency> + asm;inline=true, + tagsoup;inline=true, + jhighlight;inline=true, + commons-io;inline=true, + commons-codec;inline=true, + poi;inline=true + </Embed-Dependency> + <Embed-Transitive>true</Embed-Transitive> + <Export-Package> + org.apache.tika.parser.asm.*, + org.apache.tika.parser.code.*, + org.apache.tika.parser.executable.* + </Export-Package> + <Import-Package> + *, + javax.servlet;resolution:=optional, + javax.servlet.http;resolution:=optional + </Import-Package> + </instructions> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + </plugin> + <plugin> + <artifactId>maven-failsafe-plugin</artifactId> + </plugin> </plugins> </build> http://git-wip-us.apache.org/repos/asf/tika/blob/8a5923dd/tika-parser-modules/tika-parser-code-module/src/main/java/org/apache/tika/module/code/internal/Activator.java ---------------------------------------------------------------------- diff --git a/tika-parser-modules/tika-parser-code-module/src/main/java/org/apache/tika/module/code/internal/Activator.java b/tika-parser-modules/tika-parser-code-module/src/main/java/org/apache/tika/module/code/internal/Activator.java new file mode 100644 index 0000000..6e4801b --- /dev/null +++ b/tika-parser-modules/tika-parser-code-module/src/main/java/org/apache/tika/module/code/internal/Activator.java @@ -0,0 +1,20 @@ +package org.apache.tika.module.code.internal; + +import org.apache.tika.osgi.TikaAbstractBundleActivator; +import org.osgi.framework.BundleContext; + +public class Activator extends TikaAbstractBundleActivator { + + @Override + public void start(BundleContext context) throws Exception { + + registerTikaParserServiceLoader(context, Activator.class.getClassLoader()); + + } + + @Override + public void stop(BundleContext context) throws Exception { + + } + +} http://git-wip-us.apache.org/repos/asf/tika/blob/8a5923dd/tika-parser-modules/tika-parser-code-module/src/test/java/org/apache/tika/module/BundleIT.java ---------------------------------------------------------------------- diff --git a/tika-parser-modules/tika-parser-code-module/src/test/java/org/apache/tika/module/BundleIT.java b/tika-parser-modules/tika-parser-code-module/src/test/java/org/apache/tika/module/BundleIT.java new file mode 100644 index 0000000..c9f821f --- /dev/null +++ b/tika-parser-modules/tika-parser-code-module/src/test/java/org/apache/tika/module/BundleIT.java @@ -0,0 +1,86 @@ +/* + * 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. + */ +package org.apache.tika.module; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertNotNull; +import static org.ops4j.pax.exam.CoreOptions.bundle; +import static org.ops4j.pax.exam.CoreOptions.junitBundles; +import static org.ops4j.pax.exam.CoreOptions.options; +import static org.ops4j.pax.exam.CoreOptions.mavenBundle; + +import javax.inject.Inject; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; +import java.io.Writer; +import java.net.URISyntaxException; +import java.util.Dictionary; + +import org.apache.tika.io.TikaInputStream; +import org.apache.tika.metadata.Metadata; +import org.apache.tika.metadata.TikaCoreProperties; +import org.apache.tika.mime.MediaType; +import org.apache.tika.osgi.TikaService; +import org.apache.tika.parser.ParseContext; +import org.apache.tika.sax.BodyContentHandler; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.ops4j.pax.exam.Configuration; +import org.ops4j.pax.exam.Option; +import org.ops4j.pax.exam.junit.PaxExam; +import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; +import org.ops4j.pax.exam.spi.reactors.PerMethod; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.xml.sax.ContentHandler; + +@RunWith(PaxExam.class) +@ExamReactorStrategy(PerMethod.class) +public class BundleIT { + + private static final String BUNDLE_JAR_SYS_PROP = "project.bundle.file"; + @Inject + private BundleContext bc; + + @Configuration + public Option[] configuration() throws IOException, URISyntaxException { + String bundleFileName = System.getProperty(BUNDLE_JAR_SYS_PROP); + return options(junitBundles(), mavenBundle("org.apache.tika", "tika-core"), + bundle(new File(bundleFileName).toURI().toString())); + } + + @Test + public void testBundleLoaded() throws Exception { + boolean hasCore = false, hasBundle = false; + for (Bundle b : bc.getBundles()) { + if ("org.apache.tika.core".equals(b.getSymbolicName())) { + hasCore = true; + assertEquals("Core not activated", Bundle.ACTIVE, b.getState()); + } + if ("org.apache.tika.parser-code-module".equals(b.getSymbolicName())) { + hasBundle = true; + assertEquals("Bundle not activated", Bundle.ACTIVE, b.getState()); + } + } + assertTrue("Core bundle not found", hasCore); + assertTrue("Code bundle not found", hasBundle); + } +} http://git-wip-us.apache.org/repos/asf/tika/blob/8a5923dd/tika-parser-modules/tika-parser-crypto-module/pom.xml ---------------------------------------------------------------------- diff --git a/tika-parser-modules/tika-parser-crypto-module/pom.xml b/tika-parser-modules/tika-parser-crypto-module/pom.xml index 3d41017..636d008 100644 --- a/tika-parser-modules/tika-parser-crypto-module/pom.xml +++ b/tika-parser-modules/tika-parser-crypto-module/pom.xml @@ -20,6 +20,7 @@ </parent> <artifactId>tika-parser-crypto-module</artifactId> + <packaging>bundle</packaging> <name>Apache Tika parser crypto module</name> <url>http://tika.apache.org/</url> @@ -47,6 +48,46 @@ <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> </plugin> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <classifier>bundle</classifier> + <instructions> + <Bundle-Activator>org.apache.tika.module.crypto.internal.Activator</Bundle-Activator> + <Embed-Dependency> + bcmail-jdk15on;inline=true, + bcprov-jdk15on;inline=true, + bcpkix-jdk15on;inline=true, + commons-io;inline=true + </Embed-Dependency> + <Embed-Transitive>true</Embed-Transitive> + <Export-Package> + org.apache.tika.parser.crypto.*, + </Export-Package> + <Import-Package> + *, + javax.mail;resolution:=optional, + javax.mail.internet;resolution:=optional, + org.bouncycastle.cert;resolution:=optional, + org.bouncycastle.cert.jcajce;resolution:=optional, + org.bouncycastle.cert.ocsp;resolution:=optional, + org.bouncycastle.cms.bc;resolution:=optional, + org.bouncycastle.operator;resolution:=optional, + org.bouncycastle.operator.bc;resolution:=optional, + org.bouncycastle.tsp;resolution:=optional + </Import-Package> + </instructions> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + </plugin> + <plugin> + <artifactId>maven-failsafe-plugin</artifactId> + </plugin> </plugins> </build> http://git-wip-us.apache.org/repos/asf/tika/blob/8a5923dd/tika-parser-modules/tika-parser-crypto-module/src/main/java/org/apache/tika/module/crypto/internal/Activator.java ---------------------------------------------------------------------- diff --git a/tika-parser-modules/tika-parser-crypto-module/src/main/java/org/apache/tika/module/crypto/internal/Activator.java b/tika-parser-modules/tika-parser-crypto-module/src/main/java/org/apache/tika/module/crypto/internal/Activator.java new file mode 100644 index 0000000..e03ec1e --- /dev/null +++ b/tika-parser-modules/tika-parser-crypto-module/src/main/java/org/apache/tika/module/crypto/internal/Activator.java @@ -0,0 +1,20 @@ +package org.apache.tika.module.crypto.internal; + +import org.apache.tika.osgi.TikaAbstractBundleActivator; +import org.osgi.framework.BundleContext; + +public class Activator extends TikaAbstractBundleActivator { + + @Override + public void start(BundleContext context) throws Exception { + + registerTikaParserServiceLoader(context, Activator.class.getClassLoader()); + + } + + @Override + public void stop(BundleContext context) throws Exception { + + } + +} http://git-wip-us.apache.org/repos/asf/tika/blob/8a5923dd/tika-parser-modules/tika-parser-crypto-module/src/test/java/org/apache/tika/module/BundleIT.java ---------------------------------------------------------------------- diff --git a/tika-parser-modules/tika-parser-crypto-module/src/test/java/org/apache/tika/module/BundleIT.java b/tika-parser-modules/tika-parser-crypto-module/src/test/java/org/apache/tika/module/BundleIT.java new file mode 100644 index 0000000..7e3c297 --- /dev/null +++ b/tika-parser-modules/tika-parser-crypto-module/src/test/java/org/apache/tika/module/BundleIT.java @@ -0,0 +1,86 @@ +/* + * 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. + */ +package org.apache.tika.module; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertNotNull; +import static org.ops4j.pax.exam.CoreOptions.bundle; +import static org.ops4j.pax.exam.CoreOptions.junitBundles; +import static org.ops4j.pax.exam.CoreOptions.options; +import static org.ops4j.pax.exam.CoreOptions.mavenBundle; + +import javax.inject.Inject; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; +import java.io.Writer; +import java.net.URISyntaxException; +import java.util.Dictionary; + +import org.apache.tika.io.TikaInputStream; +import org.apache.tika.metadata.Metadata; +import org.apache.tika.metadata.TikaCoreProperties; +import org.apache.tika.mime.MediaType; +import org.apache.tika.osgi.TikaService; +import org.apache.tika.parser.ParseContext; +import org.apache.tika.sax.BodyContentHandler; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.ops4j.pax.exam.Configuration; +import org.ops4j.pax.exam.Option; +import org.ops4j.pax.exam.junit.PaxExam; +import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; +import org.ops4j.pax.exam.spi.reactors.PerMethod; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.xml.sax.ContentHandler; + +@RunWith(PaxExam.class) +@ExamReactorStrategy(PerMethod.class) +public class BundleIT { + + private static final String BUNDLE_JAR_SYS_PROP = "project.bundle.file"; + @Inject + private BundleContext bc; + + @Configuration + public Option[] configuration() throws IOException, URISyntaxException { + String bundleFileName = System.getProperty(BUNDLE_JAR_SYS_PROP); + return options(junitBundles(), mavenBundle("org.apache.tika", "tika-core"), + bundle(new File(bundleFileName).toURI().toString())); + } + + @Test + public void testBundleLoaded() throws Exception { + boolean hasCore = false, hasBundle = false; + for (Bundle b : bc.getBundles()) { + if ("org.apache.tika.core".equals(b.getSymbolicName())) { + hasCore = true; + assertEquals("Core not activated", Bundle.ACTIVE, b.getState()); + } + if ("org.apache.tika.parser-crypto-module".equals(b.getSymbolicName())) { + hasBundle = true; + assertEquals("Bundle not activated", Bundle.ACTIVE, b.getState()); + } + } + assertTrue("Core bundle not found", hasCore); + assertTrue("Crypto bundle not found", hasBundle); + } +} http://git-wip-us.apache.org/repos/asf/tika/blob/8a5923dd/tika-parser-modules/tika-parser-multimedia-module/pom.xml ---------------------------------------------------------------------- diff --git a/tika-parser-modules/tika-parser-multimedia-module/pom.xml b/tika-parser-modules/tika-parser-multimedia-module/pom.xml index 13a7705..084c8a7 100644 --- a/tika-parser-modules/tika-parser-multimedia-module/pom.xml +++ b/tika-parser-modules/tika-parser-multimedia-module/pom.xml @@ -122,7 +122,7 @@ <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> </plugin> - <plugin> + <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> <extensions>true</extensions> @@ -164,45 +164,9 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> - <executions> - <execution> - <phase>package</phase> - <goals> - <goal>jar</goal> - </goals> - <configuration> - <useDefaultManifestFile>true</useDefaultManifestFile> - <includes> - <include>org/apache/tika/**</include> - <include>META-INF/**</include> - </includes> - </configuration> - </execution> - </executions> </plugin> <plugin> <artifactId>maven-failsafe-plugin</artifactId> - <executions> - <execution> - <goals> - <goal>integration-test</goal> - <goal>verify</goal> - </goals> - </execution> - </executions> - <configuration> - <systemPropertyVariables> - <org.ops4j.pax.logging.DefaultServiceLog.level> - WARN - </org.ops4j.pax.logging.DefaultServiceLog.level> - </systemPropertyVariables> - <systemProperties> - <property> - <name>project.bundle.file</name> - <value>target/${project.build.finalName}-bundle.jar</value> - </property> - </systemProperties> - </configuration> </plugin> </plugins> </build>
