Skip to Content.
Sympa Menu

perfsonar-dev - r1630 - in branches/yi-udel/perfsonar/src/org/perfsonar: commons/auxiliary/components/scheduler/actions service/commons/storage service/commons/storage/xmldb/exist/rest service/commons/storage/xmldb/exist/xmlrpc service/commons/storage/xmlfile service/lookupService/xmlType

Subject: perfsonar development work

List archive

r1630 - in branches/yi-udel/perfsonar/src/org/perfsonar: commons/auxiliary/components/scheduler/actions service/commons/storage service/commons/storage/xmldb/exist/rest service/commons/storage/xmldb/exist/xmlrpc service/commons/storage/xmlfile service/lookupService/xmlType


Chronological Thread 
  • From:
  • To:
  • Subject: r1630 - in branches/yi-udel/perfsonar/src/org/perfsonar: commons/auxiliary/components/scheduler/actions service/commons/storage service/commons/storage/xmldb/exist/rest service/commons/storage/xmldb/exist/xmlrpc service/commons/storage/xmlfile service/lookupService/xmlType
  • Date: Tue, 12 Sep 2006 01:35:32 -0400

Author: zurawski
Date: 2006-09-12 01:35:31 -0400 (Tue, 12 Sep 2006)
New Revision: 1630

Modified:

branches/yi-udel/perfsonar/src/org/perfsonar/commons/auxiliary/components/scheduler/actions/SchedulerAction.java

branches/yi-udel/perfsonar/src/org/perfsonar/service/commons/storage/GenericXmlStorageManager.java

branches/yi-udel/perfsonar/src/org/perfsonar/service/commons/storage/StorageManager.java

branches/yi-udel/perfsonar/src/org/perfsonar/service/commons/storage/xmldb/exist/rest/ExistDbHttpXmlStorageManager.java

branches/yi-udel/perfsonar/src/org/perfsonar/service/commons/storage/xmldb/exist/xmlrpc/ExistDbXmlrpcXmlStorageManager.java

branches/yi-udel/perfsonar/src/org/perfsonar/service/commons/storage/xmlfile/XmlFileStorageManager.java

branches/yi-udel/perfsonar/src/org/perfsonar/service/lookupService/xmlType/LSAction.java

branches/yi-udel/perfsonar/src/org/perfsonar/service/lookupService/xmlType/LSCleanup.java

branches/yi-udel/perfsonar/src/org/perfsonar/service/lookupService/xmlType/LSDeregisterAction.java

branches/yi-udel/perfsonar/src/org/perfsonar/service/lookupService/xmlType/LSGenericRegisterAction.java

branches/yi-udel/perfsonar/src/org/perfsonar/service/lookupService/xmlType/LSRegisterAction.java
Log:
This batch of changes represents the removal of XUpdate statements in
place of the newer XQuery update insert/replace/value/delete/rename
available in the newer releases of eXist.

The LS code updates are reasonably cleaned up (all references to the old
style were removed). The storage classes are commented for now, namely
because of two questions:

- Is the 'NMWGStorageManager' meant to be an interface of
'StorageManager'? It is currently not, and it works out well that it is

not (if we wish to remove the 'store' functions). Chaning StorageManager
DID affect 'SchedulerAction' but based on internal observations the
offending line was being used wrong anyway, and a fix to use
NMWGStorageManager was implemented.

- Is the 'store' functionality useful at all without having XUpdate? It
is also used in classes such as 'XMLFileStorageManager' and
'GenericXmlStorageManager' and I have not seen any issues come up after
the commenting.

This branch can now be used to test against the current trunk in hopes
of revealing where the performance issues lie in testing the LS (it will
be necessary to use 1.0 or 1.1 versions of eXist on this branch from now
on).

-jason



Modified:
branches/yi-udel/perfsonar/src/org/perfsonar/commons/auxiliary/components/scheduler/actions/SchedulerAction.java
===================================================================
---
branches/yi-udel/perfsonar/src/org/perfsonar/commons/auxiliary/components/scheduler/actions/SchedulerAction.java
2006-09-12 05:26:42 UTC (rev 1629)
+++
branches/yi-udel/perfsonar/src/org/perfsonar/commons/auxiliary/components/scheduler/actions/SchedulerAction.java
2006-09-12 05:35:31 UTC (rev 1630)
@@ -16,6 +16,7 @@
import org.perfsonar.service.commons.exceptions.SystemException;
import org.perfsonar.service.commons.measurementExecutor.MeasurementExecutor;
import org.perfsonar.service.commons.storage.StorageManager;
+import org.perfsonar.service.commons.storage.NMWGStorageManager;
import org.perfsonar.commons.auxiliary.AuxiliaryComponentManager;
import org.perfsonar.commons.auxiliary.ComponentNames;
import
org.perfsonar.commons.auxiliary.components.configuration.ConfigurationComponent;
@@ -348,9 +349,8 @@

logger.debug("SchedulerAction: The event type:
"+eventTypeString+" requires" +
"contacting a StorageManager of type:
"+handlerClassName);
- StorageManager storageManager =
(StorageManager)handlerClass.newInstance();
- replyMessage = (Message)
storageManager.store(requestMessage);
-
+ NMWGStorageManager nmwgStorageManager =
(NMWGStorageManager)handlerClass.newInstance();
+ replyMessage = (Message)
nmwgStorageManager.store(requestMessage);

}
else {


Modified:
branches/yi-udel/perfsonar/src/org/perfsonar/service/commons/storage/GenericXmlStorageManager.java
===================================================================
---
branches/yi-udel/perfsonar/src/org/perfsonar/service/commons/storage/GenericXmlStorageManager.java
2006-09-12 05:26:42 UTC (rev 1629)
+++
branches/yi-udel/perfsonar/src/org/perfsonar/service/commons/storage/GenericXmlStorageManager.java
2006-09-12 05:35:31 UTC (rev 1630)
@@ -31,9 +31,13 @@
/**
* Stores data in a data repository.
*/
+/*
+
+Do we still need this w/ no XUpdate?
+
public Object store(Object dataSet)
throws SystemException, RequestException, DataFormatException;
+*/


-
-} //StorageManager
\ No newline at end of file
+} //StorageManager

Modified:
branches/yi-udel/perfsonar/src/org/perfsonar/service/commons/storage/StorageManager.java
===================================================================
---
branches/yi-udel/perfsonar/src/org/perfsonar/service/commons/storage/StorageManager.java
2006-09-12 05:26:42 UTC (rev 1629)
+++
branches/yi-udel/perfsonar/src/org/perfsonar/service/commons/storage/StorageManager.java
2006-09-12 05:35:31 UTC (rev 1630)
@@ -36,9 +36,13 @@
/**
* Stores data in a data repository.
*/
+/*
+
+Do we still need this w/ no XUpdate?
+
public Object store(Object dataSet)
throws SystemException, RequestException, DataFormatException;
+*/


-
-} //StorageManager
\ No newline at end of file
+} //StorageManager

Modified:
branches/yi-udel/perfsonar/src/org/perfsonar/service/commons/storage/xmldb/exist/rest/ExistDbHttpXmlStorageManager.java
===================================================================
---
branches/yi-udel/perfsonar/src/org/perfsonar/service/commons/storage/xmldb/exist/rest/ExistDbHttpXmlStorageManager.java
2006-09-12 05:26:42 UTC (rev 1629)
+++
branches/yi-udel/perfsonar/src/org/perfsonar/service/commons/storage/xmldb/exist/rest/ExistDbHttpXmlStorageManager.java
2006-09-12 05:35:31 UTC (rev 1630)
@@ -116,13 +116,17 @@
* @param dataSet Must be String, contains XUpdate string
* @return depends on getResultType()
*/
+/*
+
+Do we still need this w/ no XUpdate?
+
public Object store(Object dataSet)
throws SystemException, RequestException, DataFormatException {

return xupdateHttp(dataSet);

}
-
+*/
// -------------------------------------- protected methods


@@ -157,7 +161,10 @@
}


-
+/*
+
+Do we still need this w/ no XUpdate?
+
protected Object xupdateHttp(Object xml)
throws SystemException {

@@ -186,8 +193,8 @@
return results; // String, String[] or XmlDbResult
// - depends on getResultType()
}
+*/



-
} //ExistDbXmlrpcXmlStorageManager

Modified:
branches/yi-udel/perfsonar/src/org/perfsonar/service/commons/storage/xmldb/exist/xmlrpc/ExistDbXmlrpcXmlStorageManager.java
===================================================================
---
branches/yi-udel/perfsonar/src/org/perfsonar/service/commons/storage/xmldb/exist/xmlrpc/ExistDbXmlrpcXmlStorageManager.java
2006-09-12 05:26:42 UTC (rev 1629)
+++
branches/yi-udel/perfsonar/src/org/perfsonar/service/commons/storage/xmldb/exist/xmlrpc/ExistDbXmlrpcXmlStorageManager.java
2006-09-12 05:35:31 UTC (rev 1630)
@@ -183,6 +183,8 @@

}

+
+

/**
* Store data. dataSet input parameter MUST be String
@@ -190,6 +192,10 @@
* @param dataSet Must be String, contains XUpdate string
* @return null
*/
+/*
+
+Do we still need this with no XUpdate?
+
public Object store(Object dataSet) throws SystemException,
RequestException, DataFormatException {

@@ -232,7 +238,10 @@

return null;
}
+*/

+
+
/**
* Check if keepConnection flag is set.
* @return true if the connection is persistent (common for all DB
requests),

Modified:
branches/yi-udel/perfsonar/src/org/perfsonar/service/commons/storage/xmlfile/XmlFileStorageManager.java
===================================================================
---
branches/yi-udel/perfsonar/src/org/perfsonar/service/commons/storage/xmlfile/XmlFileStorageManager.java
2006-09-12 05:26:42 UTC (rev 1629)
+++
branches/yi-udel/perfsonar/src/org/perfsonar/service/commons/storage/xmlfile/XmlFileStorageManager.java
2006-09-12 05:35:31 UTC (rev 1630)
@@ -159,14 +159,18 @@
/**
* UNIMPLEMENTED
*/
+/*
+
+Do we still need this w/ no XUpdate?
+
public Object store(Object dataSet) throws SystemException,
RequestException, DataFormatException {

throw new SystemException("not implemented");

}
+*/

-


// /**

Modified:
branches/yi-udel/perfsonar/src/org/perfsonar/service/lookupService/xmlType/LSAction.java
===================================================================
---
branches/yi-udel/perfsonar/src/org/perfsonar/service/lookupService/xmlType/LSAction.java
2006-09-12 05:26:42 UTC (rev 1629)
+++
branches/yi-udel/perfsonar/src/org/perfsonar/service/lookupService/xmlType/LSAction.java
2006-09-12 05:35:31 UTC (rev 1630)
@@ -65,12 +65,20 @@
* Footer for all XUpdates used in LS register
*/
protected static final String XUPDATE_FOOTER = "</xu:modifications>";
+
+ /**
+ * Header for all XQuery used in LS modifications
+ */
+ protected static final String XQUERY_UPDATE_DECLARE = "declare " +
+ "namespace nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\";; ";
+ protected static final String XQUERY_UPDATE_INSERT = "update insert ";
+ protected static final String XQUERY_UPDATE_REPLACE = "update replace ";
+ protected static final String XQUERY_UPDATE_VALUE = "update value ";
+ protected static final String XQUERY_UPDATE_DELETE = "update delete ";
+ protected static final String XQUERY_UPDATE_RENAME = "update rename ";


-
-
// ----------------------------------------------------- Instance
variables
-
-
+
/**
* Local XML DB Access, Storage Manager
*/

Modified:
branches/yi-udel/perfsonar/src/org/perfsonar/service/lookupService/xmlType/LSCleanup.java
===================================================================
---
branches/yi-udel/perfsonar/src/org/perfsonar/service/lookupService/xmlType/LSCleanup.java
2006-09-12 05:26:42 UTC (rev 1629)
+++
branches/yi-udel/perfsonar/src/org/perfsonar/service/lookupService/xmlType/LSCleanup.java
2006-09-12 05:35:31 UTC (rev 1630)
@@ -133,22 +133,21 @@
"REMOVING metadata for key ["+
keys[i]+"] and related data");

- //generate XUpdate that removes data
+ //generate XQuery that removes data
//removes data from ALL schemas (LSStore,
LSStore-control)
- String query;
- query = XUPDATE_HEADER +
- "<xu:remove
select=\"/nmwg:store/nmwg:metadata[@id='"+
- keys[i]+"']\"/>\n" +
- "<xu:remove
select=\"/nmwg:store/nmwg:data[@metadataIdRef='"+
- keys[i]+"']\"/>\n" +
- XUPDATE_FOOTER;
-
- //remove
-
- /****/
- xmlStorageManager.store(query); //XUpdate
- /****/
-
+
+ String query = "";
+ query = XQUERY_UPDATE_DECLARE +
+ "for $md in
/nmwg:store/nmwg:metadata[@id='"
+
+ keys[i] + "'] return " + XQUERY_UPDATE_DELETE +
"$md";
+ xmlStorageManager.fetch(query); //XQuery

+
+ query = "";
+ query = XQUERY_UPDATE_DECLARE +
+ "for $d in
/nmwg:store/nmwg:data[@metadataIdRef='"
+
+ keys[i] + "'] return " + XQUERY_UPDATE_DELETE +
"$d";
+ xmlStorageManager.fetch(query); //XQuery

+
} //if

} //else

Modified:
branches/yi-udel/perfsonar/src/org/perfsonar/service/lookupService/xmlType/LSDeregisterAction.java
===================================================================
---
branches/yi-udel/perfsonar/src/org/perfsonar/service/lookupService/xmlType/LSDeregisterAction.java
2006-09-12 05:26:42 UTC (rev 1629)
+++
branches/yi-udel/perfsonar/src/org/perfsonar/service/lookupService/xmlType/LSDeregisterAction.java
2006-09-12 05:35:31 UTC (rev 1630)
@@ -92,16 +92,15 @@

//If found at least one matching Data element, remove all
if (countDataRemoved>0) {
+
+ //generate XQuery that removes data

- //generate XUpdate that removes data
- String remove = XUPDATE_HEADER +
- "<xu:remove
select=\"/nmwg:store/nmwg:data[@metadataIdRef='"
- + keyValue +"']\"/>\n"
- + XUPDATE_FOOTER;
-
- logger.debug("XmlTypeLSServiceEngine: Remove xupdate="+remove);
- xmlStorageManager.store(remove);
-
+ String remove = "";
+ remove = XQUERY_UPDATE_DECLARE +
+ "for $d in
/nmwg:store/nmwg:data[@metadataIdRef='"
+ + keyValue +"'] return " + XQUERY_UPDATE_DELETE + "$d";
+ logger.debug("XmlTypeLSServiceEngine: Remove xupdate=" +
remove);
+ xmlStorageManager.fetch(remove); //XQuery
}

//Query - get metadata identifiers for Key (all occurencies of
Metadata
@@ -127,15 +126,14 @@
//if found - remove (XUpdate)
if (countDataRemoved>0) {

- //generate XUpdate that removes data
+ //generate XQuery that removes data
//removes data from ALL schemas (LSStore, LSStore-control)
- query = XUPDATE_HEADER +
- "<xu:remove
select=\"/nmwg:store/nmwg:metadata[@id='"+
- keyValue+"']\"/>\n" +
- XUPDATE_FOOTER;
-
- xmlStorageManager.store(query); //XUpdate
-
+
+ String remove2 = "";
+ remove2 = XQUERY_UPDATE_DECLARE +
+ "for $md in
/nmwg:store/nmwg:metadata[@id='"
+
+ keyValue+"'] return " + XQUERY_UPDATE_DELETE + "$md";

+ xmlStorageManager.fetch(remove2); //XQuery
}

//status of operation

Modified:
branches/yi-udel/perfsonar/src/org/perfsonar/service/lookupService/xmlType/LSGenericRegisterAction.java
===================================================================
---
branches/yi-udel/perfsonar/src/org/perfsonar/service/lookupService/xmlType/LSGenericRegisterAction.java
2006-09-12 05:26:42 UTC (rev 1629)
+++
branches/yi-udel/perfsonar/src/org/perfsonar/service/lookupService/xmlType/LSGenericRegisterAction.java
2006-09-12 05:35:31 UTC (rev 1630)
@@ -71,25 +71,20 @@
String key,
String parameterName,
StorageManager xmlStorageManager) throws SystemException,
RequestException, DataFormatException {
-
+
String remove = null;

//remove single parameter

logger.debug("LSGenericRegisterAction: remove parameter ["+
- parameterName+"] for key ["+key+"]");
+ parameterName+"] for key ["+key+"]");
+
+ remove = XQUERY_UPDATE_DECLARE +
+ "for $p in
/nmwg:store[@type='"
+ LS_STORE_CONTROL_COLLECTION_TYPE +
+
"']/nmwg:metadata[@id='"
+ key +
"']/nmwg:parameters/nmwg:parameter[@name='"
+
+ parameterName + "'] return " + XQUERY_UPDATE_DELETE + "$p";

+ xmlStorageManager.fetch(remove); //XQuery

- remove = XUPDATE_HEADER +
- "<xu:remove select=\"" +
-
"/nmwg:store[@type='"+LS_STORE_CONTROL_COLLECTION_TYPE+"']/nmwg:metadata[@id='"+key+
-
"']/nmwg:parameters/nmwg:parameter[@name='"+parameterName+"']"
+
- "\">\n" +
- "</xu:remove>\n"+
- XUPDATE_FOOTER;
-
- //remove data
- xmlStorageManager.store(remove);
-
//check if metadata empty

String query = "declare namespace
nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\";; " +
@@ -104,16 +99,12 @@
logger.debug("LSGenericRegisterAction: metadata block for key
["+key
+"] remained empty, delete it");

- remove = XUPDATE_HEADER +
- "<xu:remove select=\"" +
-
"/nmwg:store[@type='"+LS_STORE_CONTROL_COLLECTION_TYPE+"']/nmwg:metadata[@id='"
- + key +"']\">\n" +
- "</xu:remove>\n"+
- XUPDATE_FOOTER;
-
- //remove empty metadata
- xmlStorageManager.store(remove);
-
+ remove = XQUERY_UPDATE_DECLARE +
+ "for $md in
/nmwg:store[@type='"
+ LS_STORE_CONTROL_COLLECTION_TYPE +
+
"']/nmwg:metadata[@id='"
+ key + "'] return " +
+ XQUERY_UPDATE_DELETE + "$md";

+ xmlStorageManager.fetch(remove); //XQuery
+
}

} //remove parameter
@@ -156,19 +147,14 @@

logger.debug("LSGenericRegisterAction: setParameter: no control
metadata, put metadata+parameters");

- String insert = XUPDATE_HEADER +
- "<xu:append
select=\"/nmwg:store[@type='"+LS_STORE_CONTROL_COLLECTION_TYPE+"']\"
child=\"last()\">\n" +
- " <nmwg:metadata id=\""+key+"\">\n" +
- " <nmwg:parameters id=\"control-parameters\">\n" +
- //empty content
- " </nmwg:parameters>\n" +
- " </nmwg:metadata>\n" +
- "</xu:append>\n"+
- XUPDATE_FOOTER;
-
- //put
- xmlStorageManager.store(insert);
-
+ String insert = XQUERY_UPDATE_DECLARE + XQUERY_UPDATE_INSERT;
+ insert = insert + " <nmwg:metadata id=\"" + key + "\">\n" +
+ " <nmwg:parameters
id=\"control-parameters\">\n" +
+ " </nmwg:parameters>\n" +
+ " </nmwg:metadata>\n into
/nmwg:store[@type='"
+
+ LS_STORE_CONTROL_COLLECTION_TYPE + "']";
+ xmlStorageManager.fetch(insert);
+
} else {

//if there is the metadata, check if it has a parameters block
@@ -184,17 +170,14 @@
logger.debug("LSGenericRegisterAction: setParameter: no
parameters, put parameters");

//put parameters
- String insert = XUPDATE_HEADER +
- "<xu:append
select=\"/nmwg:store[@type='"+LS_STORE_CONTROL_COLLECTION_TYPE+
-
"']/nmwg:metadata[@id='"+
key +"']\" child=\"last()\">\n" +
- " <nmwg:parameters id=\"control-parameters\">\n" +
- //empty content
- " </nmwg:parameters>\n" +
- "</xu:append>\n"+
- XUPDATE_FOOTER;
-
- //put parameters
- xmlStorageManager.store(insert);
+
+ String insert = XQUERY_UPDATE_DECLARE + XQUERY_UPDATE_INSERT;
+ insert = insert + " <nmwg:parameters
id=\"control-parameters\">\n" +
+ " </nmwg:parameters>\n into
/nmwg:store[@type='"
+
+ LS_STORE_CONTROL_COLLECTION_TYPE +
"']/nmwg:metadata[@id='"
+
+ key + "']";
+ xmlStorageManager.fetch(insert);
+
}

}
@@ -215,26 +198,14 @@
logger.debug("LSGenericRegisterAction: Set parameter
["+parameterName+
"] not found, " +
"insert new parameter ["+key+"]");
-
- String insert = XUPDATE_HEADER +
- "<xu:append select=\"" +
-
"/nmwg:store[@type='"+LS_STORE_CONTROL_COLLECTION_TYPE+"']/nmwg:metadata[@id='"
- +key+
- "']/nmwg:parameters" +
- "\"" +
- " child=\"last()\">\n" +
- " "+
-
- "<nmwg:parameter name=\""+parameterName+"\">" +
- parameterValue+ "</nmwg:parameter>"+
-
- "</xu:append>\n"+
- XUPDATE_FOOTER;
-
- //put (append)
- //logger.debug(insert);
- xmlStorageManager.store(insert);
-
+
+ String insert = XQUERY_UPDATE_DECLARE + XQUERY_UPDATE_INSERT;
+ insert = insert + "<nmwg:parameter name=\"" + parameterName +
"\">" +
+ parameterValue + "</nmwg:parameter> into
/nmwg:store[@type='"
+
+ LS_STORE_CONTROL_COLLECTION_TYPE +
"']/nmwg:metadata[@id='"
+
+ key + "']/nmwg:parameters";
+ xmlStorageManager.fetch(insert);
+
} else {

//otherwise update it
@@ -242,22 +213,13 @@
logger.debug("LSGenericRegisterAction: Set parameter ["
+parameterName+"] found," +
"update existing one");
-
- String update = XUPDATE_HEADER +
- "<xu:update select=\"" +
-
"/nmwg:store[@type='"+LS_STORE_CONTROL_COLLECTION_TYPE+"']/nmwg:metadata[@id='"
- +key+
-
"']/nmwg:parameters/nmwg:parameter[@name='"+parameterName+"']\">"
+
-
- parameterValue+
-
- "</xu:update>\n"+
- XUPDATE_FOOTER;
-
- //update
- //logger.debug(update);
- xmlStorageManager.store(update);
-
+
+ String update = XQUERY_UPDATE_DECLARE + XQUERY_UPDATE_VALUE;
+ update = update +
"/nmwg:store[@type='"
+ LS_STORE_CONTROL_COLLECTION_TYPE +
+
"']/nmwg:metadata[@id='"
+ key +
+
"']/nmwg:parameters/nmwg:parameter[@name='"
+ parameterName +
+ "'] with " + parameterValue;
+ xmlStorageManager.fetch(update);
}

} //set parameter

Modified:
branches/yi-udel/perfsonar/src/org/perfsonar/service/lookupService/xmlType/LSRegisterAction.java
===================================================================
---
branches/yi-udel/perfsonar/src/org/perfsonar/service/lookupService/xmlType/LSRegisterAction.java
2006-09-12 05:26:42 UTC (rev 1629)
+++
branches/yi-udel/perfsonar/src/org/perfsonar/service/lookupService/xmlType/LSRegisterAction.java
2006-09-12 05:35:31 UTC (rev 1630)
@@ -65,7 +65,7 @@

public Message performAction(Message request)
throws SystemException, RequestException, DataFormatException {
-
+
logger.debug(
"LSRegisterAction: LS register - action REGISTER started");

@@ -174,14 +174,21 @@
if (allowReplaceIfAlreadyRegistered) {

logger.debug("LSRegisterAction: old data will be replaced by
new set of data");
-
- removeUpdate =
- "<xu:remove
select=\"/nmwg:store[@type='"+LS_STORE_COLLECTION_TYPE+"']/nmwg:metadata[@id='"
- +keyValue+"']\" />\n" +
- "<xu:remove
select=\"/nmwg:store[@type='"+LS_STORE_COLLECTION_TYPE+"']/nmwg:data[@metadataIdRef='"
- +keyValue+"']\" />\n";
-

+ String remove = XQUERY_UPDATE_DECLARE +
+ "for $md in
/nmwg:store[@type='"
+ LS_STORE_COLLECTION_TYPE +
+
"']/nmwg:metadata[@id='"
+ keyValue + "'] return " +
+ XQUERY_UPDATE_DELETE + "$md";
+ xmlStorageManager.fetch(remove); //XQuery
+
+
+ remove = "";
+ remove = XQUERY_UPDATE_DECLARE +
+ "for $d in
/nmwg:store[@type='"
+ LS_STORE_COLLECTION_TYPE +
+
"']/nmwg:data[@metadataIdRef='"
+ keyValue + "'] return " +
+ XQUERY_UPDATE_DELETE + "$d";
+ xmlStorageManager.fetch(remove); //XQuery
+
} else {

String m = "LSRegisterAction: Can't replace data";
@@ -196,16 +203,14 @@
//change metadata id
requestMetadata.setId(accessPoint);

- //Prepare XUpdate for Metadata
- String updateMeta = "<xu:append
select=\"/nmwg:store[@type='"+LS_STORE_COLLECTION_TYPE+"']\"
child=\"last()\">\n" +
- XMLUtils.serializeXML(requestMetadata) +
- "\n</xu:append>\n";
+ String insert = XQUERY_UPDATE_DECLARE + XQUERY_UPDATE_INSERT;
+ insert = insert + XMLUtils.serializeXML(requestMetadata) + " into
/nmwg:store[@type='"
+
+ LS_STORE_COLLECTION_TYPE + "']";
+ xmlStorageManager.fetch(insert);


- //Prepare XUpdate data
+ //Prepare XQuery data

-
- //create array for data xupdate
String updateData[] = new String[reqDataArr.size()];

//for each datas
@@ -231,43 +236,21 @@
requestData.setId(accessPoint+"/"+currTime+"/"+datanum);
requestData.setMetadataIdRef(accessPoint);

- //Prepare XUpdate for Data
+ //Prepare XQuery for Data
//fill updateData structure

- updateData[datanum] =
- "<xu:append
select=\"/nmwg:store[@type='"+
- LS_STORE_COLLECTION_TYPE+"']\" child=\"last()\">\n" +
- XMLUtils.serializeXML(requestData) +
- "\n</xu:append>\n";
-
- datanum++;
-
+ String insert2 = XQUERY_UPDATE_DECLARE + XQUERY_UPDATE_INSERT;
+ insert2 = insert2 + XMLUtils.serializeXML(requestData) + " into
/nmwg:store[@type='"
+
+ LS_STORE_COLLECTION_TYPE + "']";
+ xmlStorageManager.fetch(insert2);
+
+ datanum++;
}

//if no errors and exceptions reported/thrown, put metadata and
data into DB

-
- StringBuffer update=new StringBuffer(XUPDATE_HEADER);
-
- //remove old data (if necessary)
- if (removeUpdate!=null) {
- update.append(removeUpdate);
- }
-
- //put metadata
- update.append(updateMeta);
-
logger.debug("LSRegisterAction: "+((removeUpdate!=null)?"remove old
entries":"")+", insert metadata and ["+updateData.length+"] data elements");

- for (int i=0; i<updateData.length; i++) {
- update.append(updateData[i]);
- }
- update.append(XUPDATE_FOOTER);
-
- //XUpdate
- xmlStorageManager.store(update.toString());
-
-
//update control time - last modification
updateTime(keyValue, xmlStorageManager); //TODO: change
xmlStorageManager to LSstorage-control




  • r1630 - in branches/yi-udel/perfsonar/src/org/perfsonar: commons/auxiliary/components/scheduler/actions service/commons/storage service/commons/storage/xmldb/exist/rest service/commons/storage/xmldb/exist/xmlrpc service/commons/storage/xmlfile service/lookupService/xmlType, svnlog, 09/12/2006

Archive powered by MHonArc 2.6.16.

Top of Page