You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ta...@apache.org on 2020/12/01 15:14:11 UTC
[tika] 01/01: TIKA-3178 -- WIP -- does not build. do not merge
This is an automated email from the ASF dual-hosted git repository.
tallison pushed a commit to branch TIKA-3178
in repository https://gitbox.apache.org/repos/asf/tika.git
commit 2892ad5454f7cd006d879a2883a5f55926d884c5
Author: tallison <ta...@apache.org>
AuthorDate: Tue Dec 1 10:13:47 2020 -0500
TIKA-3178 -- WIP -- does not build. do not merge
---
pom.xml | 2 +-
tika-bundle/pom.xml | 17 +++++--
tika-core/pom.xml | 5 ++
tika-parsers/pom.xml | 27 +++++++++++
.../org/apache/tika/parser/internal/Activator.java | 54 ++++++++++++++++++++++
5 files changed, 100 insertions(+), 5 deletions(-)
diff --git a/pom.xml b/pom.xml
index 259ed1b..c2f3a09 100644
--- a/pom.xml
+++ b/pom.xml
@@ -39,8 +39,8 @@
<module>tika-core</module>
<module>tika-parser-modules</module>
<module>tika-parsers</module>
+ <module>tika-bundle</module>
<module>tika-parsers-extended</module>
-<!-- <module>tika-bundle</module> turn this off for now -->
<module>tika-xmp</module>
<module>tika-serialization</module>
<module>tika-batch</module>
diff --git a/tika-bundle/pom.xml b/tika-bundle/pom.xml
index 87628f9..ec49ff3 100644
--- a/tika-bundle/pom.xml
+++ b/tika-bundle/pom.xml
@@ -57,6 +57,11 @@
<artifactId>tika-parsers</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>${commons.io.version}</version>
+ </dependency>
<!-- Test dependencies -->
<dependency>
@@ -139,13 +144,13 @@
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
- <version>2.3.2</version>
+ <version>${jaxb.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.istack</groupId>
<artifactId>istack-commons-runtime</artifactId>
- <version>3.0.8</version>
+ <version>3.0.11</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -157,7 +162,7 @@
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>txw2</artifactId>
- <version>2.3.2</version>
+ <version>${jaxb.version}</version>
<scope>test</scope>
</dependency>
@@ -185,6 +190,7 @@
commons-codec|
commons-csv|
commons-io|
+ org.apache.commons.io;version=2.8.0|
commons-exec|
commons-collections4|
dd-plist|
@@ -249,6 +255,9 @@
!org.apache.tika.parser,
!org.apache.tika.parser.external,
org.apache.tika.parser.*,
+ org.apache.tika.exception,
+ org.apache.tika.fork,
+ org.apache.tika.io,
org.apache.tika.metadata.serialization.*,
</Export-Package>
<Import-Package>
@@ -265,6 +274,7 @@
!org.apache.spark.sql.*,
org.apache.tika.mime,
org.apache.tika.fork,
+ org.apache.commons.io,
android.util;resolution:=optional,
com.adobe.xmp;resolution:=optional,
com.adobe.xmp.impl;resolution:=optional,
@@ -333,7 +343,6 @@
org.apache.cxf.jaxrs.client;resolution:=optional,
org.apache.cxf.jaxrs.ext.multipart;resolution:=optional,
org.apache.commons.exec;resolution:=optional,
- org.apache.commons.io;resolution:=optional,
org.apache.commons.httpclient;resolution:=optional,
org.apache.commons.httpclient.auth;resolution:=optional,
org.apache.commons.httpclient.methods;resolution:=optional,
diff --git a/tika-core/pom.xml b/tika-core/pom.xml
index 6e22b8e..5c9a614 100644
--- a/tika-core/pom.xml
+++ b/tika-core/pom.xml
@@ -100,6 +100,11 @@
org.apache.tika.config.TikaActivator
</Bundle-Activator>
<Bundle-ActivationPolicy>lazy</Bundle-ActivationPolicy>
+ <Import-Package>
+ org.apache.commons.io;version=2.8.0,
+ org.apache.commons.io.input;version=2.8.0,
+ org.apache.commons.io.output;version=2.8.0,
+ *</Import-Package>
</instructions>
</configuration>
</plugin>
diff --git a/tika-parsers/pom.xml b/tika-parsers/pom.xml
index 8f20259..8d1cea7 100644
--- a/tika-parsers/pom.xml
+++ b/tika-parsers/pom.xml
@@ -31,6 +31,14 @@
<artifactId>tika-parsers</artifactId>
<dependencies>
+ <!-- Optional OSGi dependency, used only when running within OSGi -->
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>${osgi.core.version}</version>
+ <scope>provided</scope>
+ <optional>true</optional>
+ </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>tika-parser-apple-module</artifactId>
@@ -153,6 +161,25 @@
<build>
<plugins>
<plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>${maven.bundle.version}</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-DocURL>${project.url}</Bundle-DocURL>
+ <Bundle-Activator>
+ org.apache.tika.parser.internal.Activator
+ </Bundle-Activator>
+ <Import-Package>
+ org.w3c.dom,
+ org.apache.tika.*,
+ *;resolution:=optional
+ </Import-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
<groupId>org.apache.rat</groupId>
<artifactId>apache-rat-plugin</artifactId>
<version>${rat.version}</version>
diff --git a/tika-parsers/src/main/java/org/apache/tika/parser/internal/Activator.java b/tika-parsers/src/main/java/org/apache/tika/parser/internal/Activator.java
new file mode 100644
index 0000000..b436dd6
--- /dev/null
+++ b/tika-parsers/src/main/java/org/apache/tika/parser/internal/Activator.java
@@ -0,0 +1,54 @@
+/*
+ * 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.parser.internal;
+
+import org.apache.tika.detect.DefaultDetector;
+import org.apache.tika.detect.Detector;
+import org.apache.tika.parser.DefaultParser;
+import org.apache.tika.parser.Parser;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+import java.util.Hashtable;
+
+public class Activator implements BundleActivator {
+
+ private ServiceRegistration detectorService;
+
+ private ServiceRegistration parserService;
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ detectorService = context.registerService(
+ Detector.class.getName(),
+ new DefaultDetector(Activator.class.getClassLoader()),
+ new Hashtable<>());
+ Parser parser = new DefaultParser(Activator.class.getClassLoader());
+ parserService = context.registerService(
+ Parser.class.getName(),
+ parser,
+ new Hashtable<>());
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ parserService.unregister();
+ detectorService.unregister();
+ }
+
+}