uk.org.ogsadai.client.toolkit.activity.delivery
Class DeliverToAttachment

java.lang.Object
  |
  +--uk.org.ogsadai.client.toolkit.activity.RequestComponent
        |
        +--uk.org.ogsadai.client.toolkit.activity.Activity
              |
              +--uk.org.ogsadai.client.toolkit.activity.delivery.DeliverToAttachment

public class DeliverToAttachment
extends Activity

This activity delivers data to an attachment that will be sent with the response message.

Activity ouput stores a value of the Content-Id MIME header identifying attachment that holds the proper activity output data. This data can be accessed using AttachmentManager that can be obtained from the Response object.

See usage example below.


      List data = new ArrayList();
      data.add("data");
      DataStore ds = new DataStore(data);
      
      DeliverToAttachment dta = new DeliverToAttachment();
      dta.setInput(ds.getOutput());
      
      ActivityRequest request = new ActivityRequest();
      request.add(ds);
      request.add(dta);
      
      // Perform request
      Response response = dataservice.perform(request);
      
      // Get attachment manager from response
      AttachmentManager attMgr = response.getAttachmentManager();
      
      // Get Content-Id MIME Header value
      String contentID = dta.getOutput().getData();
      
      // Extract data as string from attachment identified by Content-Id
      String dataRcv = attMgr.getAttachmentAsString(contentID);
  

Author:
OGSA-DAI team

Field Summary
private static java.lang.String COPYRIGHT_NOTICE
          Copyright statement
private static org.apache.log4j.Logger LOG
           
private  boolean mIsSessionSpecific
          Is the resource property to be session specfic.
private  javax.xml.namespace.QName mResourcePropertyName
          Name of resource property that output is written to.
 
Fields inherited from class uk.org.ogsadai.client.toolkit.activity.Activity
 
Fields inherited from class uk.org.ogsadai.client.toolkit.activity.RequestComponent
 
Constructor Summary
DeliverToAttachment()
          Constructs the activity.
 
Method Summary
protected  java.lang.String generateXML()
          Generates the XML representing the activity.
 ActivityOutput getOutput()
          Gets the activity output.
 void setInput(ActivityOutput input)
          Connected the input of this activity to output of another activity.
 
Methods inherited from class uk.org.ogsadai.client.toolkit.activity.Activity
addInput, addOutput, addOutputs, getDataResourceID, getInputParameters, getOutputParameters, getOutputs, replaceSpecialCharacters, setDataResourceID, setInput
 
Methods inherited from class uk.org.ogsadai.client.toolkit.activity.RequestComponent
getDataService, getName, getSession, setDataService, setSession
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT_NOTICE

private static final java.lang.String COPYRIGHT_NOTICE
Copyright statement

See Also:
Constant Field Values

LOG

private static final org.apache.log4j.Logger LOG

mResourcePropertyName

private javax.xml.namespace.QName mResourcePropertyName
Name of resource property that output is written to.


mIsSessionSpecific

private boolean mIsSessionSpecific
Is the resource property to be session specfic.

Constructor Detail

DeliverToAttachment

public DeliverToAttachment()
Constructs the activity.

Method Detail

setInput

public final void setInput(ActivityOutput input)
Connected the input of this activity to output of another activity. By this mechanism, activities can be chained to one another.

Parameters:
input - output from another activity
Throws:
java.lang.IllegalArgumentException - if the argument is null

getOutput

public ActivityOutput getOutput()
Gets the activity output.

Returns:
the activity output

generateXML

protected java.lang.String generateXML()
Description copied from class: RequestComponent
Generates the XML representing the activity. This XML can then be inserted into a perform document that is sent to a data service.

Specified by:
generateXML in class Activity
Returns:
the XML for the activity