Package org.apache.uima.adapter.vinci
Class CASTransportable
java.lang.Object
org.xml.sax.helpers.DefaultHandler
org.apache.uima.adapter.vinci.CASTransportable
- All Implemented Interfaces:
Transportable
,ContentHandler
,DTDHandler
,EntityResolver
,ErrorHandler
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) class
This nested class handles serializing the CAS to XTalk through events provided by an XCASSerializer. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate String
private String
private VinciFrame
private ContentHandler
boolean
boolean
private boolean
private boolean
private boolean
private String
private byte[]
private CAS
private CasPool
private OutOfTypeSystemData
private int
-
Constructor Summary
ConstructorsConstructorDescriptionCASTransportable
(CAS cas, OutOfTypeSystemData outOfTypeSystemData, UimaContext uimaContext, boolean includeDocText) This constructor is used on the client side, where we have a dedicated CAS instance for the request.CASTransportable
(CasPool casPool, OutOfTypeSystemData outOfTypeSystemData, UimaContext uimaContext, boolean includeDocText) This constructor is used on the service side - a CAS Pool reference is provided. -
Method Summary
Modifier and TypeMethodDescriptionvoid
characters
(char[] ch, int start, int length) void
cleanup()
private IOException
Converts a Throwable to an IOException.void
void
endElement
(String uri, String name, String qName) protected void
finalize()
Read the object from the input stream.getCas()
Gets the cas.Gets the command.Gets the extra data frame.Gets the out of type system data.void
setCommand
(String command) Sets the command.void
void
startElement
(String uri, String name, String qName, Attributes atts) void
toStream
(OutputStream os) Serialize the CAS to the stream in XTalk format.Create a SAXException that wraps the given IOException.Methods inherited from class org.xml.sax.helpers.DefaultHandler
endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning
-
Field Details
-
myCasPool
-
myCas
-
mybuf
private byte[] mybuf -
outOfTypeSystemData
-
incomingCommand
private boolean incomingCommand -
incomingError
private boolean incomingError -
incomingExtraData
private boolean incomingExtraData -
lastqName
-
command
-
error
-
ready
private int ready -
handler
-
extraDataFrame
-
uimaContext
-
includeDocText
public boolean includeDocText -
ignoreResponse
public boolean ignoreResponse
-
-
Constructor Details
-
CASTransportable
public CASTransportable(CasPool casPool, OutOfTypeSystemData outOfTypeSystemData, UimaContext uimaContext, boolean includeDocText) This constructor is used on the service side - a CAS Pool reference is provided. We don't check a CAS out of the pool until we get a request.- Parameters:
casPool
- the cas pooloutOfTypeSystemData
- the out of type system datauimaContext
- the uima contextincludeDocText
- the include doc text
-
CASTransportable
public CASTransportable(CAS cas, OutOfTypeSystemData outOfTypeSystemData, UimaContext uimaContext, boolean includeDocText) This constructor is used on the client side, where we have a dedicated CAS instance for the request.- Parameters:
cas
- the casoutOfTypeSystemData
- the out of type system datauimaContext
- the uima contextincludeDocText
- the include doc text
-
-
Method Details
-
getExtraDataFrame
Gets the extra data frame.- Returns:
- the extra data frame
-
getOutOfTypeSystemData
Gets the out of type system data.- Returns:
- the out of type system data
-
getCommand
Gets the command.- Returns:
- the command
-
setCommand
Sets the command.- Parameters:
command
- the new command
-
getCas
Gets the cas.- Returns:
- the cas
-
fromStream
Description copied from interface:Transportable
Read the object from the input stream.- Specified by:
fromStream
in interfaceTransportable
- Parameters:
is
- The stream to read from.- Returns:
- -
- Throws:
IOException
- -
-
toStream
Serialize the CAS to the stream in XTalk format. After serialization is complete the cas is returned to the pool (if it was allocated from a pool.)- Specified by:
toStream
in interfaceTransportable
- Parameters:
os
- the os- Throws:
IOException
- Signals that an I/O exception has occurred.
-
cleanup
public void cleanup() -
finalize
protected void finalize() -
startElement
public void startElement(String uri, String name, String qName, Attributes atts) throws SAXException - Specified by:
startElement
in interfaceContentHandler
- Overrides:
startElement
in classDefaultHandler
- Throws:
SAXException
-
endElement
- Specified by:
endElement
in interfaceContentHandler
- Overrides:
endElement
in classDefaultHandler
- Throws:
SAXException
-
characters
- Specified by:
characters
in interfaceContentHandler
- Overrides:
characters
in classDefaultHandler
- Throws:
SAXException
-
startDocument
- Specified by:
startDocument
in interfaceContentHandler
- Overrides:
startDocument
in classDefaultHandler
- Throws:
SAXException
-
endDocument
- Specified by:
endDocument
in interfaceContentHandler
- Overrides:
endDocument
in classDefaultHandler
- Throws:
SAXException
-
wrapAsSAXException
Create a SAXException that wraps the given IOException. The wrapping is done using the standard Java 1.4 mechanism, so that getCause() will work. Note that new SAXException(Exception) does NOT work.- Parameters:
e
- an IOException to wrap- Returns:
- a SAX exception for which
getCause()
will returne
.
-
convertToIOException
Converts a Throwable to an IOException. Ift
is an IOException, thent
is returned. If not, then ift
was caused by an IOException (directly or indirectly), then that IOException is returned. Otherwise, a new IOException is created which wraps (is caused by)t
.- Parameters:
t
- the throwable to convert- Returns:
- an IOException which is either t, one of the causes of t, or a new IOException that wraps t.
-