Package org.apache.uima.uimacpp
Class UimacppEngine
- java.lang.Object
-
- org.apache.uima.uimacpp.UimacppEngine
-
public class UimacppEngine extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private static intBYTEHEAP(package private) CAScasprivate static java.lang.String[]compatibleTafJniVersions(package private) longcppEnginePointerthis field is the physical pointer to the C++ TafClEngine object this TafWrapper object is associated with.private static intFSHEAP(package private) booleanhasNextprivate static intINDEXEDFSSprivate static intLONGHEAPprivate static intSHORTHEAPprivate static intSTRINGSYMBOL
-
Constructor Summary
Constructors Constructor Description UimacppEngine()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbatchProcessComplete()batchProcessCompleteprivate voidbatchProcessCompleteJNI()voidcollectionProcessComplete()CasConsumer collectionProcessCompleteprivate voidcollectionProcessCompleteJNI()static voidconfigureResourceManager(java.lang.String workDirectory, java.lang.String dataDirectory)Configure the TAF Resource Manager.private static voidconfigureResourceManagerJNI(java.lang.String workDir, java.lang.String dataDir)private voidconstructorJNI()static UimacppEnginecreateJTafTAE(java.lang.String configFile)create a TAF engine with a config fileprivate static voidcreateResourceManager()Create the TAF resource manager.private static voidcreateResourceManagerJNI()voiddestroy()de-initializes the TAF engine.private voiddestroyJNI()private voiddestructorJNI()private voidfillCASJNI(int[] heapArray, int[] fsIndex, java.lang.String[] stringTable, byte[] byteArray, short[] shortArray, long[] longArray)protected voidfinalize()static java.lang.StringgetErrorMessage(long errorCode)helper function to get the error message for some TAF error ID.private static java.lang.StringgetErrorMessageJNI(long errorId)private java.lang.ObjectgetSerializedDataJNI(int what)private java.lang.ObjectgetSerializedSegmentDataJNI(int what)static java.lang.StringgetTafJNIVersion()helper function to get the TAF JNI version.private static java.lang.StringgetVersionJNI()booleanhasNext()hasNextprivate booleanhasNextSegmentJNI()(package private) voidinitialize(java.lang.String config)initialize Taf engineprivate voidinitializeJNI(java.lang.String configFile)voidnext(CAS segment)nextprivate voidnextSegmentJNI()(package private) static voidprintArray(java.lang.String s, int[] ar)(package private) static voidprintArray(java.lang.String s, java.lang.String[] ar)voidprocess(ResultSpecification rs, CAS aCas, boolean casIsEmpty)process the document.private voidprocessJNI(int isTCas, java.lang.String sofaName, int[] resultSpecTypes, int[] resultSpecFeatures)private voidreleaseSegmentJNI()private voidresetJNI()private voidserializeCASJNI(boolean bSerializeData)private static voidserializeResultSpecification(ResultSpecification rs, CASImpl cas, IntVector resultSpecTypes, IntVector resultSpecFeatures)private voidserializeSegmentJNI(boolean bSerializeData)(package private) static voidthrowJTafException(java.lang.Exception exc)(package private) voidtypeSystemInit(CASMgrSerializer casMgrSerializer)reinit Taf engine type systemprivate voidtypeSystemInitJNI(java.lang.String[] typeNames, java.lang.String[] featureNames, int[] typeInheritance, int[] featDecls, int topTypeCode, int[] featureOffsets, int[] typeOrder, int[] stringSubTypes, java.lang.String[] stringSubTypeValues, int[] stringSubTypeValuePos, java.lang.String[] indexNames, int[] nameToIndexMap, int[] indexingStrategy, int[] comparatorIndex, int[] comparators)
-
-
-
Field Detail
-
compatibleTafJniVersions
private static java.lang.String[] compatibleTafJniVersions
-
cppEnginePointer
long cppEnginePointer
this field is the physical pointer to the C++ TafClEngine object this TafWrapper object is associated with. Do not use explicitly anywhere. It is set automatically by theconstructorJNI()method and set to 0 by thedestructorJNI()method.
-
cas
CAS cas
-
hasNext
boolean hasNext
-
FSHEAP
private static final int FSHEAP
- See Also:
- Constant Field Values
-
STRINGSYMBOL
private static final int STRINGSYMBOL
- See Also:
- Constant Field Values
-
INDEXEDFSS
private static final int INDEXEDFSS
- See Also:
- Constant Field Values
-
BYTEHEAP
private static final int BYTEHEAP
- See Also:
- Constant Field Values
-
SHORTHEAP
private static final int SHORTHEAP
- See Also:
- Constant Field Values
-
LONGHEAP
private static final int LONGHEAP
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
UimacppEngine
public UimacppEngine() throws UimacppException- Throws:
UimacppException
-
-
Method Detail
-
createResourceManagerJNI
private static void createResourceManagerJNI() throws InternalTafException- Throws:
InternalTafException
-
configureResourceManagerJNI
private static void configureResourceManagerJNI(java.lang.String workDir, java.lang.String dataDir) throws InternalTafException- Throws:
InternalTafException
-
constructorJNI
private void constructorJNI() throws InternalTafException- Throws:
InternalTafException
-
destructorJNI
private void destructorJNI() throws InternalTafException- Throws:
InternalTafException
-
initializeJNI
private void initializeJNI(java.lang.String configFile) throws InternalTafException- Throws:
InternalTafException
-
typeSystemInitJNI
private void typeSystemInitJNI(java.lang.String[] typeNames, java.lang.String[] featureNames, int[] typeInheritance, int[] featDecls, int topTypeCode, int[] featureOffsets, int[] typeOrder, int[] stringSubTypes, java.lang.String[] stringSubTypeValues, int[] stringSubTypeValuePos, java.lang.String[] indexNames, int[] nameToIndexMap, int[] indexingStrategy, int[] comparatorIndex, int[] comparators) throws InternalTafException- Throws:
InternalTafException
-
destroyJNI
private void destroyJNI() throws InternalTafException- Throws:
InternalTafException
-
resetJNI
private void resetJNI() throws InternalTafException- Throws:
InternalTafException
-
fillCASJNI
private void fillCASJNI(int[] heapArray, int[] fsIndex, java.lang.String[] stringTable, byte[] byteArray, short[] shortArray, long[] longArray)
-
processJNI
private void processJNI(int isTCas, java.lang.String sofaName, int[] resultSpecTypes, int[] resultSpecFeatures) throws InternalTafException- Throws:
InternalTafException
-
serializeCASJNI
private void serializeCASJNI(boolean bSerializeData) throws InternalTafException- Throws:
InternalTafException
-
getSerializedDataJNI
private java.lang.Object getSerializedDataJNI(int what) throws InternalTafException- Throws:
InternalTafException
-
batchProcessCompleteJNI
private void batchProcessCompleteJNI() throws InternalTafException- Throws:
InternalTafException
-
collectionProcessCompleteJNI
private void collectionProcessCompleteJNI() throws InternalTafException- Throws:
InternalTafException
-
hasNextSegmentJNI
private boolean hasNextSegmentJNI() throws InternalTafException- Throws:
InternalTafException
-
nextSegmentJNI
private void nextSegmentJNI() throws InternalTafException- Throws:
InternalTafException
-
serializeSegmentJNI
private void serializeSegmentJNI(boolean bSerializeData) throws InternalTafException- Throws:
InternalTafException
-
getSerializedSegmentDataJNI
private java.lang.Object getSerializedSegmentDataJNI(int what) throws InternalTafException- Throws:
InternalTafException
-
releaseSegmentJNI
private void releaseSegmentJNI() throws InternalTafException- Throws:
InternalTafException
-
getErrorMessageJNI
private static java.lang.String getErrorMessageJNI(long errorId) throws InternalTafException- Throws:
InternalTafException
-
getVersionJNI
private static java.lang.String getVersionJNI() throws InternalTafException- Throws:
InternalTafException
-
createResourceManager
private static void createResourceManager() throws UimacppExceptionCreate the TAF resource manager.- Throws:
UimacppException
-
configureResourceManager
public static void configureResourceManager(java.lang.String workDirectory, java.lang.String dataDirectory) throws UimacppExceptionConfigure the TAF Resource Manager.- Parameters:
workDirectory- the work directorydataDirectory- the data directory- Throws:
UimacppException- wraps any exception
-
createJTafTAE
public static UimacppEngine createJTafTAE(java.lang.String configFile) throws UimacppException
create a TAF engine with a config file- Parameters:
configFile- the configuration file used for initialization- Returns:
- a UimacppEngine
- Throws:
UimacppException- pass thru
-
printArray
static void printArray(java.lang.String s, int[] ar)
-
printArray
static void printArray(java.lang.String s, java.lang.String[] ar)
-
initialize
void initialize(java.lang.String config) throws UimacppExceptioninitialize Taf engine- Parameters:
configFile- the configuration as a string (not a filename)- Throws:
UimacppException
-
typeSystemInit
void typeSystemInit(CASMgrSerializer casMgrSerializer) throws UimacppException
reinit Taf engine type system- Parameters:
serialized- CAS definition- Throws:
UimacppException
-
destroy
public void destroy() throws UimacppExceptionde-initializes the TAF engine.- Throws:
UimacppException- wraps any exception
-
serializeResultSpecification
private static void serializeResultSpecification(ResultSpecification rs, CASImpl cas, IntVector resultSpecTypes, IntVector resultSpecFeatures)
-
process
public void process(ResultSpecification rs, CAS aCas, boolean casIsEmpty) throws UimacppException
process the document.- Parameters:
rs- the result specificationaCas- the CAScasIsEmpty- tbd- Throws:
UimacppException- wraps any exception
-
hasNext
public boolean hasNext() throws UimacppExceptionhasNext- Returns:
- true if there's a next element
- Throws:
UimacppException- wraps any exception
-
next
public void next(CAS segment) throws UimacppException
next- Parameters:
segment- tbd- Throws:
UimacppException- wraps any exception
-
batchProcessComplete
public void batchProcessComplete() throws UimacppExceptionbatchProcessComplete- Throws:
UimacppException- wraps any exception
-
collectionProcessComplete
public void collectionProcessComplete() throws UimacppExceptionCasConsumer collectionProcessComplete- Throws:
UimacppException- wraps any exception
-
getErrorMessage
public static java.lang.String getErrorMessage(long errorCode) throws UimacppExceptionhelper function to get the error message for some TAF error ID.- Parameters:
errorCode- the code used as the key to look up the error message- Returns:
- the error message
- Throws:
UimacppException- wraps any exception
-
getTafJNIVersion
public static java.lang.String getTafJNIVersion() throws UimacppExceptionhelper function to get the TAF JNI version.- Returns:
- Taf JNI Version
- Throws:
UimacppException- wraps any exception
-
throwJTafException
static void throwJTafException(java.lang.Exception exc) throws UimacppException- Throws:
UimacppException
-
finalize
protected void finalize() throws java.lang.Throwable- Overrides:
finalizein classjava.lang.Object- Throws:
java.lang.Throwable
-
-