uk.org.ogsadai.client.toolkit.activity
Class ActivityRequest

java.lang.Object
  |
  +--uk.org.ogsadai.client.toolkit.Request
        |
        +--uk.org.ogsadai.client.toolkit.activity.ActivityRequest

public class ActivityRequest
extends Request

An OGSA-DAI request constructed as a collection of connected activities.

Requests are sent to a data service resource exposed by a data service. The request consists of a number of activities that that manipulate data exposed by the resource. The Activity objects that make up the request will have their corresponding ActivityOutput objects populated with any result data when the response is received by the client toolkit from the data service.

Author:
The OGSA-DAI Project Team

Field Summary
private static java.lang.String COPYRIGHT_NOTICE
          Copyright statement
private static java.lang.String FOOTER
          Perform document footer
private static java.lang.String HEADER
          Perform document header
private  java.util.List mComponents
          Request components - list of uk.org.ogsadai.client.toolkit.activity.RequestComponents
private  java.util.Map mOutputs
          Map from activity output names (java.lang.String) to uk.org.ogsadai.client.toolkit.activity.ActivityOutput.
private  SessionRequirements mSessionRequirements
          Encapsulates the session requirements for the request.
 
Fields inherited from class uk.org.ogsadai.client.toolkit.Request
 
Constructor Summary
ActivityRequest()
          Constructs an activity request with no activities.
ActivityRequest(RequestComponent[] components)
          Constructs an activity request that contains the specified components.
 
Method Summary
 void add(RequestComponent component)
          Adds the given request component to the request.
 void add(RequestComponent[] components)
          Adds the given array of request components to the request.
 void clear()
          Removes all the request components and activity outputs from the request.
private  void constructOutputsMap()
          Constructs a mapping from activity names to activity outputs by asking each request component in turn to add their name and their outputs to a common mapping.
 Response createResponse(org.w3c.dom.Document responseDocument)
          Create a response object corresponding to the given XML document which is assumed to hold an OGSA-DAI XML response document.
 Response createResponse(org.w3c.dom.Document responseDocument, AttachmentManager attachmentManager)
          Create a response object corresponding to the given XML document which is assumed to hold an OGSA-DAI XML response document.
 org.w3c.dom.Document getDocument()
          Get the request (perform document) in its XML format.
 void setDataResourceID(ResourceID id)
          Set the ID of the data service resource at which the request will be directed.
 void setDataService(DataService dataService)
          Sets the proxy of the data service at which the request will be directed.
private  void setRequestComponentSession(Session session)
          Sets the session for each of the request components making up the request.
 void setSessionRequirements(SessionRequirements requirements)
          Sets the session requirements for the request.
 java.lang.String toString()
          Returns a brief description of the request.
 
Methods inherited from class uk.org.ogsadai.client.toolkit.Request
getDataService
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

COPYRIGHT_NOTICE

private static final java.lang.String COPYRIGHT_NOTICE
Copyright statement

See Also:
Constant Field Values

HEADER

private static final java.lang.String HEADER
Perform document header

See Also:
Constant Field Values

FOOTER

private static final java.lang.String FOOTER
Perform document footer

See Also:
Constant Field Values

mComponents

private java.util.List mComponents
Request components - list of uk.org.ogsadai.client.toolkit.activity.RequestComponents


mOutputs

private java.util.Map mOutputs
Map from activity output names (java.lang.String) to uk.org.ogsadai.client.toolkit.activity.ActivityOutput.


mSessionRequirements

private SessionRequirements mSessionRequirements
Encapsulates the session requirements for the request.

Constructor Detail

ActivityRequest

public ActivityRequest()
Constructs an activity request with no activities. Activities can be added using the add methods.


ActivityRequest

public ActivityRequest(RequestComponent[] components)
Constructs an activity request that contains the specified components.

Parameters:
components - Array of components to include in the request.
Throws:
java.lang.IllegalArgumentException - if components is null.
Method Detail

add

public void add(RequestComponent component)
Adds the given request component to the request.

Parameters:
component - Request component to add.
Throws:
java.lang.IllegalArgumentException - if component is null.

add

public void add(RequestComponent[] components)
Adds the given array of request components to the request.

Parameters:
components - Array of components to include in the request.
Throws:
java.lang.IllegalArgumentException - if components is null.

clear

public void clear()
Removes all the request components and activity outputs from the request.


toString

public java.lang.String toString()
Returns a brief description of the request. The exact details are subject to change but at present the format is:
"[ActivityRequest: #activities=3 ]"

Overrides:
toString in class java.lang.Object

createResponse

public Response createResponse(org.w3c.dom.Document responseDocument)
                        throws DataFormatException
Description copied from class: Request
Create a response object corresponding to the given XML document which is assumed to hold an OGSA-DAI XML response document.

Specified by:
createResponse in class Request
Parameters:
responseDocument - OGSA-DAI response document.
Returns:
response object.
Throws:
DataFormatException - if response does not hold an OGSA-DAI Response document.
See Also:
Request.createResponse(org.w3c.dom.Document)

createResponse

public Response createResponse(org.w3c.dom.Document responseDocument,
                               AttachmentManager attachmentManager)
                        throws DataFormatException
Description copied from class: Request
Create a response object corresponding to the given XML document which is assumed to hold an OGSA-DAI XML response document. The response object will also contain a reference to the AttachmentManager object which provides access to attachments data.

Specified by:
createResponse in class Request
Parameters:
responseDocument - OGSA-DAI response document.
attachmentManager - Object managing attachments.
Returns:
response object.
Throws:
DataFormatException - if response does not hold an OGSA-DAI Response document.
See Also:
Request.createResponse(org.w3c.dom.Document, uk.org.ogsadai.client.toolkit.soap.AttachmentManager)

setRequestComponentSession

private void setRequestComponentSession(Session session)
Sets the session for each of the request components making up the request.

Parameters:
session - the session within which the request components were processed.

setDataResourceID

public void setDataResourceID(ResourceID id)
Description copied from class: Request
Set the ID of the data service resource at which the request will be directed.

Specified by:
setDataResourceID in class Request
Parameters:
id - Data service resource ID.

setDataService

public void setDataService(DataService dataService)
Description copied from class: Request
Sets the proxy of the data service at which the request will be directed.

Overrides:
setDataService in class Request
Parameters:
dataService - Data service proxy that will process the request.

getDocument

public org.w3c.dom.Document getDocument()
Description copied from class: Request
Get the request (perform document) in its XML format.

Specified by:
getDocument in class Request
Returns:
request as an XML perform document.

constructOutputsMap

private void constructOutputsMap()
Constructs a mapping from activity names to activity outputs by asking each request component in turn to add their name and their outputs to a common mapping.


setSessionRequirements

public void setSessionRequirements(SessionRequirements requirements)
Sets the session requirements for the request. For example, this method could be used to instruct the request to join an existing or new session. If there are no specific session requirements then this method need not be invoked.

Parameters:
requirements - the session requirements for the request
Throws:
java.lang.IllegalArgumentException - if requirements is null.