You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by al...@apache.org on 2007/01/31 22:51:18 UTC
svn commit: r502012 - in
/incubator/uima/uimaj/trunk/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm:
container/CPEFactory.java engine/CPMEngine.java
Author: alally
Date: Wed Jan 31 13:51:17 2007
New Revision: 502012
URL: http://svn.apache.org/viewvc?view=rev&rev=502012
Log:
Fixes for invoking CPE via "old" CPM interface, for problems
introduced while implementing fix for UIMA-78.
https://issues.apache.org/jira/browse/UIMA-78
Modified:
incubator/uima/uimaj/trunk/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/CPEFactory.java
incubator/uima/uimaj/trunk/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/CPMEngine.java
Modified: incubator/uima/uimaj/trunk/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/CPEFactory.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/CPEFactory.java?view=diff&rev=502012&r1=502011&r2=502012
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/CPEFactory.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/CPEFactory.java Wed Jan 31 13:51:17 2007
@@ -128,6 +128,9 @@
* Create a new CPEFactory on which we will later call parse(String) to parse a CPE descriptor.
*/
public CPEFactory(ResourceManager aResourceManager) {
+ if (aResourceManager == null) {
+ aResourceManager = UIMAFramework.newDefaultResourceManager();
+ }
uimaContext = UIMAFramework.newUimaContext(UIMAFramework.getLogger(), aResourceManager,
UIMAFramework.newConfigurationManager());
}
Modified: incubator/uima/uimaj/trunk/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/CPMEngine.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/CPMEngine.java?view=diff&rev=502012&r1=502011&r2=502012
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/CPMEngine.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/CPMEngine.java Wed Jan 31 13:51:17 2007
@@ -33,6 +33,7 @@
import org.apache.uima.UIMAFramework;
import org.apache.uima.UimaContext;
import org.apache.uima.adapter.vinci.util.Descriptor;
+import org.apache.uima.analysis_engine.AnalysisEngine;
import org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase;
import org.apache.uima.cas.CAS;
import org.apache.uima.cas.impl.CASImpl;
@@ -2689,7 +2690,7 @@
/**
* Registers Type Systems of all components with the CasManager.
- * TODO: could do this registration after initialization of each component.
+ *
*/
private void registerTypeSystemsWithCasManager() throws Exception {
CasManager manager= this.cpeFactory.getResourceManager().getCasManager();
@@ -2726,7 +2727,11 @@
if (processor instanceof AnalysisEngineImplBase) {
//Integrated AEs already have added their metadata to the CasManager during
//their initialization, so we don't need to do it again.
- continue;
+ //(Exception: when running from "old" CPM interface - where AEs are created outside
+ // and passed in, the AE may not share a ResourceManager with the CPE. In that case
+ // we DO need to register its metadata.)
+ if (((AnalysisEngine)processor).getResourceManager() == this.cpeFactory.getResourceManager())
+ continue;
}
ProcessingResourceMetaData md = processor.getProcessingResourceMetaData();
@@ -2754,9 +2759,11 @@
CasProcessor processor = container.getCasProcessor();
try {
if (processor instanceof AnalysisEngineImplBase) {
- //Integrated AEs already have added their metadata to the CasManager during
- //their initialization, so we don't need to do it again.
- continue;
+ //(Exception: when running from "old" CPM interface - where AEs are created outside
+ // and passed in, the AE may not share a ResourceManager with the CPE. In that case
+ // we DO need to register its metadata.)
+ if (((AnalysisEngine)processor).getResourceManager() == this.cpeFactory.getResourceManager())
+ continue;
}
ProcessingResourceMetaData md = processor.getProcessingResourceMetaData();