[maven-release-plugin] copy for tag uima-ducc-3.0.0
git-svn-id: https://svn.apache.org/repos/asf/uima/uima-ducc/tags/uima-ducc-3.0.0@1856199 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/launcher/DuccCommandExecutor.java b/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/launcher/DuccCommandExecutor.java
index c0e7526..3105a5d 100644
--- a/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/launcher/DuccCommandExecutor.java
+++ b/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/launcher/DuccCommandExecutor.java
@@ -813,7 +813,7 @@
String duccHomePath = Utils.findDuccHome();
-
+ /*
String[] jars = classpath.split(":");
URLClassLoader clsLoader = newClassLoader(jars);
Class<?> cls = clsLoader.loadClass("org.apache.uima.impl.UimaVersion");
@@ -837,7 +837,7 @@
} else {
((JavaCommandLine) cmdLine).setClasspath(classpath);
}
-
+ */
cmdLine.addOption("-DDUCC_HOME=" + duccHomePath);
cmdLine.addOption("-Dducc.deploy.configuration="
+ System.getProperty("ducc.deploy.configuration"));
diff --git a/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/DuccJobSubmit.java b/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/DuccJobSubmit.java
index 4d07618..d8a7461 100644
--- a/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/DuccJobSubmit.java
+++ b/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/DuccJobSubmit.java
@@ -18,13 +18,20 @@
*/
package org.apache.uima.ducc.cli;
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Map.Entry;
import java.util.Properties;
import org.apache.uima.ducc.cli.aio.AllInOneLauncher;
+import org.apache.uima.ducc.common.exception.DuccRuntimeException;
import org.apache.uima.ducc.common.utils.DuccSchedulerClasses;
import org.apache.uima.ducc.common.utils.IllegalConfigurationException;
+import org.apache.uima.ducc.common.utils.Utils;
import org.apache.uima.ducc.transport.event.IDuccContext.DuccContext;
import org.apache.uima.ducc.transport.event.SubmitJobDuccEvent;
import org.apache.uima.ducc.transport.event.SubmitJobReplyDuccEvent;
@@ -320,8 +327,54 @@
}
}
-
+ private URLClassLoader newClassLoader(String[] classPathElements) throws IOException {
+ ArrayList<URL> urlList = new ArrayList<URL>(classPathElements.length);
+ for (String element : classPathElements) {
+ if (element.endsWith("*")) {
+ File dir = new File(element.substring(0, element.length() - 1));
+ File[] files = dir.listFiles(); // Will be null if missing or not a dir
+ if (files != null) {
+ for (File f : files) {
+ if (f.getName().endsWith(".jar")) {
+ urlList.add(f.getCanonicalFile().toURI().toURL());
+ }
+ }
+ }
+ } else {
+ File f = new File(element);
+ if (f.exists()) {
+ urlList.add(f.getCanonicalFile().toURI().toURL());
+ }
+ }
+ }
+ URL[] urls = new URL[urlList.size()];
+ return new URLClassLoader(urlList.toArray(urls), ClassLoader.getSystemClassLoader().getParent());
+ }
//**********
+ private void modifyClasspathBasedOnUimaVersion(String classpathKey) throws Exception {
+ String duccHomePath = Utils.findDuccHome();
+
+ String classpath = jobRequestProperties.getProperty(classpathKey);
+ String[] jars = classpath.split(":");
+ URLClassLoader clsLoader = newClassLoader(jars);
+ Class<?> cls = clsLoader.loadClass("org.apache.uima.impl.UimaVersion");
+ Method majorVersionMethod = cls.getMethod("getMajorVersion");
+ short majorVersion = (short)majorVersionMethod.invoke(null);
+
+
+ if ( !duccHomePath.trim().endsWith("/") ) {
+ duccHomePath = duccHomePath.concat("/");
+ }
+ String workItemJarDir = duccHomePath+"lib/uima-ducc/workitem/uima-ducc-workitem-";
+ if ( majorVersion < 3 ) {
+ classpath = workItemJarDir+"v2.jar:"+classpath;
+ } else if ( majorVersion >= 3 ) {
+ classpath = workItemJarDir+"v3.jar:"+classpath;
+ } else {
+ throw new DuccRuntimeException("Unknown version of UIMA - majorVersion="+majorVersion);
+ }
+ jobRequestProperties.setProperty(classpathKey,classpath);
+ }
/**
* Execute collects the job parameters, does basic error and correctness checking, and sends
@@ -355,7 +408,10 @@
if (!jobRequestProperties.containsKey(key_cp)) {
jobRequestProperties.setProperty(key_cp, System.getProperty("java.class.path"));
}
-
+ // using user classpath determine which uima version is being used and
+ // add to the front a corresponding version of uima-ducc-workitem-v<N>.jar
+ modifyClasspathBasedOnUimaVersion(key_cp);
+
if (jobRequestProperties.containsKey(UiOption.Debug.pname())) {
jobRequestProperties.dump();
}
diff --git a/uima-ducc-duccdocs/src/site/tex/duccbook/part1/overview.tex b/uima-ducc-duccdocs/src/site/tex/duccbook/part1/overview.tex
index d8a51e0..a675615 100644
--- a/uima-ducc-duccdocs/src/site/tex/duccbook/part1/overview.tex
+++ b/uima-ducc-duccdocs/src/site/tex/duccbook/part1/overview.tex
@@ -35,6 +35,11 @@
does not provide job or cluster management of the resources. DUCC defines a formal job model
that closely maps to a standard UIMA pipeline. Around this job model DUCC provides cluster
management services to automate the scale-out of UIMA pipelines over computing clusters.
+
+ As of DUCC version 3.0.0 both UIMAv2 and UIMAv3 applications are supported. Although DUCC
+ distributes a UIMA-AS runtime, it only uses UIMA classes specified by the user's application
+ classpath.
+
\section{DUCC Job Model}
diff --git a/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/protocol/builtin/DefaultServiceProtocolHandler.java b/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/protocol/builtin/DefaultServiceProtocolHandler.java
index c550590..b89b5f0 100644
--- a/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/protocol/builtin/DefaultServiceProtocolHandler.java
+++ b/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/protocol/builtin/DefaultServiceProtocolHandler.java
@@ -20,6 +20,8 @@
import java.io.ByteArrayOutputStream;
import java.io.ObjectOutputStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
import java.util.Objects;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicInteger;
@@ -107,9 +109,10 @@
} catch (Throwable e) {
initError = true;
running = false;
+ e.printStackTrace();
logger.log(Level.WARNING, "ProtocolHandler initialize() failed -",e);
throw new ServiceInitializationException(
- "Thread:" + Thread.currentThread().getName() + " Failed initialization");
+ "Thread:" + Thread.currentThread().getName() + " Failed initialization - "+ e);
} finally {
initLatch.countDown();