Class ServiceDataCargo
- java.lang.Object
-
- org.apache.uima.analysis_engine.service.impl.ServiceDataCargo
-
- All Implemented Interfaces:
java.io.Serializable
public class ServiceDataCargo extends java.lang.Object implements java.io.Serializable
A serializable class containing the information passed to and returned from Analysis Engine Services.It is not required that Analysis Engine Services use this class. It is provided as a convenience for those services that communicate using binary data.
This object contains state information extracted from an
AnalysisProcessData
. TheAnalysisProcessData
object itself is not serializable, because it contains theCAS
object. CASes are heavyweight objects and should not be created and destroyed with each network call.Instead, to pass Analysis Process Data to a remote service, one should create a
ServiceDataCargo
and send that to the remote service.A
ServiceDataCargo
can be unmarshalled into an existingAnalysisProcessData
by calling theunmarshalInto(AnalysisProcessData, boolean)
method. Alternatively, the CAS state can be unmarshalled separately by calling theunmarshalCas(CAS, boolean)
method.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private CASCompleteSerializer
mCasSer
private ProcessTrace
mProcessTrace
private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description ServiceDataCargo(AnalysisProcessData aData)
Creates a newSerializableAnalysisProcessData
that contains information extracted from the specifiedAnalysisProcessData
.ServiceDataCargo(CAS aCAS, ProcessTrace aProcessTrace)
Creates a newSerializableAnalysisProcessData
that contains the givenCAS
andProcessTrace
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ProcessTrace
getProcessTrace()
Gets the ProcessTrace object from thisServiceDataCargo
.void
setProcessTrace(ProcessTrace aProcessTrace)
Sets the ProcessTrace object from thisServiceDataCargo
.void
unmarshalCas(CAS aCas, boolean aReplaceCasTypeSystem)
Unmarshalls the CAS data in thisServiceDataCargo
into an existingCAS
instance.void
unmarshalInto(AnalysisProcessData aDataContainer, boolean aReplaceCasTypeSystem)
Unmarshalls thisSerializableAnalysisProcessData
into an existingAnalysisProcessData
object.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
mCasSer
private CASCompleteSerializer mCasSer
-
mProcessTrace
private ProcessTrace mProcessTrace
-
-
Constructor Detail
-
ServiceDataCargo
public ServiceDataCargo(AnalysisProcessData aData)
Creates a newSerializableAnalysisProcessData
that contains information extracted from the specifiedAnalysisProcessData
.- Parameters:
aData
- the AnalysisProcessData to extract from
-
ServiceDataCargo
public ServiceDataCargo(CAS aCAS, ProcessTrace aProcessTrace)
Creates a newSerializableAnalysisProcessData
that contains the givenCAS
andProcessTrace
.- Parameters:
aCAS
- the CAS whose state will be extracted into this objectaProcessTrace
- the process trace object. This may be null, if no process trace is available. (For example, ProcessTrace data may often be returned from a service but not passed to the service.)
-
-
Method Detail
-
unmarshalInto
public void unmarshalInto(AnalysisProcessData aDataContainer, boolean aReplaceCasTypeSystem) throws CASException
Unmarshalls thisSerializableAnalysisProcessData
into an existingAnalysisProcessData
object. The existing CAS data in theaDataContainer
object will be replaced by the CAS data in this object. TheProcessTrace
events in this object will be appended to theProcessTrace
of theaDataContainer
object.- Parameters:
aDataContainer
- the AnalysisProcessData to unmarshal intoaReplaceCasTypeSystem
- -- Throws:
CASException
- -
-
unmarshalCas
public void unmarshalCas(CAS aCas, boolean aReplaceCasTypeSystem) throws CASException
Unmarshalls the CAS data in thisServiceDataCargo
into an existingCAS
instance. The data in the exsiting CAS will be replaced by the CAS data in this object.- Parameters:
aCas
- the CAS to unmarshal intoaReplaceCasTypeSystem
- if true, assumes serialized data contains the type system- Throws:
CASException
- passthru
-
getProcessTrace
public ProcessTrace getProcessTrace()
Gets the ProcessTrace object from thisServiceDataCargo
. This may return null, if no process trace is available. (For example, ProcessTrace data may often be returned from a service but not passed to the service.)- Returns:
- the process trace
-
setProcessTrace
public void setProcessTrace(ProcessTrace aProcessTrace)
Sets the ProcessTrace object from thisServiceDataCargo
.- Parameters:
aProcessTrace
- the process trace
-
-