uk.org.ogsadai.activity
Class ActivityCreator

java.lang.Object
  |
  +--uk.org.ogsadai.activity.ActivityCreator

class ActivityCreator
extends java.lang.Object

An ActivityCreator knows how to create and initialise one type of Activity implementation.

When an ActivityCreator creates an Activity, the following steps are performed:

For the sake of optimisation the activity properties and configuration objects, where applicable, are only created once and then passed into each Activity that is created.

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  java.lang.String mClass
          Implementation class for the Activity
private  org.w3c.dom.Document mConfigDoc
          Activity configuration document, if applicable, otherwise null
private  ActivityConfiguration mConfiguration
          Activity configuration object, if applicable, otherwise null
private  java.lang.String mName
          Name of the activity that this ActivityCreator creates
private  java.util.Properties mProperties
          The activity properties, if applicable, otherwise null.
private  org.w3c.dom.Document mSchemaDoc
          Activity schema document.
 
Constructor Summary
(package private) ActivityCreator(ActivityConfig activityConfig)
          Constructs an ActivityCreator that can create the Activity described by the specified Element.
 
Method Summary
 Activity createActivity(org.w3c.dom.Element element)
          Creates an Activity instance.
 java.lang.String getName()
          Returns the name of the activity that this ActivityCreator can create.
 org.w3c.dom.Document getSchema()
          Returns the schema Document for the activity.
private  void initialiseActivityConfiguration(Activity activity, org.w3c.dom.Document configurationDoc)
          Creates an activity configuration object, if it hasn't already been created, then passes it into the new activity.
 
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


mName

private final java.lang.String mName
Name of the activity that this ActivityCreator creates


mClass

private final java.lang.String mClass
Implementation class for the Activity


mSchemaDoc

private final org.w3c.dom.Document mSchemaDoc
Activity schema document.


mConfigDoc

private final org.w3c.dom.Document mConfigDoc
Activity configuration document, if applicable, otherwise null


mConfiguration

private ActivityConfiguration mConfiguration
Activity configuration object, if applicable, otherwise null


mProperties

private final java.util.Properties mProperties
The activity properties, if applicable, otherwise null.

Constructor Detail

ActivityCreator

ActivityCreator(ActivityConfig activityConfig)
Constructs an ActivityCreator that can create the Activity described by the specified Element.

Parameters:
activityConfig - Configuration details of an activity - its name, implementation classe and configuration.
Throws:
java.lang.IllegalArgumentException - If activityConfig is null.
Method Detail

createActivity

public Activity createActivity(org.w3c.dom.Element element)
                        throws ActivitySpecificationException,
                               ActivityCreationException
Creates an Activity instance.

Parameters:
element - Element from a perform document containing a specific activity.
Returns:
Activity.
Throws:
ActivitySpecificationException - If a client mistake prevents the activity from being constructed successfully. This may be raised in either of the following circumstances:
  • the activity is unsupported by this factory
  • .
  • a required element or attribute has been omitted from an activity element in a perform document
ActivityCreationException - If there is some problem that prevents an activity being created. This is typically caused by a configuration or programming error.

initialiseActivityConfiguration

private void initialiseActivityConfiguration(Activity activity,
                                             org.w3c.dom.Document configurationDoc)
                                      throws ActivityConfigurationException
Creates an activity configuration object, if it hasn't already been created, then passes it into the new activity. Note that the individual activity configuration file is not schema-validated.

Parameters:
activity - activity to pass the configuration to
configurationDoc - XML document containing the activity configuration
Throws:
ActivityConfigurationException - If there is a problem initialising the ActivityConfiguration. object

getName

public final java.lang.String getName()
Returns the name of the activity that this ActivityCreator can create. This name corresponds to the name of the element as used in a perform document for this activity, not the name of the implementation class.

Returns:
the activity name as a String

getSchema

public org.w3c.dom.Document getSchema()
Returns the schema Document for the activity.

Returns:
a Document containing XML Schema.