org.apache.uima.analysis_engine.service.impl

## Class ServiceDataCargo

- java.lang.Object
- - org.apache.uima.analysis_engine.service.impl.ServiceDataCargo

- All Implemented Interfaces:
    Serializable

      public class ServiceDataCargo
      extends Object
      implements 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`. The `AnalysisProcessData` object itself is not serializable, because it contains the `CAS` 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 existing `AnalysisProcessData` by calling the `unmarshalInto(AnalysisProcessData, boolean)` method. Alternatively, the CAS state can be unmarshalled separately by calling the `unmarshalCas(CAS, boolean)` method.

  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ServiceDataCargo(AnalysisProcessData aData)` Creates a new `SerializableAnalysisProcessData` that contains information extracted from the specified `AnalysisProcessData`.
    `ServiceDataCargo(CAS aCAS, ProcessTrace aProcessTrace)` Creates a new `SerializableAnalysisProcessData` that contains the given `CAS` and `ProcessTrace`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `ProcessTrace` | `getProcessTrace()` Gets the ProcessTrace object from this `ServiceDataCargo`.
    `void` | `setProcessTrace(ProcessTrace aProcessTrace)` Sets the ProcessTrace object from this `ServiceDataCargo`.
    `void` | `unmarshalCas(CAS aCas, boolean aReplaceCasTypeSystem)` Unmarshalls the CAS data in this `ServiceDataCargo` into an existing `CAS` instance.
    `void` | `unmarshalInto(AnalysisProcessData aDataContainer, boolean aReplaceCasTypeSystem)` Unmarshalls this `SerializableAnalysisProcessData` into an existing `AnalysisProcessData` object.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ServiceDataCargo

          public ServiceDataCargo(AnalysisProcessData aData)

      Creates a new `SerializableAnalysisProcessData` that contains information extracted from the specified `AnalysisProcessData`.
      Parameters:
        `aData` - the AnalysisProcessData to extract from

    - #### ServiceDataCargo

          public ServiceDataCargo(CAS aCAS,
                                  ProcessTrace aProcessTrace)

      Creates a new `SerializableAnalysisProcessData` that contains the given `CAS` and `ProcessTrace`.
      Parameters:
        `aCAS` - the CAS whose state will be extracted into this object
        `aProcessTrace` - 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 this `SerializableAnalysisProcessData` into an existing `AnalysisProcessData` object. The existing CAS data in the `aDataContainer` object will be replaced by the CAS data in this object. The `ProcessTrace` events in this object will be appended to the `ProcessTrace` of the `aDataContainer` object.
      Parameters:
        `aDataContainer` - the AnalysisProcessData to unmarshal into
        `aReplaceCasTypeSystem` - -
      Throws:
        `CASException` - -

    - #### unmarshalCas

          public void unmarshalCas(CAS aCas,
                                   boolean aReplaceCasTypeSystem)
                            throws CASException

      Unmarshalls the CAS data in this `ServiceDataCargo` into an existing `CAS` instance. The data in the exsiting CAS will be replaced by the CAS data in this object.
      Parameters:
        `aCas` - the CAS to unmarshal into
        `aReplaceCasTypeSystem` - if true, assumes serialized data contains the type system
      Throws:
        `CASException` - passthru

    - #### getProcessTrace

          public ProcessTrace getProcessTrace()

      Gets the ProcessTrace object from this `ServiceDataCargo`. 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 this `ServiceDataCargo`.
      Parameters:
        `aProcessTrace` - the process trace

Copyright © 2006–2021 The Apache Software Foundation. All rights reserved.