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 int
BYTEHEAP
(package private) CAS
cas
private static java.lang.String[]
compatibleTafJniVersions
(package private) long
cppEnginePointer
this field is the physical pointer to the C++ TafClEngine object this TafWrapper object is associated with.private static int
FSHEAP
(package private) boolean
hasNext
private static int
INDEXEDFSS
private static int
LONGHEAP
private static int
SHORTHEAP
private static int
STRINGSYMBOL
-
Constructor Summary
Constructors Constructor Description UimacppEngine()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
batchProcessComplete()
batchProcessCompleteprivate void
batchProcessCompleteJNI()
void
collectionProcessComplete()
CasConsumer collectionProcessCompleteprivate void
collectionProcessCompleteJNI()
static void
configureResourceManager(java.lang.String workDirectory, java.lang.String dataDirectory)
Configure the TAF Resource Manager.private static void
configureResourceManagerJNI(java.lang.String workDir, java.lang.String dataDir)
private void
constructorJNI()
static UimacppEngine
createJTafTAE(java.lang.String configFile)
create a TAF engine with a config fileprivate static void
createResourceManager()
Create the TAF resource manager.private static void
createResourceManagerJNI()
void
destroy()
de-initializes the TAF engine.private void
destroyJNI()
private void
destructorJNI()
private void
fillCASJNI(int[] heapArray, int[] fsIndex, java.lang.String[] stringTable, byte[] byteArray, short[] shortArray, long[] longArray)
protected void
finalize()
static java.lang.String
getErrorMessage(long errorCode)
helper function to get the error message for some TAF error ID.private static java.lang.String
getErrorMessageJNI(long errorId)
private java.lang.Object
getSerializedDataJNI(int what)
private java.lang.Object
getSerializedSegmentDataJNI(int what)
static java.lang.String
getTafJNIVersion()
helper function to get the TAF JNI version.private static java.lang.String
getVersionJNI()
boolean
hasNext()
hasNextprivate boolean
hasNextSegmentJNI()
(package private) void
initialize(java.lang.String config)
initialize Taf engineprivate void
initializeJNI(java.lang.String configFile)
void
next(CAS segment)
nextprivate void
nextSegmentJNI()
(package private) static void
printArray(java.lang.String s, int[] ar)
(package private) static void
printArray(java.lang.String s, java.lang.String[] ar)
void
process(ResultSpecification rs, CAS aCas, boolean casIsEmpty)
process the document.private void
processJNI(int isTCas, java.lang.String sofaName, int[] resultSpecTypes, int[] resultSpecFeatures)
private void
releaseSegmentJNI()
private void
resetJNI()
private void
serializeCASJNI(boolean bSerializeData)
private static void
serializeResultSpecification(ResultSpecification rs, CASImpl cas, IntVector resultSpecTypes, IntVector resultSpecFeatures)
private void
serializeSegmentJNI(boolean bSerializeData)
(package private) static void
throwJTafException(java.lang.Exception exc)
(package private) void
typeSystemInit(CASMgrSerializer casMgrSerializer)
reinit Taf engine type systemprivate 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)
-
-
-
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 UimacppException
Create the TAF resource manager.- Throws:
UimacppException
-
configureResourceManager
public static void configureResourceManager(java.lang.String workDirectory, java.lang.String dataDirectory) throws UimacppException
Configure 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 UimacppException
initialize 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 UimacppException
de-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 UimacppException
hasNext- 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 UimacppException
batchProcessComplete- Throws:
UimacppException
- wraps any exception
-
collectionProcessComplete
public void collectionProcessComplete() throws UimacppException
CasConsumer collectionProcessComplete- Throws:
UimacppException
- wraps any exception
-
getErrorMessage
public static java.lang.String getErrorMessage(long errorCode) throws UimacppException
helper 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 UimacppException
helper 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:
finalize
in classjava.lang.Object
- Throws:
java.lang.Throwable
-
-