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

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

public class XPathQuery
extends Activity

This activity queries a resource/collection according to an XPath expression.

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

<resourceSet>
<resource>
<someMatchingResource
xmlns:src="http://xml.apache.org/xindice/Query"
src:col="someCollection" src:key="someKey">
<someElt name="someAttribute"/>
<someElt name="someAttribute"/>
</someMatchingResource>
</resource>
</resourceSet>

Author:
The OGSA-DAI Project Team

Constructor Summary
XPathQuery()
          Constructs a request to query a resource/collection using XPath.
XPathQuery(java.lang.String expression)
          Constructs a request to query a resource/collection using XPath.
 
Method Summary
protected  java.lang.String generateXML()
          Generates the XML representing the activity.
 ActivityOutput getOutput()
          Gets the activity's only output.
 org.xmldb.api.base.ResourceSet getResourceSet()
          Get a proprietary representation of the XPath query result.
 void setCollectionName(java.lang.String parentCollectionName)
          Set the parent collection name.
 void setExpression(java.lang.String expression)
          Set the XPath expression.
 void setNamespaceBinding(java.lang.String prefix, java.lang.String url)
          Add a binding from a namespace prefix used within the XPath query to a namespace URL.
 void setNamespaceBindings(java.util.Map bindings)
          Add a collection of bindings from namespace prefixes used within the XPath query to namespace URLs.
 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, getDataServiceStub, getInputParameters, getOutputParameters, getOutputs, replaceSpecialCharacters, setDataResourceID, setDataServiceStub, setInput
 
Methods inherited from class uk.org.ogsadai.client.toolkit.activity.RequestComponent
getName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XPathQuery

public XPathQuery()
Constructs a request to query a resource/collection using XPath.


XPathQuery

public XPathQuery(java.lang.String expression)
Constructs a request to query a resource/collection using XPath.

Parameters:
expression -
Method Detail

setExpression

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

Parameters:
expression -

setResourceName

public void setResourceName(java.lang.String resourceName)
Set the resource name.

Parameters:
resourceName -

setCollectionName

public void setCollectionName(java.lang.String parentCollectionName)
Set the parent collection name.

Parameters:
parentCollectionName -

setNamespaceBinding

public void setNamespaceBinding(java.lang.String prefix,
                                java.lang.String url)
Add a binding from a namespace prefix used within the XPath query to a namespace URL.

Parameters:
prefix -
url - a legal URL e.g. http://www.org/test
Throws:
java.lang.IllegalArgumentException - If the given URL is not a legal URL If the prefix or the URL are null

setNamespaceBindings

public void setNamespaceBindings(java.util.Map bindings)
Add a collection of bindings from namespace prefixes used within the XPath query to namespace URLs.

Parameters:
bindings - from namespace prefixes to namespace URLs
Throws:
java.lang.IllegalArgumentException - If the given bindings are null If the given URLs are not legal URLs

getResourceSet

public org.xmldb.api.base.ResourceSet getResourceSet()
                                              throws ActivityOutputException,
                                                     DataFormatException
Get a proprietary representation of the XPath query result.

Returns:
query result in an OGSA-DAI ResourceSet
Throws:
DataFormatException - If the output data is not in the expected format.
ActivityOutputException - If there is no output data.

getOutput

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

Returns:
the activity output.

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