uk.org.ogsadai.activity
Class ActivityRequestFactory

java.lang.Object
  |
  +--uk.org.ogsadai.activity.ActivityRequestFactory
All Implemented Interfaces:
RequestFactory

public class ActivityRequestFactory
extends java.lang.Object
implements RequestFactory

A RequestFactory for creating activity requests. An activity request is a request containing a collection of Activity objects that may or may not be connected to one another. An activity typically dictates an action to be performed, such as a database query or data transformation.

Author:
The OGSA-DAI Project Team

Field Summary
private static java.lang.String COPYRIGHT_NOTICE
          Copyright statement.
private static DAILogger LOG
          Logger object for logging in this class.
private  ActivityFactory mActivityFactory
          Factory for creating Activity objects from request document.
private  AccessAuthorizer mAuthority
           
private  RequestComponentFactory mComponentFactory
          Factory for creating composite object model of the request.
private  SessionStrategyFactory mSessionStrategyFactory
          Factory for creating session strategies.
 
Constructor Summary
ActivityRequestFactory(ActivityFactory activityFactory, AccessAuthorizer authority)
          Creates an instance that will use the specified activity factory.
 
Method Summary
private  void authorizeActivities(Activity[] activities, RequestContext context)
          Authorize activities within the current request context.
private  Activity[] createActivities(org.w3c.dom.Document requestDocument)
          Creates all of the activities described in the request document.
 Request createRequest(org.w3c.dom.Document document, RequestContext context)
          Create a request from the specified XML perform document.
(package private)  void setRequestComponentFactory(RequestComponentFactory factory)
          Set the factory to be used to build the request components.
(package private)  void setSessionStrategyFactory(SessionStrategyFactory factory)
          Set the factory to be used to build the session strategies.
 
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 DAILogger LOG
Logger object for logging in this class.


mActivityFactory

private final ActivityFactory mActivityFactory
Factory for creating Activity objects from request document.


mComponentFactory

private RequestComponentFactory mComponentFactory
Factory for creating composite object model of the request.


mSessionStrategyFactory

private SessionStrategyFactory mSessionStrategyFactory
Factory for creating session strategies.


mAuthority

private final AccessAuthorizer mAuthority
Constructor Detail

ActivityRequestFactory

public ActivityRequestFactory(ActivityFactory activityFactory,
                              AccessAuthorizer authority)
Creates an instance that will use the specified activity factory.

Parameters:
activityFactory - ActivityFactory to use for creating the activities described in the request documents
authority - authorizes access to activities
Method Detail

createRequest

public Request createRequest(org.w3c.dom.Document document,
                             RequestContext context)
                      throws RequestSpecificationException,
                             RequestExecutionException,
                             ActivityAccessAuthorizationException
Description copied from interface: RequestFactory
Create a request from the specified XML perform document.

Specified by:
createRequest in interface RequestFactory
Parameters:
document - a perform document to build the request from.
context - context of the request.
Returns:
a concrete Request ready for submission to a RequestEngine.
Throws:
RequestSpecificationException - if the request is incorrectly specified e.g. does not match the perform document schema or contains an unsupported activity.
ActivityAccessAuthorizationException - if an activity could not be authorized
RequestExecutionException - if some problem prevents creation of the request.

createActivities

private Activity[] createActivities(org.w3c.dom.Document requestDocument)
                             throws RequestSpecificationException,
                                    RequestCreationException
Creates all of the activities described in the request document.

Parameters:
requestDocument - Request (perform) document.
Returns:
An array of the activities that were created.
Throws:
RequestSpecificationException - If the request is incorrectly specified.
RequestCreationException - If there is a problem encountered when creating the activities.

authorizeActivities

private void authorizeActivities(Activity[] activities,
                                 RequestContext context)
                          throws ActivityAccessAuthorizationException
Authorize activities within the current request context. If the user is not authorized to access an activity an exception will be thrown.

Parameters:
activities - activities to authorize
context - the current request context containing the security context and the resource ID
Throws:
ActivityAccessAuthorizationException - if the user is not authorized to access one of the activities

setRequestComponentFactory

void setRequestComponentFactory(RequestComponentFactory factory)
Set the factory to be used to build the request components.

Assists with testing.

Parameters:
factory - Factory for request components.

setSessionStrategyFactory

void setSessionStrategyFactory(SessionStrategyFactory factory)
Set the factory to be used to build the session strategies.

Assists with testing.

Parameters:
factory - Factory for session strategies.