Class CPMUtils
- java.lang.Object
-
- org.apache.uima.collection.impl.cpm.utils.CPMUtils
-
public class CPMUtils extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static String
CPM_LOG_RESOURCE_BUNDLE
-
Constructor Summary
Constructors Constructor Description CPMUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
convertToAbsolutePath(String aSystemVar, String aExpr, String aPathToConvert)
static void
dumpEvents(ProcessTrace aPTr)
Dumps all events in the process trace objectstatic long
extractTime(ProcessTrace aPT, String eventName)
Returns the total duration of a given eventstatic File
findDeployDirectory(String aServiceName)
static ChunkMetadata
getChunkMetadata(CAS aCas)
Extract metadata associated with chunk from a given CAS.static int
getFeatureAsInt(CAS aCas, Feature aFeature, String aName)
static String
getFeatureAsString(CAS aCas, Feature aFeature, String aName)
Returns a value associated with a given featurestatic String[]
getKeys2Drop(String aKeyDropMapFile)
Currently, this returns initialized array of Strings.static UimaTimer
getTimer()
static UimaTimer
getTimer(String aTimerClass)
Return timer to measure performace of the cpm.static String
scrubThePath(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 void
setTimer(UimaTimer aTimer)
-
-
-
Field Detail
-
CPM_LOG_RESOURCE_BUNDLE
public static final String CPM_LOG_RESOURCE_BUNDLE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getKeys2Drop
public static String[] getKeys2Drop(String aKeyDropMapFile) throws ResourceConfigurationException
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
public static void setTimer(UimaTimer aTimer)
- Parameters:
aTimer
-
-
getTimer
public static UimaTimer getTimer()
- Returns:
- the timer
-
convertToAbsolutePath
public static String convertToAbsolutePath(String aSystemVar, String aExpr, String aPathToConvert)
- Parameters:
aSystemVar
-aExpr
-aPathToConvert
-- Returns:
- absolute path
-
getTimer
public static UimaTimer getTimer(String aTimerClass) throws Exception
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.- Returns:
- - customer timer or JavaTimer (default)
- Throws:
Exception
- -
-
extractTime
public static long extractTime(ProcessTrace aPT, String eventName)
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
public static void dumpEvents(ProcessTrace aPTr)
Dumps all events in the process trace object- Parameters:
aPTr
- - event container
-
scrubThePath
public static String scrubThePath(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.
-
findDeployDirectory
public static File findDeployDirectory(String aServiceName) throws Exception
- Parameters:
aServiceName
-- Returns:
- the deploy directory
- Throws:
Exception
- -
-
getFeatureAsInt
public static int getFeatureAsInt(CAS aCas, Feature aFeature, String aName) throws Exception
- Throws:
Exception
-
getFeatureAsString
public static String getFeatureAsString(CAS aCas, Feature aFeature, String aName) throws Exception
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
-
getChunkMetadata
public static ChunkMetadata getChunkMetadata(CAS aCas)
Extract metadata associated with chunk from a given CAS.- Parameters:
aCas
- - Cas to extract chunk metadata from- Returns:
- - chunk metadata
-
-