Skip to Content.
Sympa Menu

perfsonar-dev - r1721 - in branches/yi-udel/perfsonar/src/org/perfsonar/service: commons/storage/xmldb/bdbxml lookupService/xmlType

Subject: perfsonar development work

List archive

r1721 - in branches/yi-udel/perfsonar/src/org/perfsonar/service: commons/storage/xmldb/bdbxml lookupService/xmlType


Chronological Thread 
  • From:
  • To:
  • Subject: r1721 - in branches/yi-udel/perfsonar/src/org/perfsonar/service: commons/storage/xmldb/bdbxml lookupService/xmlType
  • Date: Fri, 27 Oct 2006 15:20:26 -0400

Author: yi
Date: 2006-10-27 15:20:23 -0400 (Fri, 27 Oct 2006)
New Revision: 1721

Modified:

branches/yi-udel/perfsonar/src/org/perfsonar/service/commons/storage/xmldb/bdbxml/BerkeleyDbXmlStorageManager.java

branches/yi-udel/perfsonar/src/org/perfsonar/service/lookupService/xmlType/LSCleanup.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:


Modified:
branches/yi-udel/perfsonar/src/org/perfsonar/service/commons/storage/xmldb/bdbxml/BerkeleyDbXmlStorageManager.java
===================================================================
---
branches/yi-udel/perfsonar/src/org/perfsonar/service/commons/storage/xmldb/bdbxml/BerkeleyDbXmlStorageManager.java
2006-10-27 18:22:13 UTC (rev 1720)
+++
branches/yi-udel/perfsonar/src/org/perfsonar/service/commons/storage/xmldb/bdbxml/BerkeleyDbXmlStorageManager.java
2006-10-27 19:20:23 UTC (rev 1721)
@@ -57,7 +57,7 @@
public String getType() { return "Berkeley DB XML"; }
public void setType(String type) {}
public void initStorage(DataRepository dataRepository) {}
-
+ public Object store(Object dataSet) {return null;}
//-----------------------------------------------------------------------

// debug

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-10-27 18:22:13 UTC (rev 1720)
+++
branches/yi-udel/perfsonar/src/org/perfsonar/service/lookupService/xmlType/LSCleanup.java
2006-10-27 19:20:23 UTC (rev 1721)
@@ -202,19 +202,14 @@
throws SystemException, RequestException, DataFormatException {


- String query =
- "declare namespace nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\";; " +
-
"data(/nmwg:store[@type='"
+ LS_STORE_COLLECTION_TYPE + "' or @type='" +
- LS_CACHE_COLLECTION_TYPE + "']/nmwg:metadata/@id)";
+ String query;

- XmlDbResult edbres = (XmlDbResult)xmlStorageManager.fetch(query);
- String[] res = (String[])edbres.getResultAsStringArray();
-
if (xmlStorageManager instanceof ExistDbXmlrpcXmlStorageManager)
{
query =
- "declare namespace
nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\";; " +
-
"data(/nmwg:store[@type='"+LS_STORE_COLLECTION_TYPE+"']/nmwg:metadata/@id)";
+ "declare namespace
nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\";; " +
+
"data(/nmwg:store[@type='"
+ LS_STORE_COLLECTION_TYPE + "' or @type='" +
+ LS_CACHE_COLLECTION_TYPE + "']/nmwg:metadata/@id)";
XmlDbResult edbres =
(XmlDbResult)xmlStorageManager.fetch(query);
String[] res = (String[])edbres.getResultAsStringArray();
return res;

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-10-27 18:22:13 UTC (rev 1720)
+++
branches/yi-udel/perfsonar/src/org/perfsonar/service/lookupService/xmlType/LSGenericRegisterAction.java
2006-10-27 19:20:23 UTC (rev 1721)
@@ -114,12 +114,6 @@
else
throw new SystemException("error.common.storage.xmldb.query",
"No database exists");

-
- String query = "declare namespace
nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\";; " +
-
"data(/nmwg:store[@type='"
+ LS_STORE_CONTROL_COLLECTION_TYPE +
"']/nmwg:metadata[@id='"+key+"']/@id)";
-
- XmlDbResult res = (XmlDbResult)xmlStorageManager.fetch(query);
-
int resnum = res.getCount();

//metadata empty -> remove it
@@ -186,13 +180,7 @@
}
else
throw new SystemException("error.common.storage.xmldb.query",
"No database exists");
-

- query = "declare namespace
nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\";; " +
-
"data(/nmwg:store[@type='"
+ LS_STORE_CONTROL_COLLECTION_TYPE +
"']/nmwg:metadata[@id='"+key+"']/@id)";
-
- XmlDbResult res = (XmlDbResult)xmlStorageManager.fetch(query);
-
resnum = res.getCount();

//if there is no control metadata, put it
@@ -244,7 +232,7 @@
if (xmlStorageManager instanceof
ExistDbXmlrpcXmlStorageManager)
{
String insert = XQUERY_UPDATE_DECLARE +
XQUERY_UPDATE_INSERT;
- insert = insert + " <nmwg:parameters
id=\"control-parameters\">\n" +
+ insert = insert + " <nmwg:parameters
id=\"control-parameters\" xmlns:nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\";>\n"
+
" </nmwg:parameters>\n
into
/nmwg:store[@type='"
+
LS_STORE_CONTROL_COLLECTION_TYPE +
"']/nmwg:metadata[@id='"
+ key + "']";
xmlStorageManager.fetch(insert);
@@ -252,7 +240,7 @@
else if (xmlStorageManager instanceof
BerkeleyDbXmlStorageManager)
{
String xPath =
"/nmwg:metadata[@id='"
+ key + "']";
- String insertData = "<nmwg:parameters
id=\"control-parameters\">\n" +
+ String insertData = "<nmwg:parameters
id=\"control-parameters\" xmlns:nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\";>\n"
+

"</nmwg:parameters>\n";

((BerkeleyDbXmlStorageManager)xmlStorageManager).insert(LS_STORE_CONTROL_CONTAINER,
XQUERY_UPDATE_DECLARE, xPath, insertData);
}
@@ -274,14 +262,7 @@
}
else
throw new SystemException("error.common.storage.xmldb.query",
"No database exists");
-

- query = "declare namespace
nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\";; " +
-
"/nmwg:store[@type='"
+ LS_STORE_CONTROL_COLLECTION_TYPE +
"']/nmwg:metadata[@id='"+key+
-
"']/nmwg:parameters/nmwg:parameter[@name='"+parameterName+"']";
-
- res = (XmlDbResult)xmlStorageManager.fetch(query);
-
resnum = res.getCount();

if (resnum==0) {
@@ -348,7 +329,8 @@
{
query =
"declare namespace
nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\";; " +
-
"data(/nmwg:store[@type='"+LS_STORE_COLLECTION_TYPE+"']/nmwg:metadata[@id='"+key+"']/@id)";

+
"data(/nmwg:store[@type='"+
LS_STORE_COLLECTION_TYPE + "' or @type='" +
+ LS_CACHE_COLLECTION_TYPE +
"']/nmwg:metadata[@id='"+key+"']/@id)";

res = (XmlDbResult)xmlStorageManager.fetch(query);
}
else if (xmlStorageManager instanceof
BerkeleyDbXmlStorageManager)
@@ -360,11 +342,6 @@
else
throw new
SystemException("error.common.storage.xmldb.query", "No database exists");

- String query =
- "declare namespace
nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\";; " +
-
"data(/nmwg:store[@type='"+
LS_STORE_COLLECTION_TYPE + "' or @type='" +
- LS_CACHE_COLLECTION_TYPE +
"']/nmwg:metadata[@id='"+key+"']/@id)";

-
int resnum = res.getCount();

if (resnum>0)

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-10-27 18:22:13 UTC (rev 1720)
+++
branches/yi-udel/perfsonar/src/org/perfsonar/service/lookupService/xmlType/LSRegisterAction.java
2006-10-27 19:20:23 UTC (rev 1721)
@@ -178,140 +178,140 @@



-// update peer list (local vs global check) ...
- if(summaryParam != null) {
- logger.debug("LSRegisterAction: LS register - we need to update
the '" +
- summaryParam.getParameterValue() + "' peers list
...");
- org.ggf.ns.nmwg.base.v2_0.Parameter sumParam = null;
- if(request.getParameters() != null) {
- sumParam = request.getParameters().getParameterByName("summary");
- if(sumParam != null) {
- if(sumParam.getParameterValue().equals("local")) {
- lsTokenUtil.addToPeerList(xmlStorageManager,
requestMetadata, "local");
- }
- else if(sumParam.getParameterValue().equals("global")) {
- lsTokenUtil.addToPeerList(xmlStorageManager,
requestMetadata, "global");
-
+//// update peer list (local vs global check) ...
+// if(summaryParam != null) {
+// logger.debug("LSRegisterAction: LS register - we need to update
the '" +
+// summaryParam.getParameterValue() + "' peers list
...");
+// org.ggf.ns.nmwg.base.v2_0.Parameter sumParam = null;
+// if(request.getParameters() != null) {
+// sumParam =
request.getParameters().getParameterByName("summary");
+// if(sumParam != null) {
+// if(sumParam.getParameterValue().equals("local")) {
+// lsTokenUtil.addToPeerList(xmlStorageManager,
requestMetadata, "local");
+// }
+// else if(sumParam.getParameterValue().equals("global")) {
+// lsTokenUtil.addToPeerList(xmlStorageManager,
requestMetadata, "global");
+//
+//
+// //we need to 'back up' the stuff from global guys
+//
+// //get the contents of LSLocalPeers
+// String query = XQUERY_UPDATE_DECLARE +
"//nmwg:store[@type='"
+ LS_LOCAL_PEER_COLLECTION_TYPE + "']";
+// String[] results = lsUtil.getDBContents(xmlStorageManager,
query);
+//
+// if(results[0].equals("")) {
+// String m = "LSLocalTokenAction: " +
+// "Peer List is empty; please populate it with at
least one peer.";
+// logger.error(m);
+// throw new SystemException("error.ls.peer_list_empty", m);

+// }
+//
+// Store result = (Store)XMLUtils.stringToElement(results[0],
lsUtil.getParserFile(), "store");
+//
+// Collection metadataCol = null;
+// metadataCol = result.getMetadataMap().values();
+// if(metadataCol.size() < 1) {
+// String m = "LSLocalTokenAction: " +
+// "Peer List is empty; please populate it with at
least one peer.";
+// logger.error(m);
+// throw new SystemException("error.ls.peer_list_empty", m);
+// }
+// String[][] sortedList = null;
+// sortedList = lsTokenUtil.formPeerArray(metadataCol);
+//
+// //create a 'special' global summary message (one that
won't be
+// // propagated by the other peers
+//
+// //setup the parameters for the message (indicating it is a
summary)
+// org.ggf.ns.nmwg.base.v2_0.Parameters reqParams = new
org.ggf.ns.nmwg.base.v2_0.Parameters();
+// reqParams = lsUtil.createSummaryParameters(reqParams,
"summary", "global-backup");
+//
+// //put them in a message, then insert
+// org.ggf.ns.nmwg.base.v2_0.Message registerMessage = new
Message();
+// registerMessage.setType("LSRegisterRequest");
+// registerMessage.addChild(requestMetadata);
+// Iterator reqDataArrIterator = reqDataArr.iterator();
+// while (reqDataArrIterator.hasNext()) {
+// registerMessage.addChild((Data)reqDataArrIterator.next());

+// }
+// registerMessage.addChild(reqParams);
+//
+//
+// //now try to send the message to people
+// int counter = 0;
+// for(int b = 0; b < metadataCol.size(); b++) {
+//
+// logger.debug("LSRegisterAction: Sending message to: " +
sortedList[b][0] + " - " + sortedList[b][1]);
+// try {
+// org.ggf.ns.nmwg.base.v2_0.Message response =
lsTokenUtil.sendRequest(sortedList[b][0], registerMessage);
+// if(response != null) {
+// //check to see if we succeeded:
+//
+// org.ggf.ns.nmwg.base.v2_0.Metadata
requestMetadata2[] = response.getMetadataArray();
+// if(requestMetadata2.length > 0){
+//
+// logger.debug("LSRegisterAction: response: " +
requestMetadata2[0].toString());
+//
if((requestMetadata2[0].getEventType().getEventType()).equals("result.success"))
{
+// if(Integer.parseInt(sortedList[b][1]) < 3) {
+// //update the peers list
+// String update = XQUERY_UPDATE_DECLARE +
XQUERY_UPDATE_VALUE;
+//
+// update = update +
"/nmwg:store[@type='"
+ LS_LOCAL_PEER_COLLECTION_TYPE +
+//
"']//nmwg:parameters[@id='"
+ sortedList[b][0] + "']/nmwg:parameter" +
+//
"[@name='familiar']
with '" + (int)((Integer.parseInt(sortedList[b][1]))+1) + "'";
+//
+// xmlStorageManager.fetch(update);
+// sortedList[b][1] =
Integer.toString(Integer.parseInt(sortedList[b][1]) + 1);
+// counter++;
+// }
+// }
+// else {
+// logger.debug("LSRegisterAction: Success Code from
peer not found");
+// }
+// }
+// else {
+// logger.debug("LSRegisterAction: No metadata in peer
response");
+// }
+// }
+// else {
+// logger.debug("LSRegisterAction: Null response when
talking to peer");
+// if(Integer.parseInt(sortedList[b][1]) > 0) {
+// //update the peers list
+// String update = XQUERY_UPDATE_DECLARE +
XQUERY_UPDATE_VALUE;
+//
+// update = update +
"/nmwg:store[@type='"
+ LS_LOCAL_PEER_COLLECTION_TYPE +
+//
"']//nmwg:parameters[@id='"
+ sortedList[b][0] + "']/nmwg:parameter" +
+//
"[@name='familiar']
with '" + (int)(Integer.parseInt(sortedList[b][1])-1) + "'";
+//
+// xmlStorageManager.fetch(update);
+// sortedList[b][1] =
Integer.toString(Integer.parseInt(sortedList[b][1])-1);
+// }
+// }
+// }
+// catch(Exception e) {
+// logger.debug("LSRegisterAction: Exception: " +
e.toString());
+// throw new SystemException("error.ls.client_error",
+// "Error sending to client LS " +
+// e.getMessage());
+// }
+// if(counter >= 2) {
+// b = metadataCol.size() + 1;
+// }
+// }
+//
+//
+//
+//
+//
+// }
+// else
if(sumParam.getParameterValue().equals("global-backup")) {
+// lsTokenUtil.addToPeerList(xmlStorageManager,
requestMetadata, "global");
+// }
+// }
+// }
+// }

-//we need to 'back up' the stuff from global guys

- //get the contents of LSLocalPeers
- String query = XQUERY_UPDATE_DECLARE +
"//nmwg:store[@type='"
+ LS_LOCAL_PEER_COLLECTION_TYPE + "']";
- String[] results = lsUtil.getDBContents(xmlStorageManager,
query);
-
- if(results[0].equals("")) {
- String m = "LSLocalTokenAction: " +
- "Peer List is empty; please populate it with at
least one peer.";
- logger.error(m);
- throw new SystemException("error.ls.peer_list_empty", m);

- }
-
- Store result = (Store)XMLUtils.stringToElement(results[0],
lsUtil.getParserFile(), "store");
-
- Collection metadataCol = null;
- metadataCol = result.getMetadataMap().values();
- if(metadataCol.size() < 1) {
- String m = "LSLocalTokenAction: " +
- "Peer List is empty; please populate it with at
least one peer.";
- logger.error(m);
- throw new SystemException("error.ls.peer_list_empty", m);
- }
- String[][] sortedList = null;
- sortedList = lsTokenUtil.formPeerArray(metadataCol);
-
-//create a 'special' global summary message (one that won't be
-// propagated by the other peers
-
- //setup the parameters for the message (indicating it is a
summary)
- org.ggf.ns.nmwg.base.v2_0.Parameters reqParams = new
org.ggf.ns.nmwg.base.v2_0.Parameters();
- reqParams = lsUtil.createSummaryParameters(reqParams,
"summary", "global-backup");
-
- //put them in a message, then insert
- org.ggf.ns.nmwg.base.v2_0.Message registerMessage = new
Message();
- registerMessage.setType("LSRegisterRequest");
- registerMessage.addChild(requestMetadata);
- Iterator reqDataArrIterator = reqDataArr.iterator();
- while (reqDataArrIterator.hasNext()) {
- registerMessage.addChild((Data)reqDataArrIterator.next());

- }
- registerMessage.addChild(reqParams);
-
-
- //now try to send the message to people
- int counter = 0;
- for(int b = 0; b < metadataCol.size(); b++) {
-
- logger.debug("LSRegisterAction: Sending message to: " +
sortedList[b][0] + " - " + sortedList[b][1]);
- try {
- org.ggf.ns.nmwg.base.v2_0.Message response =
lsTokenUtil.sendRequest(sortedList[b][0], registerMessage);
- if(response != null) {
- //check to see if we succeeded:
-
- org.ggf.ns.nmwg.base.v2_0.Metadata requestMetadata2[]
= response.getMetadataArray();
- if(requestMetadata2.length > 0){
-
- logger.debug("LSRegisterAction: response: " +
requestMetadata2[0].toString());
-
if((requestMetadata2[0].getEventType().getEventType()).equals("result.success"))
{
- if(Integer.parseInt(sortedList[b][1]) < 3) {
- //update the peers list
- String update = XQUERY_UPDATE_DECLARE +
XQUERY_UPDATE_VALUE;
-
- update = update +
"/nmwg:store[@type='"
+ LS_LOCAL_PEER_COLLECTION_TYPE +
-
"']//nmwg:parameters[@id='"
+ sortedList[b][0] + "']/nmwg:parameter" +
-
"[@name='familiar']
with '" + (int)((Integer.parseInt(sortedList[b][1]))+1) + "'";
-
- xmlStorageManager.fetch(update);
- sortedList[b][1] =
Integer.toString(Integer.parseInt(sortedList[b][1]) + 1);
- counter++;
- }
- }
- else {
- logger.debug("LSRegisterAction: Success Code from
peer not found");
- }
- }
- else {
- logger.debug("LSRegisterAction: No metadata in peer
response");
- }
- }
- else {
- logger.debug("LSRegisterAction: Null response when
talking to peer");
- if(Integer.parseInt(sortedList[b][1]) > 0) {
- //update the peers list
- String update = XQUERY_UPDATE_DECLARE +
XQUERY_UPDATE_VALUE;
-
- update = update +
"/nmwg:store[@type='"
+ LS_LOCAL_PEER_COLLECTION_TYPE +
-
"']//nmwg:parameters[@id='"
+ sortedList[b][0] + "']/nmwg:parameter" +
-
"[@name='familiar']
with '" + (int)(Integer.parseInt(sortedList[b][1])-1) + "'";
-
- xmlStorageManager.fetch(update);
- sortedList[b][1] =
Integer.toString(Integer.parseInt(sortedList[b][1])-1);
- }
- }
- }
- catch(Exception e) {
- logger.debug("LSRegisterAction: Exception: " +
e.toString());
- throw new SystemException("error.ls.client_error",
- "Error sending to client LS " +
- e.getMessage());
- }
- if(counter >= 2) {
- b = metadataCol.size() + 1;
- }
- }
-
-
-
-
-
- }
- else if(sumParam.getParameterValue().equals("global-backup")) {
- lsTokenUtil.addToPeerList(xmlStorageManager,
requestMetadata, "global");
- }
- }
- }
- }
-
-






  • r1721 - in branches/yi-udel/perfsonar/src/org/perfsonar/service: commons/storage/xmldb/bdbxml lookupService/xmlType, svnlog, 10/27/2006

Archive powered by MHonArc 2.6.16.

Top of Page