uk.org.ogsadai.activity.management
Class CreateRelationalResourceActivity

java.lang.Object
  extended by uk.org.ogsadai.activity.ActivityBase
      extended by uk.org.ogsadai.activity.MatchedIterativeActivity
          extended by uk.org.ogsadai.activity.management.CreateRelationalResourceActivity
All Implemented Interfaces:
Activity, ConfigurableActivity, ResourceFactoryActivity, ResourceManagerActivity, SecureActivity

public class CreateRelationalResourceActivity
extends MatchedIterativeActivity
implements ResourceManagerActivity, ResourceFactoryActivity, ConfigurableActivity, SecureActivity

An activity that creates a relational data resource based upon a resource template available on the server. This is not intended for production use but rather to demonstrate one way in which dynamic resource creation can be supported in OGSA-DAI.

Activity inputs:

Activity outputs:

Configuration parameters:

Activity input/output ordering: none.

Activity contracts: none.

Target data resource: none.

Behaviour:

Author:
The OGSA-DAI Project Team.

Field Summary
static java.lang.String INPUT_ID
          Activity input name (resourceId) - ID of the new resource to create (String).
static java.lang.String INPUT_TEMPLATE_ID
          Activity input name (templateId) - ID of the resource template (String).
static java.lang.String RESULT
          Activity output name (result) - ID of the newly created resource (String).
static Key TEMPLATE_ID
          Key into activities configuration file denoting the default template resource ID (dai.template.id).
 
Fields inherited from class uk.org.ogsadai.activity.ActivityBase
mContracts
 
Constructor Summary
CreateRelationalResourceActivity()
           
 
Method Summary
 void configureActivity(KeyValueProperties properties)
          Configures the activity with a property set.
protected  JDBCDataResource createResource(ResourceID templateID)
          Use the resource factory to create a new resource from the specified template.
protected  ActivityInput[] getIterationInputs()
          Gets the iteration inputs.
protected  Login getLogin(ResourceID templateID, LoginProvider loginProvider, SecurityContext context)
          Get login for the template resource.
protected  LoginProvider getLoginProvider(JDBCDataResourceState state)
          Get the login provider for the new resource.
protected  void postprocess()
          Performs any post-processing required after the iterative part of the activity processing has completed.
protected  void preprocess()
          Performs any pre-processing required before the iterative part of the activity processing commences.
protected  void processIteration(java.lang.Object[] iterationData)
          Performs an iteration of the activity processing.
 void setResourceFactory(ResourceFactory resourceFactory)
          Sets the resource factory.
 void setResourceManager(ResourceManager resourceManager)
          Sets the resource manager.
 void setSecurityContext(SecurityContext context)
          Sets the security context of the user processing the activity.
protected  void updateLogin(ResourceID resourceID, LoginProvider loginProvider, Login login, SecurityContext context)
          Add the given login as a login for the new resource associated with the given security context.
 
Methods inherited from class uk.org.ogsadai.activity.MatchedIterativeActivity
cleanUp, iterativeStageComplete, process
 
Methods inherited from class uk.org.ogsadai.activity.ActivityBase
addInput, addOutput, close, closeDueToError, getActivityContracts, getActivityDescriptor, getInput, getInput, getInputs, getOutput, getOutput, getOutputs, hasInput, hasOutput, removeInput, setActivityDescriptor, toString, validateInput, validateInputs, validateOutput, validateOutputs
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface uk.org.ogsadai.activity.Activity
addInput, addOutput, getActivityContracts, getActivityDescriptor, process, setActivityDescriptor
 

Field Detail

TEMPLATE_ID

public static final Key TEMPLATE_ID
Key into activities configuration file denoting the default template resource ID (dai.template.id).


INPUT_ID

public static final java.lang.String INPUT_ID
Activity input name (resourceId) - ID of the new resource to create (String).

See Also:
Constant Field Values

INPUT_TEMPLATE_ID

public static final java.lang.String INPUT_TEMPLATE_ID
Activity input name (templateId) - ID of the resource template (String).

See Also:
Constant Field Values

RESULT

public static final java.lang.String RESULT
Activity output name (result) - ID of the newly created resource (String).

See Also:
Constant Field Values
Constructor Detail

CreateRelationalResourceActivity

public CreateRelationalResourceActivity()
Method Detail

setResourceManager

public void setResourceManager(ResourceManager resourceManager)
Sets the resource manager.

Specified by:
setResourceManager in interface ResourceManagerActivity
Parameters:
resourceManager - Resource manager

setResourceFactory

public void setResourceFactory(ResourceFactory resourceFactory)
Sets the resource factory.

Specified by:
setResourceFactory in interface ResourceFactoryActivity
Parameters:
resourceFactory - resource factory

getIterationInputs

protected ActivityInput[] getIterationInputs()
Gets the iteration inputs.

Specified by:
getIterationInputs in class MatchedIterativeActivity
Returns:
an array of ActivityInput objects

preprocess

protected void preprocess()
                   throws ActivityUserException,
                          ActivityProcessingException,
                          ActivityTerminatedException
Performs any pre-processing required before the iterative part of the activity processing commences.

Specified by:
preprocess in class MatchedIterativeActivity
Throws:
ActivityUserException - if the settings specified by the user prevent processing from completing
ActivityProcessingException - if an internal error prevents processing from completing
ActivityTerminatedException - if activity processing is terminated at an intermediate stage

processIteration

protected void processIteration(java.lang.Object[] iterationData)
                         throws ActivityProcessingException,
                                ActivityTerminatedException,
                                ActivityUserException
Performs an iteration of the activity processing. During this the input blocks should be consumed and the output blocks produced.

Specified by:
processIteration in class MatchedIterativeActivity
Parameters:
iterationData - the data from this iteration
Throws:
ActivityProcessingException - if an internal error prevents processing from completing
ActivityTerminatedException - if activity processing is terminated at an intermediate stage
ActivityUserException - if the settings specified by the user prevent processing from completing

postprocess

protected void postprocess()
                    throws ActivityUserException,
                           ActivityProcessingException,
                           ActivityTerminatedException
Performs any post-processing required after the iterative part of the activity processing has completed. Note that this will not be be invoked if an error occurs during an earlier stage of processing. No post-processing.

Specified by:
postprocess in class MatchedIterativeActivity
Throws:
ActivityUserException - if the settings specified by the user prevent processing from completing
ActivityProcessingException - if an internal error prevents processing from completing
ActivityTerminatedException - if activity processing is terminated at an intermediate stage

createResource

protected JDBCDataResource createResource(ResourceID templateID)
                                   throws java.lang.Exception
Use the resource factory to create a new resource from the specified template.

Parameters:
templateID - Resource template ID.
Returns:
resource Newly created resource.
Throws:
java.lang.Exception - If:
  • Server deployer did not provide a template of the given ID (ResourceUnknownException), or
  • There was a problem accessing the template resource configuration (ResourceCreationException), or
  • There is a template with the given ID but it does not specify a data resource (ResourceTypeException), or
  • There is a template with the given ID but it does not specify a relational data resource (DAIClassMissingInterfaceException)

getLoginProvider

protected LoginProvider getLoginProvider(JDBCDataResourceState state)
                                  throws java.lang.Exception
Get the login provider for the new resource.

Parameters:
state - New resource state.
Returns:
login provider.
Throws:
java.lang.Exception - If the server deployer didn't specify a login provider for the template (and so for this) resource. This exception will be one of ConfigurationValueMissingException or ConfigurationValueIllegalException.

getLogin

protected Login getLogin(ResourceID templateID,
                         LoginProvider loginProvider,
                         SecurityContext context)
                  throws java.lang.Exception
Get login for the template resource.

Parameters:
templateID - Template resource ID.
loginProvider - Login provider for both template resource and new resource.
context - Security context to use to get login.
Returns:
login for the template resource ID under the given security context.
Throws:
java.lang.Exception - If:
  • Server deployer did not specify any login the template resource (ResourceUnknownException), or
  • Server deployer did not specify a login for the template resource with this security context (LoginDeniedException), or
  • The login provider can't handle the given type of security context (LoginProviderException) or,
  • Some other login provider problem arose (LoginProviderException).

updateLogin

protected void updateLogin(ResourceID resourceID,
                           LoginProvider loginProvider,
                           Login login,
                           SecurityContext context)
                    throws java.lang.Exception
Add the given login as a login for the new resource associated with the given security context. Used in conjunction with getLogin this basically allows the login information for the template resource (under the conditions of a specific security context) to be used for the new resource.

Parameters:
resourceID - Resource ID.
loginProvider - Login provider for both template resource and new resource.
login - Login for the new resource - inherited from the template resource
context - Security context associated with this login.
Throws:
java.lang.Exception - If:
  • The login provider can't handle the given type of security context (LoginProviderException) or,
  • Some other login provide problem arose (LoginProviderException), or
  • Service deployer specified a login provider that does not implement ManageableLoginProvider and so cannot be updated (DAIClassMissingInterfaceException)

configureActivity

public void configureActivity(KeyValueProperties properties)
Configures the activity with a property set. Extracts value with key dai.template.id and attempts to parse into a uk.org.ogsadai.resource.ResourceID.

Specified by:
configureActivity in interface ConfigurableActivity
Parameters:
properties - Activity configuration properties.

setSecurityContext

public void setSecurityContext(SecurityContext context)
Sets the security context of the user processing the activity.

Specified by:
setSecurityContext in interface SecureActivity
Parameters:
context - security context