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
public class CASTransportable extends DefaultHandler implements Transportable
-
-
Field Summary
Fields Modifier and Type Field Description booleanignoreResponsebooleanincludeDocTextUimaContextuimaContext
-
Constructor Summary
Constructors Constructor Description 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.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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcharacters(char[] ch, int start, int length)voidcleanup()voidendDocument()voidendElement(String uri, String name, String qName)protected voidfinalize()KeyValuePairfromStream(InputStream is)Read the object from the input stream.CASgetCas()StringgetCommand()VinciFramegetExtraDataFrame()OutOfTypeSystemDatagetOutOfTypeSystemData()voidsetCommand(String command)voidstartDocument()voidstartElement(String uri, String name, String qName, Attributes atts)voidtoStream(OutputStream os)Serialize the CAS to the stream in XTalk format.SAXExceptionwrapAsSAXException(IOException e)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 Detail
-
uimaContext
public UimaContext uimaContext
-
includeDocText
public boolean includeDocText
-
ignoreResponse
public boolean ignoreResponse
-
-
Constructor Detail
-
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-outOfTypeSystemData-uimaContext-includeDocText-
-
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-outOfTypeSystemData-uimaContext-includeDocText-
-
-
Method Detail
-
getExtraDataFrame
public VinciFrame getExtraDataFrame()
-
getOutOfTypeSystemData
public OutOfTypeSystemData getOutOfTypeSystemData()
-
getCommand
public String getCommand()
-
setCommand
public void setCommand(String command)
-
getCas
public CAS getCas()
-
fromStream
public KeyValuePair fromStream(InputStream is) throws IOException
Description copied from interface:TransportableRead the object from the input stream.- Specified by:
fromStreamin interfaceTransportable- Parameters:
is- The stream to read from.- Returns:
- -
- Throws:
IOException- -
-
toStream
public void toStream(OutputStream os) throws IOException
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:
toStreamin interfaceTransportable- Parameters:
os- The stream to write into.- Throws:
IOException- -
-
cleanup
public void cleanup()
-
startElement
public void startElement(String uri, String name, String qName, Attributes atts) throws SAXException
- Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classDefaultHandler- Throws:
SAXException
-
endElement
public void endElement(String uri, String name, String qName) throws SAXException
- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classDefaultHandler- Throws:
SAXException
-
characters
public void characters(char[] ch, int start, int length) throws SAXException- Specified by:
charactersin interfaceContentHandler- Overrides:
charactersin classDefaultHandler- Throws:
SAXException
-
startDocument
public void startDocument() throws SAXException- Specified by:
startDocumentin interfaceContentHandler- Overrides:
startDocumentin classDefaultHandler- Throws:
SAXException
-
endDocument
public void endDocument() throws SAXException- Specified by:
endDocumentin interfaceContentHandler- Overrides:
endDocumentin classDefaultHandler- Throws:
SAXException
-
wrapAsSAXException
public SAXException wrapAsSAXException(IOException e)
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.
-
-