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

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

public class XMLCreateResource
extends Activity

This activity creates a new resource within an XML database collection exposed by an XMLDB data service resource.

This activity has no input and one output - the name of the new resource. The format of the output is OGSA-DAI specific XML. For example:

<createdResource name="someNewResource"/>

Author:
The OGSA-DAI Project Team

Field Summary
private static java.lang.String COPYRIGHT_NOTICE
          Copyright statement
private  java.lang.String mContent
          Resource content
private  java.lang.String mParentCollectionName
          Parent Collection name
private  java.lang.String mResourceName
          Resource name
 
Fields inherited from class uk.org.ogsadai.client.toolkit.activity.Activity
 
Fields inherited from class uk.org.ogsadai.client.toolkit.activity.RequestComponent
 
Constructor Summary
XMLCreateResource()
          Constructs a request to create a resource.
XMLCreateResource(java.lang.String content)
          Constructs a request to create a resource.
 
Method Summary
protected  java.lang.String generateXML()
          Generates the XML representing the activity.
 ActivityOutput getOutput()
          Gets the activity's only output - the name of the new resource.
 java.lang.String getResourceName()
          Gets the name of the new resource.
 void setContent(java.lang.String content)
          Sets the content of the new resource.
 void setContentFromFile(java.lang.String contentFileName)
          Sets the content of the new resource from a file.
 void setParentCollectionName(java.lang.String parentCollectionName)
          Set the parent collection name.
 void setResourceName(java.lang.String resourceName)
          Set the name of the resource to be created.
 
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

mResourceName

private java.lang.String mResourceName
Resource name


mParentCollectionName

private java.lang.String mParentCollectionName
Parent Collection name


mContent

private java.lang.String mContent
Resource content

Constructor Detail

XMLCreateResource

public XMLCreateResource()
Constructs a request to create a resource. The resource will be created in the base collection and it is assumed the XMLDB resource will assign it a name. The content must be set using setContent or setContentFromFile.


XMLCreateResource

public XMLCreateResource(java.lang.String content)
                  throws XMLDBResourceException
Constructs a request to create a resource. The resource will be created in the base collection and it is assumed the XMLDB resource will assign it a name.

Parameters:
content - Content of the new resource in XML.
Throws:
java.lang.IllegalArgumentException - If content is null.
XMLDBResourceException - If content cannot be parsed as XML.
Method Detail

setResourceName

public void setResourceName(java.lang.String resourceName)
Set the name of the resource to be created.

Parameters:
resourceName - Name of resource to be created. If null then it is assumed the XMLDB resource will assign it a name.

setParentCollectionName

public void setParentCollectionName(java.lang.String parentCollectionName)
Set the parent collection name. The resource will be created in this collection. If this is set to null then the resource will be created in the base collection.

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

setContent

public void setContent(java.lang.String content)
                throws XMLDBResourceException
Sets the content of the new resource.

Parameters:
content - Content of the new resource in XML.
Throws:
java.lang.IllegalArgumentException - If content is null.
XMLDBResourceException - If content cannot be parsed as XML.

setContentFromFile

public void setContentFromFile(java.lang.String contentFileName)
                        throws XMLDBResourceException
Sets the content of the new resource from a file.

Parameters:
contentFileName - Name of XML file containing the content of the new resource.
Throws:
java.lang.IllegalArgumentException - If contentFileName is null.
XMLDBResourceException - If there is a problem accessing resource e.g. accessing the file or parsing its contents.

getOutput

public ActivityOutput getOutput()
Gets the activity's only output - the name of the new resource.

Returns:
the activity output.

getResourceName

public java.lang.String getResourceName()
                                 throws NoActivityOutputException,
                                        DataFormatException
Gets the name of the new resource.

Returns:
resource name.
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 name.

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
See Also:
Activity.generateXML()