You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2016/11/12 18:26:09 UTC
svn commit: r1769397 [1/4] - in
/uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl:
cpm/container/ cpm/container/deployer/socket/ cpm/engine/ cpm/utils/
cpm/vinci/ metadata/cpe/
Author: schor
Date: Sat Nov 12 18:26:08 2016
New Revision: 1769397
URL: http://svn.apache.org/viewvc?rev=1769397&view=rev
Log:
[UIMA-5172] batch 2 of javadoc improvements so they pass lint checking on Java 8. Also added some @Overrides
Modified:
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/CasObjectNetworkCasProcessorImpl.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/socket/OFSocketTransportImpl.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/socket/ProcessControllerAdapter.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/socket/SocketTransport.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/BoundedWorkQueue.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/CPMChunkTimeoutException.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/ConsumerCasUtils.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/DebugControlThread.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/NonThreadedProcessingUnit.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/SequencedQueue.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/WorkUnit.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/CasMetaData.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/ChunkMetadata.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/ConfigurableFeature.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/CpmLocalizedMessage.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/Execute.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/ExpirationTimer.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/FeatureMap.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/Filter.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/JavaTimer.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/QueueEntity.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/Timer.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/TimerFactory.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/TypeComplianceConverterImpl.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/ValuePair.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/vinci/DATACasUtils.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/vinci/Vinci.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/CasProcessorConfigurationParameterSettingsImpl.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/CasProcessorCpeObject.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/CasProcessorDeploymentParamImpl.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/CasProcessorDeploymentParamsImpl.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/CasProcessorErrorHandlingImpl.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/CasProcessorErrorRateThresholdImpl.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/CasProcessorExecArgImpl.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/CasProcessorExecArgsImpl.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/CasProcessorExecutableImpl.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/CasProcessorFilterImpl.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/CasProcessorMaxRestartsImpl.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/CasProcessorRunInSeperateProcessImpl.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/CasProcessorRuntimeEnvParamImpl.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/CasProcessorTimeoutImpl.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/CpeCasProcessorsImpl.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/CpeCheckpointImpl.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/CpeCollectionReaderCasInitializerImpl.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/CpeCollectionReaderImpl.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/CpeCollectionReaderIteratorImpl.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/CpeComponentDescriptorImpl.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/CpeConfigurationImpl.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/CpeDescriptionImpl.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/CpeDescriptorFactory.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/CpeIncludeImpl.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/CpeIntegratedCasProcessorImpl.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/CpeLocalCasProcessorImpl.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/CpeObject.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/CpeRemoteCasProcessorImpl.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/CpeResourceManagerConfigurationImpl.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/CpeSofaMappingImpl.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/CpeSofaMappingsImpl.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/CpeTimerImpl.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/NameValuePairImpl.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/OutputQueue_impl.java
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/CasObjectNetworkCasProcessorImpl.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/CasObjectNetworkCasProcessorImpl.java?rev=1769397&r1=1769396&r2=1769397&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/CasObjectNetworkCasProcessorImpl.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/CasObjectNetworkCasProcessorImpl.java Sat Nov 12 18:26:08 2016
@@ -46,6 +46,7 @@ import org.apache.uima.util.InvalidXMLEx
import org.apache.uima.util.Level;
import org.apache.uima.util.ProcessTrace;
+// TODO: Auto-generated Javadoc
/**
* 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
@@ -53,23 +54,29 @@ import org.apache.uima.util.ProcessTrace
*
*/
public class CasObjectNetworkCasProcessorImpl implements CasObjectProcessor {
+
+ /** The transport. */
private SocketTransport transport = null;
+ /** The name. */
private String name = null;
+ /** The socket. */
private Socket socket = null;
+ /** The timeout. */
private long timeout = 0;
+ /** The metadata. */
private ProcessingResourceMetaData metadata = null;
/**
* 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
+ * @throws ResourceConfigurationException the resource configuration exception
*/
public CasObjectNetworkCasProcessorImpl(CpeCasProcessor aCasProcessor)
throws ResourceConfigurationException {
@@ -113,8 +120,8 @@ public class CasObjectNetworkCasProcesso
}
/**
- * Create Transport object from a given class and associate it with this CasProcessor
- *
+ * Create Transport object from a given class and associate it with this CasProcessor.
+ *
* @param aTransportClass -
* name of the Transport class
* @return - instance of SocketTransport
@@ -129,8 +136,8 @@ public class CasObjectNetworkCasProcesso
}
/**
- * Creates URL object containing service endpoint info ( host and port)
- *
+ * Creates URL object containing service endpoint info ( host and port).
+ *
* @return URL
*/
public URL getEndpoint() {
@@ -145,11 +152,10 @@ public class CasObjectNetworkCasProcesso
}
/**
- * Connects to a service endpoint defined in the given URL
- *
+ * Connects to a service endpoint defined in the given URL.
+ *
* @param aURL -
* contains service endpoint info (hots and port)
- *
* @throws ResourceInitializationException wraps SocketException
*/
public void connect(URL aURL) throws ResourceInitializationException {
@@ -167,6 +173,7 @@ public class CasObjectNetworkCasProcesso
* @param aCAS CAS to be analyzed
* @throws ResourceProcessException wraps Exception, SocketException
*/
+ @Override
public void processCas(CAS aCAS) throws ResourceProcessException {
try {
// delegate analysis of the CAS to remote object
@@ -179,12 +186,12 @@ public class CasObjectNetworkCasProcesso
}
/**
- * Uses configured transport to delegate given CASes to the remote service
- *
+ * 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
*/
+ @Override
public void processCas(CAS[] aCASes) throws ResourceProcessException {
try {
for (int i = 0; i < aCASes.length; i++) {
@@ -203,6 +210,7 @@ public class CasObjectNetworkCasProcesso
*
* @see org.apache.uima.collection.base_cpm.CasObjectProcessor#typeSystemInit(org.apache.uima.cas.TypeSystem)
*/
+ @Override
public void typeSystemInit(TypeSystem aTypeSystem) throws ResourceInitializationException {
// noop
@@ -213,6 +221,7 @@ public class CasObjectNetworkCasProcesso
*
* @see org.apache.uima.collection.base_cpm.CasProcessor#isStateless()
*/
+ @Override
public boolean isStateless() {
return true;
}
@@ -222,14 +231,17 @@ public class CasObjectNetworkCasProcesso
*
* @see org.apache.uima.collection.base_cpm.CasProcessor#isReadOnly()
*/
+ @Override
public boolean isReadOnly() {
return true;
}
/**
* Returns {@link ProcessingResourceMetaData} object returned from the remote CasProcessor.
- *
+ *
+ * @return the processing resource meta data
*/
+ @Override
public ProcessingResourceMetaData getProcessingResourceMetaData() {
if (socket == null) {
return metadata;
@@ -254,6 +266,7 @@ public class CasObjectNetworkCasProcesso
*
* @see org.apache.uima.collection.base_cpm.CasProcessor#batchProcessComplete(org.apache.uima.util.ProcessTrace)
*/
+ @Override
public void batchProcessComplete(ProcessTrace aTrace) throws ResourceProcessException,
IOException {
// noop
@@ -261,9 +274,13 @@ public class CasObjectNetworkCasProcesso
}
/**
- * Closes the connection to the remote service
- *
+ * 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.
*/
+ @Override
public void collectionProcessComplete(ProcessTrace aTrace) throws ResourceProcessException,
IOException {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/socket/OFSocketTransportImpl.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/socket/OFSocketTransportImpl.java?rev=1769397&r1=1769396&r2=1769397&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/socket/OFSocketTransportImpl.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/socket/OFSocketTransportImpl.java Sat Nov 12 18:26:08 2016
@@ -33,13 +33,16 @@ import org.apache.uima.cas.CAS;
import org.apache.uima.resource.metadata.ProcessingResourceMetaData;
import org.apache.uima.util.Level;
+// TODO: Auto-generated Javadoc
/**
- *
- *
+ * The Class OFSocketTransportImpl.
*/
public class OFSocketTransportImpl implements SocketTransport {
+ /**
+ * Instantiates a new OF socket transport impl.
+ */
public OFSocketTransportImpl() {
super();
@@ -50,6 +53,7 @@ public class OFSocketTransportImpl imple
*
* @see org.apache.uima.collection.impl.cpm.container.deployer.socket.SocketTransport#getName()
*/
+ @Override
public String getName() {
return null;
@@ -61,6 +65,7 @@ public class OFSocketTransportImpl imple
* @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 {
try {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
@@ -81,6 +86,7 @@ public class OFSocketTransportImpl imple
* @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 {
DataOutputStream os = null;
@@ -143,6 +149,7 @@ public class OFSocketTransportImpl imple
*
* @see org.apache.uima.collection.impl.cpm.container.deployer.socket.SocketTransport#getProcessingResourceMetaData()
*/
+ @Override
public ProcessingResourceMetaData getProcessingResourceMetaData(Socket aSocket)
throws SocketException {
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/socket/ProcessControllerAdapter.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/socket/ProcessControllerAdapter.java?rev=1769397&r1=1769396&r2=1769397&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/socket/ProcessControllerAdapter.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/socket/ProcessControllerAdapter.java Sat Nov 12 18:26:08 2016
@@ -21,24 +21,22 @@ package org.apache.uima.collection.impl.
import java.net.URL;
+// TODO: Auto-generated Javadoc
/**
* 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
- *
* @return URL[] - list of URLs containing endpoint info
- *
- * @throws
- * Exception Failure to start fenced CasProcessor
+ * @throws Exception the exception
*/
public URL[] deploy(String aCasProcessorName, int howMany) throws Exception;
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/socket/SocketTransport.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/socket/SocketTransport.java?rev=1769397&r1=1769396&r2=1769397&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/socket/SocketTransport.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/socket/SocketTransport.java Sat Nov 12 18:26:08 2016
@@ -28,14 +28,15 @@ import org.apache.uima.analysis_engine.A
import org.apache.uima.cas.CAS;
import org.apache.uima.resource.metadata.ProcessingResourceMetaData;
+// TODO: Auto-generated Javadoc
/**
- *
- *
+ * The Interface SocketTransport.
*/
public interface SocketTransport {
+
/**
- * Returns transport identifier
- *
+ * Returns transport identifier.
+ *
* @return - String uniquely identifying the transport.
*/
public String getName();
@@ -55,25 +56,20 @@ public interface SocketTransport {
/**
* Invokes fenced CasProcessor.
- *
+ *
* @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 - Socket timesout before receiving response from the fenced
- * CasProcessor
- * @throws
- * SocketException - connection broken
- *
+ * @throws SocketTimeoutException the socket timeout exception
+ * @throws SocketException the socket exception
+ * @throws AnalysisEngineProcessException the analysis engine process exception
*/
public CAS process(Socket aSocket, CAS aCas) throws SocketTimeoutException, SocketException,
AnalysisEngineProcessException;
/**
- * Returns metadata associated with the fenced CasProcessor
- *
+ * Returns metadata associated with the fenced CasProcessor.
+ *
* @param aSocket -
* socket to the fenced CasProcessor
* @return - metadata
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/BoundedWorkQueue.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/BoundedWorkQueue.java?rev=1769397&r1=1769396&r2=1769397&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/BoundedWorkQueue.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/BoundedWorkQueue.java Sat Nov 12 18:26:08 2016
@@ -26,6 +26,7 @@ import org.apache.uima.cas.CAS;
import org.apache.uima.collection.impl.cpm.utils.CPMUtils;
import org.apache.uima.util.Level;
+// TODO: Auto-generated Javadoc
/**
* 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
@@ -38,21 +39,28 @@ import org.apache.uima.util.Level;
*
*/
public class BoundedWorkQueue {
+
+ /** The queue max size. */
protected final int queueMaxSize;
+ /** The queue. */
protected LinkedList queue = new LinkedList();
+ /** The number elements in queue. */
protected int numberElementsInQueue = 0;
+ /** The queue name. */
protected String queueName = "";
+ /** The cpm. */
protected CPMEngine cpm;
+ /** The Constant WAIT_TIMEOUT. */
protected static final int WAIT_TIMEOUT = 50;
/**
- * Initialize the instance
- *
+ * Initialize the instance.
+ *
* @param aQueueSize -
* fixed size for this queue (capacity)
* @param aQueueName -
@@ -67,8 +75,8 @@ public class BoundedWorkQueue {
}
/**
- * Returns Queue name
- *
+ * Returns Queue name.
+ *
* @return - name of the queue
*/
public String getName() {
@@ -94,8 +102,8 @@ public class BoundedWorkQueue {
}
/**
- * Returns the queue capacity
- *
+ * Returns the queue capacity.
+ *
* @return - queue max size
*/
public int getCapacity() {
@@ -287,6 +295,11 @@ public class BoundedWorkQueue {
return resource;
}
+ /**
+ * Invalidate.
+ *
+ * @param aCasObjectList the a cas object list
+ */
public void invalidate(CAS[] aCasObjectList) {
}
}
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/CPMChunkTimeoutException.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/CPMChunkTimeoutException.java?rev=1769397&r1=1769396&r2=1769397&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/CPMChunkTimeoutException.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/CPMChunkTimeoutException.java Sat Nov 12 18:26:08 2016
@@ -22,17 +22,27 @@ package org.apache.uima.collection.impl.
import org.apache.uima.resource.ResourceProcessException;
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CPMChunkTimeoutException.
+ */
public class CPMChunkTimeoutException extends ResourceProcessException {
+
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = 358067081843640078L;
+ /** The document URL. */
private String documentURL = null;
+ /** The throttle ID. */
private String throttleID = null;
+ /** The doc ID. */
private long docID = 0L;
/**
- *
+ * Instantiates a new CPM chunk timeout exception.
+ *
* @param aDocumentId the document ID
* @param aThrottleID tbd
* @param aDocumentURL document URL
@@ -44,11 +54,18 @@ public class CPMChunkTimeoutException ex
documentURL = aDocumentURL;
}
+ /**
+ * Gets the document URL.
+ *
+ * @return the document URL
+ */
public String getDocumentURL() {
return documentURL;
}
/**
+ * Gets the doc ID.
+ *
* @return the docID
*/
public long getDocID() {
@@ -56,6 +73,8 @@ public class CPMChunkTimeoutException ex
}
/**
+ * Gets the throttle ID.
+ *
* @return the ThrottleID
*/
public String getThrottleID() {
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/ConsumerCasUtils.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/ConsumerCasUtils.java?rev=1769397&r1=1769396&r2=1769397&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/ConsumerCasUtils.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/ConsumerCasUtils.java Sat Nov 12 18:26:08 2016
@@ -23,23 +23,21 @@ import org.apache.uima.cas.CAS;
import org.apache.uima.cas.FSIterator;
import org.apache.uima.cas.FeatureStructure;
+// TODO: Auto-generated Javadoc
/**
- *
- *
- *
- *
+ * The Class ConsumerCasUtils.
*/
public class ConsumerCasUtils {
+
/**
- * Returns an int value of a given Feature Structure
- *
+ * 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
- *
* @return - feature value as int
*/
public static int getIntFeatValue(CAS aCasView, String aTypeS, String aFeatS) {
@@ -54,15 +52,14 @@ public class ConsumerCasUtils {
}
/**
- * Returns a string value of a given Feature Structure
- *
+ * 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
- *
* @return feature value as string
*/
public static String getStringFeatValue(CAS aCasView, String aTypeS, String aFeatS) {
@@ -79,13 +76,12 @@ public class ConsumerCasUtils {
}
/**
- * Returns a Feature Structure of a given type
- *
+ * Returns a Feature Structure of a given 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) {
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/DebugControlThread.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/DebugControlThread.java?rev=1769397&r1=1769396&r2=1769397&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/DebugControlThread.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/DebugControlThread.java Sat Nov 12 18:26:08 2016
@@ -29,29 +29,53 @@ import org.apache.uima.collection.impl.c
import org.apache.uima.util.FileUtils;
import org.apache.uima.util.Level;
+// TODO: Auto-generated Javadoc
+/**
+ * The Class DebugControlThread.
+ */
public class DebugControlThread implements Runnable {
+
+ /** The Constant NOTFOUND. */
private final static String NOTFOUND = "NOT-FOUND";
+ /** The file name. */
private String fileName = null;
+ /** The stop. */
private volatile boolean stop = false;
+ /** The checkpoint frequency. */
private int checkpointFrequency = 3000;
+ /** The pause. */
// This variable guarded by lockForPause
private boolean pause = false;
+ /** The lock for pause. */
private final Object lockForPause = new Object();
+ /** The cpm. */
// private boolean isRunning = false;
private CPMEngine cpm = null;
+ /**
+ * Instantiates a new debug control thread.
+ *
+ * @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;
fileName = aFilename;
checkpointFrequency = aCheckpointFrequency;
}
+ /**
+ * Start.
+ *
+ * @throws RuntimeException the runtime exception
+ */
public void start() throws RuntimeException {
if (fileName == null) {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
@@ -80,12 +104,19 @@ public class DebugControlThread implemen
}
}
+ /**
+ * Stop.
+ */
public void stop() {
stop = true;
// isRunning = false;
doCheckpoint();
}
+ /* (non-Javadoc)
+ * @see java.lang.Runnable#run()
+ */
+ @Override
public void run() {
// isRunning = true;
while (!stop && cpm.isRunning()) {
@@ -114,9 +145,9 @@ public class DebugControlThread implemen
}
/**
- *
- *
- * @param aCommand
+ * Interpret and execute command.
+ *
+ * @param aCommand the a command
*/
private void interpretAndExecuteCommand(String aCommand) {
if (aCommand == null) {
@@ -170,6 +201,9 @@ public class DebugControlThread implemen
}
}
+ /**
+ * Delete checkpoint.
+ */
public void deleteCheckpoint() {
try {
File inF = null;
@@ -183,10 +217,16 @@ public class DebugControlThread implemen
}
+ /**
+ * Pause.
+ */
public void pause() {
pause = true;
}
+ /**
+ * Resume.
+ */
public void resume() {
synchronized (lockForPause) {
if (pause) {
@@ -200,6 +240,11 @@ public class DebugControlThread implemen
}
+ /**
+ * Do checkpoint.
+ *
+ * @return the string
+ */
public String doCheckpoint() {
File inF = null;
try {
@@ -232,6 +277,11 @@ public class DebugControlThread implemen
return null;
}
+ /**
+ * Exists.
+ *
+ * @return true, if successful
+ */
public boolean exists() {
try {
new File(fileName);
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/NonThreadedProcessingUnit.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/NonThreadedProcessingUnit.java?rev=1769397&r1=1769396&r2=1769397&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/NonThreadedProcessingUnit.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/NonThreadedProcessingUnit.java Sat Nov 12 18:26:08 2016
@@ -57,51 +57,76 @@ import org.apache.uima.util.UimaTimer;
import org.apache.uima.util.impl.ProcessTrace_impl;
+// TODO: Auto-generated Javadoc
+/**
+ * The Class NonThreadedProcessingUnit.
+ */
public class NonThreadedProcessingUnit {
+
+ /** The thread state. */
public int threadState = 0;
+ /** The cas pool. */
protected CPECasPool casPool;
+ /** The relase CAS. */
protected boolean relaseCAS = false;
+ /** The cpm. */
protected CPMEngine cpm = null;
+ /** The work queue. */
protected BoundedWorkQueue workQueue = null;
+ /** The output queue. */
protected BoundedWorkQueue outputQueue = null;
+ /** The m converter. */
protected CasConverter mConverter;
+ /** The processing unit process trace. */
protected ProcessTrace processingUnitProcessTrace;
+ /** The process containers. */
protected LinkedList processContainers = new LinkedList();
+ /** The num to process. */
protected long numToProcess = 0;
+ /** The cas list. */
protected CAS[] casList;
+ /** The status cb L. */
protected ArrayList statusCbL = new ArrayList();
+ /** The notify listeners. */
protected boolean notifyListeners = false;
+ /** The conversion cas. */
protected CAS conversionCas = null;
+ /** The artifact. */
protected Object[] artifact = null;
+ /** The conversion cas array. */
protected CAS[] conversionCasArray;
+ /** The timer. */
protected UimaTimer timer;
+ /** The thread id. */
protected String threadId = null;
+ /** The cpe configuration. */
protected CpeConfiguration cpeConfiguration = null;
+ /** The cas cache. */
private CAS[] casCache = null;
/**
- * Initialize the PU
- *
+ * Initialize the PU.
+ *
* @param acpm -
* component managing life cycle of the CPE
* @param aInputQueue -
@@ -134,6 +159,11 @@ public class NonThreadedProcessingUnit {
}
}
+ /**
+ * Instantiates a new non threaded processing unit.
+ *
+ * @param acpm the acpm
+ */
public NonThreadedProcessingUnit(CPMEngine acpm) {
cpm = acpm;
try {
@@ -146,8 +176,8 @@ public class NonThreadedProcessingUnit {
}
/**
- * Alternative method of providing a queue from which this PU will read bundle of Cas
- *
+ * Alternative method of providing a queue from which this PU will read bundle of Cas.
+ *
* @param aInputQueue -
* read queue
*/
@@ -156,8 +186,8 @@ public class NonThreadedProcessingUnit {
}
/**
- * Alternative method of providing a queue where this PU will deposit results of analysis
- *
+ * Alternative method of providing a queue where this PU will deposit results of analysis.
+ *
* @param aOutputQueue -
* queue to write to
*/
@@ -167,8 +197,8 @@ public class NonThreadedProcessingUnit {
/**
* Alternative method of providing the reference to the component managing the lifecycle of the
- * CPE
- *
+ * CPE.
+ *
* @param acpm -
* reference to the contrlling engine
*/
@@ -196,8 +226,8 @@ public class NonThreadedProcessingUnit {
}
/**
- * Set a flag indicating if notifications should be made via configured Listeners
- *
+ * Set a flag indicating if notifications should be made via configured Listeners.
+ *
* @param aDoNotify -
* true if notification is required, false otherwise
*/
@@ -226,8 +256,8 @@ public class NonThreadedProcessingUnit {
}
/**
- * Removes given listener from the list of listeners
- *
+ * Removes given listener from the list of listeners.
+ *
* @param aListener -
* object to remove from the list
*/
@@ -236,8 +266,8 @@ public class NonThreadedProcessingUnit {
}
/**
- * Plugs in ProcessTrace object used to collect statistics
- *
+ * Plugs in ProcessTrace object used to collect statistics.
+ *
* @param aProcessingUnitProcessTrace -
* object to compile stats
*/
@@ -247,8 +277,8 @@ public class NonThreadedProcessingUnit {
}
/**
- * Plugs in custom timer used by the PU for getting time
- *
+ * Plugs in custom timer used by the PU for getting time.
+ *
* @param aTimer -
* custom timer to use
*/
@@ -340,6 +370,14 @@ public class NonThreadedProcessingUnit {
}
}
+ /**
+ * Analyze.
+ *
+ * @param aCasObjectList the a cas object list
+ * @param pTrTemp the tr temp
+ * @return true, if successful
+ * @throws Exception the exception
+ */
protected boolean analyze(Object[] aCasObjectList, ProcessTrace pTrTemp) throws Exception // throws
// ResourceProcessException,
// IOException,
@@ -574,27 +612,31 @@ public class NonThreadedProcessingUnit {
}
/**
- *
- * @param aFlag
+ * Sets the release CAS flag.
+ *
+ * @param aFlag the new release CAS flag
*/
public void setReleaseCASFlag(boolean aFlag) {
relaseCAS = aFlag;
}
/**
- * @param aPool
+ * Sets the cas pool.
+ *
+ * @param aPool the new cas pool
*/
public void setCasPool(CPECasPool aPool) {
casPool = aPool;
}
/**
- *
- * @param aCasObjectList
- * @param isCasObject
- * @param casObjects
- * @param aProcessTr
- * @param doneAlready
+ * 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 -
*/
private void postAnalysis(Object[] aCasObjectList, boolean isCasObject, Object[] casObjects,
@@ -710,12 +752,26 @@ public class NonThreadedProcessingUnit {
}
}
+ /**
+ * Do release 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) {
aContainer.releaseCasProcessor(aCasProcessor);
}
}
+ /**
+ * 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
+ */
private void doEndOfBatch(ProcessingContainer aContainer, CasProcessor aProcessor,
ProcessTrace aProcessTr, int howManyCases) {
String containerName = aContainer.getName();
@@ -911,12 +967,13 @@ public class NonThreadedProcessingUnit {
}
/**
- *
- * @param container
- * @param processor
- * @param aCasObjectList
- * @param pTrTemp
- * @param isCasObject
+ * 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 -
*/
private void invokeCasObjectCasProcessor(ProcessingContainer container, CasProcessor processor,
@@ -1024,10 +1081,11 @@ public class NonThreadedProcessingUnit {
}
/**
- *
- * @param casIndex
- * @param aContainerName
- * @param aCasObjectList
+ * Convert cas data to cas object.
+ *
+ * @param casIndex the cas index
+ * @param aContainerName the a container name
+ * @param aCasObjectList the a cas object list
* @throws Exception -
*/
private void convertCasDataToCasObject(int casIndex, String aContainerName,
@@ -1074,13 +1132,14 @@ public class NonThreadedProcessingUnit {
}
/**
- *
- * @param container
- * @param processor
- * @param aCasObjectList
- * @param pTrTemp
- * @param isCasObject
- * @param retry
+ * Invoke cas data 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
+ * @param retry the retry
* @throws Exception -
*/
private void invokeCasDataCasProcessor(ProcessingContainer container, CasProcessor processor,
@@ -1184,6 +1243,12 @@ public class NonThreadedProcessingUnit {
}
+ /**
+ * Container disabled.
+ *
+ * @param aContainer the a container
+ * @return true, if successful
+ */
private boolean containerDisabled(ProcessingContainer aContainer) {
synchronized (aContainer) {
// Check to see if the CasProcessor is available for processing
@@ -1203,7 +1268,10 @@ public class NonThreadedProcessingUnit {
}
/**
- * Check if the CASProcessor status is available for processing
+ * Check if the CASProcessor status is available for processing.
+ *
+ * @param aStatus the a status
+ * @return true, if is processor ready
*/
protected boolean isProcessorReady(int aStatus) {
if (aStatus == Constants.CAS_PROCESSOR_READY || aStatus == Constants.CAS_PROCESSOR_RUNNING) {
@@ -1213,6 +1281,14 @@ public class NonThreadedProcessingUnit {
return false;
}
+ /**
+ * Filter out the CAS.
+ *
+ * @param aContainer the a container
+ * @param isCasObject the is cas object
+ * @param aCasObjectList the a cas object list
+ * @return true, if successful
+ */
private boolean filterOutTheCAS(ProcessingContainer aContainer, boolean isCasObject,
Object[] aCasObjectList) {
// Check if any of the Cas'es in the set has a required feature structure.
@@ -1233,8 +1309,8 @@ public class NonThreadedProcessingUnit {
}
/**
- * Notifies Listeners of the fact that the pipeline has finished processing the current set Cas'es
- *
+ * Notifies Listeners of the fact that the pipeline has finished processing the current set Cas'es.
+ *
* @param aCas -
* object containing an array of OR a single instance of Cas
* @param isCasObject -
@@ -1325,6 +1401,9 @@ public class NonThreadedProcessingUnit {
}
+ /**
+ * Clear cas cache.
+ */
private void clearCasCache() {
if (casCache != null) {
for (int index = 0; index < casCache.length; index++) {
@@ -1359,16 +1438,13 @@ public class NonThreadedProcessingUnit {
* pipelines shareing a common service. If this service dies (Socket Down), only one thread should
* initiate service restart. While the service is being restarted no invocations on the service
* should be done. Containers will be resumed on successfull service restart.
- *
+ *
* @param aContainer -
* a container that manages the current Cas Processor.
- * @param aProcessor -
- * a Cas Processor to be disabled
+ * @param aException the a exception
* @param aThreadId -
* id of the current thread
- *
- * @throws Exception -
- * exception
+ * @return true, if successful
*/
private boolean pauseContainer(ProcessingContainer aContainer, Exception aException,
String aThreadId) {
@@ -1381,11 +1457,12 @@ public class NonThreadedProcessingUnit {
}
/**
- *
- * @param aContainer
- * @param aProcessor
- * @param aProcessTr
- * @param ex
+ * Handle service exception.
+ *
+ * @param aContainer the a container
+ * @param aProcessor the a processor
+ * @param aProcessTr the a process tr
+ * @param ex the ex
* @throws Exception -
*/
private void handleServiceException(ProcessingContainer aContainer, CasProcessor aProcessor,
@@ -1485,10 +1562,11 @@ public class NonThreadedProcessingUnit {
}
/**
- *
- * @param aContainer
- * @param aCasObjectList
- * @param isLastCP
+ * Handle skip cas processor.
+ *
+ * @param aContainer the a container
+ * @param aCasObjectList the a cas object list
+ * @param isLastCP the is last CP
* @throws Exception -
*/
private void handleSkipCasProcessor(ProcessingContainer aContainer, Object[] aCasObjectList,
@@ -1556,13 +1634,12 @@ public class NonThreadedProcessingUnit {
/**
* Conditionally, releases CASes back to the CAS pool. The release only occurs if the Cas
* Processor is the last in the processing chain.
- *
+ *
* @param aCasList -
* list of CASes to release
* @param lastProcessor -
* determines if the release takes place
- * @param aContainer -
- * current container
+ * @param aName the a name
*/
private void releaseCases(Object aCasList, boolean lastProcessor, String aName) // ProcessingContainer
// aContainer)
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/SequencedQueue.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/SequencedQueue.java?rev=1769397&r1=1769396&r2=1769397&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/SequencedQueue.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/SequencedQueue.java Sat Nov 12 18:26:08 2016
@@ -20,7 +20,6 @@
package org.apache.uima.collection.impl.cpm.engine;
import java.util.ArrayList;
-import java.util.Date;
import java.util.HashMap;
import org.apache.uima.UIMAFramework;
@@ -33,6 +32,7 @@ import org.apache.uima.collection.impl.c
import org.apache.uima.collection.impl.cpm.utils.ExpirationTimer;
import org.apache.uima.util.Level;
+// TODO: Auto-generated Javadoc
/**
* This component extends the Bound Queue by guaranteeing delivery of CASes in sequential order.
* Large documents may be split into smaller chunks and and each is processed asynchronously. Since
@@ -44,17 +44,22 @@ import org.apache.uima.util.Level;
* chunk. If the timer goes off, the entire document ( and all its CASes) are invalidated.
*/
public class SequencedQueue extends BoundedWorkQueue {
+
+ /** The chunk state. */
private boolean chunkState = false; // if a CAS is part of a larger sequence
+ /** The next chunk metadata. */
private ChunkMetadata nextChunkMetadata = new ChunkMetadata("", 0, false);
+ /** The timed out docs. */
private HashMap timedOutDocs = new HashMap();
+ /** The status cb L. */
protected ArrayList statusCbL = new ArrayList();
/**
- * Initialize this queue
- *
+ * Initialize this queue.
+ *
* @param aQueueSize -
* the size of the queue
* @param aQueueName -
@@ -68,8 +73,9 @@ public class SequencedQueue extends Boun
}
/**
- *
- * @param achunkMetadata
+ * Sequence timed out.
+ *
+ * @param achunkMetadata the achunk metadata
* @return true if it timed out
*/
private boolean sequenceTimedOut(ChunkMetadata achunkMetadata) {
@@ -120,6 +126,7 @@ public class SequencedQueue extends Boun
*
* @return object dequeued from the head of the queue
*/
+ @Override
public synchronized Object dequeue() {
// Check if there is anything in the queue
if (numberElementsInQueue == 0) {
@@ -416,6 +423,7 @@ public class SequencedQueue extends Boun
*
* @return - Object from the queue, or null if time out
*/
+ @Override
public synchronized Object dequeue(long aTimeout) {
Object resource = null;
long startTime = System.currentTimeMillis();
@@ -487,6 +495,10 @@ public class SequencedQueue extends Boun
return resource;
}
+ /* (non-Javadoc)
+ * @see org.apache.uima.collection.impl.cpm.engine.BoundedWorkQueue#invalidate(org.apache.uima.cas.CAS[])
+ */
+ @Override
public synchronized void invalidate(CAS[] aCasObjectList) {
for (int i = 0; aCasObjectList != null && i < aCasObjectList.length
&& aCasObjectList[i] != null; i++) {
@@ -504,6 +516,12 @@ public class SequencedQueue extends Boun
}
}
+ /**
+ * Adds the doc to timed out docs.
+ *
+ * @param aLifespan the a lifespan
+ * @param aDocId the a doc id
+ */
private void addDocToTimedOutDocs(int aLifespan, String aDocId) {
// The expected chunk sequence did not arrive within given window. Create a timer
// object and associate it with the document that has timed out. Add the timer object
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/WorkUnit.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/WorkUnit.java?rev=1769397&r1=1769396&r2=1769397&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/WorkUnit.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/WorkUnit.java Sat Nov 12 18:26:08 2016
@@ -22,35 +22,71 @@ package org.apache.uima.collection.impl.
import org.apache.uima.cas.CAS;
+// TODO: Auto-generated Javadoc
+/**
+ * The Class WorkUnit.
+ */
public class WorkUnit {
+
+ /** The payload. */
private Object payload = null;
+ /** The cas. */
private CAS[] cas = null;
+ /** The timedout. */
private boolean timedout = false;
+ /**
+ * Instantiates a new work unit.
+ *
+ * @param aPayload the a payload
+ */
public WorkUnit(Object aPayload) {
super();
payload = aPayload;
}
+ /**
+ * Gets the.
+ *
+ * @return the object
+ */
public Object get() {
return payload;
}
+ /**
+ * Sets the cas.
+ *
+ * @param aCas the new cas
+ */
public void setCas(CAS[] aCas) {
cas = aCas;
}
+ /**
+ * Gets the cas.
+ *
+ * @return the cas
+ */
public CAS[] getCas() {
return cas;
}
+ /**
+ * Sets the timed out.
+ */
public void setTimedOut() {
timedout = true;
}
+ /**
+ * Checks if is timed out.
+ *
+ * @return true, if is timed out
+ */
public boolean isTimedOut() {
return timedout;
}
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/CasMetaData.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/CasMetaData.java?rev=1769397&r1=1769396&r2=1769397&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/CasMetaData.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/CasMetaData.java Sat Nov 12 18:26:08 2016
@@ -28,18 +28,26 @@ import org.apache.uima.collection.impl.c
import org.apache.uima.resource.metadata.NameValuePair;
import org.apache.uima.util.Level;
+// TODO: Auto-generated Javadoc
/**
- *
- *
+ * The Class CasMetaData.
*/
public class CasMetaData implements Serializable {
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = 836775023988205201L;
+ /** The cas object. */
Object casObject;
+ /** The cas meta data. */
NameValuePair[] casMetaData = null;
+ /**
+ * Sets the cas meta data.
+ *
+ * @param aCas the new cas meta data
+ */
public void setCasMetaData(Object aCas) {
if (aCas != null && aCas instanceof CasData) {
casObject = aCas;
@@ -53,6 +61,11 @@ public class CasMetaData implements Seri
}
}
+ /**
+ * Gets the cas meta data.
+ *
+ * @return the cas meta data
+ */
public NameValuePair[] getCasMetaData() {
if (casMetaData == null) {
return new NameValuePair[0];
@@ -60,6 +73,12 @@ public class CasMetaData implements Seri
return casMetaData;
}
+ /**
+ * Gets the value.
+ *
+ * @param aName the a name
+ * @return the value
+ */
public Object getValue(String aName) {
if (casMetaData == null || aName == null) {
return null;
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/ChunkMetadata.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/ChunkMetadata.java?rev=1769397&r1=1769396&r2=1769397&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/ChunkMetadata.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/ChunkMetadata.java Sat Nov 12 18:26:08 2016
@@ -19,65 +19,117 @@
package org.apache.uima.collection.impl.cpm.utils;
+// TODO: Auto-generated Javadoc
/**
* Convenience class that is used to hold metadata associated with chunking and sequencing of
* documents. It allows the OutputQueue to manage sequencing of chunks destined for the CasConsumer.
*/
public class ChunkMetadata {
+
+ /** The Constant SEQUENCE. */
public static final String SEQUENCE = "sequenceNumber";
+ /** The Constant DOCUMENTID. */
public static final String DOCUMENTID = "documentId";
+ /** The Constant ISCOMPLETED. */
public static final String ISCOMPLETED = "isCompleted";
+ /** The Constant DOCUMENTURL. */
public static final String DOCUMENTURL = "url";
+ /** The Constant THROTTLEID. */
public static final String THROTTLEID = "throttleID";
+ /** The doc id. */
private String docId;
+ /** The sequence. */
private int sequence;
+ /** The last. */
private boolean last = true;
+ /** The timed out. */
private boolean timedOut = false;
+ /** The url. */
private String url;
+ /** The throttle ID. */
private String throttleID;
+ /**
+ * Instantiates a new chunk metadata.
+ *
+ * @param aDocId the a doc id
+ * @param aSequence the a sequence
+ * @param aLast the a last
+ */
public ChunkMetadata(String aDocId, int aSequence, boolean aLast) {
docId = aDocId;
sequence = aSequence;
last = aLast;
}
+ /**
+ * Checks if is last.
+ *
+ * @return true, if is last
+ */
public boolean isLast() {
return last;
}
+ /**
+ * Gets the sequence.
+ *
+ * @return the sequence
+ */
public int getSequence() {
return sequence;
}
+ /**
+ * Checks if is one of many.
+ *
+ * @return true, if is one of many
+ */
public boolean isOneOfMany() {
return sequence == 0 ? false : true;
}
+ /**
+ * Gets the doc id.
+ *
+ * @return the doc id
+ */
public String getDocId() {
return docId;
}
+ /**
+ * Gets the throttle ID.
+ *
+ * @return the throttle ID
+ */
public String getThrottleID() {
return throttleID;
}
+ /**
+ * Gets the url.
+ *
+ * @return the url
+ */
public String getURL() {
return url;
}
/**
+ * Checks if is timed out.
+ *
* @return true if timed out
*/
public boolean isTimedOut() {
@@ -85,16 +137,28 @@ public class ChunkMetadata {
}
/**
+ * Sets the timed out.
+ *
* @param b true means timed out
*/
public void setTimedOut(boolean b) {
timedOut = b;
}
+ /**
+ * Sets the throttle ID.
+ *
+ * @param aThrottleID the new throttle ID
+ */
public void setThrottleID(String aThrottleID) {
throttleID = aThrottleID;
}
+ /**
+ * Sets the url.
+ *
+ * @param aURL the new url
+ */
public void setURL(String aURL) {
url = aURL;
}
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/ConfigurableFeature.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/ConfigurableFeature.java?rev=1769397&r1=1769396&r2=1769397&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/ConfigurableFeature.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/ConfigurableFeature.java Sat Nov 12 18:26:08 2016
@@ -21,31 +21,70 @@ package org.apache.uima.collection.impl.
import java.util.ArrayList;
+// TODO: Auto-generated Javadoc
+/**
+ * The Class ConfigurableFeature.
+ */
public class ConfigurableFeature {
+
+ /** The value. */
private ValuePair value;
+ /** The attribute list. */
private ArrayList attributeList = new ArrayList();
+ /**
+ * Instantiates a new configurable feature.
+ *
+ * @param oldV the old V
+ * @param newV the new V
+ */
public ConfigurableFeature(String oldV, String newV) {
value = new ValuePair(oldV, newV);
}
+ /**
+ * Gets the old feature name.
+ *
+ * @return the old feature name
+ */
public String getOldFeatureName() {
return value.getOldV();
}
+ /**
+ * Gets the new feature name.
+ *
+ * @return the new feature name
+ */
public String getNewFeatureName() {
return value.getNewV();
}
+ /**
+ * Adds the attribute.
+ *
+ * @param value the value
+ */
public void addAttribute(ValuePair value) {
attributeList.add(value);
}
+ /**
+ * Adds the attributes.
+ *
+ * @param attList the att list
+ */
public void addAttributes(ArrayList attList) {
attributeList = attList;
}
+ /**
+ * Gets the old attribute value.
+ *
+ * @param index the index
+ * @return the old attribute value
+ */
public String getOldAttributeValue(int index) {
if (index < 0 || attributeList.size() == 0 || attributeList.size() < index) {
return null;
@@ -53,6 +92,12 @@ public class ConfigurableFeature {
return ((ValuePair) attributeList.get(index)).getOldV();
}
+ /**
+ * Gets the old attribute value.
+ *
+ * @param key the key
+ * @return the old attribute value
+ */
public String getOldAttributeValue(String key) {
for (int i = 0; i < attributeList.size(); i++) {
if (((ValuePair) attributeList.get(i)).getOldV().equals(key)) {
@@ -62,6 +107,12 @@ public class ConfigurableFeature {
return null;
}
+ /**
+ * Gets the new attribute value.
+ *
+ * @param index the index
+ * @return the new attribute value
+ */
public String getNewAttributeValue(int index) {
if (index < 0 || attributeList.size() == 0 || attributeList.size() < index) {
return null;
@@ -69,6 +120,12 @@ public class ConfigurableFeature {
return ((ValuePair) attributeList.get(index)).getNewV();
}
+ /**
+ * Gets the new attribute value.
+ *
+ * @param key the key
+ * @return the new attribute value
+ */
public String getNewAttributeValue(String key) {
for (int i = 0; i < attributeList.size(); i++) {
if (((ValuePair) attributeList.get(i)).getOldV().equals(key)) {
@@ -78,6 +135,11 @@ public class ConfigurableFeature {
return null;
}
+ /**
+ * Attribute list size.
+ *
+ * @return the int
+ */
public int attributeListSize() {
if (attributeList == null) {
return 0;
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/CpmLocalizedMessage.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/CpmLocalizedMessage.java?rev=1769397&r1=1769396&r2=1769397&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/CpmLocalizedMessage.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/CpmLocalizedMessage.java Sat Nov 12 18:26:08 2016
@@ -23,8 +23,20 @@ import java.text.MessageFormat;
import java.util.Locale;
import java.util.ResourceBundle;
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CpmLocalizedMessage.
+ */
public class CpmLocalizedMessage {
+ /**
+ * Gets the localized message.
+ *
+ * @param aResourceBundleName the a resource bundle name
+ * @param aMessageKey the a message key
+ * @param aArguments the a arguments
+ * @return the localized message
+ */
public static String getLocalizedMessage(String aResourceBundleName, String aMessageKey,
Object[] aArguments) {
if (aMessageKey == null)
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/Execute.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/Execute.java?rev=1769397&r1=1769396&r2=1769397&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/Execute.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/Execute.java Sat Nov 12 18:26:08 2016
@@ -19,24 +19,31 @@
package org.apache.uima.collection.impl.cpm.utils;
+// TODO: Auto-generated Javadoc
/**
* Contains command line and environment for launching a seperate process.
*
*
*/
public class Execute {
+
+ /** The environment. */
private String[] environment;
+ /** The cmd line. */
private String[] cmdLine;
+ /**
+ * Instantiates a new execute.
+ */
public Execute() {
super();
}
/**
- * Returns command line as String Array
- *
+ * Returns command line as String Array.
+ *
* @return - command line
*/
public String[] getCmdLine() {
@@ -44,8 +51,8 @@ public class Execute {
}
/**
- * Returns Cas Processor environment
- *
+ * Returns Cas Processor environment.
+ *
* @return - environment
*/
public String[] getEnvironment() {
@@ -53,8 +60,8 @@ public class Execute {
}
/**
- * Copies Cas Processor command line
- *
+ * Copies Cas Processor command line.
+ *
* @param strings -
* command line
*/
@@ -63,9 +70,9 @@ public class Execute {
}
/**
- * Copies Cas Processor environment
- *
- * @param strings
+ * Copies Cas Processor environment.
+ *
+ * @param strings the new environment
*/
public void setEnvironment(String[] strings) {
environment = strings;
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/ExpirationTimer.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/ExpirationTimer.java?rev=1769397&r1=1769396&r2=1769397&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/ExpirationTimer.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/ExpirationTimer.java Sat Nov 12 18:26:08 2016
@@ -25,22 +25,33 @@ import org.apache.uima.UIMAFramework;
import org.apache.uima.collection.impl.cpm.engine.CPMEngine;
import org.apache.uima.util.Level;
+// TODO: Auto-generated Javadoc
/**
* Facilitates cleaning up resources associated with chunking/sequencing logic.
*
*/
public class ExpirationTimer extends Thread {
+
+ /** The time out. */
private final long timeOut;
+ /** The map. */
private final HashMap map;
+ /** The key. */
private final String key;
+ /** The cpm. */
CPMEngine cpm = null;
/**
* Constructs a Timer that expires after a given interval. It keeps the map from growing
* indefinitely. Its main purpose is to remove entries from a given map using a provided key.
+ *
+ * @param aTimeout the a timeout
+ * @param aMap the a map
+ * @param aKey the a key
+ * @param aCpm the a cpm
*/
public ExpirationTimer(long aTimeout, HashMap aMap, String aKey, CPMEngine aCpm) {
super();
@@ -55,6 +66,7 @@ public class ExpirationTimer extends Thr
* HashMap using provided key. The map holds docId's that have been split into chunks.
*
*/
+ @Override
public void run() {
try {
Thread.sleep(timeOut);
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/FeatureMap.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/FeatureMap.java?rev=1769397&r1=1769396&r2=1769397&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/FeatureMap.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/FeatureMap.java Sat Nov 12 18:26:08 2016
@@ -21,17 +21,37 @@ package org.apache.uima.collection.impl.
import java.util.ArrayList;
+// TODO: Auto-generated Javadoc
+/**
+ * The Class FeatureMap.
+ */
public class FeatureMap {
+
+ /** The entities. */
ArrayList entities = null;
+ /**
+ * Instantiates a new feature map.
+ */
public FeatureMap() {
entities = new ArrayList();
}
+ /**
+ * Adds the.
+ *
+ * @param entity the entity
+ */
public void add(ConfigurableFeature entity) {
entities.add(entity);
}
+ /**
+ * Gets the.
+ *
+ * @param index the index
+ * @return the configurable feature
+ */
public ConfigurableFeature get(int index) {
if (entities.size() < index) {
return null;
@@ -40,6 +60,12 @@ public class FeatureMap {
return (ConfigurableFeature) entities.get(index);
}
+ /**
+ * Gets the.
+ *
+ * @param key the key
+ * @return the configurable feature
+ */
public ConfigurableFeature get(String key) {
for (int i = 0; i < entities.size(); i++) {
if (((ConfigurableFeature) entities.get(i)).getOldFeatureName().equals(key))
@@ -48,6 +74,12 @@ public class FeatureMap {
return null;
}
+ /**
+ * Contains.
+ *
+ * @param key the key
+ * @return true, if successful
+ */
public boolean contains(String key) {
for (int i = 0; i < entities.size(); i++) {
if (((ConfigurableFeature) entities.get(i)).getOldFeatureName().equals(key))
@@ -56,6 +88,11 @@ public class FeatureMap {
return false;
}
+ /**
+ * Size.
+ *
+ * @return the int
+ */
public int size() {
return entities.size();
}
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/Filter.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/Filter.java?rev=1769397&r1=1769396&r2=1769397&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/Filter.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/Filter.java Sat Nov 12 18:26:08 2016
@@ -27,29 +27,33 @@ import java.util.StringTokenizer;
import org.apache.uima.UIMAFramework;
import org.apache.uima.util.Level;
+// TODO: Auto-generated Javadoc
/**
- * Parses the filter expression associated with a Cas Processor in the cpe descriptor
- *
- *
+ * Parses the filter expression associated with a Cas Processor in the cpe descriptor.
*/
public class Filter {
+
+ /** The stack. */
Stack stack = new Stack();
+ /** The expression list. */
LinkedList expressionList = new LinkedList();
+ /** The is and filter. */
protected boolean isAndFilter = false;
+ /** The is or filter. */
protected boolean isOrFilter = true; // default filter is OR as it is least restrictive
+ /** The filter initialized. */
protected boolean filterInitialized = false;
/**
- * Parses filter expression
- *
+ * Parses filter expression.
+ *
* @param expression -
* filter expression to parse
* @return - list of filters
- *
* @throws ParseException -
*/
public LinkedList parse(String expression) throws ParseException {
@@ -79,11 +83,10 @@ public class Filter {
}
/**
- * Parses tokens
- *
+ * Parses tokens.
+ *
* @param aTokenizer -
* tokenized filter expression
- *
* @throws ParseException -
*/
private void parseTokens(StringTokenizer aTokenizer) throws ParseException {
@@ -124,8 +127,9 @@ public class Filter {
}
/**
- * Builds filter expression from values from the stack
- *
+ * Builds filter expression from values from the stack.
+ *
+ * @param anOp the an op
* @throws ParseException -
*/
private void evaluate(String anOp) throws ParseException {
@@ -159,66 +163,117 @@ public class Filter {
}
/**
- * Operand
+ * Operand.
*/
public class Operand {
+
+ /** The operand. */
private String operand;
+ /**
+ * Instantiates a new operand.
+ *
+ * @param aOp the a op
+ */
public Operand(String aOp) {
operand = aOp;
}
+ /**
+ * Gets the operand.
+ *
+ * @return the operand
+ */
public String getOperand() {
return operand;
}
}
/**
- * Left part of filter expression
+ * Left part of filter expression.
*/
public class LeftPart {
+
+ /** The left part. */
private String leftPart;
+ /**
+ * Instantiates a new left part.
+ *
+ * @param aLPart the a L part
+ */
public LeftPart(String aLPart) {
leftPart = aLPart;
}
+ /**
+ * Gets the.
+ *
+ * @return the string
+ */
public String get() {
return leftPart;
}
}
/**
- * Right part of the filter expression
+ * Right part of the filter expression.
*/
public class RightPart {
+
+ /** The right part. */
private String rightPart;
+ /**
+ * Instantiates a new right part.
+ *
+ * @param aRPart the a R part
+ */
public RightPart(String aRPart) {
rightPart = aRPart;
}
+ /**
+ * Gets the.
+ *
+ * @return the string
+ */
public String get() {
return rightPart;
}
}
/**
- * Object containing single filter
+ * Object containing single filter.
*/
public class Expression {
+
+ /** The l P. */
private LeftPart lP;
+ /** The r P. */
private RightPart rP;
+ /** The op. */
private Operand op;
+ /** The filter. */
private Filter filter = null;
+ /**
+ * Instantiates a new expression.
+ *
+ * @param aFilter the a filter
+ */
public Expression(Filter aFilter) {
filter = aFilter;
}
+ /**
+ * Sets the is or filter.
+ *
+ * @throws ParseException the parse exception
+ */
protected void setIsOrFilter() throws ParseException {
// Already defined as AND filter. Currently filtering is either AND or OR. No mixing is
// supported
@@ -231,6 +286,11 @@ public class Filter {
filter.filterInitialized = true;
}
+ /**
+ * Sets the is and filter.
+ *
+ * @throws ParseException the parse exception
+ */
protected void setIsAndFilter() throws ParseException {
// Already defined as OR filter. Currently filtering is either AND or OR. No mixing is
// supported
@@ -243,26 +303,56 @@ public class Filter {
filter.isOrFilter = false; // turnoff default
}
+ /**
+ * Checks if is or filter.
+ *
+ * @return true, if is or filter
+ */
public boolean isOrFilter() {
return filter.isOrFilter;
}
+ /**
+ * Checks if is and filter.
+ *
+ * @return true, if is and filter
+ */
public boolean isAndFilter() {
return filter.isAndFilter;
}
+ /**
+ * Sets the left part.
+ *
+ * @param aLP the new left part
+ */
public void setLeftPart(LeftPart aLP) {
lP = aLP;
}
+ /**
+ * Sets the right part.
+ *
+ * @param aRP the new right part
+ */
public void setRightPart(RightPart aRP) {
rP = aRP;
}
+ /**
+ * Sets the operand.
+ *
+ * @param aOP the new operand
+ */
public void setOperand(Operand aOP) {
op = aOP;
}
+ /**
+ * Checks for left part.
+ *
+ * @return true, if successful
+ */
public boolean hasLeftPart() {
if (lP != null) {
return true;
@@ -270,6 +360,11 @@ public class Filter {
return false;
}
+ /**
+ * Checks for right part.
+ *
+ * @return true, if successful
+ */
public boolean hasRightPart() {
if (rP != null) {
return true;
@@ -277,6 +372,11 @@ public class Filter {
return false;
}
+ /**
+ * Checks for operand.
+ *
+ * @return true, if successful
+ */
public boolean hasOperand() {
if (op != null) {
return true;
@@ -284,19 +384,39 @@ public class Filter {
return false;
}
+ /**
+ * Gets the left part.
+ *
+ * @return the left part
+ */
public LeftPart getLeftPart() {
return lP;
}
+ /**
+ * Gets the right part.
+ *
+ * @return the right part
+ */
public RightPart getRightPart() {
return rP;
}
+ /**
+ * Gets the operand.
+ *
+ * @return the operand
+ */
public Operand getOperand() {
return op;
}
}
+ /**
+ * The main method.
+ *
+ * @param args the arguments
+ */
public static void main(String[] args) {
Filter filter = new Filter();
try {
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/JavaTimer.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/JavaTimer.java?rev=1769397&r1=1769396&r2=1769397&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/JavaTimer.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/JavaTimer.java Sat Nov 12 18:26:08 2016
@@ -23,50 +23,89 @@ import java.io.Serializable;
import org.apache.uima.util.UimaTimer;
+// TODO: Auto-generated Javadoc
/**
+ * The Class JavaTimer.
+ *
* @deprecated replaced by {@link UimaTimer}
- *
*/
@Deprecated
public class JavaTimer implements Timer, Serializable {
+
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = 5399135137398839124L;
+ /** The start. */
private long start = 0;
+ /** The end. */
private long end = 0;
+ /* (non-Javadoc)
+ * @see org.apache.uima.collection.impl.cpm.utils.Timer#start()
+ */
// starts the time
+ @Override
public void start() {
start = System.currentTimeMillis();
}
+ /* (non-Javadoc)
+ * @see org.apache.uima.collection.impl.cpm.utils.Timer#end()
+ */
// ends the timer
+ @Override
public void end() {
end = System.currentTimeMillis();
}
+ /* (non-Javadoc)
+ * @see org.apache.uima.collection.impl.cpm.utils.Timer#getResolution()
+ */
+ @Override
public long getResolution() {
return 10;
}
+ /* (non-Javadoc)
+ * @see org.apache.uima.collection.impl.cpm.utils.Timer#getDuration()
+ */
// returns duration (in ms) between start() and end() calls
+ @Override
public long getDuration() {
return (end - start);
}
+ /**
+ * Gets the time.
+ *
+ * @return the time
+ */
private synchronized long getTime() {
return System.currentTimeMillis();
}
+ /* (non-Javadoc)
+ * @see org.apache.uima.collection.impl.cpm.utils.Timer#getTimeInSecs()
+ */
+ @Override
public synchronized long getTimeInSecs() {
return (getTime() / 1000);
}
+ /* (non-Javadoc)
+ * @see org.apache.uima.collection.impl.cpm.utils.Timer#getTimeInMillis()
+ */
+ @Override
public synchronized long getTimeInMillis() {
return getTime();
}
+ /* (non-Javadoc)
+ * @see org.apache.uima.collection.impl.cpm.utils.Timer#getTimeInMicros()
+ */
+ @Override
public synchronized long getTimeInMicros() {
return System.currentTimeMillis() * 1000;
}
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/QueueEntity.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/QueueEntity.java?rev=1769397&r1=1769396&r2=1769397&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/QueueEntity.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/QueueEntity.java Sat Nov 12 18:26:08 2016
@@ -19,6 +19,7 @@
package org.apache.uima.collection.impl.cpm.utils;
+// TODO: Auto-generated Javadoc
/**
* Convenience wrapper that is internally used by the CPM. Created in the OutputQueue this wrapper
* contains the CAS and additional information needed to determine if the CAS contained has arrived
@@ -28,12 +29,18 @@ package org.apache.uima.collection.impl.
*
*/
public class QueueEntity {
+
+ /** The timed out. */
private boolean timedOut = false;
+ /** The entity. */
private Object entity = null;
/**
- * Initialize the instance with the Entity (CAS) and the timeout
+ * Initialize the instance with the Entity (CAS) and the timeout.
+ *
+ * @param anEntity the an entity
+ * @param hasTimedOut the has timed out
*/
public QueueEntity(Object anEntity, boolean hasTimedOut) {
timedOut = hasTimedOut;
@@ -41,6 +48,8 @@ public class QueueEntity {
}
/**
+ * Gets the entity.
+ *
* @return the entity
*/
public Object getEntity() {
@@ -48,6 +57,8 @@ public class QueueEntity {
}
/**
+ * Checks if is timed out.
+ *
* @return true if timed out
*/
public boolean isTimedOut() {
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/Timer.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/Timer.java?rev=1769397&r1=1769396&r2=1769397&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/Timer.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/Timer.java Sat Nov 12 18:26:08 2016
@@ -21,28 +21,62 @@ package org.apache.uima.collection.impl.
import org.apache.uima.util.UimaTimer;
+// TODO: Auto-generated Javadoc
/**
+ * The Interface Timer.
+ *
* @deprecated replaced by {@link UimaTimer}
- *
*/
@Deprecated
public interface Timer {
+
+ /**
+ * Start.
+ */
// starts the time
public void start();
+ /**
+ * End.
+ */
// ends the timer
public void end();
+ /**
+ * Gets the duration.
+ *
+ * @return the duration
+ */
// returns duration (in ms) between start() and end() calls
public long getDuration();
+ /**
+ * Gets the time in secs.
+ *
+ * @return the time in secs
+ */
public long getTimeInSecs();
+ /**
+ * Gets the time in millis.
+ *
+ * @return the time in millis
+ */
public long getTimeInMillis();
+ /**
+ * Gets the time in micros.
+ *
+ * @return the time in micros
+ */
public long getTimeInMicros();
+ /**
+ * Gets the resolution.
+ *
+ * @return the resolution
+ */
public long getResolution();
}
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/TimerFactory.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/TimerFactory.java?rev=1769397&r1=1769396&r2=1769397&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/TimerFactory.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/TimerFactory.java Sat Nov 12 18:26:08 2016
@@ -25,17 +25,18 @@ import org.apache.uima.resource.Resource
import org.apache.uima.util.Level;
import org.apache.uima.util.UimaTimer;
+// TODO: Auto-generated Javadoc
/**
- * Creates an instance of UimaTimer
- *
- *
+ * Creates an instance of UimaTimer.
*/
public class TimerFactory {
+
+ /** The timer. */
private static UimaTimer timer = null;
/**
- * Instantiate UimaTimer object from a given class
- *
+ * Instantiate UimaTimer object from a given class.
+ *
* @param aClassName -
* UimaTimer implemetation class
*/
@@ -53,8 +54,8 @@ public class TimerFactory {
}
/**
- * Returns instance of {@link UimaTimer}
- *
+ * Returns instance of {@link UimaTimer}.
+ *
* @return UimaTimer instance
*/
public static UimaTimer getTimer() {
@@ -72,11 +73,10 @@ public class TimerFactory {
}
/**
- * Instantiates dynamically a UimaTimer object
- *
+ * Instantiates dynamically a UimaTimer object.
+ *
* @param aClassName -
* class implementing UimaTimer
- *
* @throws ResourceInitializationException -
*/
private void initialize(String aClassName) throws ResourceInitializationException {
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/TypeComplianceConverterImpl.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/TypeComplianceConverterImpl.java?rev=1769397&r1=1769396&r2=1769397&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/TypeComplianceConverterImpl.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/TypeComplianceConverterImpl.java Sat Nov 12 18:26:08 2016
@@ -19,6 +19,7 @@
package org.apache.uima.collection.impl.cpm.utils;
+// TODO: Auto-generated Javadoc
/**
* Component providing conversion service. It replaces all occurances of provided String patterns
* with provided replacement String.
@@ -57,6 +58,11 @@ public class TypeComplianceConverterImpl
return convertedString.toString();
}
+ /**
+ * The main method.
+ *
+ * @param args the arguments
+ */
public static void main(String[] args) {
System.out.println(TypeComplianceConverterImpl.replace("Detag_colon_DetagContent", "_colon_",
":"));
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/ValuePair.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/ValuePair.java?rev=1769397&r1=1769396&r2=1769397&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/ValuePair.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/utils/ValuePair.java Sat Nov 12 18:26:08 2016
@@ -19,11 +19,24 @@
package org.apache.uima.collection.impl.cpm.utils;
+// TODO: Auto-generated Javadoc
+/**
+ * The Class ValuePair.
+ */
public class ValuePair {
+
+ /** The old V. */
private String oldV;
+ /** The new V. */
private String newV;
+ /**
+ * Instantiates a new value pair.
+ *
+ * @param oldValue the old value
+ * @param newValue the new value
+ */
public ValuePair(String oldValue, String newValue) {
oldV = oldValue;
newV = newValue;