uk.org.ogsadai.engine.controlflow
Class RequestComponentFactoryImpl

java.lang.Object
  |
  +--uk.org.ogsadai.engine.controlflow.RequestComponentFactoryImpl
All Implemented Interfaces:
RequestComponentFactory

public class RequestComponentFactoryImpl
extends java.lang.Object
implements RequestComponentFactory

The RequestComponentFactory creates a composite RequestComponent from OGSA-DAI perform documents that conform to the OGSA-DAI perform document schema (in the http://ogsadai.org.uk/namespaces/2005/10/types namespace).

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
 
Constructor Summary
RequestComponentFactoryImpl()
           
 
Method Summary
private  void addActivityPipeline(org.w3c.dom.Element activityElement, RequestComponent component, java.util.Collection pipelines)
          Adds an ActivityPipelineRequestComponent containing the specified activity to the RequestComponent composite unless the pipeline containing this activity has already been added.
 void addChildren(org.w3c.dom.Element parentElement, RequestComponent parentComponent, java.util.Collection pipelines)
          Adds the child request components described by a parent DOM element in a request to a parent request component.
private  java.util.Collection createActivityPipelines(java.util.List activities)
          Populates a new Collection with ActivityPipelineRequestComponent objects for each pipeline or single activity contained in the request.
 RequestComponent createRequestComponent(Activity[] activities, org.w3c.dom.Document requestDocument)
          Creates a composite RequestComponent structure for the specified request document.
private  void searchForConnections(Activity activity, java.util.List activities, ActivityPipelineRequestComponent pipeline)
          Builds a pipeline by iterating through the inputs and outputs of an activity searching for connected activities.
 
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

Constructor Detail

RequestComponentFactoryImpl

public RequestComponentFactoryImpl()
Method Detail

createRequestComponent

public RequestComponent createRequestComponent(Activity[] activities,
                                               org.w3c.dom.Document requestDocument)
                                        throws RequestCreationException,
                                               RequestSpecificationException
Description copied from interface: RequestComponentFactory
Creates a composite RequestComponent structure for the specified request document.

Specified by:
createRequestComponent in interface RequestComponentFactory
Parameters:
activities - An array of the Activity objects contained in the request
requestDocument - The request (perform) Document
Returns:
a RequestComponent for the whole request
Throws:
RequestCreationException - If there is a problem that prevents the creation of the composite request that is not caused by the request itself.
RequestSpecificationException - If there is a problem creating the composite request component due to a problem in the specification of the request. This may be caused by an invalid request document, for example.

createActivityPipelines

private java.util.Collection createActivityPipelines(java.util.List activities)
Populates a new Collection with ActivityPipelineRequestComponent objects for each pipeline or single activity contained in the request.

Parameters:
activities - The activities contained in the request
Returns:
collection of ActivityPipelineRequestComponents corresponding to the activities in the request.

searchForConnections

private void searchForConnections(Activity activity,
                                  java.util.List activities,
                                  ActivityPipelineRequestComponent pipeline)
Builds a pipeline by iterating through the inputs and outputs of an activity searching for connected activities. Any that are found are added to the pipeline, then searched recursively for their own connections.

Parameters:
activity - An activity from the request.
activities - Remaining activities in the request.
pipeline - Activity pipeline to which activity belongs.

addChildren

public void addChildren(org.w3c.dom.Element parentElement,
                        RequestComponent parentComponent,
                        java.util.Collection pipelines)
Adds the child request components described by a parent DOM element in a request to a parent request component. This method is invoked recursively to build a composite request component for the whole request.

Parameters:
parentElement - Element within the perform document that may describe child elements corresponding to child request components.
parentComponent - Component to add child components to.
pipelines - A Collection of the activity pipelines contained in the request that have not yet been turned into request components.

addActivityPipeline

private void addActivityPipeline(org.w3c.dom.Element activityElement,
                                 RequestComponent component,
                                 java.util.Collection pipelines)
Adds an ActivityPipelineRequestComponent containing the specified activity to the RequestComponent composite unless the pipeline containing this activity has already been added.

Parameters:
activityElement - The activity element from the perform document
component - The composite component to add the ActivityPipelineRequestComponent to.
pipelines - A collection of the pipelines which have not yet been added to the composite.