org.apache.uima.adapter.vinci
Class CASTransportable

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by org.apache.uima.adapter.vinci.CASTransportable
All Implemented Interfaces:
Transportable, org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class CASTransportable
extends org.xml.sax.helpers.DefaultHandler
implements Transportable


Field Summary
 boolean ignoreResponse
           
 boolean includeDocText
           
 UimaContext uimaContext
           
 
Constructor Summary
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
 void characters(char[] ch, int start, int length)
           
 void cleanup()
           
 void endDocument()
           
 void endElement(java.lang.String uri, java.lang.String name, java.lang.String qName)
           
protected  void finalize()
           
 KeyValuePair fromStream(java.io.InputStream is)
          Read the object from the input stream.
 CAS getCas()
           
 java.lang.String getCommand()
           
 VinciFrame getExtraDataFrame()
           
 OutOfTypeSystemData getOutOfTypeSystemData()
           
 void setCommand(java.lang.String command)
           
 void startDocument()
           
 void startElement(java.lang.String uri, java.lang.String name, java.lang.String qName, org.xml.sax.Attributes atts)
           
 void toStream(java.io.OutputStream os)
          Serialize the CAS to the stream in XTalk format.
 org.xml.sax.SAXException wrapAsSAXException(java.io.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
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 java.lang.String getCommand()

setCommand

public void setCommand(java.lang.String command)

getCas

public CAS getCas()

fromStream

public KeyValuePair fromStream(java.io.InputStream is)
                        throws java.io.IOException
Description copied from interface: Transportable
Read the object from the input stream.

Specified by:
fromStream in interface Transportable
Parameters:
is - The stream to read from.
Throws:
java.io.IOException

toStream

public void toStream(java.io.OutputStream os)
              throws java.io.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:
toStream in interface Transportable
Parameters:
os - The stream to write into.
Throws:
java.io.IOException

cleanup

public void cleanup()

finalize

protected void finalize()
Overrides:
finalize in class java.lang.Object

startElement

public void startElement(java.lang.String uri,
                         java.lang.String name,
                         java.lang.String qName,
                         org.xml.sax.Attributes atts)
                  throws org.xml.sax.SAXException
Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

endElement

public void endElement(java.lang.String uri,
                       java.lang.String name,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Specified by:
startDocument in interface org.xml.sax.ContentHandler
Overrides:
startDocument in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
Specified by:
endDocument in interface org.xml.sax.ContentHandler
Overrides:
endDocument in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

wrapAsSAXException

public org.xml.sax.SAXException wrapAsSAXException(java.io.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 return e.


Copyright © 2011. All Rights Reserved.