You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by cw...@apache.org on 2016/12/06 15:05:11 UTC
svn commit: r1772903 - in /uima/uima-as/trunk:
uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/client/
uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/
uimaj-as-core/src/main/java/org/apache/uima/aae/
uimaj-as-core/src/main/java/org...
Author: cwiklik
Date: Tue Dec 6 15:05:11 2016
New Revision: 1772903
URL: http://svn.apache.org/viewvc?rev=1772903&view=rev
Log:
UIMA-5199 Added VersionCompatibilityChecker.java
Added:
uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/VersionCompatibilityChecker.java (with props)
Modified:
uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/client/BaseUIMAAsynchronousEngine_impl.java
uima/uima-as/trunk/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/TestUimaASExtended.java
uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/BaseAnalysisEngineController.java
Modified: uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/client/BaseUIMAAsynchronousEngine_impl.java
URL: http://svn.apache.org/viewvc/uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/client/BaseUIMAAsynchronousEngine_impl.java?rev=1772903&r1=1772902&r2=1772903&view=diff
==============================================================================
--- uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/client/BaseUIMAAsynchronousEngine_impl.java (original)
+++ uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/client/BaseUIMAAsynchronousEngine_impl.java Tue Dec 6 15:05:11 2016
@@ -57,6 +57,7 @@ import org.apache.uima.UIMA_IllegalArgum
import org.apache.uima.UIMA_IllegalStateException;
import org.apache.uima.aae.AsynchAECasManager_impl;
import org.apache.uima.aae.UIMAEE_Constants;
+import org.apache.uima.aae.VersionCompatibilityChecker;
import org.apache.uima.aae.UimaASApplicationEvent.EventTrigger;
import org.apache.uima.aae.UimaASApplicationExitEvent;
import org.apache.uima.aae.UimaAsVersion;
@@ -694,6 +695,9 @@ public class BaseUIMAAsynchronousEngine_
shutdownHookThread = new Thread(new UimaASShutdownHook(this));
Runtime.getRuntime().addShutdownHook(shutdownHookThread);
+ // throws an exception if verions of UIMA-AS is not compatible with UIMA SDK
+ VersionCompatibilityChecker.check(CLASS_NAME, "UIMA AS Client", "initialize");
+/*
// Check for compatibility with a version of uima sdk. Only check major versions.
if (UimaAsVersion.getMajorVersion() != UimaVersion.getMajorVersion() ) {
UIMAFramework.getLogger(CLASS_NAME).logrb(
@@ -709,7 +713,7 @@ public class BaseUIMAAsynchronousEngine_
+ UimaAsVersion.getUimajFullVersionString() + " but is running with version:"
+ UimaVersion.getFullVersionString()));
}
-
+*/
if (running) {
throw new ResourceInitializationException(new UIMA_IllegalStateException());
}
Modified: uima/uima-as/trunk/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/TestUimaASExtended.java
URL: http://svn.apache.org/viewvc/uima/uima-as/trunk/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/TestUimaASExtended.java?rev=1772903&r1=1772902&r2=1772903&view=diff
==============================================================================
--- uima/uima-as/trunk/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/TestUimaASExtended.java (original)
+++ uima/uima-as/trunk/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/TestUimaASExtended.java Tue Dec 6 15:05:11 2016
@@ -1059,11 +1059,11 @@ public class TestUimaASExtended extends
public void testSendAndReceive() throws Exception {
BaseUIMAAsynchronousEngine_impl uimaAsEngine
= new BaseUIMAAsynchronousEngine_impl();
-
- deployService(uimaAsEngine, relativePath + "/Deploy_MeetingDetectorAggregate.xml");
+ deployService(uimaAsEngine, relativePath + "/Deploy_NoOpAnnotator.xml");
+ deployService(uimaAsEngine, relativePath + "/Deploy_AggregateAnnotator.xml");
// Deploy Uima AS Primitive Service
// deployService(uimaAsEngine, relativePath + "/Deploy_NoOpAnnotator.xml");
- Map<String, Object> appCtx = buildContext(getMasterConnectorURI(broker).toString(),"MeetingDetectorQueue");
+ Map<String, Object> appCtx = buildContext(getMasterConnectorURI(broker).toString(),"TopLevelTaeQueue");
appCtx.put(UimaAsynchronousEngine.Timeout, 1100);
appCtx.put(UimaAsynchronousEngine.CpcTimeout, 1100);
initialize(uimaAsEngine, appCtx);
Added: uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/VersionCompatibilityChecker.java
URL: http://svn.apache.org/viewvc/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/VersionCompatibilityChecker.java?rev=1772903&view=auto
==============================================================================
--- uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/VersionCompatibilityChecker.java (added)
+++ uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/VersionCompatibilityChecker.java Tue Dec 6 15:05:11 2016
@@ -0,0 +1,48 @@
+/*
+ * 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.uima.aae;
+
+import org.apache.uima.UIMAFramework;
+import org.apache.uima.aae.error.AsynchAEException;
+import org.apache.uima.impl.UimaVersion;
+import org.apache.uima.resource.ResourceInitializationException;
+import org.apache.uima.util.Level;
+
+public class VersionCompatibilityChecker {
+
+ public static void check(Class<?> claz, String componentName, String method) throws ResourceInitializationException {
+ boolean majorMatch = UimaAsVersion.getMajorVersion() == UimaVersion.getMajorVersion();
+ boolean minorOK = UimaAsVersion.getMinorVersion() <= UimaVersion.getMinorVersion();
+ if ( !majorMatch || (majorMatch && !minorOK) ) {
+ UIMAFramework.getLogger(claz).logrb(
+ Level.WARNING,
+ claz.getName(),
+ method,
+ UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
+ "UIMAEE_incompatible_version_WARNING",
+ new Object[] { componentName, UimaAsVersion.getFullVersionString(),
+ UimaVersion.getFullVersionString() });
+ throw new ResourceInitializationException(new AsynchAEException(
+ "Version of UIMA-AS is Incompatible with a Version of UIMA Core. UIMA-AS Version is built to depend on Core UIMA version:"
+ + UimaAsVersion.getFullVersionString() + " but is running with version:"
+ + UimaVersion.getFullVersionString()));
+ }
+
+ }
+}
Propchange: uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/VersionCompatibilityChecker.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/BaseAnalysisEngineController.java
URL: http://svn.apache.org/viewvc/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/BaseAnalysisEngineController.java?rev=1772903&r1=1772902&r2=1772903&view=diff
==============================================================================
--- uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/BaseAnalysisEngineController.java (original)
+++ uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/BaseAnalysisEngineController.java Tue Dec 6 15:05:11 2016
@@ -60,6 +60,7 @@ import org.apache.uima.aae.UimaAsContext
import org.apache.uima.aae.UimaAsVersion;
import org.apache.uima.aae.UimaClassFactory;
import org.apache.uima.aae.UimaEEAdminContext;
+import org.apache.uima.aae.VersionCompatibilityChecker;
import org.apache.uima.aae.WarmUpDataProvider;
import org.apache.uima.aae.controller.LocalCache.CasStateEntry;
import org.apache.uima.aae.delegate.Delegate;
@@ -354,20 +355,10 @@ public abstract class BaseAnalysisEngine
// this adds the handler to every thread
Thread.setDefaultUncaughtExceptionHandler(new UimaAsUncaughtExceptionHandler(getComponentName()));
// Check the version of uimaj that UIMA AS was built with, against the UIMA Core version. If not the same throw Exception
- if (UimaAsVersion.getMajorVersion() != UimaVersion.getMajorVersion()) {
- UIMAFramework.getLogger(CLASS_NAME).logrb(
- Level.WARNING,
- CLASS_NAME.getName(),
- "BaseAnalysisEngineController",
- UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
- "UIMAEE_incompatible_version_WARNING",
- new Object[] { getComponentName(), UimaAsVersion.getUimajFullVersionString(),
- UimaVersion.getFullVersionString() });
- throw new ResourceInitializationException(new AsynchAEException(
- "Version of UIMA-AS is Incompatible with a Version of UIMA Core. UIMA-AS Version is built to depend on Core UIMA version:"
- + UimaAsVersion.getUimajFullVersionString() + " but is running with version:"
- + UimaVersion.getFullVersionString()));
- }
+
+ // throws an exception if verions of UIMA-AS is not compatible with UIMA SDK
+ VersionCompatibilityChecker.check(CLASS_NAME, getComponentName(),"BaseAnalysisEngineController()");
+
logPlatformInfo(getComponentName());
} else {
if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {