|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--uk.org.ogsadai.client.toolkit.activity.RequestComponent | +--uk.org.ogsadai.client.toolkit.activity.Activity | +--uk.org.ogsadai.client.toolkit.activity.xmldb.XMLBulkLoad
This activity bulk loads a set of documents into an XML collection
exposed by an XMLDB data service resource. The documents can either
be included in-line in the request or can be read from another
activity's output. If a collection is named but does not exist then
it can be created if this option is set (see
setCollectionName
).
The activity has one (optional) input - XML data from another activity - and one output - the number of resources bulk loaded. The format of the output is OGSA-DAI specific XML. For example:
<resultCount> 2 </resultCount>
Field Summary | |
private static java.lang.String |
COPYRIGHT_NOTICE
Copyright statement |
private java.lang.String |
mCollectionName
Collection name |
private boolean |
mCreateIfNotExists
Create the collection if it does not exist? |
private java.lang.String |
mData
Optional input data to be provided in-line. |
Fields inherited from class uk.org.ogsadai.client.toolkit.activity.Activity |
|
Fields inherited from class uk.org.ogsadai.client.toolkit.activity.RequestComponent |
|
Constructor Summary | |
XMLBulkLoad()
Constructs a request to bulk load resources into a collection. |
|
XMLBulkLoad(ActivityOutput input)
Constructs a request to bulk load data into a collection. |
Method Summary | |
protected java.lang.String |
generateXML()
Generates the XML representing the activity. |
ActivityOutput |
getOutput()
Gets the activity's only output - the number of inserted resources. |
int |
getResultCount()
Gets the number of inserted resources. |
void |
setCollectionName(java.lang.String collectionName)
Set the collection name. |
void |
setCollectionName(java.lang.String collectionName,
boolean createIfNotExists)
Set the collection name. |
void |
setInput(ActivityOutput input)
Sets the input of this activity to be the output from another activity that will provide the XML content of the new resource. |
void |
setInputData(org.w3c.dom.Document document)
Sets the input data for the bulk load. |
void |
setInputData(org.xmldb.api.base.ResourceSet resources)
Sets the input data for the bulk load to be the resources held within a org.xmldb.api.base.ResourceSet . |
void |
setInputData(java.lang.String content)
Sets the input data for the bulk load. |
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 |
private static final java.lang.String COPYRIGHT_NOTICE
private java.lang.String mCollectionName
private boolean mCreateIfNotExists
private java.lang.String mData
Constructor Detail |
public XMLBulkLoad()
setInput
or setInputData
By default the documents will be bulk loaded into the base
collection.
public XMLBulkLoad(ActivityOutput input)
input
- Output from another activity.
java.lang.IllegalArgumentException
- If input
is null
.Method Detail |
public final void setInput(ActivityOutput input)
input
- Output from another activity.
java.lang.IllegalArgumentException
- If input
is null
.public void setInputData(org.xmldb.api.base.ResourceSet resources) throws XMLDBResourceException
org.xmldb.api.base.ResourceSet
.
resources
- ResourceSet
XMLDBResourceException
- If the resourceSet
data cannot be written to a
string.public void setInputData(java.lang.String content) throws XMLDBResourceException
resourceSet
element containing:resource
elements.<resourceSet> <resource> <entry id="1"> <name>Ally Antonioletti</name> <address>826 Hume Crescent, Southampton</address> <phone>01670061244</phone> </entry> </resource> <resource> <entry id="10"> <name>Martin Laws</name> <address>224 Palansuriya Lane, Winchester</address> <phone>06686142062</phone> </entry> </resource> </resourceSet>
content
- A string containing the data for bulk load.
XMLDBResourceException
- If content
is not null
and cannot
be parsed as XML.public void setInputData(org.w3c.dom.Document document)
setInputData(java.lang.String) (however, no
check is made for conformance to this format only for valid
XML).
- Parameters:
document
- An XML fragment containing the data for bulk load.
public void setCollectionName(java.lang.String collectionName)
null
then
the resource will loaded in the base collection. If the
collection does not exist then it will not be created and the
activity will raise an error.
collectionName
- The name of the collection or null
.public void setCollectionName(java.lang.String collectionName, boolean createIfNotExists)
null
then
the resource will loaded in the base collection.
collectionName
- The name of the collection or null
.createIfNotExists
- If collectionName
is not null
and
does not exist then should it be created?
The collection can only be created if all its parent
collections exist. For example:
littleblackbook/address/newCollection
- the
new collection newCollection
can only be
created if the parent collections
littleblackbook
and address
exist.public int getResultCount() throws NoActivityOutputException, DataFormatException
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.public ActivityOutput getOutput()
protected java.lang.String generateXML()
RequestComponent
generateXML
in class Activity
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |