Class CPMUtils
java.lang.Object
org.apache.uima.collection.impl.cpm.utils.CPMUtils
The Class CPMUtils.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringconvertToAbsolutePath(String aSystemVar, String aExpr, String aPathToConvert) Convert to absolute path.static voiddumpEvents(ProcessTrace aPTr) Dumps all events in the process trace object.static longextractTime(ProcessTrace aPT, String eventName) Returns the total duration of a given event.static FilefindDeployDirectory(String aServiceName) Find deploy directory.static ChunkMetadatagetChunkMetadata(CAS aCas) Extract metadata associated with chunk from a given CAS.static intgetFeatureAsInt(CAS aCas, Feature aFeature, String aName) Gets the feature as int.static StringgetFeatureAsString(CAS aCas, Feature aFeature, String aName) Returns a value associated with a given feature.static String[]getKeys2Drop(String aKeyDropMapFile) Currently, this returns initialized array of Strings.static UimaTimergetTimer()Gets the timer.static UimaTimerReturn timer to measure performace of the cpm.static StringscrubThePath(String value) Finds an occurance of the ##CPM_HOME in a value parameter and returns it with an expanded form (ie.c:/cpm/...) based on the env variable CPM_HOME.static voidSets the timer.
-
Field Details
-
CPM_LOG_RESOURCE_BUNDLE
The Constant CPM_LOG_RESOURCE_BUNDLE.- See Also:
-
-
Constructor Details
-
CPMUtils
public CPMUtils()
-
-
Method Details
-
getKeys2Drop
Currently, this returns initialized array of Strings.- Parameters:
aKeyDropMapFile- - a file containing a list of features that should be removed from CAS being sent to Cas Processor. Currently not used.- Returns:
- - Array of empty Strings
- Throws:
ResourceConfigurationException- -
-
setTimer
Sets the timer.- Parameters:
aTimer- the new timer
-
getTimer
Gets the timer.- Returns:
- the timer
-
convertToAbsolutePath
Convert to absolute path.- Parameters:
aSystemVar- the a system varaExpr- the a expraPathToConvert- the a path to convert- Returns:
- absolute path
-
getTimer
Return timer to measure performace of the cpm. The timer can optionally be configured in the CPE descriptor. If none defined, the method returns default timer.- Parameters:
aTimerClass- the a timer class- Returns:
- - customer timer or JavaTimer (default)
- Throws:
Exception- -
-
extractTime
Returns the total duration of a given event.- Parameters:
aPT- - Event containereventName- - name of the event for which the time is needed- Returns:
- - total duration of an event
-
dumpEvents
Dumps all events in the process trace object.- Parameters:
aPTr- - event container
-
scrubThePath
Finds an occurance of the ##CPM_HOME in a value parameter and returns it with an expanded form (ie.c:/cpm/...) based on the env variable CPM_HOME.- Parameters:
value- the value- Returns:
- the string
-
findDeployDirectory
Find deploy directory.- Parameters:
aServiceName- the a service name- Returns:
- the deploy directory
- Throws:
Exception- -
-
getFeatureAsInt
Gets the feature as int.- Parameters:
aCas- the a casaFeature- the a featureaName- the a name- Returns:
- the feature as int
- Throws:
Exception- the exception
-
getFeatureAsString
Returns a value associated with a given feature.- Parameters:
aCas- - Cas containing data to extractaFeature- - feature to locate in the CASaName- - name of the feature- Returns:
- - value as String
- Throws:
Exception- the exception
-
getChunkMetadata
Extract metadata associated with chunk from a given CAS.- Parameters:
aCas- - Cas to extract chunk metadata from- Returns:
- - chunk metadata
-