You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by re...@apache.org on 2022/01/20 08:55:21 UTC
[uima-uimaj] 01/01: [UIMA-6373] Format UIMA Core Java SDK codebase
This is an automated email from the ASF dual-hosted git repository.
rec pushed a commit to branch refactoring/UIMA-6373-Format-UIMA-Core-Java-SDK-codebase
in repository https://gitbox.apache.org/repos/asf/uima-uimaj.git
commit 8efb551dca6a6f0e32f7adb84caa774a7ba24c6e
Author: Richard Eckart de Castilho <re...@apache.org>
AuthorDate: Thu Jan 20 09:55:12 2022 +0100
[UIMA-6373] Format UIMA Core Java SDK codebase
- Format CPE module
---
.../cas_data/impl/vinci/VinciCasDataConverter.java | 63 +-
.../apache/uima/collection/impl/CasConverter.java | 3 +-
.../impl/CollectionProcessingEngine_impl.java | 22 +-
.../base_cpm/container/CasProcessorController.java | 3 +-
.../base_cpm/container/KillPipelineException.java | 1 -
.../base_cpm/container/ProcessingContainer.java | 4 +-
.../container/deployer/CasProcessorDeployer.java | 25 +-
.../deployer/CasProcessorDeploymentException.java | 19 +-
.../uima/collection/impl/cpm/BaseCPMImpl.java | 318 +++--
.../apache/uima/collection/impl/cpm/CPEConfig.java | 20 +-
.../apache/uima/collection/impl/cpm/CPMImpl.java | 9 -
.../uima/collection/impl/cpm/Checkpoint.java | 54 +-
.../uima/collection/impl/cpm/CheckpointConfig.java | 8 +-
.../uima/collection/impl/cpm/CheckpointData.java | 15 +-
.../impl/cpm/StatusCallbackListenerImpl.java | 15 +-
.../collection/impl/cpm/container/CPEContext.java | 3 +-
.../collection/impl/cpm/container/CPEFactory.java | 633 +++++-----
.../CasObjectNetworkCasProcessorImpl.java | 63 +-
.../CasProcessorConfigurationJAXBImpl.java | 257 ++--
.../cpm/container/NetworkCasProcessorImpl.java | 79 +-
.../cpm/container/ProcessingContainer_Impl.java | 327 +++--
.../impl/cpm/container/ServiceProxyPool.java | 191 ++-
.../container/deployer/CPEDeployerDefaultImpl.java | 99 +-
.../impl/cpm/container/deployer/DeployFactory.java | 48 +-
.../container/deployer/FencedProcessReaper.java | 5 +-
.../cpm/container/deployer/JavaApplication.java | 44 +-
.../cpm/container/deployer/NonJavaApplication.java | 30 +-
.../container/deployer/RunnableApplication.java | 35 +-
.../impl/cpm/container/deployer/VinciTAP.java | 405 +++---
.../deployer/socket/OFSocketTransportImpl.java | 20 +-
.../deployer/socket/ProcessControllerAdapter.java | 15 +-
.../socket/SocketCasProcessorDeployer.java | 102 +-
.../container/deployer/socket/SocketTransport.java | 41 +-
.../deployer/vinci/VinciCasProcessorDeployer.java | 963 +++++++--------
.../impl/cpm/container/deployer/vns/LocalVNS.java | 77 +-
.../impl/cpm/container/deployer/vns/VNSQuery.java | 89 +-
.../impl/cpm/engine/ArtifactProducer.java | 192 ++-
.../impl/cpm/engine/BoundedWorkQueue.java | 124 +-
.../collection/impl/cpm/engine/CPECasPool.java | 110 +-
.../impl/cpm/engine/CPMChunkTimeoutException.java | 13 +-
.../collection/impl/cpm/engine/CPMThreadGroup.java | 31 +-
.../impl/cpm/engine/ConsumerCasUtils.java | 48 +-
.../impl/cpm/engine/DebugControlThread.java | 30 +-
.../impl/cpm/engine/NonThreadedProcessingUnit.java | 632 +++++-----
.../collection/impl/cpm/engine/ProcessingUnit.java | 869 +++++++------
.../collection/impl/cpm/engine/SequencedQueue.java | 183 ++-
.../uima/collection/impl/cpm/engine/WorkUnit.java | 11 +-
.../uima/collection/impl/cpm/utils/CPMUtils.java | 135 +-
.../collection/impl/cpm/utils/CasMetaData.java | 7 +-
.../collection/impl/cpm/utils/ChunkMetadata.java | 22 +-
.../impl/cpm/utils/ConfigurableFeature.java | 27 +-
.../impl/cpm/utils/CpmLocalizedMessage.java | 10 +-
.../uima/collection/impl/cpm/utils/Execute.java | 11 +-
.../collection/impl/cpm/utils/ExpirationTimer.java | 15 +-
.../uima/collection/impl/cpm/utils/FeatureMap.java | 15 +-
.../uima/collection/impl/cpm/utils/Filter.java | 61 +-
.../uima/collection/impl/cpm/utils/JavaTimer.java | 31 +-
.../collection/impl/cpm/utils/QueueEntity.java | 9 +-
.../uima/collection/impl/cpm/utils/Timer.java | 3 +-
.../collection/impl/cpm/utils/TimerFactory.java | 22 +-
.../cpm/utils/TypeComplianceConverterImpl.java | 24 +-
.../uima/collection/impl/cpm/utils/ValuePair.java | 9 +-
.../collection/impl/cpm/vinci/DATACasUtils.java | 139 ++-
.../uima/collection/impl/cpm/vinci/Vinci.java | 65 +-
...rocessorConfigurationParameterSettingsImpl.java | 24 +-
.../impl/metadata/cpe/CasProcessorCpeObject.java | 188 +--
.../cpe/CasProcessorDeploymentParamImpl.java | 46 +-
.../cpe/CasProcessorDeploymentParamsImpl.java | 38 +-
.../cpe/CasProcessorErrorHandlingImpl.java | 20 +-
.../cpe/CasProcessorErrorRateThresholdImpl.java | 44 +-
.../impl/metadata/cpe/CasProcessorExecArgImpl.java | 30 +-
.../metadata/cpe/CasProcessorExecArgsImpl.java | 10 +-
.../metadata/cpe/CasProcessorExecutableImpl.java | 77 +-
.../impl/metadata/cpe/CasProcessorFilterImpl.java | 38 +-
.../metadata/cpe/CasProcessorMaxRestartsImpl.java | 37 +-
.../cpe/CasProcessorRunInSeperateProcessImpl.java | 16 +-
.../cpe/CasProcessorRuntimeEnvParamImpl.java | 36 +-
.../impl/metadata/cpe/CasProcessorTimeoutImpl.java | 27 +-
.../impl/metadata/cpe/CpeCasProcessorsImpl.java | 105 +-
.../impl/metadata/cpe/CpeCheckpointImpl.java | 36 +-
.../cpe/CpeCollectionReaderCasInitializerImpl.java | 34 +-
.../impl/metadata/cpe/CpeCollectionReaderImpl.java | 27 +-
.../cpe/CpeCollectionReaderIteratorImpl.java | 30 +-
.../metadata/cpe/CpeComponentDescriptorImpl.java | 66 +-
.../impl/metadata/cpe/CpeConfigurationImpl.java | 46 +-
.../impl/metadata/cpe/CpeDescriptionImpl.java | 169 ++-
.../impl/metadata/cpe/CpeDescriptorFactory.java | 126 +-
.../impl/metadata/cpe/CpeIncludeImpl.java | 24 +-
.../cpe/CpeIntegratedCasProcessorImpl.java | 11 +-
.../metadata/cpe/CpeLocalCasProcessorImpl.java | 74 +-
.../collection/impl/metadata/cpe/CpeObject.java | 9 +-
.../metadata/cpe/CpeRemoteCasProcessorImpl.java | 12 +-
.../cpe/CpeResourceManagerConfigurationImpl.java | 26 +-
.../impl/metadata/cpe/CpeSofaMappingImpl.java | 25 +-
.../impl/metadata/cpe/CpeSofaMappingsImpl.java | 30 +-
.../collection/impl/metadata/cpe/CpeTimerImpl.java | 6 +-
.../impl/metadata/cpe/NameValuePairImpl.java | 25 +-
.../impl/metadata/cpe/OutputQueue_impl.java | 29 +-
.../impl/SofaNamingInAggregateTest.java | 52 +-
.../uima/analysis_engine/impl/TestAnnotator.java | 4 +-
.../java/org/apache/uima/cas/impl/CasTestUtil.java | 2 -
.../impl/CasHeapSizeTestCollectionReader.java | 6 +-
.../impl/CollectionProcessingEngine_implTest.java | 56 +-
.../collection/impl/SingleDocCollectionReader.java | 4 +-
.../uima/collection/impl/TestCasInitializer.java | 2 +-
.../uima/collection/impl/TestCasMultiplier.java | 27 +-
.../uima/collection/impl/cpm/CasPoolTest.java | 49 +-
.../impl/cpm/CpeCasProcessorAPI_Test.java | 65 +-
.../impl/cpm/CpeDescriptorSerialization_Test.java | 125 +-
.../uima/collection/impl/cpm/CpeImportTest.java | 68 +-
.../uima/collection/impl/cpm/CpmAE_ErrorTest.java | 204 +--
.../impl/cpm/CpmCasConsumer_ErrorTest.java | 108 +-
.../impl/cpm/CpmCollectionReader_ErrorTest.java | 1295 ++++++++++----------
.../uima/collection/impl/cpm/CpmInitTest.java | 35 +-
.../collection/impl/cpm/CpmProcessingTest.java | 111 +-
.../uima/collection/impl/cpm/CpmStopTest.java | 34 +-
.../uima/collection/impl/cpm/PearCasPoolTest.java | 66 +-
.../impl/cpm/SofaCPE_SofaUnawareCC_Test.java | 19 +-
.../uima/collection/impl/cpm/SofaCPE_Test.java | 19 +-
.../collection/impl/cpm/SofaMixedCPE_Test.java | 17 +-
.../impl/cpm/utils/DescriptorMakeUtil.java | 29 +-
.../impl/cpm/utils/ErrorTestAnnotator.java | 20 +-
.../impl/cpm/utils/ErrorTestCasConsumer.java | 8 +-
.../impl/cpm/utils/ErrorTestCollectionReader.java | 4 +-
.../impl/cpm/utils/FunctionErrorStore.java | 10 +-
.../collection/impl/cpm/utils/SlowAnnotator.java | 9 +-
.../uima/examples/cpm/sofa/CpmTestDriver.java | 4 +-
.../examples/cpm/sofa/SofaCollectionReader.java | 2 +-
.../uima/pear/util/ComponentCategoryTest.java | 8 +-
.../resource/impl/TestResourceInterface_impl.java | 11 +-
130 files changed, 5766 insertions(+), 5201 deletions(-)
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/cas_data/impl/vinci/VinciCasDataConverter.java b/uimaj-cpe/src/main/java/org/apache/uima/cas_data/impl/vinci/VinciCasDataConverter.java
index a5e4133..236291b 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/cas_data/impl/vinci/VinciCasDataConverter.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/cas_data/impl/vinci/VinciCasDataConverter.java
@@ -32,14 +32,13 @@ import org.apache.uima.cas_data.impl.XCasToCasDataSaxHandler;
import org.apache.vinci.transport.document.AFrame;
import org.xml.sax.SAXException;
-
/**
* Utilities for converting a VinciFrame to and from a CasData.
*
*
*/
public class VinciCasDataConverter {
-
+
/** The m ueid type. */
private String mUeidType;
@@ -61,12 +60,18 @@ public class VinciCasDataConverter {
/**
* Creates a new VinciCasDataConverter.
*
- * @param aUeidType CasData type that contains the UEID (may be null)
- * @param aUeidFeature CasData feature that contains the UEID (may be null)
- * @param aCasDataDocTextType CasData type that contains the document text
- * @param aCasDataDocTextFeature CasData feature that contains the document text
- * @param aXCasDocTextTag XCas tag representing the document text
- * @param aIncludeAnnotationSpannedText if true, when generating XCas for an annotation, the spanned text of the annotation
+ * @param aUeidType
+ * CasData type that contains the UEID (may be null)
+ * @param aUeidFeature
+ * CasData feature that contains the UEID (may be null)
+ * @param aCasDataDocTextType
+ * CasData type that contains the document text
+ * @param aCasDataDocTextFeature
+ * CasData feature that contains the document text
+ * @param aXCasDocTextTag
+ * XCas tag representing the document text
+ * @param aIncludeAnnotationSpannedText
+ * if true, when generating XCas for an annotation, the spanned text of the annotation
* will be included as the content of the XCas element.
*/
public VinciCasDataConverter(String aUeidType, String aUeidFeature, String aCasDataDocTextType,
@@ -83,13 +88,17 @@ public class VinciCasDataConverter {
/**
* Converts a CasData to a VinciFrame.
*
- * @param aCasData CasData to convert
- * @param aParentFrame VinciFrame to be the parent of the frame created from the CasData
- * @throws IOException Signals that an I/O exception has occurred.
- * @throws SAXException the SAX exception
+ * @param aCasData
+ * CasData to convert
+ * @param aParentFrame
+ * VinciFrame to be the parent of the frame created from the CasData
+ * @throws IOException
+ * Signals that an I/O exception has occurred.
+ * @throws SAXException
+ * the SAX exception
*/
- public void casDataToVinciFrame(CasData aCasData, AFrame aParentFrame) throws IOException,
- SAXException {
+ public void casDataToVinciFrame(CasData aCasData, AFrame aParentFrame)
+ throws IOException, SAXException {
// get UEID if necessary
String ueid = null;
if (mUeidType != null && mUeidFeature != null) {
@@ -118,22 +127,27 @@ public class VinciCasDataConverter {
/**
* Converts a VinciFrame to a CasData, appending to an existing CasData.
*
- * @param aCasFrame VinciFrame containing XCAS
- * @param aCasData CasData to which FeatureStructures from XCAS will be appended
- * @throws SAXException the SAX exception
+ * @param aCasFrame
+ * VinciFrame containing XCAS
+ * @param aCasData
+ * CasData to which FeatureStructures from XCAS will be appended
+ * @throws SAXException
+ * the SAX exception
* @deprecated Use appendVinciFrameToCasData(Aframe, CasData) or vinciFrameToCasData(AFrame)
*/
@Deprecated
-public void vinciFrameToCasData(AFrame aCasFrame, CasData aCasData) throws SAXException {
+ public void vinciFrameToCasData(AFrame aCasFrame, CasData aCasData) throws SAXException {
appendVinciFrameToCasData(aCasFrame, aCasData);
}
/**
* Converts a VinciFrame to a CasData.
*
- * @param aCasFrame VinciFrame containing XCAS
+ * @param aCasFrame
+ * VinciFrame containing XCAS
* @return a new CasData corrsponding to the XCAS in aCasFrame
- * @throws SAXException the SAX exception
+ * @throws SAXException
+ * the SAX exception
*/
public CasData vinciFrameToCasData(AFrame aCasFrame) throws SAXException {
CasData casData = new CasDataImpl();
@@ -144,9 +158,12 @@ public void vinciFrameToCasData(AFrame aCasFrame, CasData aCasData) throws SAXEx
/**
* Converts a VinciFrame to a CasData, appending to an existing CasData.
*
- * @param aCasFrame VinciFrame containing XCAS
- * @param aCasData CasData to which FeatureStructures from XCAS will be appended
- * @throws SAXException the SAX exception
+ * @param aCasFrame
+ * VinciFrame containing XCAS
+ * @param aCasData
+ * CasData to which FeatureStructures from XCAS will be appended
+ * @throws SAXException
+ * the SAX exception
*/
public void appendVinciFrameToCasData(AFrame aCasFrame, CasData aCasData) throws SAXException {
// Use VinciSaxParser to generate SAX events from VinciFrame, and send
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/CasConverter.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/CasConverter.java
index 82234c6..b269e45 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/CasConverter.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/CasConverter.java
@@ -56,7 +56,8 @@ public class CasConverter {
/**
* Sets the name of the CASData FeatureStructure Type that stores the document text.
*
- * @param aDocumentTextTypeName the document text type name
+ * @param aDocumentTextTypeName
+ * the document text type name
*/
public void setDocumentTextTypeName(String aDocumentTextTypeName) {
mDocumentTextTypeName = aDocumentTextTypeName;
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/CollectionProcessingEngine_impl.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/CollectionProcessingEngine_impl.java
index 0ff9d27..a30fb8e 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/CollectionProcessingEngine_impl.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/CollectionProcessingEngine_impl.java
@@ -36,7 +36,6 @@ import org.apache.uima.resource.ResourceManager;
import org.apache.uima.util.ProcessTrace;
import org.apache.uima.util.Progress;
-
public class CollectionProcessingEngine_impl implements CollectionProcessingEngine {
/**
* CPM instance that handles the processing
@@ -46,8 +45,9 @@ public class CollectionProcessingEngine_impl implements CollectionProcessingEngi
/*
* (non-Javadoc)
*
- * @see org.apache.uima.collection.CollectionProcessingEngine#initialize(org.apache.uima.collection.metadata.cpeDescription,
- * java.util.Map)
+ * @see
+ * org.apache.uima.collection.CollectionProcessingEngine#initialize(org.apache.uima.collection.
+ * metadata.cpeDescription, java.util.Map)
*/
@Override
public void initialize(CpeDescription aCpeDescription, Map aAdditionalParams)
@@ -59,12 +59,12 @@ public class CollectionProcessingEngine_impl implements CollectionProcessingEngi
}
// get the ResourceManager (if any) supplied in the aAdditionalParams map
- ResourceManager resMgr = aAdditionalParams == null ? null : (ResourceManager) aAdditionalParams
- .get(Resource.PARAM_RESOURCE_MANAGER);
+ ResourceManager resMgr = aAdditionalParams == null ? null
+ : (ResourceManager) aAdditionalParams.get(Resource.PARAM_RESOURCE_MANAGER);
// get performance tuning settings (if any) supplied in the aAdditionalParams map
- Properties perfSettings = aAdditionalParams == null ? null : (Properties) aAdditionalParams
- .get(Resource.PARAM_PERFORMANCE_TUNING_SETTINGS);
+ Properties perfSettings = aAdditionalParams == null ? null
+ : (Properties) aAdditionalParams.get(Resource.PARAM_PERFORMANCE_TUNING_SETTINGS);
// get ProcessControllerAdapter responsible for launching fenced services
ProcessControllerAdapter pca = aAdditionalParams == null ? null
@@ -86,7 +86,9 @@ public class CollectionProcessingEngine_impl implements CollectionProcessingEngi
/*
* (non-Javadoc)
*
- * @see org.apache.uima.collection.CollectionProcessingEngine#addStatusCallbackListener(org.apache.uima.collection.StatusCallbackListener)
+ * @see
+ * org.apache.uima.collection.CollectionProcessingEngine#addStatusCallbackListener(org.apache.uima
+ * .collection.StatusCallbackListener)
*/
@Override
public void addStatusCallbackListener(StatusCallbackListener aListener) {
@@ -96,7 +98,9 @@ public class CollectionProcessingEngine_impl implements CollectionProcessingEngi
/*
* (non-Javadoc)
*
- * @see org.apache.uima.collection.CollectionProcessingEngine#removeStatusCallbackListener(org.apache.uima.collection.StatusCallbackListener)
+ * @see
+ * org.apache.uima.collection.CollectionProcessingEngine#removeStatusCallbackListener(org.apache.
+ * uima.collection.StatusCallbackListener)
*/
@Override
public void removeStatusCallbackListener(StatusCallbackListener aListener) {
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/base_cpm/container/CasProcessorController.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/base_cpm/container/CasProcessorController.java
index c4fb083..7185dd7 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/base_cpm/container/CasProcessorController.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/base_cpm/container/CasProcessorController.java
@@ -54,7 +54,8 @@ public interface CasProcessorController {
/**
* Sets status of CasProcessor
*
- * @param aStatus -
+ * @param aStatus
+ * -
*/
void setStatus(int aStatus);
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/base_cpm/container/KillPipelineException.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/base_cpm/container/KillPipelineException.java
index ecdd5ce..19ea126 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/base_cpm/container/KillPipelineException.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/base_cpm/container/KillPipelineException.java
@@ -23,7 +23,6 @@ public class KillPipelineException extends Exception {
private static final long serialVersionUID = -4105689778536046179L;
-
public KillPipelineException(String msg) {
super(msg);
}
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/base_cpm/container/ProcessingContainer.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/base_cpm/container/ProcessingContainer.java
index 1078ab4..7bf61f8 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/base_cpm/container/ProcessingContainer.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/base_cpm/container/ProcessingContainer.java
@@ -34,8 +34,8 @@ import org.apache.uima.resource.metadata.ProcessingResourceMetaData;
* Base interface for implementing a Container object responsible for managing Cas Processor
* instances at runtime. Aggregates stats and totals and helps with error recovery.
*/
-public abstract class ProcessingContainer extends Resource_ImplBase implements
- ConfigurableResource, CasProcessorController {
+public abstract class ProcessingContainer extends Resource_ImplBase
+ implements ConfigurableResource, CasProcessorController {
public abstract boolean processCas(Object[] aCas);
public abstract void releaseCasProcessor(CasProcessor aCasProcessor);
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/base_cpm/container/deployer/CasProcessorDeployer.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/base_cpm/container/deployer/CasProcessorDeployer.java
index 994ce7e..f1590e4 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/base_cpm/container/deployer/CasProcessorDeployer.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/base_cpm/container/deployer/CasProcessorDeployer.java
@@ -31,17 +31,18 @@ import org.apache.uima.resource.ResourceConfigurationException;
*/
public interface CasProcessorDeployer {
/**
- * Deploys all Cas Processors in <i>aCasProcessorList</i>. The list contains one or more
- * instances of the same Cas Processor.
+ * Deploys all Cas Processors in <i>aCasProcessorList</i>. The list contains one or more instances
+ * of the same Cas Processor.
*
- * @param aCasProcessorList -
- * list of Cas Processors to deploy
- * @param redeploy -
- * true if the Cas Processor is being redeployed as part of the recovery, false otherwise
+ * @param aCasProcessorList
+ * - list of Cas Processors to deploy
+ * @param redeploy
+ * - true if the Cas Processor is being redeployed as part of the recovery, false
+ * otherwise
* @return ProcessingContainer managing deployed Cas Processors
*
- * @throws ResourceConfigurationException -
- * failed to deploy Cas Processor
+ * @throws ResourceConfigurationException
+ * - failed to deploy Cas Processor
*/
ProcessingContainer deployCasProcessor(List aCasProcessorList, boolean redeploy)
throws ResourceConfigurationException;
@@ -49,11 +50,11 @@ public interface CasProcessorDeployer {
/**
* Method used to redeploy a single instance of a Cas Processor.
*
- * @param aProcessingContainer -
- * ProcessingContainer managing deployed Cas Processor to redeploy
+ * @param aProcessingContainer
+ * - ProcessingContainer managing deployed Cas Processor to redeploy
*
- * @throws ResourceConfigurationException -
- * failed to deploy Cas Processor
+ * @throws ResourceConfigurationException
+ * - failed to deploy Cas Processor
*/
void deployCasProcessor(ProcessingContainer aProcessingContainer)
throws ResourceConfigurationException;
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/base_cpm/container/deployer/CasProcessorDeploymentException.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/base_cpm/container/deployer/CasProcessorDeploymentException.java
index f59e8d0..3ddcba0 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/base_cpm/container/deployer/CasProcessorDeploymentException.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/base_cpm/container/deployer/CasProcessorDeploymentException.java
@@ -59,8 +59,8 @@ public class CasProcessorDeploymentException extends ResourceProcessException {
* located.
* @param aMessageKey
* an identifier that maps to the message for this exception. The message may contain
- * placeholders for arguments as defined by the
- * {@link java.text.MessageFormat MessageFormat} class.
+ * placeholders for arguments as defined by the {@link java.text.MessageFormat
+ * MessageFormat} class.
* @param aArguments
* The arguments to the message. <code>null</code> may be used if the message has no
* arguments.
@@ -78,8 +78,8 @@ public class CasProcessorDeploymentException extends ResourceProcessException {
* located.
* @param aMessageKey
* an identifier that maps to the message for this exception. The message may contain
- * placeholders for arguments as defined by the
- * {@link java.text.MessageFormat MessageFormat} class.
+ * placeholders for arguments as defined by the {@link java.text.MessageFormat
+ * MessageFormat} class.
* @param aArguments
* The arguments to the message. <code>null</code> may be used if the message has no
* arguments.
@@ -96,8 +96,8 @@ public class CasProcessorDeploymentException extends ResourceProcessException {
*
* @param aMessageKey
* an identifier that maps to the message for this exception. The message may contain
- * placeholders for arguments as defined by the
- * {@link java.text.MessageFormat MessageFormat} class.
+ * placeholders for arguments as defined by the {@link java.text.MessageFormat
+ * MessageFormat} class.
* @param aArguments
* The arguments to the message. <code>null</code> may be used if the message has no
* arguments.
@@ -112,15 +112,16 @@ public class CasProcessorDeploymentException extends ResourceProcessException {
*
* @param aMessageKey
* an identifier that maps to the message for this exception. The message may contain
- * placeholders for arguments as defined by the
- * {@link java.text.MessageFormat MessageFormat} class.
+ * placeholders for arguments as defined by the {@link java.text.MessageFormat
+ * MessageFormat} class.
* @param aArguments
* The arguments to the message. <code>null</code> may be used if the message has no
* arguments.
* @param aCause
* the original exception that caused this exception to be thrown, if any
*/
- public CasProcessorDeploymentException(String aMessageKey, Object[] aArguments, Throwable aCause) {
+ public CasProcessorDeploymentException(String aMessageKey, Object[] aArguments,
+ Throwable aCause) {
super(aMessageKey, aArguments, aCause);
}
}
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/BaseCPMImpl.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/BaseCPMImpl.java
index 972e7ee..778b373 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/BaseCPMImpl.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/BaseCPMImpl.java
@@ -62,7 +62,6 @@ import org.apache.uima.util.Progress;
import org.apache.uima.util.UimaTimer;
import org.apache.uima.util.impl.ProcessTrace_impl;
-
/**
* Main thread that launches CPE and manages it. An application interacts with the running CPE via
* this object. Through an API, an application may start, pause, resume, and stop a CPE.
@@ -70,7 +69,7 @@ import org.apache.uima.util.impl.ProcessTrace_impl;
*
*/
public class BaseCPMImpl implements BaseCPM, Runnable {
-
+
/** The default process trace. */
private boolean defaultProcessTrace;
@@ -113,9 +112,10 @@ public class BaseCPMImpl implements BaseCPM, Runnable {
/**
* Instantiates and initializes CPE Factory with a given CPE Descriptor and defaults.
*
- * @param aDescriptor -
- * parsed CPE descriptor
- * @throws Exception -
+ * @param aDescriptor
+ * - parsed CPE descriptor
+ * @throws Exception
+ * -
*/
public BaseCPMImpl(CpeDescription aDescriptor) throws Exception {
this(aDescriptor, null, true, UIMAFramework.getDefaultPerformanceTuningProperties());
@@ -126,14 +126,16 @@ public class BaseCPMImpl implements BaseCPM, Runnable {
* Instantiates and initializes CPE Factory responsible for creating individual components that
* are part of the processing pipeline.
*
- * @param aDescriptor -
- * parsed CPE descriptor
- * @param aResourceManager -
- * ResourceManager instance to be used by the CPE
- * @param aDefaultProcessTrace -
- * ProcessTrace instance to capture events and stats
- * @param aProps the a props
- * @throws Exception -
+ * @param aDescriptor
+ * - parsed CPE descriptor
+ * @param aResourceManager
+ * - ResourceManager instance to be used by the CPE
+ * @param aDefaultProcessTrace
+ * - ProcessTrace instance to capture events and stats
+ * @param aProps
+ * the a props
+ * @throws Exception
+ * -
*/
public BaseCPMImpl(CpeDescription aDescriptor, ResourceManager aResourceManager,
boolean aDefaultProcessTrace, Properties aProps) throws Exception {
@@ -146,12 +148,14 @@ public class BaseCPMImpl implements BaseCPM, Runnable {
/**
* Parses CPE descriptor.
*
- * @param mode -
- * indicates if the CPM should use a static descriptor or one provided
- * @param aDescriptor -
- * provided descriptor path
- * @param aResourceManager ResourceManager to be used by CPM
- * @throws Exception -
+ * @param mode
+ * - indicates if the CPM should use a static descriptor or one provided
+ * @param aDescriptor
+ * - provided descriptor path
+ * @param aResourceManager
+ * ResourceManager to be used by CPM
+ * @throws Exception
+ * -
*/
public BaseCPMImpl(Boolean mode, String aDescriptor, ResourceManager aResourceManager)
throws Exception {
@@ -170,7 +174,8 @@ public class BaseCPMImpl implements BaseCPM, Runnable {
/**
* Plugs in custom perfomance tunning parameters.
*
- * @param aPerformanceTuningSettings the new performance tuning settings
+ * @param aPerformanceTuningSettings
+ * the new performance tuning settings
*/
public void setPerformanceTuningSettings(Properties aPerformanceTuningSettings) {
cpEngine.setPerformanceTuningSettings(aPerformanceTuningSettings);
@@ -180,8 +185,8 @@ public class BaseCPMImpl implements BaseCPM, Runnable {
* Plugs in a given {@link ProcessControllerAdapter}. The CPM uses this adapter to request Cas
* Processor restarts and shutdown.
*
- * @param aPca -
- * instance of the ProcessControllerAdapter
+ * @param aPca
+ * - instance of the ProcessControllerAdapter
*/
public void setProcessControllerAdapter(ProcessControllerAdapter aPca) {
cpEngine.setProcessControllerAdapter(aPca);
@@ -192,7 +197,8 @@ public class BaseCPMImpl implements BaseCPM, Runnable {
* use at the end of processing. Jedii-style reporting shows a summary for this run. The CPM
* default report shows more detail information.
*
- * @param aUseJediiReport the new jedii report
+ * @param aUseJediiReport
+ * the new jedii report
*/
public void setJediiReport(boolean aUseJediiReport) {
mEventTypeMap = new HashMap();
@@ -205,9 +211,12 @@ public class BaseCPMImpl implements BaseCPM, Runnable {
/**
* Instantiates and initializes a CPE.
*
- * @param aDummyCasProcessor -
- * @param aProps the a props
- * @throws Exception -
+ * @param aDummyCasProcessor
+ * -
+ * @param aProps
+ * the a props
+ * @throws Exception
+ * -
*/
public void init(boolean aDummyCasProcessor, Properties aProps) throws Exception {
String uimaTimerClass = cpeFactory.getCPEConfig().getTimerImpl();
@@ -239,8 +248,8 @@ public class BaseCPMImpl implements BaseCPM, Runnable {
}
if (checkpointFileName != null && checkpointFileName.trim().length() > 0) {
File checkpointFile = new File(checkpointFileName);
- checkpoint = new Checkpoint(this, checkpointFileName, cpeFactory.getCPEConfig()
- .getCheckpoint().getFrequency());
+ checkpoint = new Checkpoint(this, checkpointFileName,
+ cpeFactory.getCPEConfig().getCheckpoint().getFrequency());
// Check if the checkpoint file already exists. If it does, the CPM did not complete
// successfully during the previous run and CPM will start in recovery mode, restoring all
// totals and status's from the recovered checkpoint. The processing pipeline state will
@@ -267,12 +276,8 @@ public class BaseCPMImpl implements BaseCPM, Runnable {
CasProcessor[] casProcessors = cpeFactory.getCasProcessors();
for (int i = 0; i < casProcessors.length; i++) {
if (UIMAFramework.getLogger().isLoggable(Level.CONFIG)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.CONFIG,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_add_cp__CONFIG",
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.CONFIG, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_add_cp__CONFIG",
new Object[] { Thread.currentThread().getName(),
casProcessors[i].getProcessingResourceMetaData().getName() });
}
@@ -299,8 +304,8 @@ public class BaseCPMImpl implements BaseCPM, Runnable {
cpEngine.setInputQueueSize(casPoolSize == 0 ? iqSize : casPoolSize);
} catch (NumberFormatException e) {
throw new Exception(CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_queue_size_not_defined__WARNING", new Object[] {
- Thread.currentThread().getName(), "inputQueueSize" }));
+ "UIMA_CPM_EXP_queue_size_not_defined__WARNING",
+ new Object[] { Thread.currentThread().getName(), "inputQueueSize" }));
}
try {
int oqSize = 0;
@@ -310,16 +315,17 @@ public class BaseCPMImpl implements BaseCPM, Runnable {
cpEngine.setOutputQueueSize(casPoolSize == 0 ? oqSize : casPoolSize + 2);
} catch (NumberFormatException e) {
throw new Exception(CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_queue_size_not_defined__WARNING", new Object[] {
- Thread.currentThread().getName(), "outputQueueSize" }));
+ "UIMA_CPM_EXP_queue_size_not_defined__WARNING",
+ new Object[] { Thread.currentThread().getName(), "outputQueueSize" }));
}
try {
int threadCount = cpeFactory.getCpeDescriptor().getCpeCasProcessors().getConcurrentPUCount();
cpEngine.setConcurrentThreadSize(threadCount);
} catch (NumberFormatException e) {
throw new Exception(CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_invalid_component_reference__WARNING", new Object[] {
- Thread.currentThread().getName(), "casProcessors", "processingUnitThreadCount" }));
+ "UIMA_CPM_EXP_invalid_component_reference__WARNING",
+ new Object[] { Thread.currentThread().getName(), "casProcessors",
+ "processingUnitThreadCount" }));
}
}
@@ -327,13 +333,16 @@ public class BaseCPMImpl implements BaseCPM, Runnable {
* Returns {@link CPEConfig} object holding current CPE configuration.
*
* @return CPEConfig instance
- * @throws Exception -
+ * @throws Exception
+ * -
*/
public CpeConfiguration getCPEConfig() throws Exception {
return cpeFactory.getCPEConfig();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.apache.uima.collection.base_cpm.BaseCPM#getCasProcessors()
*/
/*
@@ -347,29 +356,40 @@ public class BaseCPMImpl implements BaseCPM, Runnable {
return casProcs == null ? new CasProcessor[0] : casProcs;
}
- /* (non-Javadoc)
- * @see org.apache.uima.collection.base_cpm.BaseCPM#addCasProcessor(org.apache.uima.collection.base_cpm.CasProcessor)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.uima.collection.base_cpm.BaseCPM#addCasProcessor(org.apache.uima.collection.base_cpm
+ * .CasProcessor)
*/
/*
* Adds given CasProcessor to the processing pipeline. A new CasProcessor is appended to the
* current list.
*
- * @see org.apache.uima.collection.base_cpm.BaseCPM#addCasProcessor(org.apache.uima.collection.base_cpm.CasProcessor)
+ * @see
+ * org.apache.uima.collection.base_cpm.BaseCPM#addCasProcessor(org.apache.uima.collection.base_cpm
+ * .CasProcessor)
*/
@Override
public void addCasProcessor(CasProcessor aCasProcessor) throws ResourceConfigurationException {
cpEngine.addCasProcessor(aCasProcessor);
}
- /* (non-Javadoc)
- * @see org.apache.uima.collection.base_cpm.BaseCPM#addCasProcessor(org.apache.uima.collection.base_cpm.CasProcessor, int)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.uima.collection.base_cpm.BaseCPM#addCasProcessor(org.apache.uima.collection.base_cpm
+ * .CasProcessor, int)
*/
/*
* Adds given CasProcessor to the processing pipeline. A new CasProcessor is inserted into a given
* spot in the current list.
*
- * @see org.apache.uima.collection.base_cpm.BaseCPM#addCasProcessor(org.apache.uima.collection.base_cpm.CasProcessor,
- * int)
+ * @see
+ * org.apache.uima.collection.base_cpm.BaseCPM#addCasProcessor(org.apache.uima.collection.base_cpm
+ * .CasProcessor, int)
*/
@Override
public void addCasProcessor(CasProcessor aCasProcessor, int aIndex)
@@ -377,26 +397,34 @@ public class BaseCPMImpl implements BaseCPM, Runnable {
cpEngine.addCasProcessor(aCasProcessor, aIndex);
}
- /* (non-Javadoc)
- * @see org.apache.uima.collection.base_cpm.BaseCPM#removeCasProcessor(org.apache.uima.collection.base_cpm.CasProcessor)
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.uima.collection.base_cpm.BaseCPM#removeCasProcessor(org.apache.uima.collection.
+ * base_cpm.CasProcessor)
*/
/*
* Removes given CasProcessor from the processing pipeline.
*
- * @see org.apache.uima.collection.base_cpm.BaseCPM#removeCasProcessor(org.apache.uima.collection.base_cpm.CasProcessor)
+ * @see org.apache.uima.collection.base_cpm.BaseCPM#removeCasProcessor(org.apache.uima.collection.
+ * base_cpm.CasProcessor)
*/
@Override
public void removeCasProcessor(CasProcessor aCasProcessor) {
cpEngine.removeCasProcessor(0);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.apache.uima.collection.base_cpm.BaseCPM#disableCasProcessor(java.lang.String)
*/
/*
* Disables given CasProcessor in the existing processing pipeline.
*
- * @see org.apache.uima.collection.base_cpm.BaseCPM#disableCasProcessor(org.apache.uima.collection.base_cpm.CasProcessor)
+ * @see
+ * org.apache.uima.collection.base_cpm.BaseCPM#disableCasProcessor(org.apache.uima.collection.
+ * base_cpm.CasProcessor)
*/
@Override
public void disableCasProcessor(String aCasProcessorName) {
@@ -407,19 +435,24 @@ public class BaseCPMImpl implements BaseCPM, Runnable {
/**
* Enable cas processor.
*
- * @param aCasProcessorName the a cas processor name
+ * @param aCasProcessorName
+ * the a cas processor name
*/
/*
* Disables given CasProcessor in the existing processing pipeline.
*
- * @see org.apache.uima.collection.base_cpm.BaseCPM#disableCasProcessor(org.apache.uima.collection.base_cpm.CasProcessor)
+ * @see
+ * org.apache.uima.collection.base_cpm.BaseCPM#disableCasProcessor(org.apache.uima.collection.
+ * base_cpm.CasProcessor)
*/
public void enableCasProcessor(String aCasProcessorName) {
cpEngine.enableCasProcessor(aCasProcessorName);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.apache.uima.collection.base_cpm.BaseCPM#isSerialProcessingRequired()
*/
/*
@@ -440,7 +473,9 @@ public class BaseCPMImpl implements BaseCPM, Runnable {
public void setSerialProcessingRequired(boolean aRequired) {
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.apache.uima.collection.base_cpm.BaseCPM#isPauseOnException()
*/
/*
@@ -453,7 +488,9 @@ public class BaseCPMImpl implements BaseCPM, Runnable {
return cpEngine.isPauseOnException();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.apache.uima.collection.base_cpm.BaseCPM#setPauseOnException(boolean)
*/
/*
@@ -466,34 +503,44 @@ public class BaseCPMImpl implements BaseCPM, Runnable {
cpEngine.setPauseOnException(aPause);
}
- /* (non-Javadoc)
- * @see org.apache.uima.collection.base_cpm.BaseCPM#addStatusCallbackListener(org.apache.uima.collection.base_cpm.BaseStatusCallbackListener)
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.uima.collection.base_cpm.BaseCPM#addStatusCallbackListener(org.apache.uima.
+ * collection.base_cpm.BaseStatusCallbackListener)
*/
/*
* Adds Event Listener. Important events like, end of entity processing, exceptions, etc will be
* sent to the registered listeners.
*
- * @see org.apache.uima.collection.base_cpm.BaseCPM#addStatusCallbackListener(org.apache.uima.collection.base_cpm.BaseStatusCallbackListener)
+ * @see org.apache.uima.collection.base_cpm.BaseCPM#addStatusCallbackListener(org.apache.uima.
+ * collection.base_cpm.BaseStatusCallbackListener)
*/
@Override
public void addStatusCallbackListener(BaseStatusCallbackListener aListener) {
cpEngine.addStatusCallbackListener(aListener);
}
- /* (non-Javadoc)
- * @see org.apache.uima.collection.base_cpm.BaseCPM#removeStatusCallbackListener(org.apache.uima.collection.base_cpm.BaseStatusCallbackListener)
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.uima.collection.base_cpm.BaseCPM#removeStatusCallbackListener(org.apache.uima.
+ * collection.base_cpm.BaseStatusCallbackListener)
*/
/*
* Remoces named listener from the listener list.
*
- * @see org.apache.uima.collection.base_cpm.BaseCPM#removeStatusCallbackListener(org.apache.uima.collection.base_cpm.BaseStatusCallbackListener)
+ * @see org.apache.uima.collection.base_cpm.BaseCPM#removeStatusCallbackListener(org.apache.uima.
+ * collection.base_cpm.BaseStatusCallbackListener)
*/
@Override
public void removeStatusCallbackListener(BaseStatusCallbackListener aListener) {
cpEngine.removeStatusCallbackListener(aListener);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Runnable#run()
*/
/*
@@ -596,7 +643,7 @@ public class BaseCPMImpl implements BaseCPM, Runnable {
// Notify all listeners that the CPM has finished processing
for (int j = 0; j < statusCbL.size(); j++) {
BaseStatusCallbackListener st = (BaseStatusCallbackListener) statusCbL.get(j);
- if ( st != null ) {
+ if (st != null) {
if (!killed) {
st.collectionProcessComplete();
} else {
@@ -619,10 +666,12 @@ public class BaseCPMImpl implements BaseCPM, Runnable {
* This method is called by an applications to begin CPM processing with a given Collection. It
* just creates a new thread and starts it.
*
- * @param aCollectionReader the a collection reader
- * @throws ResourceInitializationException the resource initialization exception
+ * @param aCollectionReader
+ * the a collection reader
+ * @throws ResourceInitializationException
+ * the resource initialization exception
* @see org.apache.uima.collection.base_cpm.BaseCPM#process()
- * @deprecated
+ * @deprecated
*/
@Deprecated
public void process(BaseCollectionReader aCollectionReader)
@@ -674,11 +723,14 @@ public class BaseCPMImpl implements BaseCPM, Runnable {
* This method is called by an applications to begin CPM processing with a given Collection. It
* just creates a new thread and starts it.
*
- * @param aCollectionReader the a collection reader
- * @param aBatchSize the a batch size
- * @throws ResourceInitializationException the resource initialization exception
+ * @param aCollectionReader
+ * the a collection reader
+ * @param aBatchSize
+ * the a batch size
+ * @throws ResourceInitializationException
+ * the resource initialization exception
* @see org.apache.uima.collection.base_cpm.BaseCPM#process()
- * @deprecated
+ * @deprecated
*/
@Deprecated
public void process(BaseCollectionReader aCollectionReader, int aBatchSize)
@@ -726,7 +778,9 @@ public class BaseCPMImpl implements BaseCPM, Runnable {
}
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.apache.uima.collection.base_cpm.BaseCPM#isProcessing()
*/
/*
@@ -740,7 +794,9 @@ public class BaseCPMImpl implements BaseCPM, Runnable {
return cpEngine.isRunning();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.apache.uima.collection.base_cpm.BaseCPM#pause()
*/
/*
@@ -757,7 +813,9 @@ public class BaseCPMImpl implements BaseCPM, Runnable {
}
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.apache.uima.collection.base_cpm.BaseCPM#isPaused()
*/
/*
@@ -770,7 +828,9 @@ public class BaseCPMImpl implements BaseCPM, Runnable {
return cpEngine.isPaused();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.apache.uima.collection.base_cpm.BaseCPM#resume(boolean)
*/
/*
@@ -783,7 +843,9 @@ public class BaseCPMImpl implements BaseCPM, Runnable {
resume();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.apache.uima.collection.base_cpm.BaseCPM#resume()
*/
/*
@@ -825,7 +887,9 @@ public class BaseCPMImpl implements BaseCPM, Runnable {
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.apache.uima.collection.base_cpm.BaseCPM#stop()
*/
/*
@@ -888,7 +952,8 @@ public class BaseCPMImpl implements BaseCPM, Runnable {
/**
* Decode status.
*
- * @param aStatus the a status
+ * @param aStatus
+ * the a status
* @return the string
*/
/*
@@ -920,10 +985,14 @@ public class BaseCPMImpl implements BaseCPM, Runnable {
/**
* Copy component events.
*
- * @param aEvType the a ev type
- * @param aList the a list
- * @param aPTr the a P tr
- * @throws IOException Signals that an I/O exception has occurred.
+ * @param aEvType
+ * the a ev type
+ * @param aList
+ * the a list
+ * @param aPTr
+ * the a P tr
+ * @throws IOException
+ * Signals that an I/O exception has occurred.
*/
/*
* Copies events of a given type found in the list to a provided ProcessTrace instance
@@ -946,10 +1015,10 @@ public class BaseCPMImpl implements BaseCPM, Runnable {
/**
* Helper method to display stats and totals.
*
- * @param aProcessTrace -
- * trace containing stats
- * @param aNumDocsProcessed -
- * number of entities processed so far
+ * @param aProcessTrace
+ * - trace containing stats
+ * @param aNumDocsProcessed
+ * - number of entities processed so far
*/
public void displayStats(ProcessTrace aProcessTrace, int aNumDocsProcessed) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
@@ -965,10 +1034,8 @@ public class BaseCPMImpl implements BaseCPM, Runnable {
// get the time.
if ("CPM".equals(event.getComponentName())) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).log(
- Level.FINEST,
- "Current Component::" + event.getComponentName() + " Time::"
- + event.getDuration());
+ UIMAFramework.getLogger(this.getClass()).log(Level.FINEST, "Current Component::"
+ + event.getComponentName() + " Time::" + event.getDuration());
}
continue;
}
@@ -1000,8 +1067,10 @@ public class BaseCPMImpl implements BaseCPM, Runnable {
/**
* Helper method to help build the CPM report.
*
- * @param aEvent the a event
- * @param aTotalTime the a total time
+ * @param aEvent
+ * the a event
+ * @param aTotalTime
+ * the a total time
*/
public void buildEventTree(ProcessTraceEvent aEvent, int aTotalTime) {
// Skip reporting the CPM time.This time has already been acquired by summing up
@@ -1019,10 +1088,8 @@ public class BaseCPMImpl implements BaseCPM, Runnable {
}
if (System.getProperty("DEBUG") != null) {
- UIMAFramework.getLogger(this.getClass()).log(
- Level.FINEST,
- "" + pct + "% (" + duration + "ms) - " + aEvent.getComponentName() + " (" + type
- + ")");
+ UIMAFramework.getLogger(this.getClass()).log(Level.FINEST, "" + pct + "% (" + duration
+ + "ms) - " + aEvent.getComponentName() + " (" + type + ")");
}
Iterator it = aEvent.getSubEvents().iterator();
while (it.hasNext()) {
@@ -1103,16 +1170,16 @@ public class BaseCPMImpl implements BaseCPM, Runnable {
Long totalCollectionReaderTime = (Long) perfReport.get("COLLECTION_READER_TIME");
String readerName = collectionReader.getProcessingResourceMetaData().getName();
if (totalCollectionReaderTime != null) {
- processTrace.addEvent(readerName, "COLLECTION_READER_TIME", String
- .valueOf(totalCollectionReaderTime), 0, null);
+ processTrace.addEvent(readerName, "COLLECTION_READER_TIME",
+ String.valueOf(totalCollectionReaderTime), 0, null);
}
for (int i = 0; i < colReaderProgress.length; i++) {
if (Progress.BYTES.equals(colReaderProgress[i].getUnit())) {
- processTrace.addEvent(readerName, Constants.COLLECTION_READER_BYTES_PROCESSED, String
- .valueOf(colReaderProgress[i].getCompleted()), 0, null);
+ processTrace.addEvent(readerName, Constants.COLLECTION_READER_BYTES_PROCESSED,
+ String.valueOf(colReaderProgress[i].getCompleted()), 0, null);
} else if (Progress.ENTITIES.equals(colReaderProgress[i].getUnit())) {
- processTrace.addEvent(readerName, Constants.COLLECTION_READER_DOCS_PROCESSED, String
- .valueOf(colReaderProgress[i].getCompleted()), 0, null);
+ processTrace.addEvent(readerName, Constants.COLLECTION_READER_DOCS_PROCESSED,
+ String.valueOf(colReaderProgress[i].getCompleted()), 0, null);
}
}
@@ -1133,8 +1200,8 @@ public class BaseCPMImpl implements BaseCPM, Runnable {
}
copyComponentEvents("Process", eList, processTrace);
- processTrace.addEvent(container.getName(), "Documents Processed", String.valueOf(container
- .getProcessed()), 0, null);
+ processTrace.addEvent(container.getName(), "Documents Processed",
+ String.valueOf(container.getProcessed()), 0, null);
String status = decodeStatus(container.getStatus());
processTrace.addEvent(container.getName(), "Processor Status", status, 0, null);
@@ -1147,20 +1214,20 @@ public class BaseCPMImpl implements BaseCPM, Runnable {
0, null);
int restartCount = container.getRestartCount();
- processTrace.addEvent(container.getName(), "Processor Restarts", String
- .valueOf(restartCount), 0, null);
+ processTrace.addEvent(container.getName(), "Processor Restarts",
+ String.valueOf(restartCount), 0, null);
int retryCount = container.getRetryCount();
processTrace.addEvent(container.getName(), "Processor Retries", String.valueOf(retryCount),
0, null);
int filteredCount = container.getFilteredCount();
- processTrace.addEvent(container.getName(), "Filtered Entities", String
- .valueOf(filteredCount), 0, null);
+ processTrace.addEvent(container.getName(), "Filtered Entities",
+ String.valueOf(filteredCount), 0, null);
long remainingCount = container.getRemaining();
- processTrace.addEvent(container.getName(), "Processor Remaining", String
- .valueOf(remainingCount), 0, null);
+ processTrace.addEvent(container.getName(), "Processor Remaining",
+ String.valueOf(remainingCount), 0, null);
HashMap aMap = container.getAllStats();
@@ -1181,16 +1248,15 @@ public class BaseCPMImpl implements BaseCPM, Runnable {
"Custom String Stat-" + key + " Value=" + (String) o);
}
} else if (o instanceof Integer) {
- processTrace.addEvent(container.getName(), key, String.valueOf(((Integer) o)
- .intValue()), 0, null);
+ processTrace.addEvent(container.getName(), key,
+ String.valueOf(((Integer) o).intValue()), 0, null);
if (System.getProperty("SHOW_CUSTOM_STATS") != null) {
UIMAFramework.getLogger(this.getClass()).log(Level.FINEST,
"Custom Integer Stat-" + key + " Value=" + o);
- }
+ }
} else {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).log(
- Level.FINEST,
+ UIMAFramework.getLogger(this.getClass()).log(Level.FINEST,
"Invalid Type Found When Generating Status For " + key + ". Type::"
+ o.getClass().getName()
+ " Not supported. Use Integer or String instead.");
@@ -1218,9 +1284,12 @@ public class BaseCPMImpl implements BaseCPM, Runnable {
/**
* Creates the default process trace.
*
- * @param aProcessors the a processors
- * @param srcProcTr the src proc tr
- * @param aProcessTrace the a process trace
+ * @param aProcessors
+ * the a processors
+ * @param srcProcTr
+ * the src proc tr
+ * @param aProcessTrace
+ * the a process trace
*/
private void createDefaultProcessTrace(CasProcessor[] aProcessors, ProcessTrace srcProcTr,
ProcessTrace aProcessTrace) {
@@ -1253,10 +1322,11 @@ public class BaseCPMImpl implements BaseCPM, Runnable {
/**
* Returns a CPE descriptor as a String.
*
- * @param aList -
- * list of components
+ * @param aList
+ * - list of components
* @return - descriptor populated with a given components
- * @throws ResourceConfigurationException the resource configuration exception
+ * @throws ResourceConfigurationException
+ * the resource configuration exception
*/
public String getDescriptor(List aList) throws ResourceConfigurationException {
return cpeFactory.getDescriptor(aList);
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/CPEConfig.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/CPEConfig.java
index 6959ae7..7405249 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/CPEConfig.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/CPEConfig.java
@@ -93,8 +93,8 @@ public class CPEConfig {
/**
* Copies Checkpoint configuration
*
- * @param config -
- * checkpoint configuration
+ * @param config
+ * - checkpoint configuration
*/
public void setChConfig(CheckpointConfig config) {
chConfig = config;
@@ -103,8 +103,8 @@ public class CPEConfig {
/**
* Copies CPE startup mode
*
- * @param aCpeDeployMode -
- * startup mode
+ * @param aCpeDeployMode
+ * - startup mode
*/
public void setDeployAs(String aCpeDeployMode) {
deployAs = aCpeDeployMode;
@@ -113,8 +113,8 @@ public class CPEConfig {
/**
* Copies number of entities to process
*
- * @param aTotalCount -
- * total number of entities to process
+ * @param aTotalCount
+ * - total number of entities to process
*/
public void setNumToProcess(long aTotalCount) {
numToProcess = aTotalCount;
@@ -123,8 +123,8 @@ public class CPEConfig {
/**
* Copies ind of the first entity to start reading
*
- * @param aStartEntityId -
- * id of entity
+ * @param aStartEntityId
+ * - id of entity
*/
public void setStartWith(String aStartEntityId) {
startWith = aStartEntityId;
@@ -133,8 +133,8 @@ public class CPEConfig {
/**
* Copies a name of the custom {@link UimaTimer} class
*
- * @param aTimerClass -
- * timer class
+ * @param aTimerClass
+ * - timer class
*/
public void setTimerClass(String aTimerClass) {
timerClass = aTimerClass;
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/CPMImpl.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/CPMImpl.java
index d771dbc..f179f80 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/CPMImpl.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/CPMImpl.java
@@ -43,7 +43,6 @@ public class CPMImpl extends BaseCPMImpl implements CollectionProcessingManager
super(null, null, aResourceManager);
}
-
@Override
public AnalysisEngine getAnalysisEngine() {
if (super.getCasProcessors()[0] != null) {
@@ -59,7 +58,6 @@ public class CPMImpl extends BaseCPMImpl implements CollectionProcessingManager
return null;
}
-
@Override
public void setAnalysisEngine(AnalysisEngine aAnalysisEngine)
throws ResourceConfigurationException {
@@ -72,7 +70,6 @@ public class CPMImpl extends BaseCPMImpl implements CollectionProcessingManager
}
}
-
@Override
public CasConsumer[] getCasConsumers() {
if (consumers != null) {
@@ -90,41 +87,35 @@ public class CPMImpl extends BaseCPMImpl implements CollectionProcessingManager
return consumers;
}
-
@Override
public void addCasConsumer(CasConsumer aCasConsumer) throws ResourceConfigurationException {
super.addCasProcessor(aCasConsumer);
}
-
@Override
public void removeCasConsumer(CasConsumer aCasConsumer) {
super.removeCasProcessor(aCasConsumer);
}
-
@Override
public void addStatusCallbackListener(StatusCallbackListener aListener) {
super.addStatusCallbackListener(aListener);
}
-
@Override
public void removeStatusCallbackListener(StatusCallbackListener aListener) {
super.removeStatusCallbackListener(aListener);
}
-
@Override
public void process(CollectionReader aCollectionReader) throws ResourceInitializationException {
super.process(aCollectionReader);
}
-
@Override
public void process(CollectionReader aCollectionReader, int aBatchSize)
throws ResourceInitializationException {
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/Checkpoint.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/Checkpoint.java
index be1217b..6cef3d7 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/Checkpoint.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/Checkpoint.java
@@ -35,19 +35,18 @@ import org.apache.uima.util.Level;
import org.apache.uima.util.ProcessTrace;
import org.apache.uima.util.ProcessTraceEvent;
-
/**
* Runing in a seperate thread creates a checkpoint file at predefined intervals.
*
*/
public class Checkpoint implements Runnable {
-
+
/** The file name. */
private String fileName = null;
/** The stop. */
- private volatile boolean stop = false; // volatile may be buggy in some JVMs apparently
- // consider changing to use synch
+ private volatile boolean stop = false; // volatile may be buggy in some JVMs apparently
+ // consider changing to use synch
/** The checkpoint frequency. */
private long checkpointFrequency = 3000;
@@ -55,7 +54,7 @@ public class Checkpoint implements Runnable {
/**
* The pause.
*
- * @GuardedBy(lockForPause)
+ * @GuardedBy(lockForPause)
*/
private boolean pause = false;
@@ -73,9 +72,12 @@ public class Checkpoint implements Runnable {
* Initialize the checkpoint with a reference to controlling cpe, the file where the checkpoint is
* to be stored, and the frequency of checkpoints.
*
- * @param aCpm the a cpm
- * @param aFilename the a filename
- * @param aCheckpointFrequency the a checkpoint frequency
+ * @param aCpm
+ * the a cpm
+ * @param aFilename
+ * the a filename
+ * @param aCheckpointFrequency
+ * the a checkpoint frequency
*/
public Checkpoint(BaseCPMImpl aCpm, String aFilename, long aCheckpointFrequency) {
fileName = aFilename;
@@ -204,7 +206,7 @@ public class Checkpoint implements Runnable {
ObjectOutputStream s = null;
try (FileOutputStream out = new FileOutputStream(fileName);
- FileOutputStream synchPointOut = new FileOutputStream(synchPointFileName)) {
+ FileOutputStream synchPointOut = new FileOutputStream(synchPointFileName)) {
s = new ObjectOutputStream(out);
SynchPoint synchPoint = cpm.getSynchPoint();
@@ -214,17 +216,17 @@ public class Checkpoint implements Runnable {
if (synchPoint != null) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST,
- this.getClass().getName(), "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_checkpoint_with_synchpoint__FINEST",
- new Object[] {Thread.currentThread().getName()});
+ this.getClass().getName(), "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_checkpoint_with_synchpoint__FINEST",
+ new Object[] { Thread.currentThread().getName() });
}
targetToSave = new CheckpointData(pTrace, synchPoint);
} else {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST,
- this.getClass().getName(), "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_checkpoint_with_pt__FINEST",
- new Object[] {Thread.currentThread().getName()});
+ this.getClass().getName(), "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_checkpoint_with_pt__FINEST",
+ new Object[] { Thread.currentThread().getName() });
}
targetToSave = new CheckpointData(pTrace);
}
@@ -240,9 +242,9 @@ public class Checkpoint implements Runnable {
}
} catch (Exception e) {
UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
- "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_exception_when_checkpointing__FINEST",
- new Object[] {Thread.currentThread().getName(), e.getMessage()});
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_exception_when_checkpointing__FINEST",
+ new Object[] { Thread.currentThread().getName(), e.getMessage() });
}
} catch (Exception e) {
@@ -256,8 +258,8 @@ public class Checkpoint implements Runnable {
/**
* Renames previous checkpoint file.
*
- * @param aFilename -
- * checkpoint file to rename
+ * @param aFilename
+ * - checkpoint file to rename
*/
public void rename(String aFilename) {
File currentFile = new File(aFilename);
@@ -268,7 +270,8 @@ public class Checkpoint implements Runnable {
/**
* Prints the stats.
*
- * @param prT the pr T
+ * @param prT
+ * the pr T
*/
public static void printStats(ProcessTrace prT) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
@@ -314,10 +317,8 @@ public class Checkpoint implements Runnable {
totDur = prEvent.getDuration();
subEveList = prEvent.getSubEvents();
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(Checkpoint.class).log(
- Level.FINEST,
- tabS + "COMPONENT : " + compNameS + "\tTYPE : " + typeS + "\tDescription : "
- + prEvent.getDescription());
+ UIMAFramework.getLogger(Checkpoint.class).log(Level.FINEST, tabS + "COMPONENT : "
+ + compNameS + "\tTYPE : " + typeS + "\tDescription : " + prEvent.getDescription());
UIMAFramework.getLogger(Checkpoint.class).log(Level.FINEST,
tabS + "TOTAL_TIME : " + totDur + "\tTIME_EXCLUDING_SUBEVENTS : " + dur);
}
@@ -347,7 +348,8 @@ public class Checkpoint implements Runnable {
* Retrieves the checkpoint from the filesystem.
*
* @return - desirialized object containing recovery information.
- * @throws IOException -
+ * @throws IOException
+ * -
*/
public synchronized Object restoreFromCheckpoint() throws IOException {
ObjectInputStream stream = null;
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/CheckpointConfig.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/CheckpointConfig.java
index c74a39a..1774e34 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/CheckpointConfig.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/CheckpointConfig.java
@@ -42,10 +42,10 @@ public class CheckpointConfig {
/**
* Initilizes instance with a file where the checkpoint will be stored and checkpoint frequency.
*
- * @param aChpFile -
- * path to the checkpoint file
- * @param aFrequency -
- * frequency of checkpoints
+ * @param aChpFile
+ * - path to the checkpoint file
+ * @param aFrequency
+ * - frequency of checkpoints
*/
public CheckpointConfig(String aChpFile, String aFrequency) {
checkpointFile = aChpFile;
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/CheckpointData.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/CheckpointData.java
index 350eff4..d003f84 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/CheckpointData.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/CheckpointData.java
@@ -48,9 +48,10 @@ public class CheckpointData implements Serializable {
/**
* Initialize instance with ProcessTrace and SynchPoint
*
- * @param aProcessTrace -
- * events and timers accumulated so far
- * @param aSynchPoint -
+ * @param aProcessTrace
+ * - events and timers accumulated so far
+ * @param aSynchPoint
+ * -
*/
public CheckpointData(ProcessTrace aProcessTrace, SynchPoint aSynchPoint) {
processTrace = aProcessTrace;
@@ -78,8 +79,8 @@ public class CheckpointData implements Serializable {
/**
* Adds ProcessTrace to save in a checkpoint
*
- * @param trace -
- * ProcessTrace to save
+ * @param trace
+ * - ProcessTrace to save
*/
public void setProcessTrace(ProcessTrace trace) {
processTrace = trace;
@@ -88,8 +89,8 @@ public class CheckpointData implements Serializable {
/**
* Adds SynchPoint to save in a checkpoint
*
- * @param point -
- * SynchPoint to save
+ * @param point
+ * - SynchPoint to save
*/
public void setSynchPoint(SynchPoint point) {
synchPoint = point;
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/StatusCallbackListenerImpl.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/StatusCallbackListenerImpl.java
index 7198d86..2cecb02 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/StatusCallbackListenerImpl.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/StatusCallbackListenerImpl.java
@@ -141,23 +141,16 @@ class StatusCallbackListenerImpl implements StatusCallbackListener {
if (aCas == null) {
for (int i = 0; i < aStatus.getFailedComponentNames().size(); i++) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_failed_component__FINEST",
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_failed_component__FINEST",
new Object[] { Thread.currentThread().getName(),
((String) aStatus.getFailedComponentNames().get(i)) });
}
}
for (int i = 0; i < aStatus.getExceptions().size(); i++) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_component_exception__FINEST",
new Object[] { Thread.currentThread().getName(),
(aStatus.getExceptions().get(i)).toString() });
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/CPEContext.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/CPEContext.java
index 4419a6f..a1654f2 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/CPEContext.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/CPEContext.java
@@ -30,7 +30,8 @@ public class CPEContext {
/**
*
- * @param aDescriptorPath -
+ * @param aDescriptorPath
+ * -
*/
public CPEContext(String aDescriptorPath) {
cpeDescriptorPath = aDescriptorPath;
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/CPEFactory.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/CPEFactory.java
index 2b6a9a9..ecbe2ea 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/CPEFactory.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/CPEFactory.java
@@ -88,7 +88,6 @@ import org.apache.uima.util.InvalidXMLException;
import org.apache.uima.util.Level;
import org.apache.uima.util.XMLInputSource;
-
/**
* Component responsible for generating objects representing cpe descriptor configuration. Provides
* various ways to instantiate object model representing cpe configuration. In the simplest form it
@@ -105,7 +104,7 @@ import org.apache.uima.util.XMLInputSource;
*
*/
public class CPEFactory {
-
+
/** The Constant CPM_HOME. */
public static final String CPM_HOME = "${CPM_HOME}";
@@ -139,7 +138,8 @@ public class CPEFactory {
/**
* Create a new CPEFactory on which we will later call parse(String) to parse a CPE descriptor.
*
- * @param aResourceManager the a resource manager
+ * @param aResourceManager
+ * the a resource manager
*/
public CPEFactory(ResourceManager aResourceManager) {
if (aResourceManager == null) {
@@ -152,18 +152,21 @@ public class CPEFactory {
/**
* Create a new CPEFactory for a CpeDescription that's already been parsed.
*
- * @param aDescriptor the a descriptor
- * @param aResourceManager the resource manager that all components of this CPE will share If null, a new
+ * @param aDescriptor
+ * the a descriptor
+ * @param aResourceManager
+ * the resource manager that all components of this CPE will share If null, a new
* ResourceManager will be created.
- * @throws ResourceInitializationException the resource initialization exception
+ * @throws ResourceInitializationException
+ * the resource initialization exception
*/
public CPEFactory(CpeDescription aDescriptor, ResourceManager aResourceManager)
throws ResourceInitializationException {
if (aDescriptor == null) {
- throw new UIMARuntimeException(new InvalidObjectException(CpmLocalizedMessage
- .getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_no_cpe_descriptor__WARNING", new Object[] { Thread
- .currentThread().getName() })));
+ throw new UIMARuntimeException(
+ new InvalidObjectException(CpmLocalizedMessage.getLocalizedMessage(
+ CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_EXP_no_cpe_descriptor__WARNING",
+ new Object[] { Thread.currentThread().getName() })));
}
if (aResourceManager == null) {
@@ -185,8 +188,8 @@ public class CPEFactory {
if (resMgrCfgDesc.get().length() > 0) {
String descriptorPath = CPMUtils.convertToAbsolutePath(System.getProperty("CPM_HOME"),
CPM_HOME, resMgrCfgDesc.get());
- resMgrCfg = UIMAFramework.getXMLParser().parseResourceManagerConfiguration(
- new XMLInputSource(descriptorPath));
+ resMgrCfg = UIMAFramework.getXMLParser()
+ .parseResourceManagerConfiguration(new XMLInputSource(descriptorPath));
aResourceManager.initializeExternalResources(resMgrCfg, "/", null);
}
} catch (InvalidXMLException e) {
@@ -200,24 +203,25 @@ public class CPEFactory {
/**
* Creates an object representation for configuration in a given cpe descriptor file.
*
- * @param aDescriptor -
- * path to the descriptor
+ * @param aDescriptor
+ * - path to the descriptor
*
- * @throws InstantiationException -
+ * @throws InstantiationException
+ * -
*/
public void parse(String aDescriptor) throws InstantiationException {
defaultConfig = false;
if (aDescriptor == null || aDescriptor.trim().length() == 0) {
- throw new UIMARuntimeException(new FileNotFoundException(CpmLocalizedMessage
- .getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_no_cpe_descriptor__WARNING", new Object[] { Thread
- .currentThread().getName() })));
+ throw new UIMARuntimeException(
+ new FileNotFoundException(CpmLocalizedMessage.getLocalizedMessage(
+ CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_EXP_no_cpe_descriptor__WARNING",
+ new Object[] { Thread.currentThread().getName() })));
}
try {
- setCpeDescriptor(CpeDescriptorFactory.produceDescriptor(new FileInputStream(new File(
- aDescriptor))));
+ setCpeDescriptor(
+ CpeDescriptorFactory.produceDescriptor(new FileInputStream(new File(aDescriptor))));
} catch (Exception e) {
throw new UIMARuntimeException(InvalidXMLException.INVALID_DESCRIPTOR_FILE,
@@ -228,18 +232,19 @@ public class CPEFactory {
/**
* Creates an object representation for configuration in a given stream.
*
- * @param aDescriptorStream -
- * stream containing cpe description
- * @throws InstantiationException -
+ * @param aDescriptorStream
+ * - stream containing cpe description
+ * @throws InstantiationException
+ * -
*/
public void parse(InputStream aDescriptorStream) throws InstantiationException {
defaultConfig = false;
if (aDescriptorStream == null) {
- throw new UIMARuntimeException(new IOException(CpmLocalizedMessage.getLocalizedMessage(
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_invalid_cpe_descriptor_stream__WARNING", new Object[] { Thread
- .currentThread().getName() })));
+ throw new UIMARuntimeException(new IOException(
+ CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_EXP_invalid_cpe_descriptor_stream__WARNING",
+ new Object[] { Thread.currentThread().getName() })));
}
try {
@@ -252,7 +257,8 @@ public class CPEFactory {
/**
* Creates an object representation from default cpe descriptor.
*
- * @throws UIMARuntimeException wraps Exception
+ * @throws UIMARuntimeException
+ * wraps Exception
*/
public void parse() {
defaultConfig = true;
@@ -274,14 +280,15 @@ public class CPEFactory {
/**
* Checks if cpe description has been created.
*
- * @throws ResourceConfigurationException the resource configuration exception
+ * @throws ResourceConfigurationException
+ * the resource configuration exception
*/
private void checkForErrors() throws ResourceConfigurationException {
if (cpeDescriptor == null) {
- throw new ResourceConfigurationException(new Exception(CpmLocalizedMessage
- .getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_no_cpe_descriptor__WARNING", new Object[] { Thread
- .currentThread().getName() })));
+ throw new ResourceConfigurationException(
+ new Exception(CpmLocalizedMessage.getLocalizedMessage(
+ CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_EXP_no_cpe_descriptor__WARNING",
+ new Object[] { Thread.currentThread().getName() })));
}
}
@@ -291,7 +298,8 @@ public class CPEFactory {
* CollectionReader.
*
* @return CollectionReader instance
- * @throws ResourceConfigurationException the resource configuration exception
+ * @throws ResourceConfigurationException
+ * the resource configuration exception
*/
public BaseCollectionReader getCollectionReader() throws ResourceConfigurationException {
checkForErrors();
@@ -300,28 +308,31 @@ public class CPEFactory {
CpeCollectionReader reader = (getCpeDescriptor().getAllCollectionCollectionReaders())[0];
if (reader == null) {
throw new ResourceConfigurationException(InvalidXMLException.ELEMENT_NOT_FOUND,
- new Object[] { "<collectionReader>", "<cpeDescriptor>" }, new Exception(
- CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_missing_required_element__WARNING", new Object[] {
- Thread.currentThread().getName(), "<collectionReader>" })));
+ new Object[] { "<collectionReader>", "<cpeDescriptor>" },
+ new Exception(CpmLocalizedMessage.getLocalizedMessage(
+ CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_EXP_missing_required_element__WARNING",
+ new Object[] { Thread.currentThread().getName(), "<collectionReader>" })));
}
CpeCollectionReaderIterator cit = reader.getCollectionIterator();
- if (cit == null || cit.getDescriptor() == null ||
- (cit.getDescriptor().getInclude() == null && cit.getDescriptor().getImport() == null)) {
+ if (cit == null || cit.getDescriptor() == null || (cit.getDescriptor().getInclude() == null
+ && cit.getDescriptor().getImport() == null)) {
throw new ResourceConfigurationException(InvalidXMLException.ELEMENT_NOT_FOUND,
- new Object[] { "<include>", "<collectionIterator>" }, new Exception(
+ new Object[] { "<include>", "<collectionIterator>" },
+ new Exception(
CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_EXP_missing_required_element__WARNING", new Object[] {
Thread.currentThread().getName(), "<include> or <import>" })));
}
- if (cit.getDescriptor().getInclude() != null && cit.getDescriptor().getInclude().get() == null) {
+ if (cit.getDescriptor().getInclude() != null
+ && cit.getDescriptor().getInclude().get() == null) {
throw new ResourceConfigurationException(InvalidXMLException.ELEMENT_NOT_FOUND,
- new Object[] { "<href>", "<collectionIterator>" }, new Exception(
- CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_missing_attribute_from_xml_element__WARNING",
- new Object[] { Thread.currentThread().getName(), "<href>",
- "<collectionIterator>" })));
+ new Object[] { "<href>", "<collectionIterator>" },
+ new Exception(CpmLocalizedMessage.getLocalizedMessage(
+ CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_EXP_missing_attribute_from_xml_element__WARNING", new Object[] {
+ Thread.currentThread().getName(), "<href>", "<collectionIterator>" })));
}
URL descriptorUrl = cit.getDescriptor().findAbsoluteUrl(getResourceManager());
@@ -330,7 +341,8 @@ public class CPEFactory {
ResourceSpecifier colReaderSp = UIMAFramework.getXMLParser()
.parseCollectionReaderDescription(in1);
- overrideParameterSettings(colReaderSp, cit.getConfigurationParameterSettings(), "Collection Reader");
+ overrideParameterSettings(colReaderSp, cit.getConfigurationParameterSettings(),
+ "Collection Reader");
// compute sofa mapping for the CollectionReader
CpeSofaMappings sofanamemappings = cit.getSofaNameMappings();
@@ -354,39 +366,42 @@ public class CPEFactory {
colreader = (BaseCollectionReader) UIMAFramework.produceResource(BaseCollectionReader.class,
colReaderSp, getResourceManager(), additionalParams);
- //set up CAS Initializer
+ // set up CAS Initializer
CpeCollectionReaderCasInitializer casInit = reader.getCasInitializer();
if (casInit != null) {
if (casInit.getDescriptor() == null) {
throw new ResourceConfigurationException(InvalidXMLException.ELEMENT_NOT_FOUND,
- new Object[] { "<descriptor>", "<casInitializer>" }, new Exception(
- CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_missing_required_element__WARNING", new Object[] {
- Thread.currentThread().getName(), "<descriptor>" })));
+ new Object[] { "<descriptor>", "<casInitializer>" },
+ new Exception(CpmLocalizedMessage.getLocalizedMessage(
+ CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_EXP_missing_required_element__WARNING",
+ new Object[] { Thread.currentThread().getName(), "<descriptor>" })));
}
- if (casInit.getDescriptor().getInclude() == null && casInit.getDescriptor().getImport() == null) {
+ if (casInit.getDescriptor().getInclude() == null
+ && casInit.getDescriptor().getImport() == null) {
throw new ResourceConfigurationException(InvalidXMLException.ELEMENT_NOT_FOUND,
- new Object[] { "<include>", "<casInitializer>" }, new Exception(
- CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_missing_required_element__WARNING", new Object[] {
- Thread.currentThread().getName(), "<include> or <import>" })));
+ new Object[] { "<include>", "<casInitializer>" },
+ new Exception(CpmLocalizedMessage.getLocalizedMessage(
+ CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_EXP_missing_required_element__WARNING", new Object[] {
+ Thread.currentThread().getName(), "<include> or <import>" })));
}
- if (casInit.getDescriptor().getInclude() != null &&
- (casInit.getDescriptor().getInclude().get() == null
- || casInit.getDescriptor().getInclude().get().length() == 0)) {
+ if (casInit.getDescriptor().getInclude() != null
+ && (casInit.getDescriptor().getInclude().get() == null
+ || casInit.getDescriptor().getInclude().get().length() == 0)) {
throw new ResourceConfigurationException(InvalidXMLException.ELEMENT_NOT_FOUND,
- new Object[] { "<href>", "<casInitializer>" }, new Exception(CpmLocalizedMessage
- .getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_missing_attribute_from_xml_element__WARNING",
- new Object[] { Thread.currentThread().getName(), "<href>",
- "<casInitializer>" })));
+ new Object[] { "<href>", "<casInitializer>" },
+ new Exception(CpmLocalizedMessage.getLocalizedMessage(
+ CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_EXP_missing_attribute_from_xml_element__WARNING", new Object[] {
+ Thread.currentThread().getName(), "<href>", "<casInitializer>" })));
}
URL casInitDescUrl = casInit.getDescriptor().findAbsoluteUrl(getResourceManager());
XMLInputSource in4 = new XMLInputSource(casInitDescUrl);
- ResourceSpecifier casIniSp = UIMAFramework.getXMLParser().parseCasInitializerDescription(
- in4);
+ ResourceSpecifier casIniSp = UIMAFramework.getXMLParser()
+ .parseCasInitializerDescription(in4);
overrideParameterSettings(casIniSp, casInit.getConfigurationParameterSettings(),
"Cas Initializer");
@@ -418,11 +433,11 @@ public class CPEFactory {
} else {
throw new ResourceConfigurationException(InvalidXMLException.INVALID_ELEMENT_TYPE,
new Object[] { "CasDataInitializer", initializer.getClass().getName() },
- new Exception(CpmLocalizedMessage.getLocalizedMessage(
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_incompatible_component__WARNING", new Object[] {
- Thread.currentThread().getName(), "CasInitializer",
- "CasDataInitializer", initializer.getClass().getName() })));
+ new Exception(
+ CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_EXP_incompatible_component__WARNING",
+ new Object[] { Thread.currentThread().getName(), "CasInitializer",
+ "CasDataInitializer", initializer.getClass().getName() })));
}
}
// Retrieve number of entities to process from CPE configuration
@@ -435,34 +450,29 @@ public class CPEFactory {
}
// Provide CollectionReader with the number of documents to process
((ConfigurableResource_ImplBase) colreader).setConfigParameterValue("processSize",
- (int) numDocs2Process);
+ (int) numDocs2Process);
CpeConfiguration cpeType = getCpeDescriptor().getCpeConfiguration();
if (cpeType != null && cpeType.getStartingEntityId() != null
&& cpeType.getStartingEntityId().trim().length() > 0) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
- "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_show_start_doc_id__FINEST",
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_show_start_doc_id__FINEST",
new Object[] { Thread.currentThread().getName(), cpeType.getStartingEntityId() });
}
colreader.getProcessingResourceMetaData().getConfigurationParameterSettings()
.setParameterValue("startNumber", cpeType.getStartingEntityId().trim());
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).log(
- Level.FINEST,
- "Retrieved Documents Starting with DocId ::"
- + colreader.getProcessingResourceMetaData()
- .getConfigurationParameterSettings().getParameterValue(
- "startNumber"));
+ UIMAFramework.getLogger(this.getClass()).log(Level.FINEST,
+ "Retrieved Documents Starting with DocId ::" + colreader
+ .getProcessingResourceMetaData().getConfigurationParameterSettings()
+ .getParameterValue("startNumber"));
}
}
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).log(
- Level.FINEST,
- "Retrieved processSize ::"
- + ((ConfigurableResource_ImplBase) colreader)
- .getConfigParameterValue("processSize"));
+ UIMAFramework.getLogger(this.getClass()).log(Level.FINEST,
+ "Retrieved processSize ::" + ((ConfigurableResource_ImplBase) colreader)
+ .getConfigParameterValue("processSize"));
}
return colreader;
} catch (ResourceConfigurationException e) {
@@ -476,17 +486,19 @@ public class CPEFactory {
* Returns an array of Cas Processors instantiated from the cpe descriptor.
*
* @return - array of CasProcessor instances
- * @throws ResourceConfigurationException -
+ * @throws ResourceConfigurationException
+ * -
*/
public CasProcessor[] getCasProcessors() throws ResourceConfigurationException {
checkForErrors();
try {
if (getCpeDescriptor().getCpeCasProcessors() == null) {
throw new ResourceConfigurationException(InvalidXMLException.ELEMENT_NOT_FOUND,
- new Object[] { "<casProcessors>", "<cpeDescriptor>" }, new Exception(
+ new Object[] { "<casProcessors>", "<cpeDescriptor>" },
+ new Exception(
CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_bad_cpe_descriptor__WARNING", new Object[] { Thread
- .currentThread().getName() })));
+ "UIMA_CPM_EXP_bad_cpe_descriptor__WARNING",
+ new Object[] { Thread.currentThread().getName() })));
}
CpeCasProcessors ct = getCpeDescriptor().getCpeCasProcessors();
@@ -494,10 +506,11 @@ public class CPEFactory {
Vector v = new Vector();
if (casProcessorList == null || casProcessorList.length == 0) {
throw new ResourceConfigurationException(InvalidXMLException.ELEMENT_NOT_FOUND,
- new Object[] { "<casProcessor>", "<casProcessors>" }, new Exception(
+ new Object[] { "<casProcessor>", "<casProcessors>" },
+ new Exception(
CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_bad_cpe_descriptor__WARNING", new Object[] { Thread
- .currentThread().getName() })));
+ "UIMA_CPM_EXP_bad_cpe_descriptor__WARNING",
+ new Object[] { Thread.currentThread().getName() })));
}
Hashtable namesMap = new Hashtable();
@@ -505,19 +518,21 @@ public class CPEFactory {
CpeCasProcessor processorType = casProcessorList[i];
if (processorType == null) {
throw new ResourceConfigurationException(InvalidXMLException.ELEMENT_NOT_FOUND,
- new Object[] { "<casProcessor>", "<casProcessors>" }, new Exception(
+ new Object[] { "<casProcessor>", "<casProcessors>" },
+ new Exception(
CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_bad_cpe_descriptor__WARNING", new Object[] { Thread
- .currentThread().getName() })));
+ "UIMA_CPM_EXP_bad_cpe_descriptor__WARNING",
+ new Object[] { Thread.currentThread().getName() })));
}
// Check for duplicate Cas Processor names. Names must be unique
if (namesMap.containsKey(processorType.getName())) {
throw new ResourceConfigurationException(InvalidXMLException.INVALID_CPE_DESCRIPTOR,
- new Object[] { "casProcessor", "name" }, new CPMException(CpmLocalizedMessage
- .getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_duplicate_name__WARNING", new Object[] {
- Thread.currentThread().getName(), processorType.getName() })));
+ new Object[] { "casProcessor", "name" },
+ new CPMException(CpmLocalizedMessage.getLocalizedMessage(
+ CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_EXP_duplicate_name__WARNING",
+ new Object[] { Thread.currentThread().getName(),
+ processorType.getName() })));
} else {
namesMap.put(processorType.getName(), processorType.getName());
}
@@ -525,7 +540,8 @@ public class CPEFactory {
String deploymentType = processorType.getDeployment();
if (deploymentType == null) {
throw new ResourceConfigurationException(InvalidXMLException.REQUIRED_ATTRIBUTE_MISSING,
- new Object[] { "deployment", "<casProcessor>" }, new Exception(
+ new Object[] { "deployment", "<casProcessor>" },
+ new Exception(
CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_EXP_missing_attribute_from_xml_element__WARNING",
new Object[] { Thread.currentThread().getName(),
@@ -562,11 +578,12 @@ public class CPEFactory {
deployModel = Constants.DEPLOYMENT_REMOTE;
} else {
throw new ResourceConfigurationException(InvalidXMLException.REQUIRED_ATTRIBUTE_MISSING,
- new Object[] { "deployment", "<casProcessor>" }, new Exception(
+ new Object[] { "deployment", "<casProcessor>" },
+ new Exception(
CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_Exception_invalid_deployment__WARNING", new Object[] {
- Thread.currentThread().getName(), processorType.getName(),
- deploymentType })));
+ "UIMA_CPM_Exception_invalid_deployment__WARNING",
+ new Object[] { Thread.currentThread().getName(),
+ processorType.getName(), deploymentType })));
}
// Add the casProcessor instantiated above to the map. The map is used to check if
@@ -590,8 +607,8 @@ public class CPEFactory {
// the
// CPE descriptor
if (firstTime && Constants.DEPLOYMENT_INTEGRATED.equalsIgnoreCase(deployModel)) {
- throw new ResourceConfigurationException(new CPMException(CpmLocalizedMessage
- .getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ throw new ResourceConfigurationException(new CPMException(
+ CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_EXP_duplicate_name__WARNING", new Object[] {
Thread.currentThread().getName(), processorType.getName() })));
}
@@ -615,14 +632,15 @@ public class CPEFactory {
/**
* Check if a class has appropriate type.
*
- * @param aResourceClass -
- * class to check
- * @param resourceSpecifier -
- * specifier containing expected type
- * @param aDescriptor -
- * descriptor name
+ * @param aResourceClass
+ * - class to check
+ * @param resourceSpecifier
+ * - specifier containing expected type
+ * @param aDescriptor
+ * - descriptor name
* @return true - if class matches type
- * @throws ResourceConfigurationException -
+ * @throws ResourceConfigurationException
+ * -
*/
public boolean isDefinitionInstanceOf(Class aResourceClass, ResourceSpecifier resourceSpecifier,
String aDescriptor) throws ResourceConfigurationException {
@@ -664,15 +682,16 @@ public class CPEFactory {
/**
* Instantiates CasData Consumer from a given class.
*
- * @param aResourceClass -
- * CasDataConsumer class
- * @param aSpecifier -
- * specifier
- * @param aAdditionalParams -
- * parameters used to initialize CasDataConsumer
+ * @param aResourceClass
+ * - CasDataConsumer class
+ * @param aSpecifier
+ * - specifier
+ * @param aAdditionalParams
+ * - parameters used to initialize CasDataConsumer
* @return - instance of CasProcessor
*
- * @throws ResourceInitializationException -
+ * @throws ResourceInitializationException
+ * -
*/
public CasProcessor produceCasDataConsumer(Class aResourceClass, ResourceSpecifier aSpecifier,
Map aAdditionalParams) throws ResourceInitializationException {
@@ -707,12 +726,12 @@ public class CPEFactory {
new Object[] { className, aSpecifier.getSourceUrlString() }, e);
} catch (IllegalAccessException e) {
throw new ResourceInitializationException(
- ResourceInitializationException.COULD_NOT_INSTANTIATE, new Object[] { className,
- aSpecifier.getSourceUrlString() }, e);
+ ResourceInitializationException.COULD_NOT_INSTANTIATE,
+ new Object[] { className, aSpecifier.getSourceUrlString() }, e);
} catch (InstantiationException e) {
throw new ResourceInitializationException(
- ResourceInitializationException.COULD_NOT_INSTANTIATE, new Object[] { className,
- aSpecifier.getSourceUrlString() }, e);
+ ResourceInitializationException.COULD_NOT_INSTANTIATE,
+ new Object[] { className, aSpecifier.getSourceUrlString() }, e);
}
return null;
@@ -721,13 +740,14 @@ public class CPEFactory {
/**
* Instantiates Cas Initializer from a given class. It return
*
- * @param aSpecifier -
- * configuration for Cas Initializer
- * @param aAdditionalParams -
- * parameters to initialize Cas Initializer
+ * @param aSpecifier
+ * - configuration for Cas Initializer
+ * @param aAdditionalParams
+ * - parameters to initialize Cas Initializer
*
* @return instance of CasDataInitializer or CasInitializer
- * @throws ResourceInitializationException -
+ * @throws ResourceInitializationException
+ * -
*/
private Object produceInitializer(ResourceSpecifier aSpecifier, Map aAdditionalParams)
throws ResourceInitializationException {
@@ -745,8 +765,8 @@ public class CPEFactory {
((CasDataInitializer) initializer).initialize(aSpecifier, aAdditionalParams);
return initializer;
} else {
- throw new InstantiationException("Unexpected CasInitializer-"
- + initializer.getClass().getName());
+ throw new InstantiationException(
+ "Unexpected CasInitializer-" + initializer.getClass().getName());
}
}
// if an exception occurs, log it but do not throw it... yet
@@ -755,31 +775,33 @@ public class CPEFactory {
new Object[] { className, aSpecifier.getSourceUrlString() }, e);
} catch (IllegalAccessException e) {
throw new ResourceInitializationException(
- ResourceInitializationException.COULD_NOT_INSTANTIATE, new Object[] { className,
- aSpecifier.getSourceUrlString() }, e);
+ ResourceInitializationException.COULD_NOT_INSTANTIATE,
+ new Object[] { className, aSpecifier.getSourceUrlString() }, e);
} catch (InstantiationException e) {
throw new ResourceInitializationException(
- ResourceInitializationException.COULD_NOT_INSTANTIATE, new Object[] { className,
- aSpecifier.getSourceUrlString() }, e);
+ ResourceInitializationException.COULD_NOT_INSTANTIATE,
+ new Object[] { className, aSpecifier.getSourceUrlString() }, e);
}
}
/**
* Returns a descriptor path associated with Cas Processor.
*
- * @param aCasProcessorCfg -
- * Cas Processor configuration
+ * @param aCasProcessorCfg
+ * - Cas Processor configuration
* @return - Descriptor path
- * @throws ResourceConfigurationException -
+ * @throws ResourceConfigurationException
+ * -
*/
public URL getDescriptorURL(CpeCasProcessor aCasProcessorCfg)
throws ResourceConfigurationException {
if (aCasProcessorCfg.getCpeComponentDescriptor() == null) {
- throw new ResourceConfigurationException(InvalidXMLException.ELEMENT_NOT_FOUND, new Object[] {
- "descriptor", "casProcessor" }, new Exception(CpmLocalizedMessage.getLocalizedMessage(
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_EXP_missing_xml_element__WARNING",
- new Object[] { Thread.currentThread().getName(), aCasProcessorCfg.getName(),
- "descriptor" })));
+ throw new ResourceConfigurationException(InvalidXMLException.ELEMENT_NOT_FOUND,
+ new Object[] { "descriptor", "casProcessor" },
+ new Exception(CpmLocalizedMessage.getLocalizedMessage(
+ CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_EXP_missing_xml_element__WARNING",
+ new Object[] { Thread.currentThread().getName(), aCasProcessorCfg.getName(),
+ "descriptor" })));
}
return aCasProcessorCfg.getCpeComponentDescriptor().findAbsoluteUrl(getResourceManager());
}
@@ -787,10 +809,12 @@ public class CPEFactory {
/**
* Instantiates a ResourceSpecifier from a given URL.
*
- * @param aDescriptorUrl - URL of descriptor
+ * @param aDescriptorUrl
+ * - URL of descriptor
* @return - ResourceSpecifier
*
- * @throws Exception -
+ * @throws Exception
+ * -
*/
public ResourceSpecifier getSpecifier(URL aDescriptorUrl) throws Exception {
XMLInputSource in = new XMLInputSource(aDescriptorUrl);
@@ -801,18 +825,21 @@ public class CPEFactory {
/**
* Instantiates a local (managed) Cas Processor.
*
- * @param aCasProcessorCfg -
- * Cas Processor configuration
+ * @param aCasProcessorCfg
+ * - Cas Processor configuration
* @return - Local CasProcessor
- * @throws ResourceConfigurationException -
+ * @throws ResourceConfigurationException
+ * -
*/
private CasProcessor produceLocalCasProcessor(CpeCasProcessor aCasProcessorCfg)
throws ResourceConfigurationException {
if (aCasProcessorCfg == null) {
- throw new ResourceConfigurationException(InvalidXMLException.ELEMENT_NOT_FOUND, new Object[] {
- "casProcessor", "casProcessors" }, new Exception(CpmLocalizedMessage.getLocalizedMessage(
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_EXP_bad_cpe_descriptor_no_cp__WARNING",
- new Object[] { Thread.currentThread().getName() })));
+ throw new ResourceConfigurationException(InvalidXMLException.ELEMENT_NOT_FOUND,
+ new Object[] { "casProcessor", "casProcessors" },
+ new Exception(
+ CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_EXP_bad_cpe_descriptor_no_cp__WARNING",
+ new Object[] { Thread.currentThread().getName() })));
}
CasProcessor casProcessor = new NetworkCasProcessorImpl(aCasProcessorCfg);
return casProcessor;
@@ -821,13 +848,13 @@ public class CPEFactory {
/**
* Find a parameter with a given name in the in-memory component descriptor.
*
- * @param aCps -
- * parameter settings from the component's descriptor
- * @param aParamName -
- * name of the parameter to look for
+ * @param aCps
+ * - parameter settings from the component's descriptor
+ * @param aParamName
+ * - name of the parameter to look for
* @return - parameter as {@link NameValuePair} instance. If not found, returns null.
- * @throws Exception -
- * any error
+ * @throws Exception
+ * - any error
*/
private NameValuePair findMatchingNameValuePair(ConfigurationParameterSettings aCps,
String aParamName) throws Exception {
@@ -848,20 +875,23 @@ public class CPEFactory {
/**
* Replace a primitive value of a given parameter with a value defined in the CPE descriptor.
*
- * @param aType -
- * type of the primitive value ( String, Integer, Boolean, or Float)
- * @param aMandatoryParam the a mandatory param
- * @param aCps -
- * parameter settings from the component's descriptor
- * @param aCPE_nvp -
- * parameter containing array of values to replace values in the component's descriptor
- * @param aComponentName the a component name
- * @throws Exception -
+ * @param aType
+ * - type of the primitive value ( String, Integer, Boolean, or Float)
+ * @param aMandatoryParam
+ * the a mandatory param
+ * @param aCps
+ * - parameter settings from the component's descriptor
+ * @param aCPE_nvp
+ * - parameter containing array of values to replace values in the component's descriptor
+ * @param aComponentName
+ * the a component name
+ * @throws Exception
+ * -
*/
private void replacePrimitive(String aType, boolean aMandatoryParam,
ConfigurationParameterSettings aCps,
- org.apache.uima.collection.metadata.NameValuePair aCPE_nvp,
- String aComponentName) throws Exception {
+ org.apache.uima.collection.metadata.NameValuePair aCPE_nvp, String aComponentName)
+ throws Exception {
boolean newParamSetting = false;
// Get a new value for the primitive param
@@ -896,21 +926,23 @@ public class CPEFactory {
* Replace array values found in the component's descriptor with values found in the CPE
* descriptor.
*
- * @param aType -
- * primitive type of the array (Sting, Integer, Float, or Boolean)
- * @param aMandatoryParam the a mandatory param
- * @param aCps -
- * parameter settings from the component's descriptor
- * @param aCPE_nvp -
- * parameter containing array of values to replace values in the component's descriptor
- * @param aComponentName the a component name
- * @throws Exception -
- * any error
+ * @param aType
+ * - primitive type of the array (Sting, Integer, Float, or Boolean)
+ * @param aMandatoryParam
+ * the a mandatory param
+ * @param aCps
+ * - parameter settings from the component's descriptor
+ * @param aCPE_nvp
+ * - parameter containing array of values to replace values in the component's descriptor
+ * @param aComponentName
+ * the a component name
+ * @throws Exception
+ * - any error
*/
private void replaceArray(String aType, boolean aMandatoryParam,
ConfigurationParameterSettings aCps,
- org.apache.uima.collection.metadata.NameValuePair aCPE_nvp,
- String aComponentName) throws Exception {
+ org.apache.uima.collection.metadata.NameValuePair aCPE_nvp, String aComponentName)
+ throws Exception {
boolean newParamSetting = false;
Object valueObject = aCPE_nvp.getValue();
String param_name = aCPE_nvp.getName();
@@ -942,19 +974,20 @@ public class CPEFactory {
* Override component's parameters. This overridde effects the in-memory settings. The actual
* component's descriptor will not be changed.
*
- * @param aResourceSpecifier -
- * in-memory descriptor of the component
- * @param aCPE_nvp -
- * parameter represented as name-value pair. If the name of the parameter is found in the
- * component's descriptor its value will be changed.
- * @param aComponentName the a component name
+ * @param aResourceSpecifier
+ * - in-memory descriptor of the component
+ * @param aCPE_nvp
+ * - parameter represented as name-value pair. If the name of the parameter is found in
+ * the component's descriptor its value will be changed.
+ * @param aComponentName
+ * the a component name
* @return true, if successful
- * @throws Exception -
- * error during processing
+ * @throws Exception
+ * - error during processing
*/
private boolean overrideParameterIfExists(ResourceSpecifier aResourceSpecifier,
- org.apache.uima.collection.metadata.NameValuePair aCPE_nvp,
- String aComponentName) throws Exception {
+ org.apache.uima.collection.metadata.NameValuePair aCPE_nvp, String aComponentName)
+ throws Exception {
// Retrieve component's parameter settings from the in-memory descriptor
ConfigurationParameterDeclarations cpd = ((ResourceCreationSpecifier) aResourceSpecifier)
.getMetaData().getConfigurationParameterDeclarations();
@@ -977,8 +1010,7 @@ public class CPEFactory {
replaceArray(cparam.getType(), mandatory, cps, aCPE_nvp, aComponentName);
} else {
// Override primitive parameter with value from the CPE descriptor
- replacePrimitive(cparam.getType(), mandatory, cps, aCPE_nvp,
- aComponentName);
+ replacePrimitive(cparam.getType(), mandatory, cps, aCPE_nvp, aComponentName);
}
return true; // Found a match and did the override
}
@@ -991,16 +1023,18 @@ public class CPEFactory {
* Replace component's parameters. Its parameter values will be changed to match those defined in
* the CPE descriptor.
*
- * @param aResourceSpecifier -
- * component's descriptor containing parameters to override
- * @param aCpe_cps the a cpe cps
- * @param aComponentName the a component name
- * @throws Exception -
- * failure during processing
+ * @param aResourceSpecifier
+ * - component's descriptor containing parameters to override
+ * @param aCpe_cps
+ * the a cpe cps
+ * @param aComponentName
+ * the a component name
+ * @throws Exception
+ * - failure during processing
*/
private void overrideParameterSettings(ResourceSpecifier aResourceSpecifier,
- CasProcessorConfigurationParameterSettings aCpe_cps,
- String aComponentName) throws Exception {
+ CasProcessorConfigurationParameterSettings aCpe_cps, String aComponentName)
+ throws Exception {
if (aCpe_cps != null && aCpe_cps.getParameterSettings() != null) {
// Extract new parameters from the CPE descriptor
@@ -1019,9 +1053,11 @@ public class CPEFactory {
/**
* Instantiates integrated Cas Processor.
*
- * @param aCasProcessorType the a cas processor type
+ * @param aCasProcessorType
+ * the a cas processor type
* @return - Integrated CasProcessor
- * @throws ResourceConfigurationException -
+ * @throws ResourceConfigurationException
+ * -
*/
private CasProcessor produceIntegratedCasProcessor(CpeCasProcessor aCasProcessorType)
throws ResourceConfigurationException {
@@ -1046,9 +1082,9 @@ public class CPEFactory {
}
// Replace parameters in component descriptor with values defined in the CPE descriptor
- overrideParameterSettings(resourceSpecifier, aCasProcessorType
- .getConfigurationParameterSettings(), "CasProcessor:"
- + aCasProcessorType.getName());
+ overrideParameterSettings(resourceSpecifier,
+ aCasProcessorType.getConfigurationParameterSettings(),
+ "CasProcessor:" + aCasProcessorType.getName());
// create child UimaContext and insert into mInitParams map
UimaContextAdmin childContext = uimaContext.createChild(aCasProcessorType.getName(),
@@ -1058,7 +1094,8 @@ public class CPEFactory {
// need this check to do specific CasDataConsumer processing
if (resourceSpecifier instanceof CasConsumerDescription
- && !isDefinitionInstanceOf(CasConsumer.class, resourceSpecifier, descriptorUrl.toString())) {
+ && !isDefinitionInstanceOf(CasConsumer.class, resourceSpecifier,
+ descriptorUrl.toString())) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
"process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
@@ -1079,8 +1116,8 @@ public class CPEFactory {
// Check if CasProcesser has been instantiated
if (casProcessor == null) {
- throw new ResourceConfigurationException(new Exception(CpmLocalizedMessage
- .getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ throw new ResourceConfigurationException(new Exception(
+ CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_EXP_instantiation_exception__WARNING", new Object[] {
Thread.currentThread().getName(), aCasProcessorType.getName() })));
}
@@ -1095,7 +1132,7 @@ public class CPEFactory {
// Override the name of the component with the name specified in the cpe descriptor
// Uniqueness of names is enforced on names in the cpe descriptor not those defined
// in the component descriptor
- if ( casProcessor != null && aCasProcessorType != null ) {
+ if (casProcessor != null && aCasProcessorType != null) {
casProcessor.getProcessingResourceMetaData().setName(aCasProcessorType.getName());
}
@@ -1106,9 +1143,11 @@ public class CPEFactory {
/**
* Instantiates remote Cas Processor.
*
- * @param aCasProcessorType the a cas processor type
+ * @param aCasProcessorType
+ * the a cas processor type
* @return - Remote CasProcessor
- * @throws ResourceConfigurationException -
+ * @throws ResourceConfigurationException
+ * -
*/
private CasProcessor produceRemoteCasProcessor(CpeCasProcessor aCasProcessorType)
throws ResourceConfigurationException {
@@ -1133,10 +1172,12 @@ public class CPEFactory {
* <li>Number of documents to process</li>
* <li>Checkpoint configuration</li>
* <li>id of the document begin processing</li>
- * </ul>.
+ * </ul>
+ * .
*
* @return Global CPE Configuration
- * @throws InstantiationException the instantiation exception
+ * @throws InstantiationException
+ * the instantiation exception
*/
public CpeConfiguration getCPEConfig() throws InstantiationException {
try {
@@ -1150,7 +1191,8 @@ public class CPEFactory {
* Returns number of processing threads (Processing Units).
*
* @return Number of processing threads
- * @throws ResourceConfigurationException -
+ * @throws ResourceConfigurationException
+ * -
*/
public int getProcessingUnitThreadCount() throws ResourceConfigurationException {
int threadCount;
@@ -1160,8 +1202,9 @@ public class CPEFactory {
} catch (Exception e) {
throw new ResourceConfigurationException(InvalidXMLException.REQUIRED_ATTRIBUTE_MISSING,
- new Object[] { "processingUnitThreadCount" }, new Exception(CpmLocalizedMessage
- .getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ new Object[] { "processingUnitThreadCount" },
+ new Exception(
+ CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_EXP_missing_attribute_from_xml_element__WARNING",
new Object[] { Thread.currentThread().getName(), "casProcessors",
"processingUnitThreadCount", "<casProcessors>", })));
@@ -1191,7 +1234,8 @@ public class CPEFactory {
/**
* Assigns Cpe configuration to use.
*
- * @param description the new cpe descriptor
+ * @param description
+ * the new cpe descriptor
*/
private void setCpeDescriptor(CpeDescription description) {
cpeDescriptor = description;
@@ -1201,10 +1245,11 @@ public class CPEFactory {
* Checks uniqueness of a given name. This name is compared against all Cas Processors already
* defined. Cas Processor names must be unique.
*
- * @param aName -
- * name to check
+ * @param aName
+ * - name to check
* @return - true if name is unique, false otherwise
- * @throws CpeDescriptorException the cpe descriptor exception
+ * @throws CpeDescriptorException
+ * the cpe descriptor exception
*/
private boolean isUniqueName(String aName) throws CpeDescriptorException {
int index = 0;
@@ -1227,17 +1272,20 @@ public class CPEFactory {
* vnsPort. If not found the remote CasProcessor can not be located since the VNS is not
* specified. In this case an exception is thrown.
*
- * @param aCasProcessorName the a cas processor name
- * @param aDepParams the a dep params
- * @throws ResourceConfigurationException -
+ * @param aCasProcessorName
+ * the a cas processor name
+ * @param aDepParams
+ * the a dep params
+ * @throws ResourceConfigurationException
+ * -
*/
private void verifyDeploymentParams(String aCasProcessorName,
CasProcessorDeploymentParams aDepParams) throws ResourceConfigurationException {
if (aDepParams == null) {
- throw new ResourceConfigurationException(new Exception(CpmLocalizedMessage
- .getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_missing_xml_element__WARNING", new Object[] {
- Thread.currentThread().getName(), aCasProcessorName,
+ throw new ResourceConfigurationException(
+ new Exception(CpmLocalizedMessage.getLocalizedMessage(
+ CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_EXP_missing_xml_element__WARNING",
+ new Object[] { Thread.currentThread().getName(), aCasProcessorName,
"<deploymentParameters>" })));
}
if (aDepParams == null || aDepParams.getAll() == null) {
@@ -1249,11 +1297,11 @@ public class CPEFactory {
if (param == null || param.getParameterValue() == null
|| param.getParameterValue().trim().length() == 0) {
throw new ResourceConfigurationException(
- ResourceInitializationException.CONFIG_SETTING_ABSENT,
- new Object[] { "parameter" }, new Exception(CpmLocalizedMessage
- .getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_deploy_params_not_defined__WARNING", new Object[] {
- Thread.currentThread().getName(), aCasProcessorName,
+ ResourceInitializationException.CONFIG_SETTING_ABSENT, new Object[] { "parameter" },
+ new Exception(
+ CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_EXP_deploy_params_not_defined__WARNING",
+ new Object[] { Thread.currentThread().getName(), aCasProcessorName,
Constants.VNS_HOST })));
}
@@ -1261,11 +1309,11 @@ public class CPEFactory {
if (param == null || param.getParameterValue() == null
|| param.getParameterValue().trim().length() == 0) {
throw new ResourceConfigurationException(
- ResourceInitializationException.CONFIG_SETTING_ABSENT,
- new Object[] { "parameter" }, new Exception(CpmLocalizedMessage
- .getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_deploy_params_not_defined__WARNING", new Object[] {
- Thread.currentThread().getName(), aCasProcessorName,
+ ResourceInitializationException.CONFIG_SETTING_ABSENT, new Object[] { "parameter" },
+ new Exception(
+ CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_EXP_deploy_params_not_defined__WARNING",
+ new Object[] { Thread.currentThread().getName(), aCasProcessorName,
Constants.VNS_PORT })));
}
@@ -1315,9 +1363,10 @@ public class CPEFactory {
/**
* Appends given Cas Processor to the list of CasProcessors.
*
- * @param aCasProcessor -
- * CasProcessor to add
- * @throws ResourceConfigurationException the resource configuration exception
+ * @param aCasProcessor
+ * - CasProcessor to add
+ * @throws ResourceConfigurationException
+ * the resource configuration exception
*/
public void addCasProcessor(CasProcessor aCasProcessor) throws ResourceConfigurationException {
if (!initialized) {
@@ -1328,42 +1377,40 @@ public class CPEFactory {
/**
* Adds new Cas Processor with given name.
*
- * @param aCasProcessorName -
- * name of the CasProcessor to add
+ * @param aCasProcessorName
+ * - name of the CasProcessor to add
* @return -
- * @throws ResourceConfigurationException the resource configuration exception
+ * @throws ResourceConfigurationException
+ * the resource configuration exception
*/
private CpeCasProcessor addCasProcessor(String aCasProcessorName)
throws ResourceConfigurationException {
CpeCasProcessor newProcessor = null;
try {
if (!isUniqueName(aCasProcessorName)) {
- throw new ResourceConfigurationException(new Exception(CpmLocalizedMessage
- .getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_duplicate_name__WARNING", new Object[] {
- Thread.currentThread().getName(), aCasProcessorName })));
+ throw new ResourceConfigurationException(
+ new Exception(CpmLocalizedMessage.getLocalizedMessage(
+ CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_EXP_duplicate_name__WARNING",
+ new Object[] { Thread.currentThread().getName(), aCasProcessorName })));
}
int index = getCpeDescriptor().getCpeCasProcessors().getAllCpeCasProcessors().length; // getcasProcessorCount();
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "initialize",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_add_cp_with_index__FINEST",
- new Object[] { Thread.currentThread().getName(), aCasProcessorName,
- String.valueOf(index) });
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_add_cp_with_index__FINEST", new Object[] {
+ Thread.currentThread().getName(), aCasProcessorName, String.valueOf(index) });
}
- CpeCasProcessor processor = getCpeDescriptor().getCpeCasProcessors().getCpeCasProcessor(
- index - 1);
+ CpeCasProcessor processor = getCpeDescriptor().getCpeCasProcessors()
+ .getCpeCasProcessor(index - 1);
if (processor.getCheckpoint() == null) {
throw new ResourceConfigurationException(InvalidXMLException.ELEMENT_NOT_FOUND,
- new Object[] { "checkpoint", "casProcessor" }, new Exception(CpmLocalizedMessage
- .getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_missing_xml_element__WARNING", new Object[] {
- Thread.currentThread().getName(), aCasProcessorName,
+ new Object[] { "checkpoint", "casProcessor" },
+ new Exception(
+ CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_EXP_missing_xml_element__WARNING",
+ new Object[] { Thread.currentThread().getName(), aCasProcessorName,
"<checkpoint>" })));
}
@@ -1393,26 +1440,21 @@ public class CPEFactory {
// newProcessor);
}
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).log(
- Level.FINEST,
+ UIMAFramework.getLogger(this.getClass()).log(Level.FINEST,
"getCpeDescriptor().getCasProcessors().getCasProcessor.getAttributeValue(name) "
+ + " " + getCpeDescriptor().getCpeCasProcessors()
+ .getCpeCasProcessor(processorCount).getAttributeValue("name"));
+ UIMAFramework.getLogger(this.getClass()).log(Level.FINEST,
+ "getCpeDescriptor().getCasProcessors().getCasProcessor("
+ + "processorCount).getErrorHandling().getMaxConsecutiveRestarts().getAction() "
+ " "
- + getCpeDescriptor().getCpeCasProcessors().getCpeCasProcessor(
- processorCount).getAttributeValue("name"));
- UIMAFramework
- .getLogger(this.getClass())
- .log(
- Level.FINEST,
- "getCpeDescriptor().getCasProcessors().getCasProcessor("
- + "processorCount).getErrorHandling().getMaxConsecutiveRestarts().getAction() "
- + " "
- + getCpeDescriptor().getCpeCasProcessors().getCpeCasProcessor(
- processorCount).getErrorHandling()
- .getMaxConsecutiveRestarts().getAction());
+ + getCpeDescriptor().getCpeCasProcessors()
+ .getCpeCasProcessor(processorCount).getErrorHandling()
+ .getMaxConsecutiveRestarts().getAction());
}
if (!casProcessorConfigMap.containsKey(aCasProcessorName)) {
- casProcessorConfigMap.put(aCasProcessorName, getCpeDescriptor().getCpeCasProcessors()
- .getCpeCasProcessor(processorCount));
+ casProcessorConfigMap.put(aCasProcessorName,
+ getCpeDescriptor().getCpeCasProcessors().getCpeCasProcessor(processorCount));
}
} catch (Exception e) {
throw new ResourceConfigurationException(e);
@@ -1424,9 +1466,11 @@ public class CPEFactory {
/**
* Gets the descriptor.
*
- * @param aList the a list
+ * @param aList
+ * the a list
* @return the cpe descriptor constructed from the list
- * @throws ResourceConfigurationException -
+ * @throws ResourceConfigurationException
+ * -
*/
public String getDescriptor(List aList) throws ResourceConfigurationException {
if (aList.size() == 0) {
@@ -1513,22 +1557,19 @@ public class CPEFactory {
/**
* Copy cas processor.
*
- * @param aProcDesc the a proc desc
- * @param aName the a name
+ * @param aProcDesc
+ * the a proc desc
+ * @param aName
+ * the a name
*/
private void copyCasProcessor(CpeCasProcessor aProcDesc, String aName) {
try {
aProcDesc.setName(aName);
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass())
- .logrb(
- Level.FINEST,
- this.getClass().getName(),
- "initialize",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_show_cp_deployment__FINEST",
- new Object[] { Thread.currentThread().getName(), aName,
- aProcDesc.getDeployment() });
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_show_cp_deployment__FINEST", new Object[] {
+ Thread.currentThread().getName(), aName, aProcDesc.getDeployment() });
}
} catch (Exception e) {
e.printStackTrace();
@@ -1538,8 +1579,8 @@ public class CPEFactory {
/**
* Adds the collection reader.
*
- * @param collectionReader -
- * collection reader to use by the CPM
+ * @param collectionReader
+ * - collection reader to use by the CPM
*/
public void addCollectionReader(BaseCollectionReader collectionReader) {
// nothing done as of now; If there is any field that will be accessed
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/CasObjectNetworkCasProcessorImpl.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/CasObjectNetworkCasProcessorImpl.java
index 1132cc9..4eadd2f 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/CasObjectNetworkCasProcessorImpl.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/CasObjectNetworkCasProcessorImpl.java
@@ -46,7 +46,6 @@ import org.apache.uima.util.InvalidXMLException;
import org.apache.uima.util.Level;
import org.apache.uima.util.ProcessTrace;
-
/**
* Implementation of the {@link CasObjectProcessor} interface used for both Local and Remote
* CasObjectProcessors. This objects plugs in a transport object defined in the CPE Descriptor and
@@ -54,7 +53,7 @@ import org.apache.uima.util.ProcessTrace;
*
*/
public class CasObjectNetworkCasProcessorImpl implements CasObjectProcessor {
-
+
/** The transport. */
private SocketTransport transport = null;
@@ -74,9 +73,10 @@ public class CasObjectNetworkCasProcessorImpl implements CasObjectProcessor {
* Using information from the CPE descriptor creates an instance of Transport class. The transport
* class will delegate analysis of CAS to a remote object.
*
- * @param aCasProcessor -
- * Cas Process configuration from the CPE descriptor
- * @throws ResourceConfigurationException the resource configuration exception
+ * @param aCasProcessor
+ * - Cas Process configuration from the CPE descriptor
+ * @throws ResourceConfigurationException
+ * the resource configuration exception
*/
public CasObjectNetworkCasProcessorImpl(CpeCasProcessor aCasProcessor)
throws ResourceConfigurationException {
@@ -106,7 +106,8 @@ public class CasObjectNetworkCasProcessorImpl implements CasObjectProcessor {
}
} else {
throw new ResourceConfigurationException(InvalidXMLException.INVALID_CPE_DESCRIPTOR,
- new Object[] { "transport" }, new Exception(CpmLocalizedMessage.getLocalizedMessage(
+ new Object[] { "transport" },
+ new Exception(CpmLocalizedMessage.getLocalizedMessage(
CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_EXP_bad_transport__WARNING",
new Object[] { Thread.currentThread().getName() })));
@@ -122,10 +123,11 @@ public class CasObjectNetworkCasProcessorImpl implements CasObjectProcessor {
/**
* Create Transport object from a given class and associate it with this CasProcessor.
*
- * @param aTransportClass -
- * name of the Transport class
+ * @param aTransportClass
+ * - name of the Transport class
* @return - instance of SocketTransport
- * @throws Exception passthru
+ * @throws Exception
+ * passthru
*/
private SocketTransport pluginTransport(String aTransportClass) throws Exception {
Object instance = Class.forName(aTransportClass).newInstance();
@@ -154,9 +156,10 @@ public class CasObjectNetworkCasProcessorImpl implements CasObjectProcessor {
/**
* Connects to a service endpoint defined in the given URL.
*
- * @param aURL -
- * contains service endpoint info (hots and port)
- * @throws ResourceInitializationException wraps SocketException
+ * @param aURL
+ * - contains service endpoint info (hots and port)
+ * @throws ResourceInitializationException
+ * wraps SocketException
*/
public void connect(URL aURL) throws ResourceInitializationException {
try {
@@ -170,8 +173,10 @@ public class CasObjectNetworkCasProcessorImpl implements CasObjectProcessor {
/**
* Uses configured transport to delegate given CAS to the remote service.
*
- * @param aCAS CAS to be analyzed
- * @throws ResourceProcessException wraps Exception, SocketException
+ * @param aCAS
+ * CAS to be analyzed
+ * @throws ResourceProcessException
+ * wraps Exception, SocketException
*/
@Override
public void processCas(CAS aCAS) throws ResourceProcessException {
@@ -188,8 +193,10 @@ public class CasObjectNetworkCasProcessorImpl implements CasObjectProcessor {
/**
* Uses configured transport to delegate given CASes to the remote service.
*
- * @param aCASes - an array of CASes to be analyzed
- * @throws ResourceProcessException wraps SocketException, SocketTimeoutException
+ * @param aCASes
+ * - an array of CASes to be analyzed
+ * @throws ResourceProcessException
+ * wraps SocketException, SocketTimeoutException
*/
@Override
public void processCas(CAS[] aCASes) throws ResourceProcessException {
@@ -208,7 +215,8 @@ public class CasObjectNetworkCasProcessorImpl implements CasObjectProcessor {
/*
* (non-Javadoc)
*
- * @see org.apache.uima.collection.base_cpm.CasObjectProcessor#typeSystemInit(org.apache.uima.cas.TypeSystem)
+ * @see org.apache.uima.collection.base_cpm.CasObjectProcessor#typeSystemInit(org.apache.uima.cas.
+ * TypeSystem)
*/
@Override
public void typeSystemInit(TypeSystem aTypeSystem) throws ResourceInitializationException {
@@ -264,11 +272,13 @@ public class CasObjectNetworkCasProcessorImpl implements CasObjectProcessor {
/*
* (non-Javadoc)
*
- * @see org.apache.uima.collection.base_cpm.CasProcessor#batchProcessComplete(org.apache.uima.util.ProcessTrace)
+ * @see
+ * org.apache.uima.collection.base_cpm.CasProcessor#batchProcessComplete(org.apache.uima.util.
+ * ProcessTrace)
*/
@Override
- public void batchProcessComplete(ProcessTrace aTrace) throws ResourceProcessException,
- IOException {
+ public void batchProcessComplete(ProcessTrace aTrace)
+ throws ResourceProcessException, IOException {
// noop
}
@@ -276,13 +286,16 @@ public class CasObjectNetworkCasProcessorImpl implements CasObjectProcessor {
/**
* Closes the connection to the remote service.
*
- * @param aTrace the a trace
- * @throws ResourceProcessException the resource process exception
- * @throws IOException Signals that an I/O exception has occurred.
+ * @param aTrace
+ * the a trace
+ * @throws ResourceProcessException
+ * the resource process exception
+ * @throws IOException
+ * Signals that an I/O exception has occurred.
*/
@Override
- public void collectionProcessComplete(ProcessTrace aTrace) throws ResourceProcessException,
- IOException {
+ public void collectionProcessComplete(ProcessTrace aTrace)
+ throws ResourceProcessException, IOException {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
"process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_stopping_cp__FINEST",
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/CasProcessorConfigurationJAXBImpl.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/CasProcessorConfigurationJAXBImpl.java
index 9ed129c..f082784 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/CasProcessorConfigurationJAXBImpl.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/CasProcessorConfigurationJAXBImpl.java
@@ -98,37 +98,34 @@ public class CasProcessorConfigurationJAXBImpl implements CasProcessorConfigurat
private boolean parallelizable = true; // default
private boolean readOnly = false; // make this explicit
-
+
private ResourceManager resourceManager;
-
+
/**
* Initializes instance and copies configuation from cpe descriptor.
*
- * @param aCasProcessorConfig -
- * configuration object containing Cas Processor configuration
- * @param aResourceManager -
- * needed to resolve import by name
- * @throws ResourceConfigurationException if descriptor error
+ * @param aCasProcessorConfig
+ * - configuration object containing Cas Processor configuration
+ * @param aResourceManager
+ * - needed to resolve import by name
+ * @throws ResourceConfigurationException
+ * if descriptor error
*/
- public CasProcessorConfigurationJAXBImpl(CpeCasProcessor aCasProcessorConfig, ResourceManager aResourceManager)
- throws ResourceConfigurationException {
+ public CasProcessorConfigurationJAXBImpl(CpeCasProcessor aCasProcessorConfig,
+ ResourceManager aResourceManager) throws ResourceConfigurationException {
this.resourceManager = aResourceManager;
-
+
if (aCasProcessorConfig == null) {
- throw new ResourceConfigurationException(InvalidXMLException.ELEMENT_NOT_FOUND, new Object[] {
- "<casProcessor>", "<casProcessors>" }, new Exception(CpmLocalizedMessage
- .getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_bad_cpe_descriptor__WARNING", new Object[] { Thread
- .currentThread().getName() })));
+ throw new ResourceConfigurationException(InvalidXMLException.ELEMENT_NOT_FOUND,
+ new Object[] { "<casProcessor>", "<casProcessors>" },
+ new Exception(CpmLocalizedMessage.getLocalizedMessage(
+ CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_EXP_bad_cpe_descriptor__WARNING",
+ new Object[] { Thread.currentThread().getName() })));
}
name = aCasProcessorConfig.getName();// getAttributeValue("name");
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "initialize",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_max_restart_action__FINEST",
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_max_restart_action__FINEST",
new Object[] { Thread.currentThread().getName(), name,
aCasProcessorConfig.getErrorHandling().getMaxConsecutiveRestarts().getAction() });
}
@@ -149,7 +146,7 @@ public class CasProcessorConfigurationJAXBImpl implements CasProcessorConfigurat
"UIMA_CPM_config_non_java_service__FINEST",
new Object[] { Thread.currentThread().getName(), name });
}
- nonJavaApp = new NonJavaApplication(this, aCasProcessorConfig);
+ nonJavaApp = new NonJavaApplication(this, aCasProcessorConfig);
} else {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
@@ -190,8 +187,8 @@ public class CasProcessorConfigurationJAXBImpl implements CasProcessorConfigurat
/**
* Copies runtime information
*
- * @param aJaxbCasProcessorConfig -
- * configuration object containing Cas Processor configuration
+ * @param aJaxbCasProcessorConfig
+ * - configuration object containing Cas Processor configuration
*/
private void addRunInSeparateProcess(CpeCasProcessor aCasProcessorConfig) {
runInSeparateProcess = aCasProcessorConfig.getRunInSeparateProcess() != null;
@@ -200,8 +197,8 @@ public class CasProcessorConfigurationJAXBImpl implements CasProcessorConfigurat
/**
* Determines if this Cas Processor should run in java jvm.
*
- * @param aJaxbCasProcessorConfig -
- * configuration object containing Cas Processor configuration
+ * @param aJaxbCasProcessorConfig
+ * - configuration object containing Cas Processor configuration
*/
private void addIsJavaProcess(CpeCasProcessor aCasProcessorConfig) {
isJavaProcess = false;
@@ -216,28 +213,29 @@ public class CasProcessorConfigurationJAXBImpl implements CasProcessorConfigurat
/**
* Copies Error handling settings
*
- * @param aJaxbCasProcessorConfig -
- * configuration object containing Cas Processor configuration
+ * @param aJaxbCasProcessorConfig
+ * - configuration object containing Cas Processor configuration
*/
private void addErrorHandling(CpeCasProcessor aCasProcessorConfig)
throws ResourceConfigurationException {
CasProcessorErrorHandling casProcessorErrorHandling = aCasProcessorConfig.getErrorHandling();
if (casProcessorErrorHandling == null) {
- throw new ResourceConfigurationException(InvalidXMLException.ELEMENT_NOT_FOUND, new Object[] {
- "errorHandling", "casProcessor" }, new Exception(CpmLocalizedMessage.getLocalizedMessage(
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_EXP_missing_xml_element__WARNING",
- new Object[] { Thread.currentThread().getName(), name, "<errorHandling>" })));
+ throw new ResourceConfigurationException(InvalidXMLException.ELEMENT_NOT_FOUND,
+ new Object[] { "errorHandling", "casProcessor" },
+ new Exception(CpmLocalizedMessage.getLocalizedMessage(
+ CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_EXP_missing_xml_element__WARNING",
+ new Object[] { Thread.currentThread().getName(), name, "<errorHandling>" })));
}
CasProcessorMaxRestarts maxRestarts = casProcessorErrorHandling.getMaxConsecutiveRestarts();
if (maxRestarts == null) {
throw new ResourceConfigurationException(
- ResourceConfigurationException.MANDATORY_VALUE_MISSING, new Object[] {
- "maxConsecutiveRestarts", "CPE" }, new Exception(CpmLocalizedMessage
- .getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_missing_xml_element__WARNING", new Object[] {
- Thread.currentThread().getName(), name,
- "<maxConsecutiveRestarts>" })));
+ ResourceConfigurationException.MANDATORY_VALUE_MISSING,
+ new Object[] { "maxConsecutiveRestarts", "CPE" },
+ new Exception(CpmLocalizedMessage.getLocalizedMessage(
+ CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_EXP_missing_xml_element__WARNING",
+ new Object[] { Thread.currentThread().getName(), name,
+ "<maxConsecutiveRestarts>" })));
}
maxRetryThreshold = maxRestarts.getRestartCount();
waitTimeBetweenRestarts = maxRestarts.getWaitTimeBetweenRetries();
@@ -246,8 +244,9 @@ public class CasProcessorConfigurationJAXBImpl implements CasProcessorConfigurat
if (!validActionOnError(maxRestarts.getAction())) {
throw new ResourceConfigurationException(
- ResourceConfigurationException.MANDATORY_VALUE_MISSING, new Object[] { "action",
- "CPE" }, new Exception(CpmLocalizedMessage.getLocalizedMessage(
+ ResourceConfigurationException.MANDATORY_VALUE_MISSING,
+ new Object[] { "action", "CPE" },
+ new Exception(CpmLocalizedMessage.getLocalizedMessage(
CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_EXP_bad_action_string__WARNING",
new Object[] { Thread.currentThread().getName(), name,
"<maxConsecutiveRestarts>", maxRestarts.getAction() })));
@@ -259,12 +258,12 @@ public class CasProcessorConfigurationJAXBImpl implements CasProcessorConfigurat
.getErrorRateThreshold();
if (errorRateThresholdType == null) {
throw new ResourceConfigurationException(
- ResourceConfigurationException.MANDATORY_VALUE_MISSING, new Object[] {
- "errorRateThreshold", "CPE" },
+ ResourceConfigurationException.MANDATORY_VALUE_MISSING,
+ new Object[] { "errorRateThreshold", "CPE" },
new Exception(CpmLocalizedMessage.getLocalizedMessage(
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_missing_xml_element__WARNING", new Object[] {
- Thread.currentThread().getName(), name, "<errorRateThreshold>" })));
+ CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_EXP_missing_xml_element__WARNING",
+ new Object[] { Thread.currentThread().getName(), name,
+ "<errorRateThreshold>" })));
}
errorRate = errorRateThresholdType.getMaxErrorCount();
@@ -272,11 +271,12 @@ public class CasProcessorConfigurationJAXBImpl implements CasProcessorConfigurat
if (!validActionOnError(errorRateThresholdType.getAction())) {
throw new ResourceConfigurationException(
- ResourceConfigurationException.MANDATORY_VALUE_MISSING, new Object[] { "action",
- "CPE" }, new Exception(CpmLocalizedMessage.getLocalizedMessage(
+ ResourceConfigurationException.MANDATORY_VALUE_MISSING,
+ new Object[] { "action", "CPE" },
+ new Exception(CpmLocalizedMessage.getLocalizedMessage(
CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_EXP_bad_action_string__WARNING",
- new Object[] { Thread.currentThread().getName(), name,
- "<errorRateThreshold>", maxRestarts.getAction() })));
+ new Object[] { Thread.currentThread().getName(), name, "<errorRateThreshold>",
+ maxRestarts.getAction() })));
}
actionOnMaxError = errorRateThresholdType.getAction();
@@ -290,17 +290,18 @@ public class CasProcessorConfigurationJAXBImpl implements CasProcessorConfigurat
* Copies deployment parameters associated with this Cas Processor These parameters are used to
* construct appropriate command line for launching the Cas Processor in external process
*
- * @param aJaxbCasProcessorConfig -
- * configuration object containing Cas Processor configuration
+ * @param aJaxbCasProcessorConfig
+ * - configuration object containing Cas Processor configuration
*/
private void addDeploymentParameters(CpeCasProcessor aCasProcessorConfig)
throws ResourceConfigurationException {
if (aCasProcessorConfig == null) {
- throw new ResourceConfigurationException(InvalidXMLException.ELEMENT_NOT_FOUND, new Object[] {
- "<casProcessor>", "<casProcessors>" }, new Exception(CpmLocalizedMessage
- .getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_bad_cpe_descriptor_no_cp__WARNING", new Object[] { Thread
- .currentThread().getName() })));
+ throw new ResourceConfigurationException(InvalidXMLException.ELEMENT_NOT_FOUND,
+ new Object[] { "<casProcessor>", "<casProcessors>" },
+ new Exception(
+ CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_EXP_bad_cpe_descriptor_no_cp__WARNING",
+ new Object[] { Thread.currentThread().getName() })));
}
CasProcessorDeploymentParams deployParams = aCasProcessorConfig.getDeploymentParams();
@@ -309,11 +310,8 @@ public class CasProcessorConfigurationJAXBImpl implements CasProcessorConfigurat
for (int i = 0; parameters != null && i < parameters.length; i++) {
try {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "initialize",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_show_cp_deploy_params__FINEST",
new Object[] { Thread.currentThread().getName(), name,
parameters[i].getParameterName(), parameters[i].getParameterValue() });
@@ -349,27 +347,31 @@ public class CasProcessorConfigurationJAXBImpl implements CasProcessorConfigurat
/**
* Copies deployment type associated with this Cas Processor
*
- * @param aJaxbCasProcessorConfig - -
- * configuration object containing Cas Processor configuration
- * @throws ResourceConfigurationException -
+ * @param aJaxbCasProcessorConfig
+ * - - configuration object containing Cas Processor configuration
+ * @throws ResourceConfigurationException
+ * -
*/
private void addDeploymentType(CpeCasProcessor aCasProcessorConfig)
throws ResourceConfigurationException {
if (aCasProcessorConfig == null) {
- throw new ResourceConfigurationException(InvalidXMLException.ELEMENT_NOT_FOUND, new Object[] {
- "<casProcessor>", "<casProcessors>" }, new Exception(CpmLocalizedMessage
- .getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_bad_cpe_descriptor_no_cp__WARNING", new Object[] { Thread
- .currentThread().getName() })));
+ throw new ResourceConfigurationException(InvalidXMLException.ELEMENT_NOT_FOUND,
+ new Object[] { "<casProcessor>", "<casProcessors>" },
+ new Exception(
+ CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_EXP_bad_cpe_descriptor_no_cp__WARNING",
+ new Object[] { Thread.currentThread().getName() })));
}
String deployType = aCasProcessorConfig.getDeployment();
if (deployType == null || deployType.trim().length() == 0) {
throw new ResourceConfigurationException(InvalidXMLException.REQUIRED_ATTRIBUTE_MISSING,
- new Object[] { "deployment", "casProcessor" }, new Exception(CpmLocalizedMessage
- .getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ new Object[] { "deployment", "casProcessor" },
+ new Exception(
+ CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_EXP_missing_attribute_from_xml_element__WARNING",
new Object[] { Thread.currentThread().getName(),
- aCasProcessorConfig.getName(), "deployment", "<casProcessor>" })));
+ aCasProcessorConfig.getName(), "deployment",
+ "<casProcessor>" })));
}
deploymentType = deployType;
}
@@ -377,17 +379,18 @@ public class CasProcessorConfigurationJAXBImpl implements CasProcessorConfigurat
/**
* Copies filter expression used during processing.
*
- * @param aJaxbCasProcessorConfig -
- * configuration object containing Cas Processor configuration
+ * @param aJaxbCasProcessorConfig
+ * - configuration object containing Cas Processor configuration
*/
private void addFiltering(CpeCasProcessor aCasProcessorConfig)
throws ResourceConfigurationException {
if (aCasProcessorConfig == null) {
- throw new ResourceConfigurationException(InvalidXMLException.ELEMENT_NOT_FOUND, new Object[] {
- "<casProcessor>", "<casProcessors>" }, new Exception(CpmLocalizedMessage
- .getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_bad_cpe_descriptor_no_cp__WARNING", new Object[] { Thread
- .currentThread().getName() })));
+ throw new ResourceConfigurationException(InvalidXMLException.ELEMENT_NOT_FOUND,
+ new Object[] { "<casProcessor>", "<casProcessors>" },
+ new Exception(
+ CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_EXP_bad_cpe_descriptor_no_cp__WARNING",
+ new Object[] { Thread.currentThread().getName() })));
}
filterString = aCasProcessorConfig.getCasProcessorFilter();
}
@@ -395,26 +398,27 @@ public class CasProcessorConfigurationJAXBImpl implements CasProcessorConfigurat
/**
* Copies batch size associated with this Cas Processor
*
- * @param aJaxbCasProcessorConfig -
- * configuration object containing Cas Processor configuration
+ * @param aJaxbCasProcessorConfig
+ * - configuration object containing Cas Processor configuration
*/
private void addBatchSize(CpeCasProcessor aCasProcessorConfig)
throws ResourceConfigurationException {
if (aCasProcessorConfig == null) {
- throw new ResourceConfigurationException(InvalidXMLException.ELEMENT_NOT_FOUND, new Object[] {
- "<casProcessor>", "<casProcessors>" }, new Exception(CpmLocalizedMessage
- .getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_bad_cpe_descriptor_no_cp__WARNING", new Object[] { Thread
- .currentThread().getName() })));
+ throw new ResourceConfigurationException(InvalidXMLException.ELEMENT_NOT_FOUND,
+ new Object[] { "<casProcessor>", "<casProcessors>" },
+ new Exception(
+ CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_EXP_bad_cpe_descriptor_no_cp__WARNING",
+ new Object[] { Thread.currentThread().getName() })));
}
CpeCheckpoint checkpoint = aCasProcessorConfig.getCheckpoint();
if (checkpoint == null) {
- throw new ResourceConfigurationException(InvalidXMLException.ELEMENT_NOT_FOUND, new Object[] {
- "<checkpoint>", "<casProcessor>" }, new Exception(CpmLocalizedMessage
- .getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_missing_xml_element__WARNING", new Object[] {
- Thread.currentThread().getName(), aCasProcessorConfig.getName(),
- "<checkpoint>" })));
+ throw new ResourceConfigurationException(InvalidXMLException.ELEMENT_NOT_FOUND,
+ new Object[] { "<checkpoint>", "<casProcessor>" },
+ new Exception(CpmLocalizedMessage.getLocalizedMessage(
+ CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_EXP_missing_xml_element__WARNING",
+ new Object[] { Thread.currentThread().getName(),
+ aCasProcessorConfig.getName(), "<checkpoint>" })));
}
try {
@@ -423,8 +427,9 @@ public class CasProcessorConfigurationJAXBImpl implements CasProcessorConfigurat
}
} catch (NumberFormatException e) {
throw new ResourceConfigurationException(InvalidXMLException.REQUIRED_ATTRIBUTE_MISSING,
- new Object[] { "batch", "<checkpoint>" }, new Exception(CpmLocalizedMessage
- .getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ new Object[] { "batch", "<checkpoint>" },
+ new Exception(
+ CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_EXP_missing_attribute_from_xml_element__WARNING",
new Object[] { Thread.currentThread().getName(),
aCasProcessorConfig.getName(), "batch", "<checkpoint>" })));
@@ -435,31 +440,34 @@ public class CasProcessorConfigurationJAXBImpl implements CasProcessorConfigurat
/**
* Copies path of the Cas Processor descriptor.
*
- * @param aJaxbCasProcessorConfig -
- * configuration object holding path to the descriptor
+ * @param aJaxbCasProcessorConfig
+ * - configuration object holding path to the descriptor
*
- * @throws ResourceConfigurationException -
+ * @throws ResourceConfigurationException
+ * -
*/
private void addDescriptor(CpeCasProcessor aCasProcessorConfig)
throws ResourceConfigurationException {
if (aCasProcessorConfig == null) {
- throw new ResourceConfigurationException(InvalidXMLException.ELEMENT_NOT_FOUND, new Object[] {
- "<casProcessor>", "<casProcessors>" }, new Exception(CpmLocalizedMessage
- .getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_bad_cpe_descriptor_no_cp__WARNING", new Object[] { Thread
- .currentThread().getName() })));
+ throw new ResourceConfigurationException(InvalidXMLException.ELEMENT_NOT_FOUND,
+ new Object[] { "<casProcessor>", "<casProcessors>" },
+ new Exception(
+ CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_EXP_bad_cpe_descriptor_no_cp__WARNING",
+ new Object[] { Thread.currentThread().getName() })));
}
descriptor = aCasProcessorConfig.getCpeComponentDescriptor();
-
+
if (descriptor.getInclude() != null) {
String descPath = descriptor.getInclude().get();
if (descPath == null || descPath.trim().length() == 0) {
- throw new ResourceConfigurationException(InvalidXMLException.ELEMENT_NOT_FOUND, new Object[] {
- "href", "include" }, new Exception(CpmLocalizedMessage.getLocalizedMessage(
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_missing_attribute_from_xml_element__WARNING", new Object[] {
- Thread.currentThread().getName(), aCasProcessorConfig.getName(), "href",
- "<include>" })));
+ throw new ResourceConfigurationException(InvalidXMLException.ELEMENT_NOT_FOUND,
+ new Object[] { "href", "include" },
+ new Exception(
+ CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_EXP_missing_attribute_from_xml_element__WARNING",
+ new Object[] { Thread.currentThread().getName(),
+ aCasProcessorConfig.getName(), "href", "<include>" })));
}
}
@@ -474,8 +482,8 @@ public class CasProcessorConfigurationJAXBImpl implements CasProcessorConfigurat
* <li>kill-pipeline</li>
* <p>
*
- * @param aActionOnError -
- * action string to verify
+ * @param aActionOnError
+ * - action string to verify
*
* @return - true if action is valid, false otherwise
*/
@@ -628,8 +636,7 @@ public class CasProcessorConfigurationJAXBImpl implements CasProcessorConfigurat
if (filterExpression != null) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
- "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_show_cp_filter__FINEST",
+ "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_show_cp_filter__FINEST",
new Object[] { Thread.currentThread().getName(), name, filterExpression });
}
Filter filter = new Filter();
@@ -637,10 +644,10 @@ public class CasProcessorConfigurationJAXBImpl implements CasProcessorConfigurat
}
} catch (Exception e) {
throw new ResourceConfigurationException(InvalidXMLException.INVALID_ELEMENT_TEXT,
- new Object[] { "filter" }, new Exception(CpmLocalizedMessage.getLocalizedMessage(
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_missing_xml_element__WARNING", new Object[] {
- Thread.currentThread().getName(), name, "filer" })));
+ new Object[] { "filter" },
+ new Exception(CpmLocalizedMessage.getLocalizedMessage(
+ CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_EXP_missing_xml_element__WARNING",
+ new Object[] { Thread.currentThread().getName(), name, "filer" })));
}
return null;
}
@@ -669,10 +676,10 @@ public class CasProcessorConfigurationJAXBImpl implements CasProcessorConfigurat
}
} catch (Exception e) {
throw new ResourceConfigurationException(InvalidXMLException.ELEMENT_NOT_FOUND,
- new Object[] { "parameter" }, new Exception(CpmLocalizedMessage.getLocalizedMessage(
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_missing_xml_element__WARNING", new Object[] {
- Thread.currentThread().getName(), name, "parameter" })));
+ new Object[] { "parameter" },
+ new Exception(CpmLocalizedMessage.getLocalizedMessage(
+ CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_EXP_missing_xml_element__WARNING",
+ new Object[] { Thread.currentThread().getName(), name, "parameter" })));
}
return null;
}
@@ -692,17 +699,19 @@ public class CasProcessorConfigurationJAXBImpl implements CasProcessorConfigurat
*
* @return object that identifies location of descriptor
*
- * @throws ResourceConfigurationException if an import could not be resolved
+ * @throws ResourceConfigurationException
+ * if an import could not be resolved
*/
@Override
public URL getDescriptorUrl() throws ResourceConfigurationException {
return descriptor.findAbsoluteUrl(resourceManager);
}
-
+
/**
* Returns a value for a given deployment parameter
*
- * @param aDeployParameter - name of the parameter
+ * @param aDeployParameter
+ * - name of the parameter
* @return - value for parameter name
*/
@Override
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/NetworkCasProcessorImpl.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/NetworkCasProcessorImpl.java
index b266dde..fc1376b 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/NetworkCasProcessorImpl.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/NetworkCasProcessorImpl.java
@@ -72,7 +72,8 @@ public class NetworkCasProcessorImpl implements CasDataProcessor {
/**
* Initializes this instance with configuration defined in the CPE descriptor.
*
- * @param aCasProcessorType -
+ * @param aCasProcessorType
+ * -
*/
public NetworkCasProcessorImpl(CpeCasProcessor aCasProcessorType) {
casProcessorType = aCasProcessorType;
@@ -100,8 +101,8 @@ public class NetworkCasProcessorImpl implements CasDataProcessor {
/**
* Associates a proxy to remote annotator service.
*
- * @param aTap -
- * proxy to remote service
+ * @param aTap
+ * - proxy to remote service
*/
public void setProxy(VinciTAP aTap) {
textAnalysisProxy = aTap;
@@ -129,16 +130,17 @@ public class NetworkCasProcessorImpl implements CasDataProcessor {
* Main method used during analysis. The ProcessingUnit calls this method to initiate analysis of
* the content in the CasData instance. This handles one Cas at a time processing mode.
*
- * @param aCas - instance of CasData to analyze
+ * @param aCas
+ * - instance of CasData to analyze
* @return instance containing result of the analysis
*/
@Override
public CasData process(CasData aCas) throws ResourceProcessException {
if (textAnalysisProxy == null) {
- throw new ResourceProcessException(new Exception(Thread.currentThread().getName()
- + CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_no_proxy__WARNING", new Object[] { Thread.currentThread()
- .getName() })));
+ throw new ResourceProcessException(new Exception(
+ Thread.currentThread().getName() + CpmLocalizedMessage.getLocalizedMessage(
+ CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_EXP_no_proxy__WARNING",
+ new Object[] { Thread.currentThread().getName() })));
}
CasData casWithAnalysis = null;
@@ -157,11 +159,10 @@ public class NetworkCasProcessorImpl implements CasDataProcessor {
"process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_service_down__INFO",
new Object[] { Thread.currentThread().getName(), name });
}
- throw new ResourceProcessException(new ServiceConnectionException(Thread.currentThread()
- .getName()
- + CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_service_down__WARNING", new Object[] {
- Thread.currentThread().getName(), name })));
+ throw new ResourceProcessException(new ServiceConnectionException(
+ Thread.currentThread().getName() + CpmLocalizedMessage.getLocalizedMessage(
+ CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_EXP_service_down__WARNING",
+ new Object[] { Thread.currentThread().getName(), name })));
}
throw new ResourceProcessException(e);
} catch (ServiceConnectionException e) {
@@ -176,22 +177,21 @@ public class NetworkCasProcessorImpl implements CasDataProcessor {
* Main method used during analysis. The ProcessingUnit calls this method to initiate analysis of
* the content in the CasData instance. This handles processing of multiple Cas'es at a time.
*
- * @param aCasList - array of CasData instances to analyze
+ * @param aCasList
+ * - array of CasData instances to analyze
* @return CasData - array of CasData instances containing results of the analysis
*/
@Override
public CasData[] process(CasData[] aCasList) throws ResourceProcessException {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).log(
- Level.FINEST,
- Thread.currentThread().getName()
- + " ===================================Calling Proxy");
+ UIMAFramework.getLogger(this.getClass()).log(Level.FINEST, Thread.currentThread().getName()
+ + " ===================================Calling Proxy");
}
if (textAnalysisProxy == null) {
- throw new ResourceProcessException(new Exception(Thread.currentThread().getName()
- + CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_no_proxy__WARNING", new Object[] { Thread.currentThread()
- .getName() })));
+ throw new ResourceProcessException(new Exception(
+ Thread.currentThread().getName() + CpmLocalizedMessage.getLocalizedMessage(
+ CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_EXP_no_proxy__WARNING",
+ new Object[] { Thread.currentThread().getName() })));
}
try {
ProcessTrace pt = new ProcessTrace_impl();
@@ -214,16 +214,16 @@ public class NetworkCasProcessorImpl implements CasDataProcessor {
try {
resourceMetadata = textAnalysisProxy.getAnalysisEngineMetaData();
} catch (ResourceServiceException e) {
- //can't throw exception from here so just log it and return the default
+ // can't throw exception from here so just log it and return the default
UIMAFramework.getLogger(this.getClass()).log(Level.SEVERE, e.getMessage(), e);
- return true;
+ return true;
}
}
- OperationalProperties opProps = resourceMetadata.getOperationalProperties();
+ OperationalProperties opProps = resourceMetadata.getOperationalProperties();
if (opProps != null) {
return !opProps.isMultipleDeploymentAllowed();
}
- return true; //default
+ return true; // default
}
/*
@@ -237,16 +237,16 @@ public class NetworkCasProcessorImpl implements CasDataProcessor {
try {
resourceMetadata = textAnalysisProxy.getAnalysisEngineMetaData();
} catch (ResourceServiceException e) {
- //can't throw exception from here so just log it and return the default
+ // can't throw exception from here so just log it and return the default
UIMAFramework.getLogger(this.getClass()).log(Level.SEVERE, e.getMessage(), e);
- return false;
+ return false;
}
}
- OperationalProperties opProps = resourceMetadata.getOperationalProperties();
+ OperationalProperties opProps = resourceMetadata.getOperationalProperties();
if (opProps != null) {
return !opProps.getModifiesCas();
}
- return false; //default
+ return false; // default
}
/**
@@ -269,8 +269,8 @@ public class NetworkCasProcessorImpl implements CasDataProcessor {
"process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_no_metadata__FINEST",
new Object[] { Thread.currentThread().getName(), name });
}
- } else if (metadata.getConfigurationParameterSettings().getParameterValue(
- Constants.CAS_PROCESSOR_CONFIG) == null) {
+ } else if (metadata.getConfigurationParameterSettings()
+ .getParameterValue(Constants.CAS_PROCESSOR_CONFIG) == null) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
"process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
@@ -288,8 +288,8 @@ public class NetworkCasProcessorImpl implements CasDataProcessor {
"process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_service_down__INFO",
new Object[] { Thread.currentThread().getName(), name });
}
- throw new ResourceProcessException(new ServiceConnectionException("Service::" + name
- + " appears to be down"));
+ throw new ResourceProcessException(
+ new ServiceConnectionException("Service::" + name + " appears to be down"));
}
if (resourceMetadata == null) {
@@ -299,8 +299,7 @@ public class NetworkCasProcessorImpl implements CasDataProcessor {
} catch (Exception e) {
if (UIMAFramework.getLogger().isLoggable(Level.SEVERE)) {
UIMAFramework.getLogger(this.getClass()).logrb(Level.SEVERE, this.getClass().getName(),
- "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_unable_to_read_meta__SEVERE",
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_unable_to_read_meta__SEVERE",
new Object[] { Thread.currentThread().getName(), e });
}
}
@@ -314,8 +313,8 @@ public class NetworkCasProcessorImpl implements CasDataProcessor {
* @see org.apache.uima.collection.base_cpm.CasProcessor#batchProcessComplete(org.apache.uima.util.ProcessTrace)
*/
@Override
- public void batchProcessComplete(ProcessTrace aTrace) throws ResourceProcessException,
- IOException {
+ public void batchProcessComplete(ProcessTrace aTrace)
+ throws ResourceProcessException, IOException {
// Check if batch noitification is disabled == 0
if (!doSendNotification()) {
return;
@@ -337,8 +336,8 @@ public class NetworkCasProcessorImpl implements CasDataProcessor {
* @see org.apache.uima.collection.base_cpm.CasProcessor#collectionProcessComplete(org.apache.uima.util.ProcessTrace)
*/
@Override
- public void collectionProcessComplete(ProcessTrace aTrace) throws ResourceProcessException,
- IOException {
+ public void collectionProcessComplete(ProcessTrace aTrace)
+ throws ResourceProcessException, IOException {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
"process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_stopping_cp__FINEST",
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/ProcessingContainer_Impl.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/ProcessingContainer_Impl.java
index 2d99722..ae943bb 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/ProcessingContainer_Impl.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/ProcessingContainer_Impl.java
@@ -66,7 +66,6 @@ import org.apache.uima.util.Level;
import org.apache.uima.util.ProcessTrace;
import org.apache.uima.util.impl.ProcessTrace_impl;
-
/**
* Manages a pool of CasProcessor instances. Provides access to CasProcessor instance to Processing
* Thread. Processing threads check out an instance of Cas Processor and when done invoking its
@@ -78,7 +77,7 @@ import org.apache.uima.util.impl.ProcessTrace_impl;
*/
public class ProcessingContainer_Impl extends ProcessingContainer implements RunnableContainer {
-
+
/** The Constant CONTAINER_SLEEP_TIME. */
private static final int CONTAINER_SLEEP_TIME = 100;
@@ -178,7 +177,7 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
// access this only under monitor lock
/** The is paused. */
- // monitor.notifyall called when switching from true -> false
+ // monitor.notifyall called when switching from true -> false
private boolean isPaused = false;
/** The single fenced instance. */
@@ -201,12 +200,14 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
* Initialize container with CasProcessor configuration and pool containing instances of
* CasProcessor instances.
*
- * @param aCasProcessorConfig -
- * CasProcessor configuration as defined in cpe descriptor
- * @param aMetaData the a meta data
- * @param aCasProcessorPool -
- * pool of CasProcessor instances
- * @throws ResourceConfigurationException the resource configuration exception
+ * @param aCasProcessorConfig
+ * - CasProcessor configuration as defined in cpe descriptor
+ * @param aMetaData
+ * the a meta data
+ * @param aCasProcessorPool
+ * - pool of CasProcessor instances
+ * @throws ResourceConfigurationException
+ * the resource configuration exception
*/
public ProcessingContainer_Impl(CasProcessorConfiguration aCasProcessorConfig,
ProcessingResourceMetaData aMetaData, ServiceProxyPool aCasProcessorPool)
@@ -235,7 +236,8 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
/**
* Sets component's input/output capabilities.
*
- * @param aMetadata component capabilities
+ * @param aMetadata
+ * component capabilities
*/
@Override
public void setMetadata(ProcessingResourceMetaData aMetadata) {
@@ -250,15 +252,15 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
// Convert the types if necessary
for (int i = 0; i < tORf.length; i++) {
newKey = tORf[i].getName();
- if (tORf[i].getName().indexOf(
- org.apache.uima.collection.impl.cpm.Constants.SHORT_DASH_TERM) > -1) {
+ if (tORf[i].getName()
+ .indexOf(org.apache.uima.collection.impl.cpm.Constants.SHORT_DASH_TERM) > -1) {
newKey = StringUtils.replaceAll(tORf[i].getName(),
org.apache.uima.collection.impl.cpm.Constants.SHORT_DASH_TERM,
org.apache.uima.collection.impl.cpm.Constants.LONG_DASH_TERM);
modified = true;
}
- if (tORf[i].getName().indexOf(
- org.apache.uima.collection.impl.cpm.Constants.SHORT_COLON_TERM) > -1) {
+ if (tORf[i].getName()
+ .indexOf(org.apache.uima.collection.impl.cpm.Constants.SHORT_COLON_TERM) > -1) {
newKey = StringUtils.replaceAll(tORf[i].getName(),
org.apache.uima.collection.impl.cpm.Constants.SHORT_COLON_TERM,
org.apache.uima.collection.impl.cpm.Constants.LONG_COLON_TERM);
@@ -277,8 +279,8 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
/**
* Plug in deployer object used to launch/deploy the CasProcessor instance. Used for restarts.
*
- * @param aDeployer -
- * object responsible for deploying/launching CasProcessor
+ * @param aDeployer
+ * - object responsible for deploying/launching CasProcessor
*/
@Override
public void setCasProcessorDeployer(CasProcessorDeployer aDeployer) {
@@ -337,8 +339,7 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
} else {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
- "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_logpath_not_defined__FINEST",
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_logpath_not_defined__FINEST",
new Object[] { Thread.currentThread().getName(), getName() });
}
}
@@ -348,8 +349,8 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
/**
* Logs Cas'es that could not be processed.
*
- * @param abortedCasList -
- * an arrar of Cas'es that could not be processed by this CasProcessor
+ * @param abortedCasList
+ * - an arrar of Cas'es that could not be processed by this CasProcessor
*
*/
@Override
@@ -412,7 +413,8 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
/**
* Aggregate total bytes ingested by the CasProcessor.
*
- * @param aBytesIn - number of ingested bytes
+ * @param aBytesIn
+ * - number of ingested bytes
*/
@Override
public void addBytesIn(long aBytesIn) {
@@ -433,7 +435,8 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
/**
* Aggregate total bytes processed by this CasProcessor.
*
- * @param aBytesOut the a bytes out
+ * @param aBytesOut
+ * the a bytes out
*/
@Override
public void addBytesOut(long aBytesOut) {
@@ -443,7 +446,8 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
/**
* Increment number of times the casProcessor was restarted due to failures.
*
- * @param aCount - restart count
+ * @param aCount
+ * - restart count
*/
@Override
public void incrementRestartCount(int aCount) {
@@ -464,7 +468,8 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
* Increments number of times CasProceesor failed analyzing Cas'es due to timeout or some other
* problems.
*
- * @param aCount - failure count
+ * @param aCount
+ * - failure count
*/
@Override
public void incrementRetryCount(int aCount) {
@@ -484,7 +489,8 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
/**
* Increment number of aborted Cas'es due to inability to process the Cas.
*
- * @param aCount - number of aborts while processing Cas'es
+ * @param aCount
+ * - number of aborts while processing Cas'es
*/
@Override
public void incrementAbortCount(int aCount) {
@@ -506,8 +512,8 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
* features. Features that are required by the Cas Processor to perform analysis. Dependant
* feateurs are defined in the filter expression in the CPE descriptor
*
- * @param aCount -
- * number of filtered Cas'es
+ * @param aCount
+ * - number of filtered Cas'es
*/
@Override
public void incrementFilteredCount(int aCount) {
@@ -538,8 +544,8 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
/**
* Copies number of entities the CasProcessor has yet to process.
*
- * @param aRemainingCount -
- * number of entities to process
+ * @param aRemainingCount
+ * - number of entities to process
*/
@Override
public synchronized void setRemaining(long aRemainingCount) {
@@ -549,7 +555,8 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
/**
* Copies id of the last entity processed by the CasProcessor.
*
- * @param aEntityId - id of the entity
+ * @param aEntityId
+ * - id of the entity
*/
@Override
public void setLastProcessedEntityId(String aEntityId) {
@@ -572,8 +579,9 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
/**
* Copies the last Cas Processed.
*
- * @param aCasObject the new last cas
- * @deprecated
+ * @param aCasObject
+ * the new last cas
+ * @deprecated
*/
@Override
@Deprecated
@@ -585,7 +593,7 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
* Returns the last Cas processed.
*
* @return the last cas
- * @deprecated
+ * @deprecated
*/
@Override
@Deprecated
@@ -596,7 +604,8 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
/**
* Increment processed.
*
- * @param aIncrement the a increment
+ * @param aIncrement
+ * the a increment
*/
public void incrementProcessed(int aIncrement) {
processed += aIncrement;
@@ -605,7 +614,8 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
/**
* Used when recovering from checkpoint, sets the total number of entities before CPE stopped.
*
- * @param aProcessedCount - number of entities processed before CPE stopped
+ * @param aProcessedCount
+ * - number of entities processed before CPE stopped
*/
@Override
public void setProcessed(long aProcessedCount) {
@@ -630,7 +640,9 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
errorCounter = 0;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.apache.uima.collection.impl.base_cpm.container.ProcessingContainer#resetRestartCount()
*/
@Override
@@ -642,8 +654,8 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
/**
* Increments total time spend in the process() method of the CasProcessor.
*
- * @param aTime -
- * total time in process()
+ * @param aTime
+ * - total time in process()
*/
@Override
public void incrementTotalTime(long aTime) {
@@ -679,8 +691,8 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
/**
* Returns true if the Exception cause is SocketTimeoutException.
*
- * @param aThrowable -
- * Exception to check for SocketTimeoutException
+ * @param aThrowable
+ * - Exception to check for SocketTimeoutException
* @return - true if Socket Timeout, false otherwise
*/
private boolean isTimeout(Throwable aThrowable) {
@@ -698,8 +710,10 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
* run, if it should disable the CasProcessor (and all its instances), or disregard the error and
* continue.
*
- * @param aThrowable - exception to examine
- * @throws Exception the exception
+ * @param aThrowable
+ * - exception to examine
+ * @throws Exception
+ * the exception
*/
@Override
public synchronized void incrementCasProcessorErrors(Throwable aThrowable) throws Exception {
@@ -711,12 +725,8 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
}
if (System.getProperty("DEBUG_EXCEPTIONS") != null) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_show_cp_error_count__FINEST",
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_show_cp_error_count__FINEST",
new Object[] { Thread.currentThread().getName(), getName(),
String.valueOf(errorCounter), aThrowable.getCause().getMessage() });
}
@@ -758,15 +768,10 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
// Check if configured max restart count has been reached
if (restartCount > rC) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass())
- .logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_max_restart_reached__FINEST",
- new Object[] { Thread.currentThread().getName(), getName(),
- String.valueOf(rC) });
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_max_restart_reached__FINEST", new Object[] {
+ Thread.currentThread().getName(), getName(), String.valueOf(rC) });
}
// get from configuration action to be taken if max restart count reached
String actionOnMaxRestarts = casProcessorCPEConfiguration.getActionOnMaxRestart();
@@ -790,9 +795,8 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
new Object[] { Thread.currentThread().getName(), getName() });
}
throw new AbortCasProcessorException(CpmLocalizedMessage.getLocalizedMessage(
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_configured_to_disable__WARNING", new Object[] {
- Thread.currentThread().getName(), getName() }));
+ CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_EXP_configured_to_disable__WARNING",
+ new Object[] { Thread.currentThread().getName(), getName() }));
} else if (Constants.KILL_PROCESSING_PIPELINE.equals(actionOnMaxRestarts)) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST,
@@ -800,10 +804,10 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
"UIMA_CPM_kill_pipeline__FINEST",
new Object[] { Thread.currentThread().getName(), getName() });
}
- throw new KillPipelineException(CpmLocalizedMessage.getLocalizedMessage(
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_configured_to_kill_pipeline__WARNING", new Object[] {
- Thread.currentThread().getName(), getName() }));
+ throw new KillPipelineException(
+ CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_EXP_configured_to_kill_pipeline__WARNING",
+ new Object[] { Thread.currentThread().getName(), getName() }));
}
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
@@ -823,12 +827,8 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
}
if (aThrowable.getCause() != null) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_other_exception__FINEST",
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_other_exception__FINEST",
new Object[] { Thread.currentThread().getName(), getName(),
aThrowable.getCause().getClass().getName() });
}
@@ -856,11 +856,8 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
if (errorCounter > configuredErrorRate) {
if (abortCPMOnError()) {
if (UIMAFramework.getLogger().isLoggable(Level.SEVERE)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.SEVERE,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.SEVERE, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_abort_exceeded_error_threshold__SEVERE",
new Object[] { Thread.currentThread().getName(), getName(),
String.valueOf(configuredErrorRate) });
@@ -869,11 +866,8 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
}
if (isAbortable()) {
if (UIMAFramework.getLogger().isLoggable(Level.SEVERE)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.SEVERE,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.SEVERE, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_disable_exceeded_error_threshold__SEVERE",
new Object[] { Thread.currentThread().getName(), getName(),
String.valueOf(configuredErrorRate) });
@@ -896,30 +890,30 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
}
}
- /* (non-Javadoc)
- * @see org.apache.uima.collection.impl.base_cpm.container.ProcessingContainer#isEndOfBatch(org.apache.uima.collection.base_cpm.CasProcessor, int)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.uima.collection.impl.base_cpm.container.ProcessingContainer#isEndOfBatch(org.apache.
+ * uima.collection.base_cpm.CasProcessor, int)
*/
/*
* Called after each entity set is processed and its purpose is to mark end of batch associated
* with this Container. At the end of batch a CasProcessor may perform a specific processing like
* writing to a store or do indexing.
*
- * @see org.apache.uima.collection.base_cpm.container.ProcessingContainer#isEndOfBatch(org.apache.uima.collection.base_cpm.CasProcessor,
- * int)
+ * @see
+ * org.apache.uima.collection.base_cpm.container.ProcessingContainer#isEndOfBatch(org.apache.uima.
+ * collection.base_cpm.CasProcessor, int)
*/
@Override
public synchronized boolean isEndOfBatch(CasProcessor aCasProcessor, int aProcessedSize)
throws ResourceProcessException, IOException {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass())
- .logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_show_cp_batch_size__FINEST",
- new Object[] { Thread.currentThread().getName(), getName(),
- String.valueOf(batchSize) });
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_show_cp_batch_size__FINEST",
+ new Object[] { Thread.currentThread().getName(), getName(),
+ String.valueOf(batchSize) });
}
boolean eob = false;
@@ -938,15 +932,10 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
// Increment the total number of entities processed so far through this container
processed += aProcessedSize;
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass())
- .logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_show_cp_doc_count__FINEST",
- new Object[] { Thread.currentThread().getName(), getName(),
- String.valueOf(processed) });
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_show_cp_doc_count__FINEST",
+ new Object[] { Thread.currentThread().getName(), getName(),
+ String.valueOf(processed) });
}
// Check for end-of-batch
if (batchCounter > batchSize || batchCounter % batchSize == 0) {
@@ -986,8 +975,8 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
* all Cas'es must contain required features. If even one Cas does not have them, the entire
* bundle is skipped.
*
- * @param aCasList -
- * bundle containing instances of CAS
+ * @param aCasList
+ * - bundle containing instances of CAS
* @return true, if successful
*/
@Override
@@ -1014,8 +1003,8 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
* defined in the filter. Filtering is optional and if not present in the cpe descriptor this
* routine always returns true.
*
- * @param aCas -
- * Cas instance to check
+ * @param aCas
+ * - Cas instance to check
*
* @return - true if feature is in the Cas, false otherwise
*/
@@ -1050,8 +1039,8 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
}
}
Filter.Expression filterExpression = (Filter.Expression) filterList.get(i);
- String featureValue = DATACasUtils.getFeatureValueByType(aCas, filterExpression.getLeftPart()
- .get());
+ String featureValue = DATACasUtils.getFeatureValueByType(aCas,
+ filterExpression.getLeftPart().get());
// This evaluates if the Feature with a given name exist
if (filterExpression.getRightPart() == null) {
if (System.getProperty("DEBUG_FILTER") != null) {
@@ -1065,22 +1054,21 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
// the featureValue must NOT be null.
// The second check is to see if the the feature does NOT exist in the CAS. In
// this case, the feature MUST be null.
- boolean exists = DATACasUtils.hasFeatureStructure(aCas, filterExpression.getLeftPart()
- .get());
+ boolean exists = DATACasUtils.hasFeatureStructure(aCas,
+ filterExpression.getLeftPart().get());
if (System.getProperty("DEBUG_FILTER") != null) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_filter_enabled_left_part__FINEST",
new Object[] { Thread.currentThread().getName(), getName(),
filterExpression.getLeftPart().get(), String.valueOf(exists) });
}
if ((filterExpression.getOperand() == null
- || filterExpression.getOperand().getOperand() == null || !exists)
- || // this means that the feature must exist in CAS
+ || filterExpression.getOperand().getOperand() == null || !exists) || // this means
+ // that the
+ // feature must
+ // exist in CAS
("!".equals(filterExpression.getOperand().getOperand()) && exists)) // this
// means
// that
@@ -1122,8 +1110,8 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
/**
* Checks if a given Cas has required features.
*
- * @param aCas -
- * Cas instance to check
+ * @param aCas
+ * - Cas instance to check
*
* @return - true if feature is in the Cas, false otherwise
*/
@@ -1153,7 +1141,7 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
/**
* Start.
*
- * @deprecated
+ * @deprecated
*/
@Override
@Deprecated
@@ -1164,7 +1152,7 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
/**
* Stop.
*
- * @deprecated
+ * @deprecated
*/
@Override
@Deprecated
@@ -1203,11 +1191,8 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
if (!isPaused) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_resuming_container__FINEST",
new Object[] { Thread.currentThread().getName(), getName(),
String.valueOf(CONTAINER_SLEEP_TIME) });
@@ -1249,8 +1234,8 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
/**
* Returns a given casProcessor instance back to the pool.
*
- * @param aCasProcessor -
- * an instance of CasProcessor to return back to the pool
+ * @param aCasProcessor
+ * - an instance of CasProcessor to return back to the pool
* @see org.apache.uima.collection.impl.base_cpm.container.ProcessingContainer#releaseCasProcessor(org.apache.uima.collection.base_cpm.CasProcessor)
*/
@Override
@@ -1275,8 +1260,8 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
/**
* Changes the status of the CasProcessor as a group.
*
- * @param aStatus -
- * new status
+ * @param aStatus
+ * - new status
*/
@Override
public void setStatus(int aStatus) {
@@ -1287,7 +1272,7 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
* Checks if is local.
*
* @return true, if is local
- * @deprecated
+ * @deprecated
*/
@Override
@Deprecated
@@ -1299,7 +1284,7 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
* Checks if is remote.
*
* @return true, if is remote
- * @deprecated
+ * @deprecated
*/
@Override
@Deprecated
@@ -1311,7 +1296,7 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
* Checks if is integrated.
*
* @return true, if is integrated
- * @deprecated
+ * @deprecated
*/
@Override
@Deprecated
@@ -1347,11 +1332,8 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
try {
anAction = casProcessorCPEConfiguration.getActionOnError();
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_show_cp_action_on_error__FINEST",
new Object[] { Thread.currentThread().getName(), getName(),
casProcessorCPEConfiguration.getActionOnError() });
@@ -1390,9 +1372,11 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
return false;
}
-
- /* (non-Javadoc)
- * @see org.apache.uima.resource.Resource_ImplBase#initialize(org.apache.uima.resource.ResourceSpecifier, java.util.Map)
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.uima.resource.Resource_ImplBase#initialize(org.apache.uima.resource.
+ * ResourceSpecifier, java.util.Map)
*/
@Override
public boolean initialize(ResourceSpecifier aSpecifier, Map aAdditionalParams)
@@ -1426,11 +1410,8 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
@Override
public void destroy() {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_show_cp_proxy_pool_size__FINEST",
new Object[] { Thread.currentThread().getName(), getName(),
String.valueOf(casProcessorPool.getSize()) });
@@ -1499,7 +1480,7 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
* (non-Javadoc)
*
* @see org.apache.uima.resource.ConfigurableResource#getConfigParameterValue(java.lang.String,
- * java.lang.String)
+ * java.lang.String)
*/
@Override
public Object getConfigParameterValue(String aGroupName, String aParamName) {
@@ -1510,7 +1491,7 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
* (non-Javadoc)
*
* @see org.apache.uima.resource.ConfigurableResource#setConfigParameterValue(java.lang.String,
- * java.lang.Object)
+ * java.lang.Object)
*/
@Override
public void setConfigParameterValue(String aParamName, Object aValue) {
@@ -1521,7 +1502,7 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
* (non-Javadoc)
*
* @see org.apache.uima.resource.ConfigurableResource#setConfigParameterValue(java.lang.String,
- * java.lang.String, java.lang.Object)
+ * java.lang.String, java.lang.Object)
*/
@Override
public void setConfigParameterValue(String aGroupName, String aParamName, Object aValue) {
@@ -1547,9 +1528,8 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
@Override
public String getName() {
if (processorName == null) {
- if (metadata != null
- && Constants.DEPLOYMENT_INTEGRATED.equalsIgnoreCase(casProcessorCPEConfiguration
- .getDeploymentType())) {
+ if (metadata != null && Constants.DEPLOYMENT_INTEGRATED
+ .equalsIgnoreCase(casProcessorCPEConfiguration.getDeploymentType())) {
processorName = metadata.getName().trim();
} else {
processorName = casProcessorCPEConfiguration.getName().trim();
@@ -1571,8 +1551,10 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
/**
* Increment a value of a given stat.
*
- * @param aStatName the a stat name
- * @param aStat the a stat
+ * @param aStatName
+ * the a stat name
+ * @param aStat
+ * the a stat
*/
@Override
public void incrementStat(String aStatName, Integer aStat) {
@@ -1592,8 +1574,10 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
/**
* Add an arbitrary object and bind it to a given name.
*
- * @param aStatName the a stat name
- * @param aStat the a stat
+ * @param aStatName
+ * the a stat name
+ * @param aStat
+ * the a stat
*/
@Override
public void addStat(String aStatName, Object aStat) {
@@ -1608,7 +1592,8 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
/**
* Return an abject identified with a given name.
*
- * @param aStatName the a stat name
+ * @param aStatName
+ * the a stat name
* @return the stat
*/
@Override
@@ -1652,7 +1637,9 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
}
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.apache.uima.collection.impl.base_cpm.container.ProcessingContainer#resume()
*/
@Override
@@ -1668,7 +1655,9 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
}
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.apache.uima.collection.impl.base_cpm.container.ProcessingContainer#isPaused()
*/
@Override
@@ -1678,7 +1667,9 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
}
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.apache.uima.collection.impl.base_cpm.container.ProcessingContainer#getPool()
*/
@Override
@@ -1686,17 +1677,23 @@ public class ProcessingContainer_Impl extends ProcessingContainer implements Run
return casProcessorPool;
}
-
- /* (non-Javadoc)
- * @see org.apache.uima.collection.impl.base_cpm.container.ProcessingContainer#setSingleFencedService(boolean)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.uima.collection.impl.base_cpm.container.ProcessingContainer#setSingleFencedService(
+ * boolean)
*/
@Override
public void setSingleFencedService(boolean aSingleFencedInstance) {
singleFencedInstance = aSingleFencedInstance;
}
- /* (non-Javadoc)
- * @see org.apache.uima.collection.impl.base_cpm.container.ProcessingContainer#isSingleFencedService()
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.uima.collection.impl.base_cpm.container.ProcessingContainer#isSingleFencedService()
*/
@Override
public boolean isSingleFencedService() {
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/ServiceProxyPool.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/ServiceProxyPool.java
index 194aab8..23a309c 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/ServiceProxyPool.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/ServiceProxyPool.java
@@ -38,7 +38,7 @@ public class ServiceProxyPool {
private LinkedList mFreeInstances = new LinkedList();
-// private int mNumInstances;
+ // private int mNumInstances;
/**
* Checks out a Resource from the pool.
@@ -57,24 +57,16 @@ public class ServiceProxyPool {
}
CasProcessor r = (CasProcessor) mFreeInstances.remove(0);
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_show_cp_pool_size__FINEST",
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_show_cp_pool_size__FINEST",
new Object[] { Thread.currentThread().getName(),
String.valueOf(mAllInstances.size()), String.valueOf(mFreeInstances.size()) });
}
return r;
} else {
if (UIMAFramework.getLogger().isLoggable(Level.WARNING)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.WARNING,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_cp_pool_empty__WARNING",
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.WARNING, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_cp_pool_empty__WARNING",
new Object[] { Thread.currentThread().getName(),
String.valueOf(mAllInstances.size()), String.valueOf(mFreeInstances.size()) });
}
@@ -86,19 +78,16 @@ public class ServiceProxyPool {
* Checks in a Resource to the pool. Also notifies other Threads that may be waiting for available
* instance.
*
- * @param aResource -
- * instance of the CasProcessor to check in
+ * @param aResource
+ * - instance of the CasProcessor to check in
*/
public synchronized void checkIn(CasProcessor aResource) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_checking_in_cp_to_pool__FINEST",
- new Object[] { Thread.currentThread().getName(),
- String.valueOf(mAllInstances.size()), String.valueOf(mFreeInstances.size()) });
+ new Object[] { Thread.currentThread().getName(), String.valueOf(mAllInstances.size()),
+ String.valueOf(mFreeInstances.size()) });
}
// make sure this Resource was actually belongs to this pool and is checked out
if (!mAllInstances.contains(aResource) || mFreeInstances.contains(aResource)) {
@@ -127,14 +116,10 @@ public class ServiceProxyPool {
mFreeInstances.add(aResource);
}
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_show_cp_pool_size__FINEST",
- new Object[] { Thread.currentThread().getName(),
- String.valueOf(mAllInstances.size()), String.valueOf(mFreeInstances.size()) });
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_show_cp_pool_size__FINEST",
+ new Object[] { Thread.currentThread().getName(), String.valueOf(mAllInstances.size()),
+ String.valueOf(mFreeInstances.size()) });
}
// Notify any threads waiting on this object
notifyAll();
@@ -180,99 +165,91 @@ public class ServiceProxyPool {
*
* @return the available size of this pool
*/
- public synchronized int getSize() { // synch for JVM memory model to get current value
+ public synchronized int getSize() { // synch for JVM memory model to get current value
return mFreeInstances.size();
}
public synchronized void addCasProcessor(CasProcessor aCasProcessor) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_add_cp_to_pool__FINEST",
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_add_cp_to_pool__FINEST",
new Object[] { Thread.currentThread().getName(),
aCasProcessor.getProcessingResourceMetaData().getName() });
}
mAllInstances.add(aCasProcessor);
mFreeInstances.add(aCasProcessor);
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_show_cp_pool_size__FINEST",
- new Object[] { Thread.currentThread().getName(),
- String.valueOf(mAllInstances.size()), String.valueOf(mFreeInstances.size()) });
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_show_cp_pool_size__FINEST",
+ new Object[] { Thread.currentThread().getName(), String.valueOf(mAllInstances.size()),
+ String.valueOf(mFreeInstances.size()) });
}
}
-// /**
-// * Utility method used in the constructor to fill the pool with Resource instances.
-// *
-// * @param aResourceSpecifier
-// * specifier that describes how to create the Resource instances for the pool
-// * @param aResourceClass
-// * class of resource to instantiate
-// * @param aResourceInitParams
-// * initialization parameters to be passed to the
-// * {@link Resource#initialize(ResourceSpecifier,Map)} method.
-// *
-// *
-// * @throws ResourceInitializationException
-// * if the Resource instances could not be created
-// */
-// protected void fillPool(BoundedWorkQueue portQueue, Map initParams)
-// throws ResourceInitializationException {
-// boolean isServiceLocal = false;
-// if (initParams != null && initParams.containsKey("SERVICE_NAME")) {
-// isServiceLocal = true;
-// }
-// // fill the pool
-// for (int i = 0; i < mNumInstances; i++) {
-// VinciTAP tap = new VinciTAP();
-// if (isServiceLocal) {
-// String portAsString = (String) portQueue.dequeue();
-// int port = -1;
-// try {
-// port = Integer.parseInt(portAsString);
-// } catch (NumberFormatException e) {
-// }
-// String vnsHost = (String) initParams.get("VNS_HOST");
-// String vnsPort = (String) initParams.get("VNS_PORT");
-// tap.setVNSHost(vnsHost);
-// tap.setVNSPort(vnsPort);
-// try {
-// tap.connect("127.0.0.1", port);
-// } catch (ConnectException e) {
-// throw new ResourceInitializationException(e.getMessage(), null);
-// }
-// }
-// mAllInstances.add(tap);
-// mFreeInstances.add(tap);
-// }
-// }
+ // /**
+ // * Utility method used in the constructor to fill the pool with Resource instances.
+ // *
+ // * @param aResourceSpecifier
+ // * specifier that describes how to create the Resource instances for the pool
+ // * @param aResourceClass
+ // * class of resource to instantiate
+ // * @param aResourceInitParams
+ // * initialization parameters to be passed to the
+ // * {@link Resource#initialize(ResourceSpecifier,Map)} method.
+ // *
+ // *
+ // * @throws ResourceInitializationException
+ // * if the Resource instances could not be created
+ // */
+ // protected void fillPool(BoundedWorkQueue portQueue, Map initParams)
+ // throws ResourceInitializationException {
+ // boolean isServiceLocal = false;
+ // if (initParams != null && initParams.containsKey("SERVICE_NAME")) {
+ // isServiceLocal = true;
+ // }
+ // // fill the pool
+ // for (int i = 0; i < mNumInstances; i++) {
+ // VinciTAP tap = new VinciTAP();
+ // if (isServiceLocal) {
+ // String portAsString = (String) portQueue.dequeue();
+ // int port = -1;
+ // try {
+ // port = Integer.parseInt(portAsString);
+ // } catch (NumberFormatException e) {
+ // }
+ // String vnsHost = (String) initParams.get("VNS_HOST");
+ // String vnsPort = (String) initParams.get("VNS_PORT");
+ // tap.setVNSHost(vnsHost);
+ // tap.setVNSPort(vnsPort);
+ // try {
+ // tap.connect("127.0.0.1", port);
+ // } catch (ConnectException e) {
+ // throw new ResourceInitializationException(e.getMessage(), null);
+ // }
+ // }
+ // mAllInstances.add(tap);
+ // mFreeInstances.add(tap);
+ // }
+ // }
// never used
-// /**
-// * Returns all instances in the pool
-// *
-// * @return - list of CasProcessor instances
-// */
-// protected synchronized LinkedList getAllInstances() {
-// return mAllInstances;
-// }
-//
-// /**
-// * Returns a list of CasProcessor instances not currently in use
-// *
-// * @return -list of free proxies
-// */
-// protected synchronized LinkedList getFreeInstances() {
-// return mFreeInstances;
-// }
+ // /**
+ // * Returns all instances in the pool
+ // *
+ // * @return - list of CasProcessor instances
+ // */
+ // protected synchronized LinkedList getAllInstances() {
+ // return mAllInstances;
+ // }
+ //
+ // /**
+ // * Returns a list of CasProcessor instances not currently in use
+ // *
+ // * @return -list of free proxies
+ // */
+ // protected synchronized LinkedList getFreeInstances() {
+ // return mFreeInstances;
+ // }
public synchronized int getAllInstanceCount() {
return mAllInstances.size();
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/CPEDeployerDefaultImpl.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/CPEDeployerDefaultImpl.java
index f71fee5..78a2065 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/CPEDeployerDefaultImpl.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/CPEDeployerDefaultImpl.java
@@ -46,12 +46,11 @@ import org.apache.uima.resource.metadata.ProcessingResourceMetaData;
import org.apache.uima.util.InvalidXMLException;
import org.apache.uima.util.Level;
-
/**
* Implements {@link CasProcessorDeployer}. Used to instantiate integrated Cas Processor.
*/
public class CPEDeployerDefaultImpl implements CasProcessorDeployer {
-
+
/** The cas processor pool. */
private ServiceProxyPool casProcessorPool = null;
@@ -64,8 +63,8 @@ public class CPEDeployerDefaultImpl implements CasProcessorDeployer {
/**
* Initializes this instance with a reference to the CPE configuration.
*
- * @param aCpeFactory -
- * reference to CPE configuration
+ * @param aCpeFactory
+ * - reference to CPE configuration
*/
public CPEDeployerDefaultImpl(CPEFactory aCpeFactory) {
cpeFactory = aCpeFactory;
@@ -77,11 +76,15 @@ public class CPEDeployerDefaultImpl implements CasProcessorDeployer {
* processing thread created here. The <i>aCasProcessorList</i> contains instantiated Cas
* Processors. These are instantiated by the CPEFactory.
*
- * @param aCasProcessorList - list containing instantiated Cas Processors
- * @param aEngine the CPM engine
- * @param redeploy - true when redeploying failed Cas Processor
+ * @param aCasProcessorList
+ * - list containing instantiated Cas Processors
+ * @param aEngine
+ * the CPM engine
+ * @param redeploy
+ * - true when redeploying failed Cas Processor
* @return - ProcessingContainer containing pool of CasProcessors
- * @throws ResourceConfigurationException the resource configuration exception
+ * @throws ResourceConfigurationException
+ * the resource configuration exception
*/
public ProcessingContainer deployCasProcessor(List aCasProcessorList, CPMEngine aEngine,
boolean redeploy) throws ResourceConfigurationException {
@@ -95,10 +98,13 @@ public class CPEDeployerDefaultImpl implements CasProcessorDeployer {
* processing thread created here. The <i>aCasProcessorList</i> contains instantiated Cas
* Processors. These are instantiated by the CPEFactory.
*
- * @param aCasProcessorList - list containing instantiated Cas Processors
- * @param redeploy - true when redeploying failed Cas Processor
+ * @param aCasProcessorList
+ * - list containing instantiated Cas Processors
+ * @param redeploy
+ * - true when redeploying failed Cas Processor
* @return - ProcessingContainer containing pool of CasProcessors
- * @throws ResourceConfigurationException the resource configuration exception
+ * @throws ResourceConfigurationException
+ * the resource configuration exception
*/
@Override
public ProcessingContainer deployCasProcessor(List aCasProcessorList, boolean redeploy)
@@ -134,14 +140,12 @@ public class CPEDeployerDefaultImpl implements CasProcessorDeployer {
}
casProcessorPool = new ServiceProxyPool();
// Instantiate an object that encapsulates CasProcessor configuration
- casProcessorConfig = new CasProcessorConfigurationJAXBImpl(cpeCasProcessor, cpeFactory.getResourceManager());
+ casProcessorConfig = new CasProcessorConfigurationJAXBImpl(cpeCasProcessor,
+ cpeFactory.getResourceManager());
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "initialize",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_cp_checkpoint__FINEST",
new Object[] { Thread.currentThread().getName(),
String.valueOf(casProcessorConfig.getBatchSize()) });// Checkpoint().getBatch())});
@@ -166,9 +170,9 @@ public class CPEDeployerDefaultImpl implements CasProcessorDeployer {
"UIMA_CPM_cp_no_name__SEVERE",
new Object[] { Thread.currentThread().getName() });
}
- throw new ResourceConfigurationException(
- InvalidXMLException.REQUIRED_ATTRIBUTE_MISSING, new Object[] { "name",
- "casProcessor" }, new Exception(CpmLocalizedMessage.getLocalizedMessage(
+ throw new ResourceConfigurationException(InvalidXMLException.REQUIRED_ATTRIBUTE_MISSING,
+ new Object[] { "name", "casProcessor" },
+ new Exception(CpmLocalizedMessage.getLocalizedMessage(
CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_EXP_missing_attribute_from_xml_element__WARNING",
new Object[] { Thread.currentThread().getName(), "n/a", "name",
@@ -180,11 +184,11 @@ public class CPEDeployerDefaultImpl implements CasProcessorDeployer {
casProcessorConfig = processingContainer.getCasProcessorConfiguration();
if (casProcessorConfig == null) {
throw new ResourceConfigurationException(InvalidXMLException.ELEMENT_NOT_FOUND,
- new Object[] { "<casProcessor>", "<casProcessors>" }, new Exception(
- CpmLocalizedMessage.getLocalizedMessage(
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_bad_cpe_descriptor_no_cp__WARNING",
- new Object[] { Thread.currentThread().getName() })));
+ new Object[] { "<casProcessor>", "<casProcessors>" },
+ new Exception(CpmLocalizedMessage.getLocalizedMessage(
+ CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_EXP_bad_cpe_descriptor_no_cp__WARNING",
+ new Object[] { Thread.currentThread().getName() })));
}
}
// Add CasProcess to the instance pool
@@ -212,9 +216,10 @@ public class CPEDeployerDefaultImpl implements CasProcessorDeployer {
* Deploys integrated Cas Processor using configuration available in a given Container. This
* routine is called when the CasProcessor fails and needs to be restarted.
*
- * @param aProcessingContainer -
- * container managing Cas Processor
- * @throws ResourceConfigurationException the resource configuration exception
+ * @param aProcessingContainer
+ * - container managing Cas Processor
+ * @throws ResourceConfigurationException
+ * the resource configuration exception
*/
@Override
public void deployCasProcessor(ProcessingContainer aProcessingContainer)
@@ -244,10 +249,11 @@ public class CPEDeployerDefaultImpl implements CasProcessorDeployer {
/**
* Creates an instance of integrated Cas Processor from a given descriptor.
*
- * @param aDescriptor -
- * Cas Processor descriptor
+ * @param aDescriptor
+ * - Cas Processor descriptor
* @return - instantiated CasProcessor
- * @throws ResourceConfigurationException wraps Exception
+ * @throws ResourceConfigurationException
+ * wraps Exception
*/
private CasProcessor produceIntegratedCasProcessor(URL aDescriptor)
throws ResourceConfigurationException {
@@ -257,19 +263,20 @@ public class CPEDeployerDefaultImpl implements CasProcessorDeployer {
ResourceSpecifier resourceSpecifier = cpeFactory.getSpecifier(aDescriptor);
if (resourceSpecifier instanceof AnalysisEngineDescription) {
- casProcessor = UIMAFramework.produceAnalysisEngine(resourceSpecifier, this.cpeFactory
- .getResourceManager(), null);
+ casProcessor = UIMAFramework.produceAnalysisEngine(resourceSpecifier,
+ this.cpeFactory.getResourceManager(), null);
// casProcessor.
} else if (resourceSpecifier instanceof CasConsumerDescription) {
- if (cpeFactory.isDefinitionInstanceOf(CasConsumer.class, resourceSpecifier, aDescriptor.toString())) {
+ if (cpeFactory.isDefinitionInstanceOf(CasConsumer.class, resourceSpecifier,
+ aDescriptor.toString())) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST,
this.getClass().getName(), "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_producing_cas_consumer__FINEST",
new Object[] { Thread.currentThread().getName() });
}
- casProcessor = UIMAFramework.produceCasConsumer(resourceSpecifier, this.cpeFactory
- .getResourceManager(), null);
+ casProcessor = UIMAFramework.produceCasConsumer(resourceSpecifier,
+ this.cpeFactory.getResourceManager(), null);
} else if (cpeFactory.isDefinitionInstanceOf(CasProcessor.class, resourceSpecifier,
aDescriptor.toString())) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
@@ -286,7 +293,8 @@ public class CPEDeployerDefaultImpl implements CasProcessorDeployer {
// Check if CasProcesser has been instantiated
if (casProcessor == null) {
throw new ResourceConfigurationException(ResourceServiceException.RESOURCE_UNAVAILABLE,
- new Object[] {}, new Exception(CpmLocalizedMessage.getLocalizedMessage(
+ new Object[] {},
+ new Exception(CpmLocalizedMessage.getLocalizedMessage(
CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_EXP_instantiation_exception__WARNING", new Object[] {
Thread.currentThread().getName(), "Integrated Cas Processor" })));
@@ -297,18 +305,21 @@ public class CPEDeployerDefaultImpl implements CasProcessorDeployer {
} catch (Exception e) {
e.printStackTrace();
throw new ResourceConfigurationException(ResourceServiceException.RESOURCE_UNAVAILABLE,
- new Object[] {}, new Exception(CpmLocalizedMessage.getLocalizedMessage(
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_instantiation_exception__WARNING", new Object[] {
- Thread.currentThread().getName(), "Integrated Cas Processor" })));
+ new Object[] {},
+ new Exception(
+ CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_EXP_instantiation_exception__WARNING", new Object[] {
+ Thread.currentThread().getName(), "Integrated Cas Processor" })));
}
return casProcessor;
}
-
- /* (non-Javadoc)
- * @see org.apache.uima.collection.impl.base_cpm.container.deployer.CasProcessorDeployer#undeploy()
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.uima.collection.impl.base_cpm.container.deployer.CasProcessorDeployer#undeploy()
*/
@Override
public void undeploy() throws CasProcessorDeploymentException {
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/DeployFactory.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/DeployFactory.java
index 1b90182..2bfd886 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/DeployFactory.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/DeployFactory.java
@@ -49,17 +49,21 @@ public class DeployFactory {
private DeployFactory() {
}
-
+
/**
* Returns a
* {@link org.apache.uima.collection.impl.base_cpm.container.deployer.CasProcessorDeployer} object
* that specializes in deploying components as either local, remote, or integrated.
*
- * @param aCpeFactory cpe factory
- * @param aCasProcessorConfig cpe configuration reference
- * @param aPca mode of deployment.
+ * @param aCpeFactory
+ * cpe factory
+ * @param aCasProcessorConfig
+ * cpe configuration reference
+ * @param aPca
+ * mode of deployment.
* @return appropriate deployer object for the mode of depolyment
- * @throws ResourceConfigurationException missing protocol or other deployment error
+ * @throws ResourceConfigurationException
+ * missing protocol or other deployment error
*/
public static CasProcessorDeployer getDeployer(CPEFactory aCpeFactory,
@@ -73,8 +77,8 @@ public class DeployFactory {
String protocol = getProtocol(aCasProcessorConfig, aCpeFactory.getResourceManager());
if (protocol == null || protocol.trim().length() == 0) {
throw new ResourceConfigurationException(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_invalid_service_descriptor__SEVERE", new Object[] {
- Thread.currentThread().getName(), "<uriSpecifier>", "<protocol>" },
+ "UIMA_CPM_invalid_service_descriptor__SEVERE",
+ new Object[] { Thread.currentThread().getName(), "<uriSpecifier>", "<protocol>" },
new Exception(CpmLocalizedMessage.getLocalizedMessage(
CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_EXP_invalid_service_descriptor__WARNING", new Object[] {
@@ -94,28 +98,32 @@ public class DeployFactory {
return new CPEDeployerDefaultImpl(aCpeFactory);
}
throw new ResourceConfigurationException(InvalidXMLException.REQUIRED_ATTRIBUTE_MISSING,
- new Object[] { "deployment", "casProcessor" }, new Exception(CpmLocalizedMessage
- .getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_Exception_invalid_deployment__WARNING", new Object[] {
- Thread.currentThread().getName(), aCasProcessorConfig.getName(),
- deployMode })));
+ new Object[] { "deployment", "casProcessor" },
+ new Exception(CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_Exception_invalid_deployment__WARNING",
+ new Object[] { Thread.currentThread().getName(), aCasProcessorConfig.getName(),
+ deployMode })));
}
/**
* Retrieve protocol from the service descriptor
*
- * @param aCasProcessorConfig Cas Processor configuration
- * @param aResourceManager needed to resolve import by name
+ * @param aCasProcessorConfig
+ * Cas Processor configuration
+ * @param aResourceManager
+ * needed to resolve import by name
* @return - protocol as string (vinci, socket)
*
- * @throws ResourceConfigurationException wraps Exception
+ * @throws ResourceConfigurationException
+ * wraps Exception
*/
- public static String getProtocol(CpeCasProcessor aCasProcessorConfig, ResourceManager aResourceManager)
- throws ResourceConfigurationException {
+ public static String getProtocol(CpeCasProcessor aCasProcessorConfig,
+ ResourceManager aResourceManager) throws ResourceConfigurationException {
try {
- URL clientServiceDescriptor = aCasProcessorConfig.getCpeComponentDescriptor().findAbsoluteUrl(aResourceManager);
- ResourceSpecifier resourceSpecifier = UIMAFramework.getXMLParser().parseResourceSpecifier(
- new XMLInputSource(clientServiceDescriptor));
+ URL clientServiceDescriptor = aCasProcessorConfig.getCpeComponentDescriptor()
+ .findAbsoluteUrl(aResourceManager);
+ ResourceSpecifier resourceSpecifier = UIMAFramework.getXMLParser()
+ .parseResourceSpecifier(new XMLInputSource(clientServiceDescriptor));
if (resourceSpecifier instanceof URISpecifier) {
return ((URISpecifier) resourceSpecifier).getProtocol();
}
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/FencedProcessReaper.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/FencedProcessReaper.java
index 96d6ba0..47a233e 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/FencedProcessReaper.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/FencedProcessReaper.java
@@ -28,7 +28,6 @@ import org.apache.uima.util.Level;
*/
public class FencedProcessReaper {
-
public FencedProcessReaper() {
}
@@ -36,8 +35,8 @@ public class FencedProcessReaper {
/**
* When running on linux this method kill a process identified by a given PID.
*
- * @param aPid -
- * process id to kill
+ * @param aPid
+ * - process id to kill
*/
public void killProcess(String aPid) {
try {
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/JavaApplication.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/JavaApplication.java
index b462583..3487250 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/JavaApplication.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/JavaApplication.java
@@ -34,7 +34,6 @@ import org.apache.uima.resource.ResourceConfigurationException;
import org.apache.uima.util.Level;
import org.apache.uima.util.UriUtils;
-
/**
* Component responsible for configuring command line for java based CasProcessor. Each CasProcessor
* is configured via CPE descriptor either statically (xml file) or dynamically by means of APIs. In
@@ -44,28 +43,32 @@ import org.apache.uima.util.UriUtils;
*
*/
public class JavaApplication extends RunnableApplication {
-
+
/**
* Creates an instance of component responsible for configuring java based CasProcessor.
*
- * @param aCasProcessorConfiguration -
- * configuration for CasProcessor
- * @param aJaxbCasProcessorConfig the a jaxb cas processor config
- * @throws ResourceConfigurationException passthru
+ * @param aCasProcessorConfiguration
+ * - configuration for CasProcessor
+ * @param aJaxbCasProcessorConfig
+ * the a jaxb cas processor config
+ * @throws ResourceConfigurationException
+ * passthru
*/
public JavaApplication(CasProcessorConfiguration aCasProcessorConfiguration,
CpeCasProcessor aJaxbCasProcessorConfig) throws ResourceConfigurationException {
- addApplicationInfo(aCasProcessorConfiguration, aJaxbCasProcessorConfig);
+ addApplicationInfo(aCasProcessorConfiguration, aJaxbCasProcessorConfig);
}
/**
* Sets up command line used to launch Cas Processor in a separate process. Combines environment
* variables setup in the CPE descriptor with a System environment variables.
*
- * @param aCasProcessorConfiguration -
- * access to Cas Processor configuration
- * @param aCasProcessor the a cas processor
- * @throws ResourceConfigurationException passthru
+ * @param aCasProcessorConfiguration
+ * - access to Cas Processor configuration
+ * @param aCasProcessor
+ * the a cas processor
+ * @throws ResourceConfigurationException
+ * passthru
*/
@Override
protected void addApplicationInfo(CasProcessorConfiguration aCasProcessorConfiguration,
@@ -80,18 +83,19 @@ public class JavaApplication extends RunnableApplication {
* Adds to command line any program arguments configured for this Cas Processor in the CPE
* descriptor.
*
- * @param aCasProcessorConfiguration -
- * Cas Processor configuration
- * @param argList -
- * list of arguments set up in the CPE descriptor
- * @param aExecutable -
- * executable program
+ * @param aCasProcessorConfiguration
+ * - Cas Processor configuration
+ * @param argList
+ * - list of arguments set up in the CPE descriptor
+ * @param aExecutable
+ * - executable program
* @return - complete command line ready for use
- * @throws ResourceConfigurationException the resource configuration exception
+ * @throws ResourceConfigurationException
+ * the resource configuration exception
*/
protected String[] addApplicationCmdLineArguments(
- CasProcessorConfiguration aCasProcessorConfiguration, List argList, String aExecutable)
- throws ResourceConfigurationException {
+ CasProcessorConfiguration aCasProcessorConfiguration, List argList, String aExecutable)
+ throws ResourceConfigurationException {
ArrayList cmdArgs = new ArrayList();
// build commandline
cmdArgs.add(aExecutable);
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/NonJavaApplication.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/NonJavaApplication.java
index ec2e54f..7b4127b 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/NonJavaApplication.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/NonJavaApplication.java
@@ -51,10 +51,12 @@ public class NonJavaApplication extends RunnableApplication {
* Sets up command line used to launch Cas Processor in a seperate process. Combines environment
* variables setup in the CPE descriptor with a System environment variables.
*
- * @param aCasProcessorConfiguration -
- * access to Cas Processor configuration
- * @param aCasProcessor -
- * @throws ResourceConfigurationException passthru
+ * @param aCasProcessorConfiguration
+ * - access to Cas Processor configuration
+ * @param aCasProcessor
+ * -
+ * @throws ResourceConfigurationException
+ * passthru
*/
@Override
protected void addApplicationInfo(CasProcessorConfiguration aCasProcessorConfiguration,
@@ -71,19 +73,19 @@ public class NonJavaApplication extends RunnableApplication {
/**
* Returns final command line as array of Strings.
*
- * @param aCasProcessorConfiguration -
- * Cas Processor configuration
- * @param argList -
- * arguments configured for the CasProcessor in cpe descriptor
- * @param aExecutable -
- * name of the program to launch
+ * @param aCasProcessorConfiguration
+ * - Cas Processor configuration
+ * @param argList
+ * - arguments configured for the CasProcessor in cpe descriptor
+ * @param aExecutable
+ * - name of the program to launch
* @return - command line as array of Strings
- * @throws ResourceConfigurationException -
+ * @throws ResourceConfigurationException
+ * -
*/
protected String[] addApplicationCmdLineArguments(
- CasProcessorConfiguration aCasProcessorConfiguration, List argList, String aExecutable)
- throws ResourceConfigurationException
- {
+ CasProcessorConfiguration aCasProcessorConfiguration, List argList, String aExecutable)
+ throws ResourceConfigurationException {
ArrayList cmdArgs = new ArrayList();
cmdArgs.add(aExecutable);
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/RunnableApplication.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/RunnableApplication.java
index 5afaff1..31ed78b 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/RunnableApplication.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/RunnableApplication.java
@@ -37,12 +37,11 @@ import org.apache.uima.internal.util.SystemEnvReader;
import org.apache.uima.resource.ResourceConfigurationException;
import org.apache.uima.util.Level;
-
/**
* The Class RunnableApplication.
*/
public class RunnableApplication {
-
+
/** The executable. */
protected String executable;
@@ -54,7 +53,7 @@ public class RunnableApplication {
/** The arg list. */
protected List argList = new ArrayList();
-
+
/** The sys env vars. */
private Properties sysEnvVars = null;
@@ -62,10 +61,12 @@ public class RunnableApplication {
* Sets up command line used to launch Cas Processor in a separate process. Combines environment
* variables setup in the CPE descriptor with a System environment variables.
*
- * @param aCasProcessorConfiguration -
- * access to Cas Processor configuration
- * @param aCasProcessor the a cas processor
- * @throws ResourceConfigurationException wraps Exception
+ * @param aCasProcessorConfiguration
+ * - access to Cas Processor configuration
+ * @param aCasProcessor
+ * the a cas processor
+ * @throws ResourceConfigurationException
+ * wraps Exception
*/
protected void addApplicationInfo(CasProcessorConfiguration aCasProcessorConfiguration,
CpeCasProcessor aCasProcessor) throws ResourceConfigurationException {
@@ -102,12 +103,12 @@ public class RunnableApplication {
environment.clear();
boolean pathDone = false;
boolean classpathDone = false;
-
+
if (descrptrEnvVars != null) {
// First copy all env vars from the CPE Descriptor treating PATH and CLASSPATH as special
// cases
-
+
for (CasProcessorRuntimeEnvParam descrptrEv : descrptrEnvVars) {
String key = descrptrEv.getEnvParamName();
String value = descrptrEv.getEnvParamValue();
@@ -127,8 +128,8 @@ public class RunnableApplication {
if (key.equalsIgnoreCase("CLASSPATH")) {
String classpath = getSysEnvVarValue(key);
if (classpath != null) {
- environment.add(key + "=" + value + System.getProperty("path.separator")
- + classpath);
+ environment
+ .add(key + "=" + value + System.getProperty("path.separator") + classpath);
} else {
environment.add(key + "=" + value + System.getProperty("path.separator"));
}
@@ -146,8 +147,8 @@ public class RunnableApplication {
while (envKeys.hasMoreElements()) {
String key = (String) envKeys.nextElement();
// Skip those vars that we've already setup above
- if ((key.equalsIgnoreCase("PATH") && pathDone) ||
- (key.equalsIgnoreCase("CLASSPATH") && classpathDone)) {
+ if ((key.equalsIgnoreCase("PATH") && pathDone)
+ || (key.equalsIgnoreCase("CLASSPATH") && classpathDone)) {
continue;
}
environment.add(key + "=" + sysEnvVars.getProperty(key));
@@ -156,7 +157,7 @@ public class RunnableApplication {
String[] envArray = new String[environment.size()];
environment.toArray(envArray);
exec.setEnvironment(envArray);
-
+
CasProcessorExecArg[] args = rip.getExecutable().getAllCasProcessorExecArgs();
for (int i = 0; args != null && i < args.length; i++) {
argList.add(args[i]);
@@ -193,14 +194,14 @@ public class RunnableApplication {
/**
* Returns a value of a given environment variable.
*
- * @param aKey -
- * name of the environment variable
+ * @param aKey
+ * - name of the environment variable
* @return - value correspnding to environment variable
*/
protected String getSysEnvVarValue(String aKey) {
try {
// Retrieve all env variables
-// sysEnv = SystemEnvReader.getEnvVars(); // already done, do only once
+ // sysEnv = SystemEnvReader.getEnvVars(); // already done, do only once
Enumeration sysKeys = sysEnvVars.keys();
while (sysKeys.hasMoreElements()) {
String key = (String) sysKeys.nextElement();
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/VinciTAP.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/VinciTAP.java
index 8daf030..1197b1a 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/VinciTAP.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/VinciTAP.java
@@ -61,7 +61,6 @@ import org.apache.vinci.transport.VinciFrame;
import org.apache.vinci.transport.context.VinciContext;
import org.apache.vinci.transport.document.AFrame;
-
/**
* Vinci Proxy to remote Cas Processor vinci service. This component is used for both local(
* managed) and remote ( unmanaged) Cas Processors. Its main purpose is to invoke remote APIs on Cas
@@ -70,7 +69,7 @@ import org.apache.vinci.transport.document.AFrame;
*/
public class VinciTAP {
-
+
/** The service host. */
private String serviceHost;
@@ -139,8 +138,8 @@ public class VinciTAP {
/**
* Defines subject of analysis.
*
- * @param aContentTag -
- * subject of analysis
+ * @param aContentTag
+ * - subject of analysis
*/
public void setContentTag(String aContentTag) {
contentTag = aContentTag;
@@ -149,8 +148,8 @@ public class VinciTAP {
/**
* Defines a custom timer to use for stats.
*
- * @param aTimer -
- * custom timer
+ * @param aTimer
+ * - custom timer
*/
public void setTimer(UimaTimer aTimer) {
uimaTimer = aTimer;
@@ -159,8 +158,8 @@ public class VinciTAP {
/**
* Defines types as array that will not be sent to the Cas Processor service.
*
- * @param aKeys2Drop -
- * array of types excluded from the request
+ * @param aKeys2Drop
+ * - array of types excluded from the request
*/
public void setKeys2Drop(String[] aKeys2Drop) {
keys2Drop = aKeys2Drop;
@@ -169,12 +168,13 @@ public class VinciTAP {
/**
* Connects the proxy to Cas Processor running as a vinci service on a given host and port number.
*
- * @param aHost -
- * name of the host where the service is running
- * @param aPort -
- * port number where the service listens for requests
+ * @param aHost
+ * - name of the host where the service is running
+ * @param aPort
+ * - port number where the service listens for requests
*
- * @throws ConnectException wraps Exception or unable to connect
+ * @throws ConnectException
+ * wraps Exception or unable to connect
*/
public void connect(String aHost, int aPort) throws ConnectException {
int attemptCount = 0;
@@ -265,15 +265,10 @@ public class VinciTAP {
} catch (Exception e) {
if (e instanceof ConnectException) {
if (UIMAFramework.getLogger().isLoggable(Level.WARNING)) {
- UIMAFramework.getLogger(this.getClass())
- .logrb(
- Level.WARNING,
- this.getClass().getName(),
- "initialize",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_connection_not_established__WARNING",
- new Object[] { Thread.currentThread().getName(), aHost,
- String.valueOf(aPort) });
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.WARNING, this.getClass().getName(),
+ "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_connection_not_established__WARNING", new Object[] {
+ Thread.currentThread().getName(), aHost, String.valueOf(aPort) });
}
try {
Thread.sleep(100);
@@ -289,8 +284,7 @@ public class VinciTAP {
}
if (UIMAFramework.getLogger().isLoggable(Level.WARNING)) {
UIMAFramework.getLogger(this.getClass()).logrb(Level.WARNING, this.getClass().getName(),
- "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_connection_failed__WARNING",
+ "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_connection_failed__WARNING",
new Object[] { Thread.currentThread().getName(), aHost, String.valueOf(aPort) });
}
throw new ConnectException(CpmLocalizedMessage.getLocalizedMessage(
@@ -301,8 +295,8 @@ public class VinciTAP {
/**
* Define the max time in millis the proxy will wait for response from remote service.
*
- * @param aTimeout -
- * number of millis to wait
+ * @param aTimeout
+ * - number of millis to wait
*/
public void setTimeout(int aTimeout) {
timeout = aTimeout;
@@ -311,9 +305,10 @@ public class VinciTAP {
/**
* Connects to external service using service name as a way to locate it.
*
- * @param aServiceName -
- * name of the service
- * @throws ServiceConnectionException the service connection exception
+ * @param aServiceName
+ * - name of the service
+ * @throws ServiceConnectionException
+ * the service connection exception
*/
public void connect(String aServiceName) throws ServiceConnectionException {
// To locate the service by name the VNS is critical. Make sure we know where it is
@@ -321,8 +316,7 @@ public class VinciTAP {
if (UIMAFramework.getLogger().isLoggable(Level.SEVERE)) {
UIMAFramework.getLogger(this.getClass()).logrb(Level.SEVERE, this.getClass().getName(),
- "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_vns_not_provided__SEVERE",
+ "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_vns_not_provided__SEVERE",
new Object[] { Thread.currentThread().getName() });
}
throw new ServiceConnectionException(CpmLocalizedMessage.getLocalizedMessage(
@@ -335,12 +329,8 @@ public class VinciTAP {
try {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "initialize",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_locating_service__FINEST",
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_locating_service__FINEST",
new Object[] { Thread.currentThread().getName(), aServiceName,
System.getProperty("VNS_HOST"), System.getProperty("VNS_PORT") });
}
@@ -350,8 +340,7 @@ public class VinciTAP {
vctx.setVNSPort(Integer.parseInt(getVNSPort()));
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).log(
- Level.FINEST,
+ UIMAFramework.getLogger(this.getClass()).log(Level.FINEST,
Thread.currentThread().getName() + " Connecting to::" + aServiceName
+ " VinciContext.getVNSHost():" + vctx.getVNSHost()
+ " VinciContext.getVNSPort():" + vctx.getVNSPort()); // getVNSHost());
@@ -361,11 +350,8 @@ public class VinciTAP {
conn.setSocketTimeout(timeout);
conn.setRetry(false);
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "initialize",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_set_service_timeout__FINEST",
new Object[] { Thread.currentThread().getName(),
aServiceName + ":" + String.valueOf(timeout) });
@@ -383,8 +369,8 @@ public class VinciTAP {
"UIMA_CPM_connection_failed__WARNING",
new Object[] { Thread.currentThread().getName(), aServiceName, "" });
- UIMAFramework.getLogger(this.getClass()).log(Level.FINEST,
- Thread.currentThread().getName(), e);
+ UIMAFramework.getLogger(this.getClass()).log(Level.FINEST, Thread.currentThread().getName(),
+ e);
}
}
@@ -397,8 +383,10 @@ public class VinciTAP {
/**
* Test and reconnect.
*
- * @throws ServiceException the service exception
- * @throws ServiceConnectionException the service connection exception
+ * @throws ServiceException
+ * the service exception
+ * @throws ServiceConnectionException
+ * the service connection exception
*/
private void testAndReconnect() throws ServiceException, ServiceConnectionException {
// Make sure there is valid connection to the service and if there isnt one establish it
@@ -420,10 +408,10 @@ public class VinciTAP {
}
} catch (ConnectException ce) {
if (serviceName != null) {
- throw new ServiceException(CpmLocalizedMessage.getLocalizedMessage(
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_unable_to_connect_toservice__WARNING", new Object[] {
- Thread.currentThread().getName(), serviceName }));
+ throw new ServiceException(
+ CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_EXP_unable_to_connect_toservice__WARNING",
+ new Object[] { Thread.currentThread().getName(), serviceName }));
} else {
throw new ServiceException(CpmLocalizedMessage.getLocalizedMessage(
CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_EXP_unable_to_connect__WARNING",
@@ -441,22 +429,20 @@ public class VinciTAP {
/**
* Send a given Vinci Frame to the remote vinci service and return result.
*
- * @param aFrame -
- * Vinci Frame containing request
+ * @param aFrame
+ * - Vinci Frame containing request
* @return AFrame - Frame containing result
- * @throws ServiceException the service exception
- * @throws ServiceConnectionException the service connection exception
+ * @throws ServiceException
+ * the service exception
+ * @throws ServiceConnectionException
+ * the service connection exception
*/
public AFrame sendAndReceive(AFrame aFrame) throws ServiceException, ServiceConnectionException {
int currentTimeout = 0;
currentTimeout = conn.getSocketTimeout();
if (UIMAFramework.getLogger().isLoggable(Level.FINE)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINE,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_sending_process_req__FINEST",
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINE, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_sending_process_req__FINEST",
new Object[] { Thread.currentThread().getName(), serviceHost, servicePort,
String.valueOf(currentTimeout) });
}
@@ -471,11 +457,8 @@ public class VinciTAP {
long memStart = Runtime.getRuntime().freeMemory();
if (System.getProperty("SHOW_MEMORY") != null) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_show_memory_before_call__FINEST",
new Object[] { Thread.currentThread().getName(),
String.valueOf(Runtime.getRuntime().totalMemory() / 1024),
@@ -483,11 +466,8 @@ public class VinciTAP {
}
responseFrame = (AFrame) conn.sendAndReceive(aFrame, AFrame.getAFrameFactory(), timeout);
if (System.getProperty("SHOW_MEMORY") != null) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_show_memory_after_call__FINEST",
new Object[] { Thread.currentThread().getName(),
String.valueOf(Runtime.getRuntime().totalMemory() / 1024),
@@ -500,11 +480,8 @@ public class VinciTAP {
}
return responseFrame;
} catch (VNSException vnse) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.WARNING,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.WARNING, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_failed_service_request__WARNING",
new Object[] { Thread.currentThread().getName(), conn.getHost(),
String.valueOf(conn.getPort()) });
@@ -514,11 +491,8 @@ public class VinciTAP {
conn.close();
throw new ServiceException(vnse.getMessage());
} catch (ServiceDownException sde) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.WARNING,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.WARNING, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_failed_service_request__WARNING",
new Object[] { Thread.currentThread().getName(), conn.getHost(),
String.valueOf(conn.getPort()) });
@@ -527,11 +501,8 @@ public class VinciTAP {
conn.close();
throw new ServiceConnectionException(sde.getMessage());
} catch (ServiceException sde) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.WARNING,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.WARNING, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_failed_service_request__WARNING",
new Object[] { Thread.currentThread().getName(), conn.getHost(),
String.valueOf(conn.getPort()) });
@@ -542,11 +513,8 @@ public class VinciTAP {
}
throw new ServiceConnectionException(sde.getMessage());
} catch (IOException e) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.WARNING,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.WARNING, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_failed_service_request__WARNING",
new Object[] { Thread.currentThread().getName(), conn.getHost(),
String.valueOf(conn.getPort()) });
@@ -566,11 +534,8 @@ public class VinciTAP {
new Object[] { Thread.currentThread().getName(), conn.getHost(),
String.valueOf(conn.getPort()), String.valueOf(currentTimeout) }));
} catch (Exception e) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.WARNING,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.WARNING, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_failed_service_request__WARNING",
new Object[] { Thread.currentThread().getName(), conn.getHost(),
String.valueOf(conn.getPort()) });
@@ -587,13 +552,14 @@ public class VinciTAP {
* Appends keys (types) from XCAS to provided CasData instance doing conversions of ':' in WF keys
* to '_colon_' and '-' to '_dash_' to enforce UIMA compliance.
*
- * @param dataCas -
- * instance of CasData where the keys will be appended
- * @param aFrame -
- * source of keys (data)
+ * @param dataCas
+ * - instance of CasData where the keys will be appended
+ * @param aFrame
+ * - source of keys (data)
* @return - modified CasData
*
- * @throws Exception passthru
+ * @throws Exception
+ * passthru
*/
public static CasData addKeysToDataCas(CasData dataCas, AFrame aFrame) throws Exception {
try {
@@ -636,7 +602,8 @@ public class VinciTAP {
/**
* Prints to stdout contents of a given CasData instance.
*
- * @param aCAS the a CAS
+ * @param aCAS
+ * the a CAS
*/
private static void dumpFeatures(CasData aCAS) {
@@ -672,14 +639,15 @@ public class VinciTAP {
* Produces XCas from a given Cas. It selectively copies features from the Cas excluding those
* types that are defined in a given dropKeyList.
*
- * @param aCasData -
- * Cas for which XCAS is built
- * @param dataFrame -
- * XCas frame for data
- * @param aDropKeyList -
- * list of types to exclude from XCas
+ * @param aCasData
+ * - Cas for which XCAS is built
+ * @param dataFrame
+ * - XCas frame for data
+ * @param aDropKeyList
+ * - list of types to exclude from XCas
*
- * @throws Exception passthru
+ * @throws Exception
+ * passthru
*/
private void produceXCASRequestFrame(CasData aCasData, AFrame dataFrame, String[] aDropKeyList)
throws Exception {
@@ -741,8 +709,8 @@ public class VinciTAP {
/**
* Returns true if a given feature represents any of the content (SoFa) types.
*
- * @param feature -
- * type to check
+ * @param feature
+ * - type to check
*
* @return - true if SoFa, false otherwise
*/
@@ -757,15 +725,17 @@ public class VinciTAP {
/**
* Performs Analysis of the CAS by the remote vinci service Cas Processor.
*
- * @param aCas -
- * Cas to analayze
- * @param aPT -
- * performance trace object for stats and totals
- * @param aResourceName -
- * name of the Cas Processor
+ * @param aCas
+ * - Cas to analayze
+ * @param aPT
+ * - performance trace object for stats and totals
+ * @param aResourceName
+ * - name of the Cas Processor
* @return - CAS containing results of analysis
- * @throws ServiceException - passthru, wraps Exception
- * @throws ServiceConnectionException passthru
+ * @throws ServiceException
+ * - passthru, wraps Exception
+ * @throws ServiceConnectionException
+ * passthru
*/
public CasData analyze(CasData aCas, ProcessTrace aPT, String aResourceName)
throws ServiceException, ServiceConnectionException {
@@ -793,8 +763,8 @@ public class VinciTAP {
if (casDataFs != null) {
newCasData.addFeatureStructure(casDataFs);
}
- vinciCasDataConverter.appendVinciFrameToCasData(responseFrame.fgetAFrame("DATA").fgetAFrame(
- "KEYS"), newCasData);
+ vinciCasDataConverter.appendVinciFrameToCasData(
+ responseFrame.fgetAFrame("DATA").fgetAFrame("KEYS"), newCasData);
aCas = newCasData;
aPT.endEvent(aResourceName, "Vinci Response Frame to CAS", "");
@@ -848,8 +818,10 @@ public class VinciTAP {
/**
* Drop named types.
*
- * @param aKeyFrame the a key frame
- * @param aDropKeyList the a drop key list
+ * @param aKeyFrame
+ * the a key frame
+ * @param aDropKeyList
+ * the a drop key list
*/
private void dropNamedTypes(AFrame aKeyFrame, String[] aDropKeyList) {
// Now drop keys this annotator does not want to see
@@ -888,15 +860,18 @@ public class VinciTAP {
* frame. These keys are not required by the annotator thus it is waste of bandwidth to include
* them in the request.
*
- * @param aCasList -
- * a list of Cas to send to service for analysis
- * @param aPT -
- * Process Trace object to aggrate time and stats
- * @param aResourceName -
- * name of the Cas Processor
+ * @param aCasList
+ * - a list of Cas to send to service for analysis
+ * @param aPT
+ * - Process Trace object to aggrate time and stats
+ * @param aResourceName
+ * - name of the Cas Processor
* @return - List of Cas instances containing results of analysis
- * @throws ServiceException - passthru, wraps Exception
- * @throws ServiceConnectionException passthru */
+ * @throws ServiceException
+ * - passthru, wraps Exception
+ * @throws ServiceConnectionException
+ * passthru
+ */
public CasData[] analyze(CasData[] aCasList, ProcessTrace aPT, String aResourceName)
throws ServiceException, ServiceConnectionException {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
@@ -979,7 +954,7 @@ public class VinciTAP {
return aCasList;
}
ArrayList d = new ArrayList();
- if ( responseFrame != null ) {
+ if (responseFrame != null) {
d = responseFrame.fget("DATA");
}
int instanceCount = 0;
@@ -1041,12 +1016,8 @@ public class VinciTAP {
instanceCount++;
} catch (Exception e) {
if (UIMAFramework.getLogger().isLoggable(Level.FINER)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINER,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_exception__FINER",
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINER, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_exception__FINER",
new Object[] { Thread.currentThread().getName(), e.getMessage(),
dataFrame.toXML() });
e.printStackTrace();
@@ -1091,16 +1062,13 @@ public class VinciTAP {
* service.
*
* @return the analysis engine meta data
- * @throws ResourceServiceException the resource service exception
+ * @throws ResourceServiceException
+ * the resource service exception
*/
public ProcessingResourceMetaData getAnalysisEngineMetaData() throws ResourceServiceException {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_request_metadata__FINEST",
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_request_metadata__FINEST",
new Object[] { Thread.currentThread().getName(), serviceName, conn.getHost(),
String.valueOf(conn.getPort()) });
}
@@ -1114,12 +1082,8 @@ public class VinciTAP {
// Send the request to the service and wait for response
resultFrame = (AFrame) conn.sendAndReceive(queryFrame, AFrame.getAFrameFactory(), timeout);
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_return_meta__FINEST",
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_return_meta__FINEST",
new Object[] { Thread.currentThread().getName(), serviceName, conn.getHost(),
String.valueOf(conn.getPort()) });
}
@@ -1133,12 +1097,8 @@ public class VinciTAP {
ProcessingResourceMetaData metadata = (ProcessingResourceMetaData) saxDeser.getObject();
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_done_parsing_meta__FINEST",
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_done_parsing_meta__FINEST",
new Object[] { Thread.currentThread().getName(), serviceName, conn.getHost(),
String.valueOf(conn.getPort()) });
}
@@ -1157,15 +1117,10 @@ public class VinciTAP {
} catch (Exception e) {
if ("No Such Command supported".equals(e.getMessage())) {
if (UIMAFramework.getLogger().isLoggable(Level.WARNING)) {
- UIMAFramework.getLogger(this.getClass())
- .logrb(
- Level.WARNING,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_service_rejected_requested__WARNING",
- new Object[] { Thread.currentThread().getName(), serviceName,
- resultFrame.toXML() });
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.WARNING, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_service_rejected_requested__WARNING", new Object[] {
+ Thread.currentThread().getName(), serviceName, resultFrame.toXML() });
}
return null;
}
@@ -1183,7 +1138,8 @@ public class VinciTAP {
* Let the remote service now that end of batch marker has been reached, the notification is
* one-way meaning the CPE does not expect anything back from the service.
*
- * @throws ResourceServiceException the resource service exception
+ * @throws ResourceServiceException
+ * the resource service exception
*/
public void batchProcessComplete() throws ResourceServiceException {
// For some installations, like WF, dont bother sending end-of-batch marker.
@@ -1196,11 +1152,8 @@ public class VinciTAP {
VinciFrame query = new VinciFrame();
query.fadd("vinci:COMMAND", Constants.BATCH_PROCESS_COMPLETE);
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_send_batch_complete__FINEST",
new Object[] { Thread.currentThread().getName(), conn.getHost(),
String.valueOf(conn.getPort()), query.toXML() });
@@ -1223,7 +1176,8 @@ public class VinciTAP {
* service before returning. This ensures that the request is accepted and the desired logic
* handling end of processing has completed.
*
- * @throws ResourceServiceException wraps Exception
+ * @throws ResourceServiceException
+ * wraps Exception
*/
public void collectionProcessComplete() throws ResourceServiceException {
try {
@@ -1231,11 +1185,8 @@ public class VinciTAP {
VinciFrame query = new VinciFrame();
query.fadd("vinci:COMMAND", Constants.COLLECTION_PROCESS_COMPLETE);
if (UIMAFramework.getLogger().isLoggable(Level.INFO)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_send_collection_complete__FINEST",
new Object[] { Thread.currentThread().getName(), conn.getHost(),
String.valueOf(conn.getPort()), query.toXML() });
@@ -1262,43 +1213,28 @@ public class VinciTAP {
* service shut itself down. It does not even wait for response. It is up to the service to clean
* itself up and terminate.
*
- * @param shutdownService -
- * flag indicating if a shutdown command should be sent to the service
- * @param aDoSendNotification -
- * indicates whether or not to sent CollectionProcessComplete frame to service
+ * @param shutdownService
+ * - flag indicating if a shutdown command should be sent to the service
+ * @param aDoSendNotification
+ * - indicates whether or not to sent CollectionProcessComplete frame to service
* @return - true if shutdown message has been sent without error, false otherwise
*/
public boolean shutdown(boolean shutdownService, boolean aDoSendNotification) {
if (System.getProperty("SHOW_STATS") != null) {
- UIMAFramework.getLogger(this.getClass())
- .logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_time_spent_serializing_xcas__FINEST",
- new Object[] { Thread.currentThread().getName(),
- String.valueOf(totalSerializeTime) });
-
- UIMAFramework.getLogger(this.getClass())
- .logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_time_spent_deserializing_xcas__FINEST",
- new Object[] { Thread.currentThread().getName(),
- String.valueOf(totalDeSerializeTime) });
-
- UIMAFramework.getLogger(this.getClass())
- .logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_time_spent_in_transit__FINEST",
- new Object[] { Thread.currentThread().getName(),
- String.valueOf(totalRoundTripTime) });
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_time_spent_serializing_xcas__FINEST", new Object[] {
+ Thread.currentThread().getName(), String.valueOf(totalSerializeTime) });
+
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_time_spent_deserializing_xcas__FINEST", new Object[] {
+ Thread.currentThread().getName(), String.valueOf(totalDeSerializeTime) });
+
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_time_spent_in_transit__FINEST",
+ new Object[] { Thread.currentThread().getName(),
+ String.valueOf(totalRoundTripTime) });
}
try {
@@ -1313,11 +1249,8 @@ public class VinciTAP {
VinciFrame query = new VinciFrame();
query.fadd("vinci:COMMAND", Constants.SHUTDOWN);
if (UIMAFramework.getLogger().isLoggable(Level.INFO)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.INFO,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.INFO, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_stopping_service__INFO",
new Object[] { Thread.currentThread().getName(), conn.getHost(),
String.valueOf(conn.getPort()), query.toXML() });
@@ -1372,23 +1305,19 @@ public class VinciTAP {
try {
// establish ownership of query object, otherwise IllegalMonitorStateException is
// thrown. Than give the service time to cleanly exit.
-
- if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_waiting_for_service_shutdown__FINEST",
- new Object[] { Thread.currentThread().getName(), String.valueOf(10 - retry),
- "10" });
- }
- Thread.sleep(100); // wait for 100ms to give the service time to exit cleanly
- if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).log(Level.FINEST,
- " Resuming CPE shutdown.Service should be down now.");
- }
-
+
+ if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_waiting_for_service_shutdown__FINEST", new Object[] {
+ Thread.currentThread().getName(), String.valueOf(10 - retry), "10" });
+ }
+ Thread.sleep(100); // wait for 100ms to give the service time to exit cleanly
+ if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
+ UIMAFramework.getLogger(this.getClass()).log(Level.FINEST,
+ " Resuming CPE shutdown.Service should be down now.");
+ }
+
} catch (InterruptedException e) {
}
if (retry-- <= 0) {
@@ -1419,8 +1348,8 @@ public class VinciTAP {
/**
* Sets the VNS port this proxy will use to locate service.
*
- * @param aVNSPort -
- * vns port to use
+ * @param aVNSPort
+ * - vns port to use
*/
public void setVNSPort(String aVNSPort) {
System.setProperty(Vinci.VNS_PORT, aVNSPort);
@@ -1430,8 +1359,8 @@ public class VinciTAP {
/**
* Sets the VNS host this proxy will use to locate service.
*
- * @param aVNSHost -
- * name of the VNS host
+ * @param aVNSHost
+ * - name of the VNS host
*/
public void setVNSHost(String aVNSHost) {
vnsHost = aVNSHost;
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/socket/OFSocketTransportImpl.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/socket/OFSocketTransportImpl.java
index 178cd28..a897361 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/socket/OFSocketTransportImpl.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/socket/OFSocketTransportImpl.java
@@ -33,13 +33,11 @@ import org.apache.uima.cas.CAS;
import org.apache.uima.resource.metadata.ProcessingResourceMetaData;
import org.apache.uima.util.Level;
-
/**
* The Class OFSocketTransportImpl.
*/
public class OFSocketTransportImpl implements SocketTransport {
-
/**
* Instantiates a new OF socket transport impl.
*/
@@ -61,8 +59,9 @@ public class OFSocketTransportImpl implements SocketTransport {
/*
* (non-Javadoc)
*
- * @see org.apache.uima.collection.impl.cpm.container.deployer.socket.SocketTransport#connect(java.net.URL,
- * long)
+ * @see
+ * org.apache.uima.collection.impl.cpm.container.deployer.socket.SocketTransport#connect(java.net.
+ * URL, long)
*/
@Override
public Socket connect(URL aURI, long aTimeout) throws SocketException {
@@ -82,8 +81,9 @@ public class OFSocketTransportImpl implements SocketTransport {
/*
* (non-Javadoc)
*
- * @see org.apache.uima.collection.impl.cpm.container.deployer.socket.SocketTransport#invoke(java.net.Socket,
- * org.apache.uima.cas.CAS)
+ * @see
+ * org.apache.uima.collection.impl.cpm.container.deployer.socket.SocketTransport#invoke(java.net.
+ * Socket, org.apache.uima.cas.CAS)
*/
@Override
public CAS process(Socket aSocket, CAS aCas) throws SocketTimeoutException, SocketException {
@@ -93,8 +93,9 @@ public class OFSocketTransportImpl implements SocketTransport {
try {
if (aSocket.isClosed()) {
- aSocket = connect(new URL("http", aSocket.getInetAddress().getHostName(),
- aSocket.getPort(), ""), 100000);
+ aSocket = connect(
+ new URL("http", aSocket.getInetAddress().getHostName(), aSocket.getPort(), ""),
+ 100000);
}
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
UIMAFramework.getLogger(this.getClass()).log(Level.FINEST,
@@ -146,7 +147,8 @@ public class OFSocketTransportImpl implements SocketTransport {
/*
* (non-Javadoc)
*
- * @see org.apache.uima.collection.impl.cpm.container.deployer.socket.SocketTransport#getProcessingResourceMetaData()
+ * @see org.apache.uima.collection.impl.cpm.container.deployer.socket.SocketTransport#
+ * getProcessingResourceMetaData()
*/
@Override
public ProcessingResourceMetaData getProcessingResourceMetaData(Socket aSocket)
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/socket/ProcessControllerAdapter.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/socket/ProcessControllerAdapter.java
index 32c6c23..c03eba4 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/socket/ProcessControllerAdapter.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/socket/ProcessControllerAdapter.java
@@ -21,29 +21,32 @@ package org.apache.uima.collection.impl.cpm.container.deployer.socket;
import java.net.URL;
-
/**
* Interface for the custom deployer component responsible for launching and terminating fenced
* CasProcessors.
*
*/
public interface ProcessControllerAdapter {
-
+
/**
* Deploys given number of CasProcessors and returns their endpoint configuration( host,port).
* This method blocks until all Connections are resolved or an error occurs.
*
- * @param aCasProcessorName -name of the fenced CasProcessor
- * @param howMany - how many CasProcessor instances to deploy
+ * @param aCasProcessorName
+ * -name of the fenced CasProcessor
+ * @param howMany
+ * - how many CasProcessor instances to deploy
* @return URL[] - list of URLs containing endpoint info
- * @throws Exception the exception
+ * @throws Exception
+ * the exception
*/
URL[] deploy(String aCasProcessorName, int howMany) throws Exception;
/**
* Stops a given CasProcessor service.
*
- * @param aURL - service endpoint.
+ * @param aURL
+ * - service endpoint.
*
*/
void undeploy(URL aURL);
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/socket/SocketCasProcessorDeployer.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/socket/SocketCasProcessorDeployer.java
index 1f72862..51db432 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/socket/SocketCasProcessorDeployer.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/socket/SocketCasProcessorDeployer.java
@@ -42,7 +42,6 @@ import org.apache.uima.resource.ResourceInitializationException;
import org.apache.uima.resource.metadata.ProcessingResourceMetaData;
import org.apache.uima.util.Level;
-
/**
* Reference implementation of the {@link CasProcessorDeployer} component responsible for launch and
* termination of the fenced CasProcessor. It uses a plug-in {@link ProcessControllerAdapter} object
@@ -50,7 +49,7 @@ import org.apache.uima.util.Level;
*
*/
public class SocketCasProcessorDeployer implements CasProcessorDeployer {
-
+
/** The cpe factory. */
private CPEFactory cpeFactory = null;
@@ -62,12 +61,13 @@ public class SocketCasProcessorDeployer implements CasProcessorDeployer {
/** The controller. */
private ProcessControllerAdapter controller = null;
-
/**
* Instantiates a new socket cas processor deployer.
*
- * @param aController the a controller
- * @param aCpeFactory the a cpe factory
+ * @param aController
+ * the a controller
+ * @param aCpeFactory
+ * the a cpe factory
*/
public SocketCasProcessorDeployer(ProcessControllerAdapter aController, CPEFactory aCpeFactory) {
controller = aController;
@@ -77,7 +77,8 @@ public class SocketCasProcessorDeployer implements CasProcessorDeployer {
/**
* Instantiates a new socket cas processor deployer.
*
- * @param aController the a controller
+ * @param aController
+ * the a controller
*/
public SocketCasProcessorDeployer(ProcessControllerAdapter aController) {
controller = aController;
@@ -89,11 +90,15 @@ public class SocketCasProcessorDeployer implements CasProcessorDeployer {
* processing thread created here. The <i>aCasProcessorList</i> contains instantiated Cas
* Processors. These are instantiated by the CPEFactory.
*
- * @param aCasProcessorList - list containing instantiated Cas Processors
- * @param aEngine the a engine
- * @param redeploy - true when redeploying failed Cas Processor
+ * @param aCasProcessorList
+ * - list containing instantiated Cas Processors
+ * @param aEngine
+ * the a engine
+ * @param redeploy
+ * - true when redeploying failed Cas Processor
* @return - ProcessingContainer containing pool of CasProcessors
- * @throws ResourceConfigurationException the resource configuration exception
+ * @throws ResourceConfigurationException
+ * the resource configuration exception
*/
public ProcessingContainer deployCasProcessor(List aCasProcessorList, CPMEngine aEngine,
boolean redeploy) throws ResourceConfigurationException {
@@ -103,10 +108,13 @@ public class SocketCasProcessorDeployer implements CasProcessorDeployer {
/**
* Uses ProcessControllerAdapter instance to launch fenced CasProcessor.
*
- * @param aCasProcessorList the a cas processor list
- * @param redeploy the redeploy
+ * @param aCasProcessorList
+ * the a cas processor list
+ * @param redeploy
+ * the redeploy
* @return the processing container
- * @throws ResourceConfigurationException the resource configuration exception
+ * @throws ResourceConfigurationException
+ * the resource configuration exception
*/
@Override
public ProcessingContainer deployCasProcessor(List aCasProcessorList, boolean redeploy)
@@ -152,7 +160,8 @@ public class SocketCasProcessorDeployer implements CasProcessorDeployer {
// through
// getCasProcessor() and releaseProcessor() methods.
// Create CasProcess Configuration holding info defined in the CPE descriptor
- casProcessorConfig = new CasProcessorConfigurationJAXBImpl(casProcessorType, cpeFactory.getResourceManager());
+ casProcessorConfig = new CasProcessorConfigurationJAXBImpl(casProcessorType,
+ cpeFactory.getResourceManager());
// Associate CasProcessor configuration from CPE descriptor with this container
processingContainer = new ProcessingContainer_Impl(casProcessorConfig, metaData,
@@ -170,8 +179,8 @@ public class SocketCasProcessorDeployer implements CasProcessorDeployer {
"UIMA_CPM_unable_to_read_meta__SEVERE", Thread.currentThread().getName());
}
throw new ResourceConfigurationException(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_casprocessor_no_name_found__SEVERE", new Object[] { Thread
- .currentThread().getName() });
+ "UIMA_CPM_casprocessor_no_name_found__SEVERE",
+ new Object[] { Thread.currentThread().getName() });
}
}
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
@@ -199,15 +208,15 @@ public class SocketCasProcessorDeployer implements CasProcessorDeployer {
// There is one instance of ProcessingContainer for set of CasProcessors
if (processingContainer == null) {
throw new ResourceConfigurationException(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_invalid_container__SEVERE", new Object[] { Thread.currentThread()
- .getName() });
+ "UIMA_CPM_invalid_container__SEVERE",
+ new Object[] { Thread.currentThread().getName() });
}
// Assumption is that the container already exists and it contains CasProcessor configuration
casProcessorConfig = processingContainer.getCasProcessorConfiguration();
if (casProcessorConfig == null) {
throw new ResourceConfigurationException(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_container_configuration_not_found__SEVERE", new Object[] { Thread
- .currentThread().getName() });
+ "UIMA_CPM_container_configuration_not_found__SEVERE",
+ new Object[] { Thread.currentThread().getName() });
}
} catch (ResourceConfigurationException e) {
if (UIMAFramework.getLogger().isLoggable(Level.SEVERE)) {
@@ -226,8 +235,10 @@ public class SocketCasProcessorDeployer implements CasProcessorDeployer {
/**
* Uses ProcessControllerAdapter instance to launch fenced CasProcessor.
*
- * @param aProcessingContainer the a processing container
- * @throws ResourceConfigurationException the resource configuration exception
+ * @param aProcessingContainer
+ * the a processing container
+ * @throws ResourceConfigurationException
+ * the resource configuration exception
*/
@Override
public void deployCasProcessor(ProcessingContainer aProcessingContainer)
@@ -240,15 +251,10 @@ public class SocketCasProcessorDeployer implements CasProcessorDeployer {
ServiceProxyPool pool = aProcessingContainer.getPool();
if (pool == null) {
if (UIMAFramework.getLogger().isLoggable(Level.SEVERE)) {
- UIMAFramework.getLogger(this.getClass())
- .logrb(
- Level.SEVERE,
- this.getClass().getName(),
- "initialize",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_no_service_proxy__SEVERE",
- new Object[] { Thread.currentThread().getName(),
- aProcessingContainer.getName() });
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.SEVERE, this.getClass().getName(),
+ "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_no_service_proxy__SEVERE", new Object[] {
+ Thread.currentThread().getName(), aProcessingContainer.getName() });
}
throw new ResourceConfigurationException(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_no_service_proxy__SEVERE", new Object[] {
@@ -259,16 +265,12 @@ public class SocketCasProcessorDeployer implements CasProcessorDeployer {
while (totalPoolSize != pool.getSize()) {
try {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.SEVERE,
- this.getClass().getName(),
- "initialize",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_wait_for_service_proxy_pool__FINEST",
- new Object[] { Thread.currentThread().getName(),
- aProcessingContainer.getName() });
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.SEVERE,
+ this.getClass().getName(), "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_wait_for_service_proxy_pool__FINEST", new Object[] {
+ Thread.currentThread().getName(), aProcessingContainer.getName() });
}
- pool.wait(); // pool has notifyall when it changes the pool.getSize() result
+ pool.wait(); // pool has notifyall when it changes the pool.getSize() result
} catch (Exception e) {
}
}
@@ -280,15 +282,10 @@ public class SocketCasProcessorDeployer implements CasProcessorDeployer {
pool.checkIn(cProcessor);
cProcessor = null;
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass())
- .logrb(
- Level.SEVERE,
- this.getClass().getName(),
- "initialize",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_deploying_service__FINEST",
- new Object[] { Thread.currentThread().getName(),
- aProcessingContainer.getName() });
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.SEVERE, this.getClass().getName(),
+ "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_deploying_service__FINEST", new Object[] {
+ Thread.currentThread().getName(), aProcessingContainer.getName() });
}
// Launch fenced CasProcessor instances (the same number as totalPoolSize)
@@ -332,11 +329,8 @@ public class SocketCasProcessorDeployer implements CasProcessorDeployer {
public void undeploy(URL aURL) throws CasProcessorDeploymentException {
try {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.SEVERE,
- this.getClass().getName(),
- "initialize",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.SEVERE, this.getClass().getName(),
+ "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_undeploying_service__FINEST",
new Object[] { Thread.currentThread().getName(), aURL.getHost(),
String.valueOf(aURL.getPort()) });
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/socket/SocketTransport.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/socket/SocketTransport.java
index ae5f299..96561cf 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/socket/SocketTransport.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/socket/SocketTransport.java
@@ -28,12 +28,11 @@ import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
import org.apache.uima.cas.CAS;
import org.apache.uima.resource.metadata.ProcessingResourceMetaData;
-
/**
* The Interface SocketTransport.
*/
public interface SocketTransport {
-
+
/**
* Returns transport identifier.
*
@@ -45,36 +44,46 @@ public interface SocketTransport {
* Creates a socket connection to a given endpoint. This method blocks until all Connections are
* resolved or an error occurs.
*
- * @param aURI URI containing service endpoint info: host & port
- * @param aTimeout max time in millis to wait for response
+ * @param aURI
+ * URI containing service endpoint info: host & port
+ * @param aTimeout
+ * max time in millis to wait for response
*
* @return Socket bound to a given endpoint
*
- * @throws SocketException Failed to connect
+ * @throws SocketException
+ * Failed to connect
*/
Socket connect(URL aURI, long aTimeout) throws SocketException;
/**
* Invokes fenced CasProcessor.
*
- * @param aSocket - Socket bound to fenced CasProcessor
- * @param aCas - CAS to be sent to the CasProcessor for analysis
+ * @param aSocket
+ * - Socket bound to fenced CasProcessor
+ * @param aCas
+ * - CAS to be sent to the CasProcessor for analysis
* @return - CAS - CAS returned from the fenced CasProcessor
- * @throws SocketTimeoutException the socket timeout exception
- * @throws SocketException the socket exception
- * @throws AnalysisEngineProcessException the analysis engine process exception
+ * @throws SocketTimeoutException
+ * the socket timeout exception
+ * @throws SocketException
+ * the socket exception
+ * @throws AnalysisEngineProcessException
+ * the analysis engine process exception
*/
- CAS process(Socket aSocket, CAS aCas) throws SocketTimeoutException, SocketException,
- AnalysisEngineProcessException;
+ CAS process(Socket aSocket, CAS aCas)
+ throws SocketTimeoutException, SocketException, AnalysisEngineProcessException;
/**
* Returns metadata associated with the fenced CasProcessor.
*
- * @param aSocket -
- * socket to the fenced CasProcessor
+ * @param aSocket
+ * - socket to the fenced CasProcessor
* @return - metadata
- * @throws SocketException passthru
- * @throws AnalysisEngineProcessException passthru
+ * @throws SocketException
+ * passthru
+ * @throws AnalysisEngineProcessException
+ * passthru
*/
ProcessingResourceMetaData getProcessingResourceMetaData(Socket aSocket)
throws SocketException, AnalysisEngineProcessException;
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/vinci/VinciCasProcessorDeployer.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/vinci/VinciCasProcessorDeployer.java
index 8bef471..390dcfb 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/vinci/VinciCasProcessorDeployer.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/vinci/VinciCasProcessorDeployer.java
@@ -63,7 +63,6 @@ import org.apache.uima.util.XMLInputSource;
import org.apache.vinci.transport.ServiceDownException;
import org.apache.vinci.transport.ServiceException;
-
/**
* Reference implementation of
* {@link org.apache.uima.collection.impl.base_cpm.container.deployer.CasProcessorDeployer} This
@@ -91,7 +90,7 @@ import org.apache.vinci.transport.ServiceException;
*
*/
public class VinciCasProcessorDeployer implements CasProcessorDeployer {
-
+
/** The Constant LOCAL_VNS. */
public static final String LOCAL_VNS = "LOCAL_VNS";
@@ -144,7 +143,7 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
private CPEFactory cpeFactory = null;
/** The monitor. */
- private final Object monitor = new Object(); // must be unique object, used for synch
+ private final Object monitor = new Object(); // must be unique object, used for synch
/** The current service list. */
private ArrayList currentServiceList = null;
@@ -152,7 +151,8 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
/**
* Instantiaes the class and gives it access to CPE configuration.
*
- * @param aCpeFactory the a cpe factory
+ * @param aCpeFactory
+ * the a cpe factory
*/
public VinciCasProcessorDeployer(CPEFactory aCpeFactory) {
cpeFactory = aCpeFactory;
@@ -164,11 +164,15 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
* processing thread created here. The <i>aCasProcessorList</i> contains instantiated Cas
* Processors. These are instantiated by the CPEFactory.
*
- * @param aCasProcessorList - list containing instantiated Cas Processors
- * @param aEngine the a engine
- * @param redeploy - true when redeploying failed Cas Processor
+ * @param aCasProcessorList
+ * - list containing instantiated Cas Processors
+ * @param aEngine
+ * the a engine
+ * @param redeploy
+ * - true when redeploying failed Cas Processor
* @return - ProcessingContainer containing pool of CasProcessors
- * @throws ResourceConfigurationException the resource configuration exception
+ * @throws ResourceConfigurationException
+ * the resource configuration exception
*/
public ProcessingContainer deployCasProcessor(List aCasProcessorList, CPMEngine aEngine,
boolean redeploy) throws ResourceConfigurationException {
@@ -179,9 +183,10 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
* Deploys CasProcessor using configuration from provided container. This method is used for
* re-launching failed Cas Processor.
*
- * @param aProcessingContainer -
- * container for deployed CasProcessor.
- * @throws ResourceConfigurationException the resource configuration exception
+ * @param aProcessingContainer
+ * - container for deployed CasProcessor.
+ * @throws ResourceConfigurationException
+ * the resource configuration exception
*/
@Override
public void deployCasProcessor(ProcessingContainer aProcessingContainer)
@@ -203,8 +208,8 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
throw e;
} catch (Exception e) {
throw new ResourceConfigurationException(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_unable_to_deploy_service__SEVERE", new Object[] {
- Thread.currentThread().getName(),
+ "UIMA_CPM_unable_to_deploy_service__SEVERE",
+ new Object[] { Thread.currentThread().getName(),
aProcessingContainer.getCasProcessorConfiguration().getName() });
}
}
@@ -217,12 +222,13 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
* vinci service and creating a connection to it. For un-managed Cas Processor the CPE establishes
* the connection.
*
- * @param aCasProcessorList -
- * list of CasProcessors to deploy
- * @param redeploy -
- * true if intent is to redeploy failed service
+ * @param aCasProcessorList
+ * - list of CasProcessors to deploy
+ * @param redeploy
+ * - true if intent is to redeploy failed service
* @return ProcessinContainer - instance of Container
- * @throws ResourceConfigurationException the resource configuration exception
+ * @throws ResourceConfigurationException
+ * the resource configuration exception
*/
@Override
public ProcessingContainer deployCasProcessor(List aCasProcessorList, boolean redeploy)
@@ -255,7 +261,8 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
// getCasProcessor() and releaseProcessor() methods.
casProcessorPool = new ServiceProxyPool();
// Create CasProcess Configuration holding info defined in the CPE descriptor
- casProcessorConfig = new CasProcessorConfigurationJAXBImpl(casProcessorType, cpeFactory.getResourceManager());
+ casProcessorConfig = new CasProcessorConfigurationJAXBImpl(casProcessorType,
+ cpeFactory.getResourceManager());
// Associate CasProcessor configuration from CPE descriptor with this container
processingContainer = new ProcessingContainer_Impl(casProcessorConfig, metaData,
@@ -272,8 +279,8 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
"UIMA_CPM_unable_to_read_meta__SEVERE", Thread.currentThread().getName());
}
throw new ResourceConfigurationException(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_casprocessor_no_name_found__SEVERE", new Object[] { Thread
- .currentThread().getName() });
+ "UIMA_CPM_casprocessor_no_name_found__SEVERE",
+ new Object[] { Thread.currentThread().getName() });
}
}
// Add CasProcess to the instance pool
@@ -283,15 +290,15 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
// There is one instance of ProcessingContainer for set of CasProcessors
if (processingContainer == null) {
throw new ResourceConfigurationException(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_invalid_container__SEVERE", new Object[] { Thread.currentThread()
- .getName() });
+ "UIMA_CPM_invalid_container__SEVERE",
+ new Object[] { Thread.currentThread().getName() });
}
// Assumption is that the container already exists and it contains CasProcessor configuration
casProcessorConfig = processingContainer.getCasProcessorConfiguration();
if (casProcessorConfig == null) {
throw new ResourceConfigurationException(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_container_configuration_not_found__SEVERE", new Object[] { Thread
- .currentThread().getName() });
+ "UIMA_CPM_container_configuration_not_found__SEVERE",
+ new Object[] { Thread.currentThread().getName() });
}
deployBasedOnModel(processingContainer, casProcessorConfig, false);
@@ -306,14 +313,15 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
/**
* Deploys CasProcessor according to configured deployment mode.
*
- * @param aProcessingContainer -
- * container managing instances of CasProcessor
- * @param aCasProcessorConfig -
- * CasProcessor configuration
- * @param redeploy -
- * flag indicating if this re-deployment of CasProcessor that failed
+ * @param aProcessingContainer
+ * - container managing instances of CasProcessor
+ * @param aCasProcessorConfig
+ * - CasProcessor configuration
+ * @param redeploy
+ * - flag indicating if this re-deployment of CasProcessor that failed
*
- * @throws ResourceConfigurationException if unknown deployment type
+ * @throws ResourceConfigurationException
+ * if unknown deployment type
*/
private void deployBasedOnModel(ProcessingContainer aProcessingContainer,
CasProcessorConfiguration aCasProcessorConfig, boolean redeploy)
@@ -345,8 +353,8 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
new Object[] { Thread.currentThread().getName(), name, deployModel });
}
throw new ResourceConfigurationException(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_unsupported_deploy_mode__SEVERE", new Object[] {
- Thread.currentThread().getName(), name, deployModel });
+ "UIMA_CPM_unsupported_deploy_mode__SEVERE",
+ new Object[] { Thread.currentThread().getName(), name, deployModel });
}
}
@@ -360,11 +368,12 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
* is the responsibility of the Cas Processor to to read this information and use it to locate VNS
* the CPE is managing.
*
- * @param aProcessingContainer -
- * container object that will hold proxies to Cas Processor when it is launched
- * @param redeploy -
- * true if intent is to redeploy failed service
- * @throws ResourceConfigurationException if the descriptor is invalid or for any internal Exception (wrapped)
+ * @param aProcessingContainer
+ * - container object that will hold proxies to Cas Processor when it is launched
+ * @param redeploy
+ * - true if intent is to redeploy failed service
+ * @throws ResourceConfigurationException
+ * if the descriptor is invalid or for any internal Exception (wrapped)
*/
private void deployLocal(ProcessingContainer aProcessingContainer, boolean redeploy)
throws ResourceConfigurationException {
@@ -408,11 +417,8 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
}
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "initialize",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_deploy_with_mode__FINEST",
new Object[] { Thread.currentThread().getName(), casProcessorConfig.getName(),
casProcessorConfig.getDeploymentType() });
@@ -428,8 +434,8 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
associateMetadataWithContainer(aProcessingContainer);
} else {
throw new ResourceConfigurationException(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_invalid_cpe_descriptor__SEVERE", new Object[] {
- Thread.currentThread().getName(), name, "runInSeparateProcess" });
+ "UIMA_CPM_invalid_cpe_descriptor__SEVERE",
+ new Object[] { Thread.currentThread().getName(), name, "runInSeparateProcess" });
}
} catch (Exception e) {
throw new ResourceConfigurationException(e);
@@ -439,8 +445,8 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
/**
* Retrieve the metadata from the service and add it to the container.
*
- * @param aProcessingContainer -
- * container where the metadata will be saved
+ * @param aProcessingContainer
+ * - container where the metadata will be saved
*/
private void associateMetadataWithContainer(ProcessingContainer aProcessingContainer) {
CasProcessor processor = null;
@@ -467,14 +473,16 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
* Launches an application as a seperate process using java's Process object. Actually, it
* launches as many copies of the application as given in the <i>howMany</i> parameter.
*
- * @param aProcessingContainer the a processing container
- * @param casProcessorConfig -
- * Configuration containing start up command
- * @param redeploy -
- * true if intent is to redeploy failed application
- * @param howMany -
- * how many seperate process to spawn
- * @throws CasProcessorDeploymentException wraps any exception
+ * @param aProcessingContainer
+ * the a processing container
+ * @param casProcessorConfig
+ * - Configuration containing start up command
+ * @param redeploy
+ * - true if intent is to redeploy failed application
+ * @param howMany
+ * - how many seperate process to spawn
+ * @throws CasProcessorDeploymentException
+ * wraps any exception
*/
private void launchLocalService(ProcessingContainer aProcessingContainer,
CasProcessorConfiguration casProcessorConfig, boolean redeploy, int howMany)
@@ -529,11 +537,8 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
for (int i = 0; cmd != null && i < cmd.length; i++) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "initialize",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_launching_with_service_cmd__FINEST",
new Object[] { Thread.currentThread().getName(), casProcessorConfig.getName(),
String.valueOf(i), cmd[i] });
@@ -544,25 +549,19 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
if ((env = exec.getEnvironment()) != null && env.length > 0) {
for (int i = 0; i < env.length; i++) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "initialize",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST,
+ this.getClass().getName(), "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_launching_with_service_env__FINEST",
- new Object[] { Thread.currentThread().getName(),
- casProcessorConfig.getName(), String.valueOf(i), env[i] });
+ new Object[] { Thread.currentThread().getName(), casProcessorConfig.getName(),
+ String.valueOf(i), env[i] });
}
}
if (System.getProperty("os.name").equalsIgnoreCase("linux")) {
for (int i = 0; execCommand != null && i < execCommand.length; i++) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "initialize",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST,
+ this.getClass().getName(), "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_launching_with_service_exec__FINEST",
new Object[] { Thread.currentThread().getName(),
casProcessorConfig.getName(), String.valueOf(i), execCommand[i] });
@@ -577,11 +576,8 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
if (System.getProperty("os.name").equalsIgnoreCase("linux")) {
for (int i = 0; execCommand != null && i < execCommand.length; i++) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "initialize",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST,
+ this.getClass().getName(), "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_launching_with_service_exec__FINEST",
new Object[] { Thread.currentThread().getName(),
casProcessorConfig.getName(), String.valueOf(i), execCommand[i] });
@@ -615,9 +611,12 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
* No-op for integrated deployment. Integrated CasProcessors are instantiated using UIMA framework
* factory in the CPEFactory.
*
- * @param aProcessingContainer the a processing container
- * @param redeploy the redeploy
- * @throws ResourceConfigurationException tbd
+ * @param aProcessingContainer
+ * the a processing container
+ * @param redeploy
+ * the redeploy
+ * @throws ResourceConfigurationException
+ * tbd
*/
private void deployIntegrated(ProcessingContainer aProcessingContainer, boolean redeploy)
throws ResourceConfigurationException {
@@ -630,11 +629,12 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
* Processor via provided VNS. The exact VNS used here is defined on per Cas Processor in the cpe
* descriptor.
*
- * @param aProcessingContainer -
- * container that will manage instances of the CasProcessor
- * @param redeploy -
- * flag indicating if this redeployment of failed CasProcessor
- * @throws ResourceConfigurationException wraps exception
+ * @param aProcessingContainer
+ * - container that will manage instances of the CasProcessor
+ * @param redeploy
+ * - flag indicating if this redeployment of failed CasProcessor
+ * @throws ResourceConfigurationException
+ * wraps exception
*/
private void deployRemote(ProcessingContainer aProcessingContainer, boolean redeploy)
throws ResourceConfigurationException {
@@ -643,12 +643,8 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
String name = casProcessorConfig.getName();
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "initialize",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_deploy_with_mode__FINEST",
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_deploy_with_mode__FINEST",
new Object[] { Thread.currentThread().getName(), name,
casProcessorConfig.getDeploymentType() });
}
@@ -694,11 +690,8 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
if (processor instanceof NetworkCasProcessorImpl) {
if (((NetworkCasProcessorImpl) processor).getProxy() == null) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "initialize",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST,
+ this.getClass().getName(), "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_reducing_cp_instance_count__FINEST",
new Object[] { Thread.currentThread().getName(), name,
casProcessorConfig.getDeploymentType() });
@@ -724,20 +717,20 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
* Create and attach a proxies to vinci services. For services with exclusive access, makes sure
* that there is only one proxy per service. Otherwise the services are shared.
*
- * @param redeploy -
- * true if the connection is made as part of the recovery due to previous service crash
+ * @param redeploy
+ * - true if the connection is made as part of the recovery due to previous service crash
* or termination.
- * @param aServiceUri -
- * servie uri, this is a vinci service name
- * @param howMany -
- * how many proxies to create and connect
- * @param aProcessingContainer -
- * hosting container for the proxies. Proxies are assigned to a pool managed by the
+ * @param aServiceUri
+ * - servie uri, this is a vinci service name
+ * @param howMany
+ * - how many proxies to create and connect
+ * @param aProcessingContainer
+ * - hosting container for the proxies. Proxies are assigned to a pool managed by the
* container.
*
* @return - how many proxies were created
- * @throws Exception -
- * error
+ * @throws Exception
+ * - error
*/
private int attachToServices(boolean redeploy, String aServiceUri, int howMany,
ProcessingContainer aProcessingContainer) throws Exception {
@@ -754,11 +747,8 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
String serviceAccess = casProcessorConfig.getDeploymentParameter("service-access");
if (serviceAccess != null && serviceAccess.equalsIgnoreCase("exclusive")) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "initialize",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_cp_with_exclusive_access__FINEST",
new Object[] { Thread.currentThread().getName(), aProcessingContainer.getName(),
casProcessorConfig.getDeploymentType() });
@@ -771,11 +761,8 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
// In case the service starts on the same port as before it crashed, mark it as
// available in the current service list
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "initialize",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_retrieve_cp_from_failed_cplist__FINEST",
new Object[] { Thread.currentThread().getName(), aProcessingContainer.getName(),
casProcessorConfig.getDeploymentType() });
@@ -808,8 +795,8 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
if (serviceList == null || serviceList.size() == 0 && redeploy == false) {
throw new ResourceConfigurationException(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_no_service_in_vns__FINEST", new Object[] {
- Thread.currentThread().getName(), aServiceUri,
+ "UIMA_CPM_no_service_in_vns__FINEST",
+ new Object[] { Thread.currentThread().getName(), aServiceUri,
casProcessorConfig.getDeploymentType(),
casProcessorConfig.getDeploymentParameter(Constants.VNS_HOST),
casProcessorConfig.getDeploymentParameter(Constants.VNS_PORT) });
@@ -846,11 +833,8 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
for (int i = 0; i < howMany; i++) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "initialize",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_activating_service__FINEST",
new Object[] { Thread.currentThread().getName(), aProcessingContainer.getName(),
String.valueOf(i), String.valueOf(howMany) });
@@ -910,14 +894,10 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
if (ex.getCause() instanceof ServiceException
|| ex.getCause() instanceof ServiceDownException) {
if (UIMAFramework.getLogger().isLoggable(Level.WARNING)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.WARNING,
- this.getClass().getName(),
- "initialize",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_activating_service__WARNING",
- new Object[] { Thread.currentThread().getName(),
- aProcessingContainer.getName() });
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.WARNING,
+ this.getClass().getName(), "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_activating_service__WARNING", new Object[] {
+ Thread.currentThread().getName(), aProcessingContainer.getName() });
}
// Increment number of CasProcessor restarts (redeploys)
restartCount++;
@@ -940,7 +920,8 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
/**
* Gets the next available.
*
- * @param aServiceList the a service list
+ * @param aServiceList
+ * the a service list
* @return the next available
*/
private VinciServiceInfo getNextAvailable(ArrayList aServiceList) {
@@ -962,12 +943,13 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
/**
* Query configured VNS for a list of services with a given service URI.
*
- * @param aServiceUri -
- * named service endpoint
- * @param aCasProcessorConfig -
- * Cas Processor configuration
+ * @param aServiceUri
+ * - named service endpoint
+ * @param aCasProcessorConfig
+ * - Cas Processor configuration
* @return - List of services provided by VNS
- * @throws Exception passthru
+ * @throws Exception
+ * passthru
*/
private ArrayList getNewServiceList(String aServiceUri,
CasProcessorConfiguration aCasProcessorConfig) throws Exception {
@@ -982,10 +964,11 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
* Handles situation when max restart threshold is reached while connecting to CasProcessor.
*
*
- * @param aProcessingContainer -
- * container holding CasProcessor configuration
+ * @param aProcessingContainer
+ * - container holding CasProcessor configuration
*
- * @throws ResourceConfigurationException when max restarts limit reached
+ * @throws ResourceConfigurationException
+ * when max restarts limit reached
*/
private void handleMaxRestartThresholdReached(ProcessingContainer aProcessingContainer)
throws ResourceConfigurationException {
@@ -993,23 +976,15 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
.getCasProcessorConfiguration();
String name = casProcessorConfig.getName();
if (UIMAFramework.getLogger().isLoggable(Level.WARNING)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.WARNING,
- this.getClass().getName(),
- "initialize",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_restart_exceeded__WARNING",
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.WARNING, this.getClass().getName(),
+ "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_restart_exceeded__WARNING",
new Object[] { Thread.currentThread().getName(), aProcessingContainer.getName(),
String.valueOf(casProcessorConfig.getMaxRestartCount()) });
}
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "initialize",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_restart_exceeded__WARNING",
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_restart_exceeded__WARNING",
new Object[] { Thread.currentThread().getName(), aProcessingContainer.getName(),
casProcessorConfig.getActionOnMaxRestart() });
}
@@ -1017,26 +992,24 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
if (Constants.TERMINATE_CPE.equals(casProcessorConfig.getActionOnMaxRestart())) {
if (UIMAFramework.getLogger().isLoggable(Level.INFO)) {
UIMAFramework.getLogger(this.getClass()).logrb(Level.INFO, this.getClass().getName(),
- "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_terminate_onerrors__INFO",
+ "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_terminate_onerrors__INFO",
new Object[] { Thread.currentThread().getName(), aProcessingContainer.getName() });
}
- throw new ResourceConfigurationException(new AbortCPMException(CpmLocalizedMessage
- .getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_configured_to_abort__WARNING", new Object[] {
- Thread.currentThread().getName(), name })));
+ throw new ResourceConfigurationException(
+ new AbortCPMException(CpmLocalizedMessage.getLocalizedMessage(
+ CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_EXP_configured_to_abort__WARNING",
+ new Object[] { Thread.currentThread().getName(), name })));
}
if (Constants.KILL_PROCESSING_PIPELINE.equals(casProcessorConfig.getActionOnMaxRestart())) {
if (UIMAFramework.getLogger().isLoggable(Level.INFO)) {
UIMAFramework.getLogger(this.getClass()).logrb(Level.INFO, this.getClass().getName(),
- "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_terminate_pipeline__INFO",
+ "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_terminate_pipeline__INFO",
new Object[] { Thread.currentThread().getName(), aProcessingContainer.getName() });
}
- throw new ResourceConfigurationException(new KillPipelineException(CpmLocalizedMessage
- .getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_configured_to_kill_pipeline__WARNING", new Object[] {
- Thread.currentThread().getName(), name })));
+ throw new ResourceConfigurationException(new KillPipelineException(
+ CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_EXP_configured_to_kill_pipeline__WARNING",
+ new Object[] { Thread.currentThread().getName(), name })));
} else if (Constants.DISABLE_CASPROCESSOR.equals(casProcessorConfig.getActionOnMaxRestart())) {
aProcessingContainer.setStatus(Constants.CAS_PROCESSOR_DISABLED);
if (UIMAFramework.getLogger().isLoggable(Level.INFO)) {
@@ -1056,10 +1029,11 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
/**
* Returns CasProcessor service name from a descriptor.
*
- * @param aCasProcessorConfig -
- * CasProcessor configuration containing service descriptor path
+ * @param aCasProcessorConfig
+ * - CasProcessor configuration containing service descriptor path
* @return - name of the service
- * @throws ResourceConfigurationException if the uri is missing or empty
+ * @throws ResourceConfigurationException
+ * if the uri is missing or empty
*/
private String getServiceUri(CasProcessorConfiguration aCasProcessorConfig)
throws ResourceConfigurationException {
@@ -1070,8 +1044,8 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
String uri = uriSpecifier.getUri();
if (uri == null || uri.trim().length() == 0) {
throw new ResourceConfigurationException(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_invalid_deployment__SEVERE", new Object[] {
- Thread.currentThread().getName(), descriptorUrl, uri });
+ "UIMA_CPM_invalid_deployment__SEVERE",
+ new Object[] { Thread.currentThread().getName(), descriptorUrl, uri });
}
return uri;
@@ -1080,17 +1054,19 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
/**
* Returns URISpecifier.
*
- * @param aDescriptorUrl the a descriptor url
+ * @param aDescriptorUrl
+ * the a descriptor url
* @return URISpecifier
- * @throws ResourceConfigurationException if the resource specifier in the URI is not a URISpecifier
+ * @throws ResourceConfigurationException
+ * if the resource specifier in the URI is not a URISpecifier
*/
private URISpecifier getURISpecifier(URL aDescriptorUrl) throws ResourceConfigurationException {
ResourceSpecifier resourceSpecifier = getSpecifier(aDescriptorUrl);
if (!(resourceSpecifier instanceof URISpecifier)) {
throw new ResourceConfigurationException(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_invalid_deployment__SEVERE", new Object[] {
- Thread.currentThread().getName(), aDescriptorUrl, null });
+ "UIMA_CPM_invalid_deployment__SEVERE",
+ new Object[] { Thread.currentThread().getName(), aDescriptorUrl, null });
}
return (URISpecifier) resourceSpecifier;
}
@@ -1098,10 +1074,11 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
/**
* Parses given service descriptor and returns initialized ResourceSpecifier.
*
- * @param aUrl -
- * URL of the descriptor
+ * @param aUrl
+ * - URL of the descriptor
* @return - ResourceSpecifier parsed from descriptor
- * @throws ResourceConfigurationException wraps Exception
+ * @throws ResourceConfigurationException
+ * wraps Exception
*/
private ResourceSpecifier getSpecifier(URL aUrl) throws ResourceConfigurationException {
try {
@@ -1110,28 +1087,26 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
} catch (Exception e) {
e.printStackTrace();
throw new ResourceConfigurationException(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_invalid_deployment__SEVERE", new Object[] {
- Thread.currentThread().getName(), aUrl, null });
+ "UIMA_CPM_invalid_deployment__SEVERE",
+ new Object[] { Thread.currentThread().getName(), aUrl, null });
}
}
/**
* Deploys internal VNS for use with local CasProcessor deployments.
*
- * @param casProcessorConfig -
- * CasProcessor configuration
- * @param redeploy -
- * flag indicating if VNS being redeployed
- * @throws CasProcessorDeploymentException wraps Exception
+ * @param casProcessorConfig
+ * - CasProcessor configuration
+ * @param redeploy
+ * - flag indicating if VNS being redeployed
+ * @throws CasProcessorDeploymentException
+ * wraps Exception
*/
private void deployVNS(CasProcessorConfiguration casProcessorConfig, boolean redeploy)
throws CasProcessorDeploymentException {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.SEVERE,
- this.getClass().getName(),
- "initialize",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.SEVERE, this.getClass().getName(),
+ "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_deploy_vns_redeploy__FINEST",
new Object[] { Thread.currentThread().getName(), String.valueOf(redeploy),
String.valueOf(restartCount) });
@@ -1164,10 +1139,10 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
try {
vns = new LocalVNS(startPort, maxPort, vnsPort);
vns.setConnectionPool(portQueue);
-
+
localVNSThread = new Thread(vns);
localVNSThread.start();
-
+
} catch (Exception e) {
throw new CasProcessorDeploymentException(e);
}
@@ -1176,77 +1151,83 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
}
// Never called
-// /**
-// * Creates a proxy and connects it to Vinci service running on a given port. Once connected the
-// * proxy is associated with Cas Processor.
-// *
-// * @param aCasProcessorConfig -
-// * CasProcessor configuration
-// * @param port -
-// * port wher vinci service is listening
-// * @return Connected proxy to service
-// *
-// * @throws ResourceInitializationException
-// * @throws ResourceConfigurationException
-// */
-// private synchronized boolean activateProcessor(CasProcessorConfiguration aCasProcessorConfig,
-// String aHost, int aPort) throws ResourceInitializationException,
-// ResourceConfigurationException {
-// // Instantiate proxy from given configuration
-// VinciTAP tap = getTextAnalysisProxy(aCasProcessorConfig);
-// if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
-// UIMAFramework.getLogger(this.getClass()).logrb(Level.SEVERE, this.getClass().getName(),
-// "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
-// "UIMA_CPM_activating_service_on_port__FINEST",
-// new Object[] { Thread.currentThread().getName(), String.valueOf(aPort) });
-// }
-// boolean tryAgain = true;
-// int maxCount = aCasProcessorConfig.getMaxRestartCount();
-// while (tryAgain) {
-// try {
-// // Connect proxy to service running on given port on the same machine as the CPM
-// tap.connect(aHost, aPort);
-// // Connection established no need to retry
-// tryAgain = false;
-// } catch (Exception e) {
-// if (maxCount-- == 0) {
-// e.printStackTrace();
-// if (UIMAFramework.getLogger().isLoggable(Level.SEVERE)) {
-// UIMAFramework.getLogger(this.getClass()).log(Level.SEVERE,
-// Thread.currentThread().getName() + "", e);
-// }
-// throw new ResourceConfigurationException(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
-// "UIMA_CPM_no_service_connection__SEVERE", new Object[] {
-// Thread.currentThread().getName(), String.valueOf(aPort), aHost,
-// aCasProcessorConfig.getName() });
-// }
-// try {
-// synchronized (monitor) {
-// monitor.wait(SLEEP_TIME);
-// }
-// } catch (InterruptedException ex) {
-// }
-// }
-// }
-// // At this point there is a connected proxy (tap), now we need to add it to container that will
-// // menage it.
-// bindProxyToNetworkCasProcessor(tap);
-// return true;
-// }
+ // /**
+ // * Creates a proxy and connects it to Vinci service running on a given port. Once connected the
+ // * proxy is associated with Cas Processor.
+ // *
+ // * @param aCasProcessorConfig -
+ // * CasProcessor configuration
+ // * @param port -
+ // * port wher vinci service is listening
+ // * @return Connected proxy to service
+ // *
+ // * @throws ResourceInitializationException
+ // * @throws ResourceConfigurationException
+ // */
+ // private synchronized boolean activateProcessor(CasProcessorConfiguration aCasProcessorConfig,
+ // String aHost, int aPort) throws ResourceInitializationException,
+ // ResourceConfigurationException {
+ // // Instantiate proxy from given configuration
+ // VinciTAP tap = getTextAnalysisProxy(aCasProcessorConfig);
+ // if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
+ // UIMAFramework.getLogger(this.getClass()).logrb(Level.SEVERE, this.getClass().getName(),
+ // "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ // "UIMA_CPM_activating_service_on_port__FINEST",
+ // new Object[] { Thread.currentThread().getName(), String.valueOf(aPort) });
+ // }
+ // boolean tryAgain = true;
+ // int maxCount = aCasProcessorConfig.getMaxRestartCount();
+ // while (tryAgain) {
+ // try {
+ // // Connect proxy to service running on given port on the same machine as the CPM
+ // tap.connect(aHost, aPort);
+ // // Connection established no need to retry
+ // tryAgain = false;
+ // } catch (Exception e) {
+ // if (maxCount-- == 0) {
+ // e.printStackTrace();
+ // if (UIMAFramework.getLogger().isLoggable(Level.SEVERE)) {
+ // UIMAFramework.getLogger(this.getClass()).log(Level.SEVERE,
+ // Thread.currentThread().getName() + "", e);
+ // }
+ // throw new ResourceConfigurationException(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ // "UIMA_CPM_no_service_connection__SEVERE", new Object[] {
+ // Thread.currentThread().getName(), String.valueOf(aPort), aHost,
+ // aCasProcessorConfig.getName() });
+ // }
+ // try {
+ // synchronized (monitor) {
+ // monitor.wait(SLEEP_TIME);
+ // }
+ // } catch (InterruptedException ex) {
+ // }
+ // }
+ // }
+ // // At this point there is a connected proxy (tap), now we need to add it to container that will
+ // // menage it.
+ // bindProxyToNetworkCasProcessor(tap);
+ // return true;
+ // }
/**
* Creates a proxy and connects it to Vinci service running on a given port. Once connected the
* proxy is associated with Cas Processor.
*
- * @param aCasProcessorConfig -
- * CasProcessor configuration
- * @param aHost the a host
- * @param aPort the a port
- * @param aProcessingContainer the a processing container
- * @param redeploy the redeploy
+ * @param aCasProcessorConfig
+ * - CasProcessor configuration
+ * @param aHost
+ * the a host
+ * @param aPort
+ * the a port
+ * @param aProcessingContainer
+ * the a processing container
+ * @param redeploy
+ * the redeploy
* @return Connected proxy to service
- * @throws ResourceConfigurationException wraps Exception
- * @throws Exception passthru
+ * @throws ResourceConfigurationException
+ * wraps Exception
+ * @throws Exception
+ * passthru
*/
private synchronized boolean activateProcessor(CasProcessorConfiguration aCasProcessorConfig,
String aHost, int aPort, ProcessingContainer aProcessingContainer, boolean redeploy)
@@ -1275,8 +1256,8 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
Thread.currentThread().getName() + "", e);
}
throw new ResourceConfigurationException(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_no_service_connection__SEVERE", new Object[] {
- Thread.currentThread().getName(), String.valueOf(aPort), aHost,
+ "UIMA_CPM_no_service_connection__SEVERE",
+ new Object[] { Thread.currentThread().getName(), String.valueOf(aPort), aHost,
aCasProcessorConfig.getName() });
}
try {
@@ -1296,14 +1277,17 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
/**
* Creates a proxy and connects it to Vinci service. Uses VNS to locate service by name.
*
- * @param aCasProcessorConfig -
- * CasProcees configuration
- * @param aService -
- * name of the vinci service
- * @param aProcessingContainer the a processing container
- * @param redeploy the redeploy
+ * @param aCasProcessorConfig
+ * - CasProcees configuration
+ * @param aService
+ * - name of the vinci service
+ * @param aProcessingContainer
+ * the a processing container
+ * @param redeploy
+ * the redeploy
* @return - connected Proxy
- * @throws Exception passthru
+ * @throws Exception
+ * passthru
*/
private synchronized boolean activateProcessor(CasProcessorConfiguration aCasProcessorConfig,
String aService, ProcessingContainer aProcessingContainer, boolean redeploy) // throws
@@ -1330,7 +1314,7 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
while (tryAgain) {
try {
- if ( sleepBetweenRetries ) {
+ if (sleepBetweenRetries) {
wait(maxTimeToWait);
} else {
sleepBetweenRetries = true;
@@ -1354,17 +1338,14 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
if (maxCount-- == 0) {
e.printStackTrace();
if (UIMAFramework.getLogger().isLoggable(Level.WARNING)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.WARNING,
- this.getClass().getName(),
- "initialize",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_max_connect_retries_exceeded__FINEST",
- new Object[] { Thread.currentThread().getName(), aService,
- String.valueOf(maxCount) });
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.WARNING, this.getClass().getName(),
+ "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_max_connect_retries_exceeded__FINEST", new Object[] {
+ Thread.currentThread().getName(), aService, String.valueOf(maxCount) });
}
- throw new ResourceInitializationException(CPMUtils.CPM_LOG_RESOURCE_BUNDLE, new Object[] {
- Thread.currentThread().getName(), aService, String.valueOf(maxCount) },
+ throw new ResourceInitializationException(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ new Object[] { Thread.currentThread().getName(), aService,
+ String.valueOf(maxCount) },
new ServiceConnectionException("Unable to connect to service :::" + aService));
}
}
@@ -1376,142 +1357,142 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
}
// Never called
-// /**
-// * Associates connected proxy with an instance of CasProcessor.
-// *
-// * @param aTap -
-// * connected proxy
-// */
-// private void bindProxyToNetworkCasProcessor(VinciTAP aTap) {
-// if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
-// UIMAFramework.getLogger(this.getClass())
-// .logrb(
-// Level.FINEST,
-// this.getClass().getName(),
-// "initialize",
-// CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
-// "UIMA_CPM_get_cp_from_pool__FINEST",
-// new Object[] { Thread.currentThread().getName(), aTap.getServiceHost(),
-// String.valueOf(aTap.getServicePort()),
-// String.valueOf(casProcessorPool.getSize()) });
-// }
-// synchronized (casProcessorPool) {
-// if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
-// UIMAFramework.getLogger(this.getClass()).logrb(
-// Level.FINEST,
-// this.getClass().getName(),
-// "initialize",
-// CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
-// "UIMA_CPM_get_cp_from_pool__FINEST",
-// new Object[] { Thread.currentThread().getName(), aTap.getServiceHost(),
-// String.valueOf(aTap.getServicePort()),
-// String.valueOf(casProcessorPool.getSize()) });
-// }
-// CasProcessor processor = null;
-// // There are as many Cas Processors as there are Procesing Threads. All of them have been
-// // already created and exist
-// // in the cas processor pool. Cas Processor may or may not already have an associated proxy.
-// // So here we cycle through all Cas Processors until we find one that has not yet have a proxy
-// // and
-// // add it.
-// for (int i = 0; i < casProcessorPool.getSize(); i++) {
-// try {
-// // Check out the next Cas Processor from the pool
-// processor = casProcessorPool.checkOut();
-// if (processor == null) {
-// if (UIMAFramework.getLogger().isLoggable(Level.SEVERE)) {
-// UIMAFramework.getLogger(this.getClass()).logrb(
-// Level.SEVERE,
-// this.getClass().getName(),
-// "initialize",
-// CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
-// "UIMA_CPM_get_cp_from_pool_error__SEVERE",
-// new Object[] { Thread.currentThread().getName(), aTap.getServiceHost(),
-// String.valueOf(aTap.getServicePort()),
-// String.valueOf(casProcessorPool.getSize()) });
-// }
-// continue;
-// }
-// // Add proxy only to instances of NetworkCasProcessorImpl
-// if (processor instanceof NetworkCasProcessorImpl) {
-// NetworkCasProcessorImpl netProcessor = (NetworkCasProcessorImpl) processor;
-// // Check if this Cas Processor has already been assigned a proxy. If so,
-// // get the next Cas Processor
-// if (netProcessor.getProxy() != null && netProcessor.getProxy().isConnected()) {
-// if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
-// UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST,
-// this.getClass().getName(), "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
-// "UIMA_CPM_already_allocated__FINEST",
-// new Object[] { Thread.currentThread().getName(), String.valueOf(i) });
-// }
-// continue;
-// }
-// if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
-// UIMAFramework.getLogger(this.getClass()).logrb(
-// Level.FINEST,
-// this.getClass().getName(),
-// "initialize",
-// CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
-// "UIMA_CPM_assign_cp_to_service__FINEST",
-// new Object[] { Thread.currentThread().getName(), String.valueOf(i),
-// aTap.getServiceHost(), String.valueOf(aTap.getServicePort()) });
-// }
-// // Associate the proxy with this Cas Processor
-// ((NetworkCasProcessorImpl) processor).setProxy(aTap);
-// synchronized (monitor) {
-//
-// monitor.notifyAll();
-// }
-// }
-// break;
-// } catch (Exception e) {
-// e.printStackTrace();
-// } finally {
-// if (processor != null) {
-// if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
-// UIMAFramework.getLogger(this.getClass()).logrb(
-// Level.FINEST,
-// this.getClass().getName(),
-// "initialize",
-// CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
-// "UIMA_CPM_checkin_cp_to_pool__FINEST",
-// new Object[] { Thread.currentThread().getName(), String.valueOf(i),
-// aTap.getServiceHost(), String.valueOf(aTap.getServicePort()) });
-// }
-// casProcessorPool.checkIn(processor);
-// if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
-// UIMAFramework.getLogger(this.getClass()).logrb(
-// Level.FINEST,
-// this.getClass().getName(),
-// "initialize",
-// CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
-// "UIMA_CPM_checked_in_cp_to_pool__FINEST",
-// new Object[] { Thread.currentThread().getName(), String.valueOf(i),
-// aTap.getServiceHost(), String.valueOf(aTap.getServicePort()) });
-// }
-// }
-// }
-// }
-// }
-// }
+ // /**
+ // * Associates connected proxy with an instance of CasProcessor.
+ // *
+ // * @param aTap -
+ // * connected proxy
+ // */
+ // private void bindProxyToNetworkCasProcessor(VinciTAP aTap) {
+ // if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
+ // UIMAFramework.getLogger(this.getClass())
+ // .logrb(
+ // Level.FINEST,
+ // this.getClass().getName(),
+ // "initialize",
+ // CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ // "UIMA_CPM_get_cp_from_pool__FINEST",
+ // new Object[] { Thread.currentThread().getName(), aTap.getServiceHost(),
+ // String.valueOf(aTap.getServicePort()),
+ // String.valueOf(casProcessorPool.getSize()) });
+ // }
+ // synchronized (casProcessorPool) {
+ // if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
+ // UIMAFramework.getLogger(this.getClass()).logrb(
+ // Level.FINEST,
+ // this.getClass().getName(),
+ // "initialize",
+ // CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ // "UIMA_CPM_get_cp_from_pool__FINEST",
+ // new Object[] { Thread.currentThread().getName(), aTap.getServiceHost(),
+ // String.valueOf(aTap.getServicePort()),
+ // String.valueOf(casProcessorPool.getSize()) });
+ // }
+ // CasProcessor processor = null;
+ // // There are as many Cas Processors as there are Procesing Threads. All of them have been
+ // // already created and exist
+ // // in the cas processor pool. Cas Processor may or may not already have an associated proxy.
+ // // So here we cycle through all Cas Processors until we find one that has not yet have a proxy
+ // // and
+ // // add it.
+ // for (int i = 0; i < casProcessorPool.getSize(); i++) {
+ // try {
+ // // Check out the next Cas Processor from the pool
+ // processor = casProcessorPool.checkOut();
+ // if (processor == null) {
+ // if (UIMAFramework.getLogger().isLoggable(Level.SEVERE)) {
+ // UIMAFramework.getLogger(this.getClass()).logrb(
+ // Level.SEVERE,
+ // this.getClass().getName(),
+ // "initialize",
+ // CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ // "UIMA_CPM_get_cp_from_pool_error__SEVERE",
+ // new Object[] { Thread.currentThread().getName(), aTap.getServiceHost(),
+ // String.valueOf(aTap.getServicePort()),
+ // String.valueOf(casProcessorPool.getSize()) });
+ // }
+ // continue;
+ // }
+ // // Add proxy only to instances of NetworkCasProcessorImpl
+ // if (processor instanceof NetworkCasProcessorImpl) {
+ // NetworkCasProcessorImpl netProcessor = (NetworkCasProcessorImpl) processor;
+ // // Check if this Cas Processor has already been assigned a proxy. If so,
+ // // get the next Cas Processor
+ // if (netProcessor.getProxy() != null && netProcessor.getProxy().isConnected()) {
+ // if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
+ // UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST,
+ // this.getClass().getName(), "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ // "UIMA_CPM_already_allocated__FINEST",
+ // new Object[] { Thread.currentThread().getName(), String.valueOf(i) });
+ // }
+ // continue;
+ // }
+ // if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
+ // UIMAFramework.getLogger(this.getClass()).logrb(
+ // Level.FINEST,
+ // this.getClass().getName(),
+ // "initialize",
+ // CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ // "UIMA_CPM_assign_cp_to_service__FINEST",
+ // new Object[] { Thread.currentThread().getName(), String.valueOf(i),
+ // aTap.getServiceHost(), String.valueOf(aTap.getServicePort()) });
+ // }
+ // // Associate the proxy with this Cas Processor
+ // ((NetworkCasProcessorImpl) processor).setProxy(aTap);
+ // synchronized (monitor) {
+ //
+ // monitor.notifyAll();
+ // }
+ // }
+ // break;
+ // } catch (Exception e) {
+ // e.printStackTrace();
+ // } finally {
+ // if (processor != null) {
+ // if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
+ // UIMAFramework.getLogger(this.getClass()).logrb(
+ // Level.FINEST,
+ // this.getClass().getName(),
+ // "initialize",
+ // CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ // "UIMA_CPM_checkin_cp_to_pool__FINEST",
+ // new Object[] { Thread.currentThread().getName(), String.valueOf(i),
+ // aTap.getServiceHost(), String.valueOf(aTap.getServicePort()) });
+ // }
+ // casProcessorPool.checkIn(processor);
+ // if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
+ // UIMAFramework.getLogger(this.getClass()).logrb(
+ // Level.FINEST,
+ // this.getClass().getName(),
+ // "initialize",
+ // CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ // "UIMA_CPM_checked_in_cp_to_pool__FINEST",
+ // new Object[] { Thread.currentThread().getName(), String.valueOf(i),
+ // aTap.getServiceHost(), String.valueOf(aTap.getServicePort()) });
+ // }
+ // }
+ // }
+ // }
+ // }
+ // }
/**
* Associates connected proxy with an instance of CasProcessor.
*
- * @param aTap -
- * connected proxy
- * @param aProcessingContainer the a processing container
- * @param redeploy the redeploy
- * @throws Exception the exception
+ * @param aTap
+ * - connected proxy
+ * @param aProcessingContainer
+ * the a processing container
+ * @param redeploy
+ * the redeploy
+ * @throws Exception
+ * the exception
*/
private void bindProxyToNetworkCasProcessor(VinciTAP aTap,
ProcessingContainer aProcessingContainer, boolean redeploy) throws Exception {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "initialize",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_checked_in_cp_to_pool__FINEST",
new Object[] { Thread.currentThread().getName(), aProcessingContainer.getName(),
aTap.getServiceHost(), String.valueOf(aTap.getServicePort()) });
@@ -1523,8 +1504,8 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
// Check out the next Cas Processor from the pool
if (((ProcessingContainer_Impl) aProcessingContainer).failedCasProcessorList.isEmpty()) {
throw new ResourceProcessException(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_no_cp_instance_in_failed_list__FINEST", new Object[] {
- Thread.currentThread().getName(), aProcessingContainer.getName(),
+ "UIMA_CPM_no_cp_instance_in_failed_list__FINEST",
+ new Object[] { Thread.currentThread().getName(), aProcessingContainer.getName(),
aTap.getServiceHost(), String.valueOf(aTap.getServicePort()) },
new Exception(CpmLocalizedMessage.getLocalizedMessage(
CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
@@ -1538,15 +1519,11 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
if (processor instanceof NetworkCasProcessorImpl) {
// NetworkCasProcessorImpl netProcessor = (NetworkCasProcessorImpl) processor;
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "initialize",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_assign_cp_to_service__FINEST",
- new Object[] { Thread.currentThread().getName(),
- aProcessingContainer.getName(), aTap.getServiceHost(),
- String.valueOf(aTap.getServicePort()) });
+ new Object[] { Thread.currentThread().getName(), aProcessingContainer.getName(),
+ aTap.getServiceHost(), String.valueOf(aTap.getServicePort()) });
}
// Associate the proxy with this Cas Processor
((NetworkCasProcessorImpl) processor).setProxy(aTap);
@@ -1564,11 +1541,8 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
processor = casProcessorPool.checkOut();
if (processor == null) {
if (UIMAFramework.getLogger().isLoggable(Level.SEVERE)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.SEVERE,
- this.getClass().getName(),
- "initialize",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.SEVERE,
+ this.getClass().getName(), "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_get_cp_from_pool_error__SEVERE",
new Object[] { Thread.currentThread().getName(), aTap.getServiceHost(),
String.valueOf(aTap.getServicePort()),
@@ -1592,11 +1566,8 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
continue;
}
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "initialize",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST,
+ this.getClass().getName(), "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_assign_cp_to_service__FINEST",
new Object[] { Thread.currentThread().getName(), String.valueOf(i),
aTap.getServiceHost(), String.valueOf(aTap.getServicePort()) });
@@ -1620,28 +1591,20 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
if (processor != null) {
if (processorAssigned) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "initialize",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_checkin_cp_to_pool__FINEST",
- new Object[] { Thread.currentThread().getName(),
- aProcessingContainer.getName(), aTap.getServiceHost(),
- String.valueOf(aTap.getServicePort()) });
+ new Object[] { Thread.currentThread().getName(), aProcessingContainer.getName(),
+ aTap.getServiceHost(), String.valueOf(aTap.getServicePort()) });
}
casProcessorPool.checkIn(processor);
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "initialize",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_checked_in_cp_to_pool__FINEST",
- new Object[] { Thread.currentThread().getName(),
- aProcessingContainer.getName(), aTap.getServiceHost(),
- String.valueOf(aTap.getServicePort()) });
+ new Object[] { Thread.currentThread().getName(), aProcessingContainer.getName(),
+ aTap.getServiceHost(), String.valueOf(aTap.getServicePort()) });
}
} else {
// Put it back into the failed Cas Processor List for subsequent retries
@@ -1655,10 +1618,11 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
/**
* Creates and initializes proxy that will be used to connect to Vinci service.
*
- * @param aCasProcessorConfig -
- * CasProcessor configuration
+ * @param aCasProcessorConfig
+ * - CasProcessor configuration
* @return - new proxy (not yet connected to service)
- * @throws ResourceConfigurationException wraps Exception
+ * @throws ResourceConfigurationException
+ * wraps Exception
*/
private VinciTAP getTextAnalysisProxy(CasProcessorConfiguration aCasProcessorConfig)
throws ResourceConfigurationException {
@@ -1667,8 +1631,8 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
String vnsPort = null;
// For 'local' or managed Cas Processor, get the VNS port
- if (aCasProcessorConfig.getDeploymentType() != null
- && Constants.DEPLOYMENT_LOCAL.equalsIgnoreCase(aCasProcessorConfig.getDeploymentType())) {
+ if (aCasProcessorConfig.getDeploymentType() != null && Constants.DEPLOYMENT_LOCAL
+ .equalsIgnoreCase(aCasProcessorConfig.getDeploymentType())) {
vnsHost = "localhost"; // default for local deployment
vnsPort = ""; // intialize
try {
@@ -1723,15 +1687,16 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
* command line) 4) Use Hardcoded default ( VNS_HOST=localhost VNS_PORT=9000)
*
*
- * @param aVNSParamKey -
- * name of the VNS parameter for which the value is sought
- * @param aCasProcessorConfig -
- * CPE descriptor settings
- * @param aDefault -
- * default value for the named parameter if parameter is not defined
+ * @param aVNSParamKey
+ * - name of the VNS parameter for which the value is sought
+ * @param aCasProcessorConfig
+ * - CPE descriptor settings
+ * @param aDefault
+ * - default value for the named parameter if parameter is not defined
*
* @return - value for a named VNS parameter
- * @throws ResourceConfigurationException passthru
+ * @throws ResourceConfigurationException
+ * passthru
*/
private String getVNSSettingFor(String aVNSParamKey,
CasProcessorConfiguration aCasProcessorConfig, String aDefault)
@@ -1777,26 +1742,23 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
* contacts local vns and is assigned a port to run on. The same port is added to the port queue
* and used here for establishing a connection.
*
- * @param aProcessingContainer the a processing container
- * @param casProcessorConfig -
- * CasProcessor configuration
- * @param redeploy -
- * flag indicating if if this is restart
- * @param howMany -
- * indicates how many connections to make
- * @throws ConnectException -
- * unable to establish connection to Cas Processor
+ * @param aProcessingContainer
+ * the a processing container
+ * @param casProcessorConfig
+ * - CasProcessor configuration
+ * @param redeploy
+ * - flag indicating if if this is restart
+ * @param howMany
+ * - indicates how many connections to make
+ * @throws ConnectException
+ * - unable to establish connection to Cas Processor
*/
private void connectToServices(ProcessingContainer aProcessingContainer,
CasProcessorConfiguration casProcessorConfig, boolean redeploy, int howMany)
throws ConnectException {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "initialize",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_thread_count__FINEST",
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_thread_count__FINEST",
new Object[] { Thread.currentThread().getName(), aProcessingContainer.getName(),
String.valueOf(howMany) });
}
@@ -1806,11 +1768,8 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
// managed by the CPE.
for (int i = 0; i < howMany; i++) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "initialize",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_activating_service_on_port2__FINEST",
new Object[] { Thread.currentThread().getName(), aProcessingContainer.getName(),
String.valueOf(i), String.valueOf(howMany) });
@@ -1856,11 +1815,8 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
// on a given port.
try {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "initialize",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_activating_service_on_port__FINEST",
new Object[] { Thread.currentThread().getName(), aProcessingContainer.getName(),
String.valueOf(port) });
@@ -1879,18 +1835,21 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
* Used during a launch of the managed (local) Cas Processor this method returns a port number on
* which the Cas Processor is waiting for requests. Each Cas Processor was a given a port by the
* local vns where it is expected to accept requests from clients. The ports assigned to Cas
- * Processors are managed by the local instance of the VNS and available in the queue <i>portQueue</i>.
+ * Processors are managed by the local instance of the VNS and available in the queue
+ * <i>portQueue</i>.
*
- * @param portQueue -
- * queue containing ports assigned to services by local VNS
+ * @param portQueue
+ * - queue containing ports assigned to services by local VNS
* @return - port as String
- * @throws TimeLimitExceededException timeout waiting for port
+ * @throws TimeLimitExceededException
+ * timeout waiting for port
*/
private String getPort(BoundedWorkQueue portQueue) throws TimeLimitExceededException {
int waitCount = MAX_WAIT_TRIES; // default
try {
- waitCount = System.getProperty(CONN_RETRY_COUNT) != null ? Integer.parseInt(System
- .getProperty(CONN_RETRY_COUNT)) : MAX_WAIT_TRIES;
+ waitCount = System.getProperty(CONN_RETRY_COUNT) != null
+ ? Integer.parseInt(System.getProperty(CONN_RETRY_COUNT))
+ : MAX_WAIT_TRIES;
} catch (NumberFormatException e) {
if (UIMAFramework.getLogger().isLoggable(Level.INFO)) {
UIMAFramework.getLogger(this.getClass()).logrb(Level.INFO, this.getClass().getName(),
@@ -1906,26 +1865,25 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
new Object[] { Thread.currentThread().getName(), "" });
}
while (portQueue.getCurrentSize() == 0) {
-
- try {
- if (UIMAFramework.getLogger().isLoggable(Level.INFO)) {
- UIMAFramework.getLogger(this.getClass()).logrb(Level.INFO, this.getClass().getName(),
- "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_service_port_not_allocated__INFO",
- new Object[] { Thread.currentThread().getName(), String.valueOf(waitCount) });
- }
- Thread.sleep(WAIT_TIME);
- } catch (InterruptedException e) {
- }
- if (waitCount-- <= 0) {
- throw new TimeLimitExceededException(CpmLocalizedMessage.getLocalizedMessage(
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_timeout_no_service_port__WARNING", new Object[] {
- Thread.currentThread().getName(),
- String.valueOf(waitCount * WAIT_TIME + " millis") }));
+ try {
+ if (UIMAFramework.getLogger().isLoggable(Level.INFO)) {
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.INFO, this.getClass().getName(),
+ "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_service_port_not_allocated__INFO",
+ new Object[] { Thread.currentThread().getName(), String.valueOf(waitCount) });
}
-
+ Thread.sleep(WAIT_TIME);
+ } catch (InterruptedException e) {
+ }
+ if (waitCount-- <= 0) {
+ throw new TimeLimitExceededException(CpmLocalizedMessage.getLocalizedMessage(
+ CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_EXP_timeout_no_service_port__WARNING",
+ new Object[] { Thread.currentThread().getName(),
+ String.valueOf(waitCount * WAIT_TIME + " millis") }));
+
+ }
+
}
Object portObject = portQueue.dequeue();
if (UIMAFramework.getLogger().isLoggable(Level.INFO)) {
@@ -1939,7 +1897,8 @@ public class VinciCasProcessorDeployer implements CasProcessorDeployer {
/**
* Shutdown local VNS.
*
- * @throws CasProcessorDeploymentException the cas processor deployment exception
+ * @throws CasProcessorDeploymentException
+ * the cas processor deployment exception
*/
@Override
public void undeploy() throws CasProcessorDeploymentException {
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/vns/LocalVNS.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/vns/LocalVNS.java
index c9fdab1..6a08d39 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/vns/LocalVNS.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/vns/LocalVNS.java
@@ -35,7 +35,6 @@ import org.apache.vinci.transport.VinciFrame;
import org.apache.vinci.transport.VinciServableAdapter;
import org.apache.vinci.transport.VinciServer;
-
/**
*
* LOCAL Vinci Naming Service. Used by locally deployed TAEs. Locally, meaning TAEs running on the
@@ -45,7 +44,7 @@ import org.apache.vinci.transport.VinciServer;
*/
public class LocalVNS extends VinciServableAdapter implements Runnable {
-
+
/** The onport. */
private int onport;
@@ -73,13 +72,14 @@ public class LocalVNS extends VinciServableAdapter implements Runnable {
/**
* Instantiates Local Vinci Naming Service.
*
- * @param aStartPort -
- * a starting port # for clients (services)
- * @param aEndPort -
- * an ending port # for clients( services)
- * @param aVNSPort -
- * port on which this VNS will listen on
- * @throws PortUnreachableException the port unreachable exception
+ * @param aStartPort
+ * - a starting port # for clients (services)
+ * @param aEndPort
+ * - an ending port # for clients( services)
+ * @param aVNSPort
+ * - port on which this VNS will listen on
+ * @throws PortUnreachableException
+ * the port unreachable exception
*/
public LocalVNS(String aStartPort, String aEndPort, String aVNSPort)
throws PortUnreachableException {
@@ -134,14 +134,15 @@ public class LocalVNS extends VinciServableAdapter implements Runnable {
* port is tested first for availability. If it is not available the next port is tested, until
* one is found to be available.
*
- * @param aStartPort -
- * starting port number used
- * @param aEndPort -
- * end port number. Together with StartPort defines the range of ports (port pool)
- * @param aVNSPort -
- * port on which this VNS will listen for requests
+ * @param aStartPort
+ * - starting port number used
+ * @param aEndPort
+ * - end port number. Together with StartPort defines the range of ports (port pool)
+ * @param aVNSPort
+ * - port on which this VNS will listen for requests
*
- * @throws PortUnreachableException unreachable port after retries
+ * @throws PortUnreachableException
+ * unreachable port after retries
*/
public LocalVNS(int aStartPort, int aEndPort, int aVNSPort) throws PortUnreachableException {
startport = aStartPort;
@@ -182,8 +183,8 @@ public class LocalVNS extends VinciServableAdapter implements Runnable {
/**
* Associates a port pool with instance of VNS.
*
- * @param pQueue -
- * queue where allocated ports will be added
+ * @param pQueue
+ * - queue where allocated ports will be added
*/
public synchronized void setConnectionPool(BoundedWorkQueue pQueue) {
portQueue = pQueue;
@@ -193,7 +194,8 @@ public class LocalVNS extends VinciServableAdapter implements Runnable {
* Determines if a given port is free. It establishes a short lived connection to the port and if
* successful returns false.
*
- * @param port number to check
+ * @param port
+ * number to check
* @return true, if is available
*/
public boolean isAvailable(int port) {
@@ -236,7 +238,8 @@ public class LocalVNS extends VinciServableAdapter implements Runnable {
*
* @return - free port
*
- * @throws PortUnreachableException can't get port in configured range
+ * @throws PortUnreachableException
+ * can't get port in configured range
*/
public synchronized int getPort() throws PortUnreachableException {
boolean portAvailable = false;
@@ -257,9 +260,8 @@ public class LocalVNS extends VinciServableAdapter implements Runnable {
// In case ports are not available break out of the loop having tried 4 times
// to acquire any of the ports in configured range
if (retryCount > 3) {
- throw new PortUnreachableException(
- "Unable to aquire any of the ports in configured range:[" + startport + ".."
- + maxport + "]");
+ throw new PortUnreachableException("Unable to aquire any of the ports in configured range:["
+ + startport + ".." + maxport + "]");
}
}
return onport;
@@ -270,9 +272,11 @@ public class LocalVNS extends VinciServableAdapter implements Runnable {
* "serveon" request to VNS and waits for assigned port. The VNS looks up its cahce of ports and
* returns to the service one that has not yest allocated.
*
- * @param in the in
+ * @param in
+ * the in
* @return the transportable
- * @throws ServiceException the service exception
+ * @throws ServiceException
+ * the service exception
*/
@Override
public synchronized Transportable eval(Transportable in) throws ServiceException {
@@ -334,15 +338,14 @@ public class LocalVNS extends VinciServableAdapter implements Runnable {
if (publicVNSHost == null || publicVNSHost.trim().length() == 0 || publicVNSPort == null
|| publicVNSPort.trim().length() == 0) {
if (UIMAFramework.getLogger().isLoggable(Level.WARNING)) {
- UIMAFramework.getLogger(this.getClass()).logrb(Level.WARNING,
- this.getClass().getName(), "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.WARNING, this.getClass().getName(),
+ "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_unknown_vns_command__WARNING",
new Object[] { Thread.currentThread().getName() });
}
VinciFrame rtn = new VinciFrame();
- rtn
- .fadd("vinci:EXCEPTION",
- "CPM Reply:Public VNS not known. Verify CPMs startup param include -DVNS_HOST and -DVNS_PORT");
+ rtn.fadd("vinci:EXCEPTION",
+ "CPM Reply:Public VNS not known. Verify CPMs startup param include -DVNS_HOST and -DVNS_PORT");
return rtn;
}
int pvnsPort = -1;
@@ -350,8 +353,8 @@ public class LocalVNS extends VinciServableAdapter implements Runnable {
pvnsPort = Integer.parseInt(publicVNSPort);
} catch (NumberFormatException e) {
if (UIMAFramework.getLogger().isLoggable(Level.WARNING)) {
- UIMAFramework.getLogger(this.getClass()).logrb(Level.WARNING,
- this.getClass().getName(), "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.WARNING, this.getClass().getName(),
+ "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_unknown_vns_command__WARNING",
new Object[] { Thread.currentThread().getName() });
}
@@ -398,8 +401,7 @@ public class LocalVNS extends VinciServableAdapter implements Runnable {
server.shutdownServing();
if (UIMAFramework.getLogger().isLoggable(Level.INFO)) {
UIMAFramework.getLogger(this.getClass()).logrb(Level.INFO, this.getClass().getName(),
- "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_vns_stopped_serving__INFO",
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_vns_stopped_serving__INFO",
new Object[] { Thread.currentThread().getName() });
}
}
@@ -409,7 +411,9 @@ public class LocalVNS extends VinciServableAdapter implements Runnable {
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#finalize()
*/
@Override
@@ -437,8 +441,7 @@ public class LocalVNS extends VinciServableAdapter implements Runnable {
try {
if (UIMAFramework.getLogger().isLoggable(Level.INFO)) {
UIMAFramework.getLogger(this.getClass()).logrb(Level.INFO, this.getClass().getName(),
- "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_launching_local_vns__INFO",
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_launching_local_vns__INFO",
new Object[] { Thread.currentThread().getName(), String.valueOf(vnsPort) });
}
server = new VinciServer(this);
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/vns/VNSQuery.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/vns/VNSQuery.java
index 17eeb0b..81139c8 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/vns/VNSQuery.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/vns/VNSQuery.java
@@ -40,13 +40,13 @@ public class VNSQuery {
/**
* Connects to a VNS server identified by host and port
*
- * @param aVnsHost -
- * VNS host name
- * @param aVnsPort -
- * VNS port number
+ * @param aVnsHost
+ * - VNS host name
+ * @param aVnsPort
+ * - VNS port number
*
- * @throws Exception -
- * when unable to connect to VNS
+ * @throws Exception
+ * - when unable to connect to VNS
*/
public VNSQuery(String aVnsHost, int aVnsPort) throws Exception {
vnsQuery = new VinciVNSQuery(aVnsHost, aVnsPort);
@@ -55,13 +55,13 @@ public class VNSQuery {
/**
* Returns a list of services registered in the VNS and bound to a given name.
*
- * @param aName -
- * name of the service
+ * @param aName
+ * - name of the service
*
* @return - ArrayList of {@link VinciServiceInfo} instances
*
- * @throws Exception -
- * unable to get a list
+ * @throws Exception
+ * - unable to get a list
*/
public ArrayList getServices(String aName) throws Exception {
return vnsQuery.getVinciServices(aName);
@@ -71,16 +71,17 @@ public class VNSQuery {
* Returns a list of services that have not yet been assigned to any CPM proxy. It diffs the
* current list and a new list as returned from the VNS.
*
- * @param aName -
- * name of the service
- * @param assignedServices -
- * a list of services currently in use
+ * @param aName
+ * - name of the service
+ * @param assignedServices
+ * - a list of services currently in use
* @return - ArrayList of {@link VinciServiceInfo} instances
*
- * @throws Exception -
- * unable to get a list
+ * @throws Exception
+ * - unable to get a list
*/
- public ArrayList getUnassignedServices(String aName, ArrayList assignedServices) throws Exception {
+ public ArrayList getUnassignedServices(String aName, ArrayList assignedServices)
+ throws Exception {
// Retrieve a new list from the VNS
ArrayList newList = getServices(aName);
// Do a diff between current and new service list
@@ -91,10 +92,10 @@ public class VNSQuery {
/**
* Diffs two lists of services and returns those that have not yet been assigned
*
- * @param oldList -
- * current (in-use) list of services
- * @param newList -
- * new list of services
+ * @param oldList
+ * - current (in-use) list of services
+ * @param newList
+ * - new list of services
*
* @return - number of un-assigned services
*/
@@ -117,10 +118,10 @@ public class VNSQuery {
* exists in the service list but is not assigned, that means that is available. If the service
* does not exist in the list it is also considered available.
*
- * @param aService -
- * {@link VinciServiceInfo} instance to locate in the list
- * @param oldList -
- * list of current (in-use) services
+ * @param aService
+ * - {@link VinciServiceInfo} instance to locate in the list
+ * @param oldList
+ * - list of current (in-use) services
*
* @return - true, if service is available. false, otherwise
*/
@@ -151,12 +152,12 @@ public class VNSQuery {
/**
* Establishes connection to a given VNS server
*
- * @param aVnsHost -
- * name of the host where the VNS is running
- * @param aVnsPort -
- * port on which the VNS is listening
- * @throws Exception -
- * unable to connect to VNS
+ * @param aVnsHost
+ * - name of the host where the VNS is running
+ * @param aVnsPort
+ * - port on which the VNS is listening
+ * @throws Exception
+ * - unable to connect to VNS
*/
public VinciVNSQuery(String aVnsHost, int aVnsPort) throws Exception {
vnsHost = aVnsHost;
@@ -168,12 +169,12 @@ public class VNSQuery {
* Returns a list of services bound to a given name. It ONLY returns those services that are
* actually running. The VNS may return services that are stale. Those will be filtered out.
*
- * @param aVinciServiceName -
- * name of the service
+ * @param aVinciServiceName
+ * - name of the service
* @return - list of services bound to a given name.
*
- * @throws Exception -
- * error while looking up the service
+ * @throws Exception
+ * - error while looking up the service
*/
public ArrayList getVinciServices(String aVinciServiceName) throws Exception {
ArrayList serviceList = new ArrayList();
@@ -204,11 +205,8 @@ public class VNSQuery {
client = new BaseClient(serviceInfo.getHost(), serviceInfo.getPort());
if (client.isOpen()) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "initialize",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST,
+ this.getClass().getName(), "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_service_active_on_port__FINEST",
new Object[] { Thread.currentThread().getName(),
serviceInfo.getServiceName(), serviceInfo.getHost(),
@@ -219,11 +217,8 @@ public class VNSQuery {
}
} catch (ConnectException ce) {
if (UIMAFramework.getLogger().isLoggable(Level.WARNING)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.WARNING,
- this.getClass().getName(),
- "initialize",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.WARNING,
+ this.getClass().getName(), "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_service_not_active_on_port__WARNING",
new Object[] { Thread.currentThread().getName(),
serviceInfo.getServiceName(), serviceInfo.getHost(),
@@ -248,8 +243,8 @@ public class VNSQuery {
/**
* Copy service information from Vinci frame.
*
- * @param aServiceFrame -
- * Vinci frame containing service info
+ * @param aServiceFrame
+ * - Vinci frame containing service info
*
* @return- instance of {@link VinciServiceInfo} containing service info
*/
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/ArtifactProducer.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/ArtifactProducer.java
index 05a413d..b36fee3 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/ArtifactProducer.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/ArtifactProducer.java
@@ -49,7 +49,6 @@ import org.apache.uima.util.Progress;
import org.apache.uima.util.UimaTimer;
import org.apache.uima.util.impl.ProcessTrace_impl;
-
/**
* Component responsible for continuously filling a work queue with bundles containing Cas'es. The
* queue is shared with a Processing Pipeline that consumes bundles of Cas. As soon as the the
@@ -65,7 +64,7 @@ import org.apache.uima.util.impl.ProcessTrace_impl;
*
*/
public class ArtifactProducer extends Thread {
-
+
/** The thread state. */
public int threadState = 0;
@@ -123,7 +122,8 @@ public class ArtifactProducer extends Thread {
/**
* Instantiates and initializes this instance.
*
- * @param acpm the acpm
+ * @param acpm
+ * the acpm
*/
public ArtifactProducer(CPMEngine acpm) {
cpm = acpm;
@@ -135,10 +135,10 @@ public class ArtifactProducer extends Thread {
/**
* Construct instance of this class with a reference to the cpe engine and a pool of cas'es.
*
- * @param acpm -
- * reference to the cpe
- * @param aPool -
- * pool of cases
+ * @param acpm
+ * - reference to the cpe
+ * @param aPool
+ * - pool of cases
*/
public ArtifactProducer(CPMEngine acpm, CPECasPool aPool) {
cpm = acpm;
@@ -160,8 +160,8 @@ public class ArtifactProducer extends Thread {
/**
* Plug in Custom Timer to time events.
*
- * @param aTimer -
- * custom timer
+ * @param aTimer
+ * - custom timer
*/
public void setUimaTimer(UimaTimer aTimer) {
timer = aTimer;
@@ -170,7 +170,8 @@ public class ArtifactProducer extends Thread {
/**
* Sets the process trace.
*
- * @param aProcTrace the new process trace
+ * @param aProcTrace
+ * the new process trace
*/
public void setProcessTrace(ProcessTrace aProcTrace) {
globalSharedProcessTrace = aProcTrace;
@@ -208,8 +209,8 @@ public class ArtifactProducer extends Thread {
/**
* Assign total number of entities to process.
*
- * @param aNumToProcess -
- * number of entities to read from the Collection Reader
+ * @param aNumToProcess
+ * - number of entities to read from the Collection Reader
*/
public void setNumEntitiesToProcess(long aNumToProcess) {
maxToProcess = aNumToProcess;
@@ -218,8 +219,8 @@ public class ArtifactProducer extends Thread {
/**
* Assign CollectionReader to be used for reading.
*
- * @param aCollectionReader -
- * collection reader as source of data
+ * @param aCollectionReader
+ * - collection reader as source of data
*/
public void setCollectionReader(BaseCollectionReader aCollectionReader) {
collectionReader = aCollectionReader;
@@ -228,15 +229,15 @@ public class ArtifactProducer extends Thread {
// Determines how many at a time this Collection Reader will return
// for each fetch
readerFetchSize = (Integer) collectionReader.getProcessingResourceMetaData()
- .getConfigurationParameterSettings().getParameterValue("fetchSize");
+ .getConfigurationParameterSettings().getParameterValue("fetchSize");
}
}
/**
* Assigns a queue where the artifacts produced by this component will be deposited.
*
- * @param aQueue -
- * queue for the artifacts this class is producing
+ * @param aQueue
+ * - queue for the artifacts this class is producing
*/
public void setWorkQueue(BoundedWorkQueue aQueue) {
workQueue = aQueue;
@@ -246,7 +247,8 @@ public class ArtifactProducer extends Thread {
* Add table that will contain statistics gathered while reading entities from a Collection This
* table is used for non-uima reports.
*
- * @param aStatTable the new CPM stat table
+ * @param aStatTable
+ * the new CPM stat table
*/
public void setCPMStatTable(Map aStatTable) {
cpmStatTable = aStatTable;
@@ -276,7 +278,8 @@ public class ArtifactProducer extends Thread {
* optimizing processing. When pipelines start up there are already entities in the work queue to
* process.
*
- * @throws Exception the exception
+ * @throws Exception
+ * the exception
*/
public void fillQueue() throws Exception {
// Create an array holding CAS'es. Configuration of the Reader may
@@ -309,14 +312,10 @@ public class ArtifactProducer extends Thread {
// determines how many entities to return for each fetch.
casObjectList = readNext(readerFetchSize);
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_enqueue_cas_bundle__FINEST",
- new Object[] { Thread.currentThread().getName(),
- String.valueOf(casObjectList.length) });
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_enqueue_cas_bundle__FINEST", new Object[] {
+ Thread.currentThread().getName(), String.valueOf(casObjectList.length) });
}
// Count number of entities fetched so far
entityCount += casObjectList.length;
@@ -337,11 +336,8 @@ public class ArtifactProducer extends Thread {
Progress[] progress = collectionReader.getProgress();
if (progress != null) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_show_cr_progress__FINEST",
new Object[] { Thread.currentThread().getName(),
String.valueOf(progress[0].getCompleted()) });
@@ -359,9 +355,9 @@ public class ArtifactProducer extends Thread {
notifyListeners((CAS) casObjectList[i], e);
casPool.releaseCas(casList[i]);
casList[i] = null;
-// synchronized (casPool) { // removed - redundant, because done as part of releaseCas
-// casPool.notifyAll();
-// }
+ // synchronized (casPool) { // removed - redundant, because done as part of releaseCas
+ // casPool.notifyAll();
+ // }
} else {
notifyListeners(null, e);
@@ -378,13 +374,15 @@ public class ArtifactProducer extends Thread {
* Reads next set of entities from the CollectionReader. This method may return more than one Cas
* at a time.
*
- * @param fetchSize the fetch size
+ * @param fetchSize
+ * the fetch size
* @return - The Object returned from the method depends on the type of the CollectionReader.
* Either CASData[] or CASObject[] initialized with document metadata and content is
* returned. If the CollectionReader has no more entities (EOF), null is returned.
- * @throws IOException -
- * error while reading corpus
- * @throws CollectionException -
+ * @throws IOException
+ * - error while reading corpus
+ * @throws CollectionException
+ * -
* @parma fetchSize - number of entities the CollectionReader should return for each fetch. It is
* hint as the Collection Reader ultimately decides how many to return.
*/
@@ -423,14 +421,10 @@ public class ArtifactProducer extends Thread {
; // intentionally empty while loop
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_cr_check_cas_for_null__FINEST",
- new Object[] { Thread.currentThread().getName(),
- String.valueOf((casList[i] == null)) });
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_cr_check_cas_for_null__FINEST", new Object[] {
+ Thread.currentThread().getName(), String.valueOf((casList[i] == null)) });
}
if (cpm.isRunning() == false) {
// CPM is in shutdown stage. No need to enqueue additional
@@ -444,9 +438,9 @@ public class ArtifactProducer extends Thread {
for (int listCounter = 0; casList != null && casList[i] != null
&& listCounter < casList.length; listCounter++) {
casPool.releaseCas(casList[listCounter]);
-// synchronized (casPool) { // redundant - releaseCas call does this
-// casPool.notifyAll();
-// }
+ // synchronized (casPool) { // redundant - releaseCas call does this
+ // casPool.notifyAll();
+ // }
}
if (cpmStatTable != null) {
Progress[] progress = collectionReader.getProgress();
@@ -477,8 +471,8 @@ public class ArtifactProducer extends Thread {
casList[i].reset();
// If Collection Reader and CAS Initilaizer do not declare any
- // output SofAs, must be passed the default view (meaning whatever's
- //mapped to _InitialView) for backward compatiblity
+ // output SofAs, must be passed the default view (meaning whatever's
+ // mapped to _InitialView) for backward compatiblity
Capability[] capabilities;
CasInitializer casIni = ((CollectionReader) collectionReader).getCasInitializer();
if (casIni != null)
@@ -509,9 +503,9 @@ public class ArtifactProducer extends Thread {
String absSofaName = context.getComponentInfo().mapToSofaID(CAS.NAME_DEFAULT_SOFA);
if (!CAS.NAME_DEFAULT_SOFA.equals(absSofaName)) {
casList[i].createView(CAS.NAME_DEFAULT_SOFA);
- }
+ }
CAS view = casList[i].getView(CAS.NAME_DEFAULT_SOFA);
-
+
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST,
this.getClass().getName(), "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
@@ -613,12 +607,12 @@ public class ArtifactProducer extends Thread {
success = true;
} finally {
if (!success) {
- localTrace.endEvent(collectionReader.getProcessingResourceMetaData().getName(),
- "Process", "failure");
+ localTrace.endEvent(collectionReader.getProcessingResourceMetaData().getName(), "Process",
+ "failure");
} else {
- localTrace.endEvent(collectionReader.getProcessingResourceMetaData().getName(),
- "Process", "success");
+ localTrace.endEvent(collectionReader.getProcessingResourceMetaData().getName(), "Process",
+ "success");
}
synchronized (globalSharedProcessTrace) {
@@ -680,8 +674,7 @@ public class ArtifactProducer extends Thread {
placeEOFToken();
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
- "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_eof_marker_enqueued__FINEST",
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_eof_marker_enqueued__FINEST",
new Object[] { Thread.currentThread().getName() });
}
return;
@@ -725,18 +718,17 @@ public class ArtifactProducer extends Thread {
threadState = 1004; // Entering hasNext()
// start the CR event
- localTrace.startEvent(collectionReader.getProcessingResourceMetaData().getName(),
- "Process", "");
+ localTrace.startEvent(collectionReader.getProcessingResourceMetaData().getName(), "Process",
+ "");
crEventCompleted = false;
if (collectionReader.hasNext()) {
- localTrace.endEvent(collectionReader.getProcessingResourceMetaData().getName(),
- "Process", "success");
+ localTrace.endEvent(collectionReader.getProcessingResourceMetaData().getName(), "Process",
+ "success");
crEventCompleted = true;
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
- "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_get_cas_from_cr__FINEST",
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_get_cas_from_cr__FINEST",
new Object[] { Thread.currentThread().getName() });
}
casObjectList = readNext(readerFetchSize);
@@ -747,14 +739,15 @@ public class ArtifactProducer extends Thread {
ChunkMetadata meta = CPMUtils.getChunkMetadata((CAS) casObjectList[i]);
if (meta != null) {
if (timedoutDocs.containsKey(meta.getDocId())) {
- notifyListeners(casList[i], new ResourceProcessException(new SkipCasException(
- "Dropping CAS due chunk Timeout. Doc Id::" + meta.getDocId()
- + " Sequence:" + meta.getSequence())));
+ notifyListeners(casList[i],
+ new ResourceProcessException(new SkipCasException(
+ "Dropping CAS due chunk Timeout. Doc Id::" + meta.getDocId()
+ + " Sequence:" + meta.getSequence())));
casPool.releaseCas((CAS) casObjectList[i]);
-// synchronized (casPool) { // redundant, releaseCas call does this
-// casPool.notifyAll();
-// }
+ // synchronized (casPool) { // redundant, releaseCas call does this
+ // casPool.notifyAll();
+ // }
releasedCas = true;
}
}
@@ -764,14 +757,10 @@ public class ArtifactProducer extends Thread {
}
}
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_place_cas_in_queue__FINEST",
- new Object[] { Thread.currentThread().getName(),
- String.valueOf(casObjectList.length) });
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST,
+ this.getClass().getName(), "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_place_cas_in_queue__FINEST", new Object[] {
+ Thread.currentThread().getName(), String.valueOf(casObjectList.length) });
}
// Prevent processing of new CASes if the CPM has been
// killed hard. Allow processing of CASes
@@ -782,17 +771,14 @@ public class ArtifactProducer extends Thread {
|| (cpm.isRunning() == false && cpm.isHardKilled() == false)) {
threadState = 1005; // Entering enqueue
workQueue.enqueue(casObjectList);
-// synchronized (workQueue) { // redundant, enqueue does this
-// workQueue.notifyAll();
-// }
+ // synchronized (workQueue) { // redundant, enqueue does this
+ // workQueue.notifyAll();
+ // }
threadState = 1006; // Done Entering enqueue
entityCount += casObjectList.length;
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST,
+ this.getClass().getName(), "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_placed_cas_in_queue__FINEST",
new Object[] { Thread.currentThread().getName(),
String.valueOf(casObjectList.length) });
@@ -838,8 +824,8 @@ public class ArtifactProducer extends Thread {
} catch (Exception e) {
// The following conditional is true if hasNext() has failed
if (!crEventCompleted) {
- localTrace.endEvent(collectionReader.getProcessingResourceMetaData().getName(),
- "Process", "failure");
+ localTrace.endEvent(collectionReader.getProcessingResourceMetaData().getName(), "Process",
+ "failure");
}
// e.printStackTrace();
// changed from FINER to WARNING: https://issues.apache.org/jira/browse/UIMA-2440
@@ -859,9 +845,9 @@ public class ArtifactProducer extends Thread {
notifyListeners(casList[i], e);
casPool.releaseCas(casList[i]);
casList[i] = null;
-// synchronized (casPool) { // redundant, releaseCas does this
-// casPool.notifyAll();
-// }
+ // synchronized (casPool) { // redundant, releaseCas does this
+ // casPool.notifyAll();
+ // }
} else {
notifyListeners(null, e);
@@ -906,20 +892,21 @@ public class ArtifactProducer extends Thread {
/**
* Notify registered callback listeners of a given exception.
*
- * @param aCas the a cas
- * @param anException -
- * exception to propagate to callback listeners
+ * @param aCas
+ * the a cas
+ * @param anException
+ * - exception to propagate to callback listeners
*/
private void notifyListeners(CAS aCas, Exception anException) {
for (int i = 0; callbackListeners != null && i < callbackListeners.size(); i++) {
StatusCallbackListener statCL = (StatusCallbackListener) callbackListeners.get(i);
- if ( statCL != null ) {
+ if (statCL != null) {
ProcessTrace prTrace = new ProcessTrace_impl(cpm.getPerformanceTuningSettings());
EntityProcessStatusImpl aEntityProcStatus = new EntityProcessStatusImpl(prTrace);
aEntityProcStatus.addEventStatus("Collection Reader Failure", "failed", anException);
// Notify the listener that the Cas has been processed
CPMEngine.callEntityProcessCompleteWithCAS(statCL, aCas, aEntityProcStatus);
-// statCL.entityProcessComplete(aCas, aEntityProcStatus);
+ // statCL.entityProcessComplete(aCas, aEntityProcStatus);
}
}
}
@@ -953,9 +940,9 @@ public class ArtifactProducer extends Thread {
new Object[] { Thread.currentThread().getName(), String.valueOf(cpm.isRunning()) });
}
-// synchronized (workQueue) { // redundant, the enqueue call above does this
-// workQueue.notifyAll();
-// }
+ // synchronized (workQueue) { // redundant, the enqueue call above does this
+ // workQueue.notifyAll();
+ // }
} catch (Exception e) {
e.printStackTrace();
if (UIMAFramework.getLogger().isLoggable(Level.SEVERE)) {
@@ -983,7 +970,8 @@ public class ArtifactProducer extends Thread {
/**
* Invalidate.
*
- * @param aCasList the a cas list
+ * @param aCasList
+ * the a cas list
*/
public void invalidate(CAS[] aCasList) {
for (int i = 0; aCasList != null && i < aCasList.length && aCasList[i] != null; i++) {
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/BoundedWorkQueue.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/BoundedWorkQueue.java
index fa97b6f..c8931fe 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/BoundedWorkQueue.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/BoundedWorkQueue.java
@@ -26,20 +26,20 @@ import org.apache.uima.cas.CAS;
import org.apache.uima.collection.impl.cpm.utils.CPMUtils;
import org.apache.uima.util.Level;
-
/**
* Implementation of a Bounded Queue, a queue with a fixed number of slots. Used primarily to feed
* data to Processing Units, it is filled by a producer like ArtifactProducer and consumed by
* ProcessingUnit(s). When the queue is full it will block a request for enqueue until a slot frees
- * up.
+ * up.
*
- * <p>There are 2 dequeue calls. One returns null if the queue is empty, the other can be given a
+ * <p>
+ * There are 2 dequeue calls. One returns null if the queue is empty, the other can be given a
* timeout - and it will wait up to that time waiting for something to get enqueued.
*
*
*/
public class BoundedWorkQueue {
-
+
/** The queue max size. */
protected final int queueMaxSize;
@@ -61,12 +61,12 @@ public class BoundedWorkQueue {
/**
* Initialize the instance.
*
- * @param aQueueSize -
- * fixed size for this queue (capacity)
- * @param aQueueName -
- * name for this queue
- * @param aCpmEngine -
- * CPE Engine reference
+ * @param aQueueSize
+ * - fixed size for this queue (capacity)
+ * @param aQueueName
+ * - name for this queue
+ * @param aCpmEngine
+ * - CPE Engine reference
*/
public BoundedWorkQueue(int aQueueSize, String aQueueName, CPMEngine aCpmEngine) {
queueMaxSize = aQueueSize;
@@ -113,17 +113,13 @@ public class BoundedWorkQueue {
/**
* Enqueues a given object onto the queue. It blocks if the queue is full.
*
- * @param anObject -
- * an object to enqueue
+ * @param anObject
+ * - an object to enqueue
*/
public synchronized void enqueue(Object anObject) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_entering_queue__FINEST",
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_entering_queue__FINEST",
new Object[] { Thread.currentThread().getName(), queueName,
String.valueOf(numberElementsInQueue) });
}
@@ -136,12 +132,8 @@ public class BoundedWorkQueue {
// Block if the queue is full AND the CPE is running
while (numberElementsInQueue == queueMaxSize && (cpm == null || cpm.isRunning())) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_queue_full__FINEST",
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_queue_full__FINEST",
new Object[] { Thread.currentThread().getName(), queueName,
String.valueOf(numberElementsInQueue) });
}
@@ -152,12 +144,8 @@ public class BoundedWorkQueue {
}
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_adding_cas_to_queue__FINEST",
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_adding_cas_to_queue__FINEST",
new Object[] { Thread.currentThread().getName(), queueName,
String.valueOf(numberElementsInQueue) });
}
@@ -166,16 +154,12 @@ public class BoundedWorkQueue {
// increment number of items in the queue
numberElementsInQueue++;
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_cas_in_queue__FINEST",
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_cas_in_queue__FINEST",
new Object[] { Thread.currentThread().getName(), queueName,
String.valueOf(numberElementsInQueue) });
}
- notifyAll();
+ notifyAll();
}
/**
@@ -185,12 +169,8 @@ public class BoundedWorkQueue {
*/
public synchronized Object dequeue() {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_enter_dequeue__FINEST",
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_enter_dequeue__FINEST",
new Object[] { Thread.currentThread().getName(), queueName,
String.valueOf(numberElementsInQueue) });
}
@@ -204,12 +184,8 @@ public class BoundedWorkQueue {
numberElementsInQueue--;
if (returnedObject instanceof Object[]) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_cas_dequeued__FINEST",
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_cas_dequeued__FINEST",
new Object[] { Thread.currentThread().getName(), queueName,
String.valueOf(((Object[]) returnedObject).length) });
}
@@ -221,16 +197,12 @@ public class BoundedWorkQueue {
}
}
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_return_from_dequeue__FINEST",
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_return_from_dequeue__FINEST",
new Object[] { Thread.currentThread().getName(), queueName,
String.valueOf(numberElementsInQueue) });
}
-
+
return returnedObject;
}
@@ -238,32 +210,29 @@ public class BoundedWorkQueue {
* Returns an object from the queue. It will wait for the object to show up in the queue until a
* given timer expires.
*
- * @param aTimeout -
- * max millis to wait for an object
+ * @param aTimeout
+ * - max millis to wait for an object
*
* @return - Object from the queue, or null if time out
*/
public synchronized Object dequeue(long aTimeout) {
Object resource = dequeue();
- // next 5 lines commented out - was old method of waiting. -- Jan 2008 MIS
+ // next 5 lines commented out - was old method of waiting. -- Jan 2008 MIS
// changes include waiting a little (WAIT_TIMEOUT) if !cpm.isRunning, to prevent
- // 100% CPU utilization while waiting for existing processes to finish
+ // 100% CPU utilization while waiting for existing processes to finish
// also, System.currentTimeMillis only called once in revised version.
-// if (resource == null && cpm.isRunning()) {
-// try {
-// // add 1 millisecond to expire time to account for "rounding" issues
-// long timeExpire = (0 == aTimeout)? Long.MAX_VALUE : (System.currentTimeMillis() + aTimeout + 1);
-// long timeLeft = timeExpire - System.currentTimeMillis();
+ // if (resource == null && cpm.isRunning()) {
+ // try {
+ // // add 1 millisecond to expire time to account for "rounding" issues
+ // long timeExpire = (0 == aTimeout)? Long.MAX_VALUE : (System.currentTimeMillis() + aTimeout +
+ // 1);
+ // long timeLeft = timeExpire - System.currentTimeMillis();
if (resource == null) {
try {
// add 1 millisecond to expire time to account for "rounding" issues
long timeNow = System.currentTimeMillis();
- long timeExpire =
- (! cpm.isRunning()) ?
- timeNow + WAIT_TIMEOUT : // a value to avoid 100% cpu
- ((0 == aTimeout) ?
- Long.MAX_VALUE :
- timeNow + aTimeout + 1);
+ long timeExpire = (!cpm.isRunning()) ? timeNow + WAIT_TIMEOUT : // a value to avoid 100% cpu
+ ((0 == aTimeout) ? Long.MAX_VALUE : timeNow + aTimeout + 1);
long timeLeft = timeExpire - timeNow;
while (timeLeft > 0) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
@@ -271,7 +240,7 @@ public class BoundedWorkQueue {
"process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_queue_empty__FINEST",
new Object[] { Thread.currentThread().getName(), queueName });
}
- this.wait(timeLeft); // timeLeft is always > 0
+ this.wait(timeLeft); // timeLeft is always > 0
resource = dequeue();
if (null != resource) {
return resource;
@@ -281,12 +250,8 @@ public class BoundedWorkQueue {
} catch (InterruptedException e) {
}
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_queue_notified__FINEST",
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_queue_notified__FINEST",
new Object[] { Thread.currentThread().getName(), queueName,
String.valueOf(numberElementsInQueue) });
}
@@ -298,7 +263,8 @@ public class BoundedWorkQueue {
/**
* Invalidate.
*
- * @param aCasObjectList the a cas object list
+ * @param aCasObjectList
+ * the a cas object list
*/
public void invalidate(CAS[] aCasObjectList) {
}
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/CPECasPool.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/CPECasPool.java
index f380417..76fe496 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/CPECasPool.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/CPECasPool.java
@@ -30,10 +30,9 @@ import org.apache.uima.resource.CasManager;
import org.apache.uima.resource.ResourceInitializationException;
import org.apache.uima.util.Level;
-
/**
* Implements object pooling mechanism to limit number of CAS instances. Cas'es are checked out,
- * used and checked back in when done.
+ * used and checked back in when done.
*/
public class CPECasPool {
@@ -52,11 +51,12 @@ public class CPECasPool {
/**
* Initialize the pool.
*
- * @param aNumInstances -
- * max size of the pool
- * @param aCasManager -
- * CAS Manager to use to create the CASes
- * @throws ResourceInitializationException -
+ * @param aNumInstances
+ * - max size of the pool
+ * @param aCasManager
+ * - CAS Manager to use to create the CASes
+ * @throws ResourceInitializationException
+ * -
*/
public CPECasPool(int aNumInstances, CasManager aCasManager)
throws ResourceInitializationException {
@@ -67,14 +67,17 @@ public class CPECasPool {
/**
* Initialize the pool.
*
- * @param aNumInstances -
- * max size of the pool
- * @param aCasManager -
- * CAS Manager to use to create the CASes
- * @param aPerformanceTuningSettings the a performance tuning settings
- * @throws ResourceInitializationException -
+ * @param aNumInstances
+ * - max size of the pool
+ * @param aCasManager
+ * - CAS Manager to use to create the CASes
+ * @param aPerformanceTuningSettings
+ * the a performance tuning settings
+ * @throws ResourceInitializationException
+ * -
*/
- public CPECasPool(int aNumInstances, CasManager aCasManager, Properties aPerformanceTuningSettings) throws ResourceInitializationException {
+ public CPECasPool(int aNumInstances, CasManager aCasManager,
+ Properties aPerformanceTuningSettings) throws ResourceInitializationException {
mNumInstances = aNumInstances;
fillPool(aCasManager, aPerformanceTuningSettings);
}
@@ -82,12 +85,15 @@ public class CPECasPool {
/**
* Fills the pool with initialized instances of CAS.
*
- * @param aCasManager -
- * definition (type system, indexes, etc.) of CASes to create
- * @param aPerformanceTuningSettings the a performance tuning settings
- * @throws ResourceInitializationException -
+ * @param aCasManager
+ * - definition (type system, indexes, etc.) of CASes to create
+ * @param aPerformanceTuningSettings
+ * the a performance tuning settings
+ * @throws ResourceInitializationException
+ * -
*/
- protected void fillPool(CasManager aCasManager, Properties aPerformanceTuningSettings) throws ResourceInitializationException {
+ protected void fillPool(CasManager aCasManager, Properties aPerformanceTuningSettings)
+ throws ResourceInitializationException {
for (int i = 0; i < mNumInstances; i++) {
CAS c = aCasManager.createNewCas(aPerformanceTuningSettings);
mAllInstances.add(c);
@@ -99,13 +105,13 @@ public class CPECasPool {
* Returns a Cas instance from the pool. This routine waits for a free instance of Cas a given
* amount of time. If free instance is not available this routine returns null.
*
- * @param aTimeout -
- * max amount of time in millis to wait for CAS instance
+ * @param aTimeout
+ * - max amount of time in millis to wait for CAS instance
* @return - CAS instance, or null on timeout
*/
public synchronized CAS getCas(long aTimeout) {
CAS cas = getCas();
-
+
if (cas != null) {
return cas;
}
@@ -131,11 +137,8 @@ public class CPECasPool {
// Add the cas to a list of checked-out cases
checkedOutInstances.add(cas);
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_add_cas_to_checkedout_list__FINEST",
new Object[] { Thread.currentThread().getName(),
String.valueOf(checkedOutInstances.size()) });
@@ -176,11 +179,8 @@ public class CPECasPool {
if (index != -1) {
checkedOutInstances.remove(index);
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_removed_from_checkedout_list__FINEST",
new Object[] { Thread.currentThread().getName(),
String.valueOf(checkedOutInstances.size()) });
@@ -188,16 +188,12 @@ public class CPECasPool {
}
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_return_cas_to_pool__FINEST",
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_return_cas_to_pool__FINEST",
new Object[] { Thread.currentThread().getName(),
String.valueOf(checkedOutInstances.size()) });
}
- this.notifyAll(); // when CAS becomes available
+ this.notifyAll(); // when CAS becomes available
}
}
@@ -214,8 +210,8 @@ public class CPECasPool {
/**
* Returns a CAS found in a given position in the list.
*
- * @param aIndex -
- * position of the CAS in the list
+ * @param aIndex
+ * - position of the CAS in the list
*
* @return CAS - reference to a CAS
*/
@@ -236,23 +232,23 @@ public class CPECasPool {
}
// never called and dangerous to expose
-// /**
-// * Returns pool capacity
-// *
-// * @return - size of the pool
-// */
-// protected Vector getAllInstances() {
-// return mAllInstances;
-// }
+ // /**
+ // * Returns pool capacity
+ // *
+ // * @return - size of the pool
+ // */
+ // protected Vector getAllInstances() {
+ // return mAllInstances;
+ // }
// Never called
-// /**
-// * Number of free Cas'es available in the pool
-// *
-// * @return
-// */
-// protected synchronized Vector getFreeInstances() {
-// return mFreeInstances;
-// }
+ // /**
+ // * Number of free Cas'es available in the pool
+ // *
+ // * @return
+ // */
+ // protected synchronized Vector getFreeInstances() {
+ // return mFreeInstances;
+ // }
}
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/CPMChunkTimeoutException.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/CPMChunkTimeoutException.java
index ac1622a..73cb9f8 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/CPMChunkTimeoutException.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/CPMChunkTimeoutException.java
@@ -21,13 +21,11 @@ package org.apache.uima.collection.impl.cpm.engine;
import org.apache.uima.resource.ResourceProcessException;
-
-
/**
* The Class CPMChunkTimeoutException.
*/
public class CPMChunkTimeoutException extends ResourceProcessException {
-
+
/** The Constant serialVersionUID. */
private static final long serialVersionUID = 358067081843640078L;
@@ -43,9 +41,12 @@ public class CPMChunkTimeoutException extends ResourceProcessException {
/**
* Instantiates a new CPM chunk timeout exception.
*
- * @param aDocumentId the document ID
- * @param aThrottleID tbd
- * @param aDocumentURL document URL
+ * @param aDocumentId
+ * the document ID
+ * @param aThrottleID
+ * tbd
+ * @param aDocumentURL
+ * document URL
*/
public CPMChunkTimeoutException(long aDocumentId, String aThrottleID, String aDocumentURL) {
docID = aDocumentId;
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/CPMThreadGroup.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/CPMThreadGroup.java
index c01f7df..d144972 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/CPMThreadGroup.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/CPMThreadGroup.java
@@ -29,7 +29,6 @@ import org.apache.uima.collection.impl.cpm.utils.CPMUtils;
import org.apache.uima.util.Level;
import org.apache.uima.util.ProcessTrace;
-
/**
* This component catches uncaught errors in the CPM. All critical threads in the CPM are part of
* this ThreadGroup. If OutOfMemory Error is thrown this component is notified by the JVM and its
@@ -37,7 +36,7 @@ import org.apache.uima.util.ProcessTrace;
*
*/
public class CPMThreadGroup extends ThreadGroup {
-
+
/** The callback listeners. */
private ArrayList callbackListeners = null;
@@ -47,7 +46,8 @@ public class CPMThreadGroup extends ThreadGroup {
/**
* Instantiates a new CPM thread group.
*
- * @param name the name
+ * @param name
+ * the name
*/
public CPMThreadGroup(String name) {
super(name);
@@ -56,10 +56,10 @@ public class CPMThreadGroup extends ThreadGroup {
/**
* Instantiates a new CPM thread group.
*
- * @param parent -
- * parent thread group
- * @param name -
- * name of this thread group
+ * @param parent
+ * - parent thread group
+ * @param name
+ * - name of this thread group
*/
public CPMThreadGroup(ThreadGroup parent, String name) {
super(parent, name);
@@ -68,8 +68,8 @@ public class CPMThreadGroup extends ThreadGroup {
/**
* Sets listeners to be used in notifications.
*
- * @param aListenerList -
- * list of registered listners
+ * @param aListenerList
+ * - list of registered listners
*/
public void setListeners(ArrayList aListenerList) {
callbackListeners = aListenerList;
@@ -78,13 +78,16 @@ public class CPMThreadGroup extends ThreadGroup {
/**
* Sets the process trace.
*
- * @param aProcessTrace the new process trace
+ * @param aProcessTrace
+ * the new process trace
*/
public void setProcessTrace(ProcessTrace aProcessTrace) {
procTr = aProcessTrace;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.ThreadGroup#uncaughtException(java.lang.Thread, java.lang.Throwable)
*/
@Override
@@ -116,8 +119,10 @@ public class CPMThreadGroup extends ThreadGroup {
/**
* Notify listener.
*
- * @param aStatCL the a stat CL
- * @param e the e
+ * @param aStatCL
+ * the a stat CL
+ * @param e
+ * the e
*/
private void notifyListener(BaseStatusCallbackListener aStatCL, Throwable e) {
EntityProcessStatusImpl enProcSt = new EntityProcessStatusImpl(procTr);
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/ConsumerCasUtils.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/ConsumerCasUtils.java
index 31789e0..6aad494 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/ConsumerCasUtils.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/ConsumerCasUtils.java
@@ -23,29 +23,30 @@ import org.apache.uima.cas.CAS;
import org.apache.uima.cas.FSIterator;
import org.apache.uima.cas.FeatureStructure;
-
/**
* The Class ConsumerCasUtils.
*/
public class ConsumerCasUtils {
-
+
/**
* Returns an int value of a given Feature Structure.
*
- * @param aCasView -
- * CAS instance to retrieve data from
- * @param aTypeS -
- * Feature Type
- * @param aFeatS -
- * Feature Structure
+ * @param aCasView
+ * - CAS instance to retrieve data from
+ * @param aTypeS
+ * - Feature Type
+ * @param aFeatS
+ * - Feature Structure
* @return - feature value as int
*/
public static int getIntFeatValue(CAS aCasView, String aTypeS, String aFeatS) {
int result = 0;
- FSIterator idIter = aCasView.getAnnotationIndex(aCasView.getTypeSystem().getType(aTypeS)).iterator();
+ FSIterator idIter = aCasView.getAnnotationIndex(aCasView.getTypeSystem().getType(aTypeS))
+ .iterator();
while (idIter != null && idIter.isValid()) {
org.apache.uima.cas.FeatureStructure idFS = idIter.get();
- result = idFS.getIntValue(aCasView.getTypeSystem().getFeatureByFullName(aTypeS + ":" + aFeatS));
+ result = idFS
+ .getIntValue(aCasView.getTypeSystem().getFeatureByFullName(aTypeS + ":" + aFeatS));
idIter.moveToNext();
}
return result;
@@ -54,12 +55,12 @@ public class ConsumerCasUtils {
/**
* Returns a string value of a given Feature Structure.
*
- * @param aCasView -
- * CAS view to retrieve data from
- * @param aTypeS -
- * Feature Type
- * @param aFeatS -
- * Feature Structure
+ * @param aCasView
+ * - CAS view to retrieve data from
+ * @param aTypeS
+ * - Feature Type
+ * @param aFeatS
+ * - Feature Structure
* @return feature value as string
*/
public static String getStringFeatValue(CAS aCasView, String aTypeS, String aFeatS) {
@@ -68,8 +69,8 @@ public class ConsumerCasUtils {
.iterator();
while (idIter != null && idIter.isValid()) {
org.apache.uima.cas.FeatureStructure idFS = idIter.get();
- result = idFS.getStringValue(aCasView.getTypeSystem().getFeatureByFullName(
- aTypeS + ":" + aFeatS));
+ result = idFS
+ .getStringValue(aCasView.getTypeSystem().getFeatureByFullName(aTypeS + ":" + aFeatS));
idIter.moveToNext();
}
return result;
@@ -78,15 +79,16 @@ public class ConsumerCasUtils {
/**
* Returns a Feature Structure of a given type.
*
- * @param aCasView -
- * CAS instance to retrieve data from
- * @param aTypeS -
- * Feature Type
+ * @param aCasView
+ * - CAS instance to retrieve data from
+ * @param aTypeS
+ * - Feature Type
* @return the first Feature Structure of a given type
*/
public static FeatureStructure getTcasFS(CAS aCasView, String aTypeS) {
org.apache.uima.cas.FeatureStructure idFS = null;
- FSIterator idIter = aCasView.getAnnotationIndex(aCasView.getTypeSystem().getType(aTypeS)).iterator();
+ FSIterator idIter = aCasView.getAnnotationIndex(aCasView.getTypeSystem().getType(aTypeS))
+ .iterator();
while (idIter != null && idIter.isValid()) {
idFS = idIter.get();
idIter.moveToNext();
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/DebugControlThread.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/DebugControlThread.java
index 806fe99..3199b46 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/DebugControlThread.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/DebugControlThread.java
@@ -29,12 +29,11 @@ import org.apache.uima.collection.impl.cpm.utils.CpmLocalizedMessage;
import org.apache.uima.util.FileUtils;
import org.apache.uima.util.Level;
-
/**
* The Class DebugControlThread.
*/
public class DebugControlThread implements Runnable {
-
+
/** The Constant NOTFOUND. */
private final static String NOTFOUND = "NOT-FOUND";
@@ -61,9 +60,12 @@ public class DebugControlThread implements Runnable {
/**
* Instantiates a new debug control thread.
*
- * @param aCpm the a cpm
- * @param aFilename the a filename
- * @param aCheckpointFrequency the a checkpoint frequency
+ * @param aCpm
+ * the a cpm
+ * @param aFilename
+ * the a filename
+ * @param aCheckpointFrequency
+ * the a checkpoint frequency
*/
public DebugControlThread(CPMEngine aCpm, String aFilename, int aCheckpointFrequency) {
cpm = aCpm;
@@ -74,7 +76,8 @@ public class DebugControlThread implements Runnable {
/**
* Start.
*
- * @throws RuntimeException the runtime exception
+ * @throws RuntimeException
+ * the runtime exception
*/
public void start() throws RuntimeException {
if (fileName == null) {
@@ -84,10 +87,10 @@ public class DebugControlThread implements Runnable {
"UIMA_CPM_checkpoint_target_not_defined__FINEST",
new Object[] { Thread.currentThread().getName() });
}
- throw new RuntimeException(CpmLocalizedMessage.getLocalizedMessage(
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_target_checkpoint_not_defined__WARNING", new Object[] { Thread
- .currentThread().getName() }));
+ throw new RuntimeException(
+ CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_EXP_target_checkpoint_not_defined__WARNING",
+ new Object[] { Thread.currentThread().getName() }));
}
if (cpm == null) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
@@ -113,7 +116,9 @@ public class DebugControlThread implements Runnable {
doCheckpoint();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Runnable#run()
*/
@Override
@@ -147,7 +152,8 @@ public class DebugControlThread implements Runnable {
/**
* Interpret and execute command.
*
- * @param aCommand the a command
+ * @param aCommand
+ * the a command
*/
private void interpretAndExecuteCommand(String aCommand) {
if (aCommand == null) {
diff --git a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/NonThreadedProcessingUnit.java b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/NonThreadedProcessingUnit.java
index cdfc2fd..a4ed109 100644
--- a/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/NonThreadedProcessingUnit.java
+++ b/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/NonThreadedProcessingUnit.java
@@ -56,13 +56,11 @@ import org.apache.uima.util.ProcessTrace;
import org.apache.uima.util.UimaTimer;
import org.apache.uima.util.impl.ProcessTrace_impl;
-
-
/**
* The Class NonThreadedProcessingUnit.
*/
public class NonThreadedProcessingUnit {
-
+
/** The thread state. */
public int threadState = 0;
@@ -123,16 +121,15 @@ public class NonThreadedProcessingUnit {
/** The cas cache. */
private CAS[] casCache = null;
-
/**
* Initialize the PU.
*
- * @param acpm -
- * component managing life cycle of the CPE
- * @param aInputQueue -
- * queue to read from
- * @param aOutputQueue -
- * queue to write to
+ * @param acpm
+ * - component managing life cycle of the CPE
+ * @param aInputQueue
+ * - queue to read from
+ * @param aOutputQueue
+ * - queue to write to
*/
public NonThreadedProcessingUnit(CPMEngine acpm, BoundedWorkQueue aInputQueue,
BoundedWorkQueue aOutputQueue) {
@@ -148,12 +145,8 @@ public class NonThreadedProcessingUnit {
outputQueue = aOutputQueue;
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_initialize_pipeline__FINEST",
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_initialize_pipeline__FINEST",
new Object[] { Thread.currentThread().getName(), workQueue.getName(),
String.valueOf(workQueue.getCurrentSize()) });
}
@@ -162,7 +155,8 @@ public class NonThreadedProcessingUnit {
/**
* Instantiates a new non threaded processing unit.
*
- * @param acpm the acpm
+ * @param acpm
+ * the acpm
*/
public NonThreadedProcessingUnit(CPMEngine acpm) {
cpm = acpm;
@@ -178,8 +172,8 @@ public class NonThreadedProcessingUnit {
/**
* Alternative method of providing a queue from which this PU will read bundle of Cas.
*
- * @param aInputQueue -
- * read queue
+ * @param aInputQueue
+ * - read queue
*/
public void setInputQueue(BoundedWorkQueue aInputQueue) {
workQueue = aInputQueue;
@@ -188,8 +182,8 @@ public class NonThreadedProcessingUnit {
/**
* Alternative method of providing a queue where this PU will deposit results of analysis.
*
- * @param aOutputQueue -
- * queue to write to
+ * @param aOutputQueue
+ * - queue to write to
*/
public void setOutputQueue(BoundedWorkQueue aOutputQueue) {
outputQueue = aOutputQueue;
@@ -199,8 +193,8 @@ public class NonThreadedProcessingUnit {
* Alternative method of providing the reference to the component managing the lifecycle of the
* CPE.
*
- * @param acpm -
- * reference to the contrlling engine
+ * @param acpm
+ * - reference to the contrlling engine
*/
public void setCPMEngine(CPMEngine acpm) {
cpm = acpm;
@@ -228,8 +222,8 @@ public class NonThreadedProcessingUnit {
/**
* Set a flag indicating if notifications should be made via configured Listeners.
*
- * @param aDoNotify -
- * true if notification is required, false otherwise
+ * @param aDoNotify
+ * - true if notification is required, false otherwise
*/
public void setNotifyListeners(boolean aDoNotify) {
notifyListeners = aDoNotify;
@@ -238,8 +232,8 @@ public class NonThreadedProcessingUnit {
/**
* Plugs in Listener object used for notifications.
*
- * @param aListener -
- * {@link org.apache.uima.collection.base_cpm.BaseStatusCallbackListener} instance
+ * @param aListener
+ * - {@link org.apache.uima.collection.base_cpm.BaseStatusCallbackListener} instance
*/
public void addStatusCallbackListener(BaseStatusCallbackListener aListener) {
statusCbL.add(aListener);
@@ -258,8 +252,8 @@ public class NonThreadedProcessingUnit {
/**
* Removes given listener from the list of listeners.
*
- * @param aListener -
- * object to remove from the list
+ * @param aListener
+ * - object to remove from the list
*/
public void removeStatusCallbackListener(BaseStatusCallbackListener aListener) {
statusCbL.remove(aListener);
@@ -268,8 +262,8 @@ public class NonThreadedProcessingUnit {
/**
* Plugs in ProcessTrace object used to collect statistics.
*
- * @param aProcessingUnitProcessTrace -
- * object to compile stats
+ * @param aProcessingUnitProcessTrace
+ * - object to compile stats
*/
public void setProcessingUnitProcessTrace(ProcessTrace aProcessingUnitProcessTrace) {
processingUnitProcessTrace = aProcessingUnitProcessTrace;
@@ -279,8 +273,8 @@ public class NonThreadedProcessingUnit {
/**
* Plugs in custom timer used by the PU for getting time.
*
- * @param aTimer -
- * custom timer to use
+ * @param aTimer
+ * - custom timer to use
*/
public void setUimaTimer(UimaTimer aTimer) {
timer = aTimer;
@@ -308,8 +302,8 @@ public class NonThreadedProcessingUnit {
* Disable a CASProcessor in the processing pipeline. Locate it by provided index. The disabled
* Cas Processor remains in the Processing Pipeline, however it is not used furing processing.
*
- * @param aCasProcessorIndex -
- * location in the pipeline of the Cas Processor to delete
+ * @param aCasProcessorIndex
+ * - location in the pipeline of the Cas Processor to delete
*/
public void disableCasProcessor(int aCasProcessorIndex) {
if (aCasProcessorIndex < 0 || aCasProcessorIndex > processContainers.size()) {
@@ -331,8 +325,8 @@ public class NonThreadedProcessingUnit {
*
* Alternative method to disable Cas Processor. Uses a name to locate it.
*
- * @param aCasProcessorName -
- * a name of the Cas Processor to disable
+ * @param aCasProcessorName
+ * - a name of the Cas Processor to disable
*/
public void disableCasProcessor(String aCasProcessorName) {
for (int i = 0; i < processContainers.size(); i++) {
@@ -353,8 +347,8 @@ public class NonThreadedProcessingUnit {
* Enables Cas Processor with a given name. Enabled Cas Processor will immediately begin to
* receive bundles of Cas.
*
- * @param aCasProcessorName -
- * name of the Cas Processor to enable
+ * @param aCasProcessorName
+ * - name of the Cas Processor to enable
*/
public void enableCasProcessor(String aCasProcessorName) {
for (int i = 0; i < processContainers.size(); i++) {
@@ -373,10 +367,13 @@ public class NonThreadedProcessingUnit {
/**
* Analyze.
*
- * @param aCasObjectList the a cas object list
- * @param pTrTemp the tr temp
+ * @param aCasObjectList
+ * the a cas object list
+ * @param pTrTemp
+ * the tr temp
* @return true, if successful
- * @throws Exception the exception
+ * @throws Exception
+ * the exception
*/
protected boolean analyze(Object[] aCasObjectList, ProcessTrace pTrTemp) throws Exception // throws
// ResourceProcessException,
@@ -450,11 +447,8 @@ public class NonThreadedProcessingUnit {
try {
if (System.getProperty("SHOW_MEMORY") != null) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST,
+ this.getClass().getName(), "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_show_memory__FINEST",
new Object[] { Thread.currentThread().getName(),
String.valueOf(Runtime.getRuntime().totalMemory() / 1024),
@@ -480,8 +474,9 @@ public class NonThreadedProcessingUnit {
}
throw new ResourceProcessException(CpmLocalizedMessage.getLocalizedMessage(
CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_EXP_invalid_component_reference__WARNING", new Object[] {
- Thread.currentThread().getName(), "CasProcessor", "NULL" }), null);
+ "UIMA_CPM_EXP_invalid_component_reference__WARNING",
+ new Object[] { Thread.currentThread().getName(), "CasProcessor", "NULL" }),
+ null);
}
// Check to see if the CasProcessor is available for processing
// The CasProcessor may have been disabled due to excessive errors and error policy
@@ -507,11 +502,8 @@ public class NonThreadedProcessingUnit {
}
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_checkedout_cp_from_container__FINEST",
new Object[] { Thread.currentThread().getName(), containerName,
processor.getClass().getName() });
@@ -526,11 +518,8 @@ public class NonThreadedProcessingUnit {
isCasObject = true;
}
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_analysis_successfull__FINEST",
new Object[] { Thread.currentThread().getName(), containerName,
processor.getClass().getName() });
@@ -552,11 +541,8 @@ public class NonThreadedProcessingUnit {
} finally {
if (retry == false) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST,
+ this.getClass().getName(), "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_end_of_batch__FINEST",
new Object[] { Thread.currentThread().getName(), containerName,
processor.getClass().getName() });
@@ -578,22 +564,16 @@ public class NonThreadedProcessingUnit {
// pipeline
if (processor != null) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST,
+ this.getClass().getName(), "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_release_cp__FINEST",
new Object[] { Thread.currentThread().getName(), containerName,
processor.getClass().getName(), String.valueOf(casCache == null) });
}
doReleaseCasProcessor(container, processor);
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST,
+ this.getClass().getName(), "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_ok_release_cp__FINEST",
new Object[] { Thread.currentThread().getName(), containerName,
processor.getClass().getName(), String.valueOf(casCache == null) });
@@ -614,7 +594,8 @@ public class NonThreadedProcessingUnit {
/**
* Sets the release CAS flag.
*
- * @param aFlag the new release CAS flag
+ * @param aFlag
+ * the new release CAS flag
*/
public void setReleaseCASFlag(boolean aFlag) {
relaseCAS = aFlag;
@@ -623,7 +604,8 @@ public class NonThreadedProcessingUnit {
/**
* Sets the cas pool.
*
- * @param aPool the new cas pool
+ * @param aPool
+ * the new cas pool
*/
public void setCasPool(CPECasPool aPool) {
casPool = aPool;
@@ -632,12 +614,18 @@ public class NonThreadedProcessingUnit {
/**
* Post analysis.
*
- * @param aCasObjectList the a cas object list
- * @param isCasObject the is cas object
- * @param casObjects the cas objects
- * @param aProcessTr the a process tr
- * @param doneAlready the done already
- * @throws Exception -
+ * @param aCasObjectList
+ * the a cas object list
+ * @param isCasObject
+ * the is cas object
+ * @param casObjects
+ * the cas objects
+ * @param aProcessTr
+ * the a process tr
+ * @param doneAlready
+ * the done already
+ * @throws Exception
+ * -
*/
private void postAnalysis(Object[] aCasObjectList, boolean isCasObject, Object[] casObjects,
ProcessTrace aProcessTr, boolean doneAlready) throws Exception {
@@ -667,15 +655,11 @@ public class NonThreadedProcessingUnit {
}
}
// enqueue CASes. If the CPM is in shutdown mode due to hard kill dont allow enqueue of CASes
- if (outputQueue != null
- && (cpm.isRunning() == true || (cpm.isRunning() == false && cpm.isHardKilled() == false))) {
+ if (outputQueue != null && (cpm.isRunning() == true
+ || (cpm.isRunning() == false && cpm.isHardKilled() == false))) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_add_cas_to_queue__FINEST",
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_add_cas_to_queue__FINEST",
new Object[] { Thread.currentThread().getName(), outputQueue.getName(),
String.valueOf(outputQueue.getCurrentSize()) });
}
@@ -689,9 +673,9 @@ public class NonThreadedProcessingUnit {
casCache = null;
-// synchronized (outputQueue) { // redundant - the above enqueue call does this
-// outputQueue.notifyAll();
-// }
+ // synchronized (outputQueue) { // redundant - the above enqueue call does this
+ // outputQueue.notifyAll();
+ // }
}
return;
@@ -702,47 +686,32 @@ public class NonThreadedProcessingUnit {
if (outputQueue == null && casObjects != null && casObjects instanceof CasData[]) {
if (System.getProperty("DEBUG_RELEASE") != null) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_done_with_cas__FINEST",
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_done_with_cas__FINEST",
new Object[] { Thread.currentThread().getName(),
String.valueOf(Runtime.getRuntime().freeMemory() / 1024) });
}
}
for (int i = 0; i < casObjects.length; i++) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_show_local_cache__FINEST",
- new Object[] { Thread.currentThread().getName(),
- String.valueOf(casCache == null) });
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_show_local_cache__FINEST", new Object[] {
+ Thread.currentThread().getName(), String.valueOf(casCache == null) });
}
casObjects[i] = null;
aCasObjectList[i] = null;
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_show_local_cache__FINEST",
- new Object[] { Thread.currentThread().getName(),
- String.valueOf(casCache == null) });
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ "UIMA_CPM_show_local_cache__FINEST", new Object[] {
+ Thread.currentThread().getName(), String.valueOf(casCache == null) });
}
}
if (System.getProperty("DEBUG_RELEASE") != null) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_show_total_memory__FINEST",
new Object[] { Thread.currentThread().getName(),
String.valueOf(Runtime.getRuntime().freeMemory() / 1024) });
@@ -755,8 +724,10 @@ public class NonThreadedProcessingUnit {
/**
* Do release cas processor.
*
- * @param aContainer the a container
- * @param aCasProcessor the a cas processor
+ * @param aContainer
+ * the a container
+ * @param aCasProcessor
+ * the a cas processor
*/
private void doReleaseCasProcessor(ProcessingContainer aContainer, CasProcessor aCasProcessor) {
if (aCasProcessor != null && aContainer != null) {
@@ -767,10 +738,14 @@ public class NonThreadedProcessingUnit {
/**
* Do end of batch.
*
- * @param aContainer the a container
- * @param aProcessor the a processor
- * @param aProcessTr the a process tr
- * @param howManyCases the how many cases
+ * @param aContainer
+ * the a container
+ * @param aProcessor
+ * the a processor
+ * @param aProcessTr
+ * the a process tr
+ * @param howManyCases
+ * the how many cases
*/
private void doEndOfBatch(ProcessingContainer aContainer, CasProcessor aProcessor,
ProcessTrace aProcessTr, int howManyCases) {
@@ -798,24 +773,25 @@ public class NonThreadedProcessingUnit {
/**
* Main routine that handles errors occuring in the processing loop.
*
- * @param e -
- * exception in the main processing loop
- * @param aContainer -
- * current container of the Cas Processor
- * @param aProcessor -
- * current Cas Processor
- * @param aProcessTrace -
- * an object containing stats for this procesing loop
- * @param aCasObjectList -
- * list of CASes being analyzed
- * @param isCasObject -
- * determines type of CAS in the aCasObjectList ( CasData or CasObject)
+ * @param e
+ * - exception in the main processing loop
+ * @param aContainer
+ * - current container of the Cas Processor
+ * @param aProcessor
+ * - current Cas Processor
+ * @param aProcessTrace
+ * - an object containing stats for this procesing loop
+ * @param aCasObjectList
+ * - list of CASes being analyzed
+ * @param isCasObject
+ * - determines type of CAS in the aCasObjectList ( CasData or CasObject)
* @return boolean
- * @throws Exception -
+ * @throws Exception
+ * -
*/
- private boolean handleErrors(Throwable e, ProcessingContainer aContainer,
- CasProcessor aProcessor, ProcessTrace aProcessTrace, Object[] aCasObjectList,
- boolean isCasObject) throws Exception {
+ private boolean handleErrors(Throwable e, ProcessingContainer aContainer, CasProcessor aProcessor,
+ ProcessTrace aProcessTrace, Object[] aCasObjectList, boolean isCasObject)
+ throws Exception {
boolean retry = true;
String containerName = aContainer.getName();
@@ -823,12 +799,8 @@ public class NonThreadedProcessingUnit {
if (UIMAFramework.getLogger().isLoggable(Level.SEVERE)) {
UIMAFramework.getLogger(this.getClass()).log(Level.SEVERE, Thread.currentThread().getName(),
e);
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.SEVERE,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_handle_exception__SEVERE",
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.SEVERE, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_handle_exception__SEVERE",
new Object[] { Thread.currentThread().getName(), containerName,
aProcessor.getClass().getName(), e.getMessage() });
}
@@ -849,12 +821,8 @@ public class NonThreadedProcessingUnit {
if (casCache != null) {
clearCasCache();
}
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.WARNING,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_drop_cas__WARNING",
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.WARNING, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_drop_cas__WARNING",
new Object[] { Thread.currentThread().getName(), containerName,
aProcessor.getClass().getName() });
@@ -957,8 +925,8 @@ public class NonThreadedProcessingUnit {
}
} catch (Exception ex) {
if (UIMAFramework.getLogger().isLoggable(Level.SEVERE)) {
- UIMAFramework.getLogger(this.getClass()).log(Level.SEVERE,
- Thread.currentThread().getName(), e);
+ UIMAFramework.getLogger(this.getClass()).log(Level.SEVERE, Thread.currentThread().getName(),
+ e);
}
retry = false;
ex.printStackTrace();
@@ -969,32 +937,30 @@ public class NonThreadedProcessingUnit {
/**
* Invoke cas object cas processor.
*
- * @param container the container
- * @param processor the processor
- * @param aCasObjectList the a cas object list
- * @param pTrTemp the tr temp
- * @param isCasObject the is cas object
- * @throws Exception -
+ * @param container
+ * the container
+ * @param processor
+ * the processor
+ * @param aCasObjectList
+ * the a cas object list
+ * @param pTrTemp
+ * the tr temp
+ * @param isCasObject
+ * the is cas object
+ * @throws Exception
+ * -
*/
private void invokeCasObjectCasProcessor(ProcessingContainer container, CasProcessor processor,
Object[] aCasObjectList, ProcessTrace pTrTemp, boolean isCasObject) throws Exception {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_show_memory__FINEST",
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_show_memory__FINEST",
new Object[] { Thread.currentThread().getName(),
String.valueOf(Runtime.getRuntime().totalMemory() / 1024),
String.valueOf(Runtime.getRuntime().freeMemory() / 1024) });
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_invoke_cp_process__FINEST",
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_invoke_cp_process__FINEST",
new Object[] { Thread.currentThread().getName(), container.getName(),
processor.getClass().getName() });
@@ -1008,11 +974,8 @@ public class NonThreadedProcessingUnit {
}
if (aCasObjectList[casIndex] == null) {
if (UIMAFramework.getLogger().isLoggable(Level.SEVERE)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.SEVERE,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.SEVERE, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_casobjectlist_is_null__SEVERE",
new Object[] { Thread.currentThread().getName(), container.getName(),
String.valueOf(casIndex) });
@@ -1026,12 +989,8 @@ public class NonThreadedProcessingUnit {
}
if (processor instanceof AnalysisEngine) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_call_process__FINEST",
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_call_process__FINEST",
new Object[] { Thread.currentThread().getName(), container.getName(),
processor.getClass().getName() });
}
@@ -1039,11 +998,8 @@ public class NonThreadedProcessingUnit {
pTrTemp.aggregate(((AnalysisEngine) processor).process(casList[casIndex]));
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_call_process_completed__FINEST",
new Object[] { Thread.currentThread().getName(), container.getName(),
processor.getClass().getName() });
@@ -1053,22 +1009,15 @@ public class NonThreadedProcessingUnit {
threadState = 2006;
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
- UIMAFramework.getLogger(this.getClass()).logrb(
- Level.FINEST,
- this.getClass().getName(),
- "process",
- CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
- "UIMA_CPM_call_process__FINEST",
+ UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
+ "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_call_process__FINEST",
new Object[] { Thread.currentThread().getName(), container.getName(),
processor.getClass().getName() });
}
... 12311 lines suppressed ...