uk.org.ogsadai.client.toolkit.activity.xmldb
Class XUpdate

java.lang.Object
  |
  +--uk.org.ogsadai.client.toolkit.activity.RequestComponent
        |
        +--uk.org.ogsadai.client.toolkit.activity.Activity
              |
              +--uk.org.ogsadai.client.toolkit.activity.xmldb.XUpdate

public class XUpdate
extends Activity

This activity updates a resource/collection exposed by an XMLDB data service resource using an XUpdate expression.

It has no input and one output - the update count in XML. The format of the output is OGSA-DAI specific XML. For example:

<modifiedNodes> 2 </modifiedNodes>

Author:
The OGSA-DAI Project Team

Field Summary
private static java.lang.String COPYRIGHT_NOTICE
          Copyright statement
private  java.lang.String mCollectionName
          Name of collection to update
private  java.lang.String mExpression
          XUpdate expression
private  java.lang.String mResourceName
          Name of resource to update
 
Fields inherited from class uk.org.ogsadai.client.toolkit.activity.Activity
 
Fields inherited from class uk.org.ogsadai.client.toolkit.activity.RequestComponent
 
Constructor Summary
XUpdate()
          Constructs an XUpdate request.
XUpdate(java.lang.String expression)
          Constructs a request to update a resource/collection using XUpdate.
 
Method Summary
protected  java.lang.String generateXML()
          Generates the XML representing the activity.
 int getModifiedNodes()
          Gets the number of updated nodes.
 ActivityOutput getOutput()
          Gets the activity's only output - the XUpdate result.
 void setCollectionName(java.lang.String collectionName)
          Set the collection name.
 void setExpression(java.lang.String expression)
          Set the XUpdate expression.
 void setResourceName(java.lang.String resourceName)
          Set the resource name.
 
Methods inherited from class uk.org.ogsadai.client.toolkit.activity.Activity
addInput, addOutput, addOutputs, getDataResourceID, getInputParameters, getOutputParameters, getOutputs, replaceSpecialCharacters, setDataResourceID, setInput
 
Methods inherited from class uk.org.ogsadai.client.toolkit.activity.RequestComponent
getDataService, getName, getSession, setDataService, setSession
 
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

mExpression

private java.lang.String mExpression
XUpdate expression


mResourceName

private java.lang.String mResourceName
Name of resource to update


mCollectionName

private java.lang.String mCollectionName
Name of collection to update

Constructor Detail

XUpdate

public XUpdate()
Constructs an XUpdate request. The XUpdate expression must be set using setExpression All resources in the base collection and its sub-collections will be updated.


XUpdate

public XUpdate(java.lang.String expression)
Constructs a request to update a resource/collection using XUpdate. All resources in the base collection and its sub-collections will be queried.

Parameters:
expression - XUpdate update expression.
Throws:
java.lang.IllegalArgumentException - If expression is null
Method Detail

setExpression

public void setExpression(java.lang.String expression)
Set the XUpdate expression.

Parameters:
expression - XUpdate update expression.
Throws:
java.lang.IllegalArgumentException - If expression is null

setResourceName

public void setResourceName(java.lang.String resourceName)
Set the resource name. The update will be executed on this resource. If this is set to null then the update will be executed on all the resources in the selected collection.

Parameters:
resourceName - The name of the resource or null.

setCollectionName

public void setCollectionName(java.lang.String collectionName)
Set the collection name. The update will be executed within this collection. If this is set to null then the update will be executed within the base collection.

Parameters:
collectionName - The name of the collection or null.

getOutput

public ActivityOutput getOutput()
Gets the activity's only output - the XUpdate result.

Returns:
the activity output.

getModifiedNodes

public int getModifiedNodes()
                     throws NoActivityOutputException,
                            DataFormatException
Gets the number of updated nodes.

Returns:
number of updated nodes.
Throws:
NoActivityOutputException - if there is no output data or the data has not yet been processed to this output or the activity that generates this output has not yet been executed.
DataFormatException - if the output from the activity cannot be parsed into a count.

generateXML

protected java.lang.String generateXML()
Description copied from class: RequestComponent
Generates the XML representing the activity. This XML can then be inserted into a perform document that is sent to a data service.

Specified by:
generateXML in class Activity
Returns:
the XML for the activity