perfsonar-dev - [GEANT/SA2/ps-java-services] r5586 - trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice
Subject: perfsonar development work
List archive
[GEANT/SA2/ps-java-services] r5586 - trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice
Chronological Thread
- From:
- To:
- Subject: [GEANT/SA2/ps-java-services] r5586 - trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice
- Date: Wed, 7 Apr 2010 15:08:29 +0100
Author: psnc.trzaszczka
Date: 2010-04-07 15:08:29 +0100 (Wed, 07 Apr 2010)
New Revision: 5586
Modified:
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/DiscoveryQueryGenerator.java
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/GenericLSServiceEngine.java
Log:
DiscoveryRequest processing improved
Modified:
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/DiscoveryQueryGenerator.java
===================================================================
---
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/DiscoveryQueryGenerator.java
2010-04-07 13:44:56 UTC (rev 5585)
+++
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/DiscoveryQueryGenerator.java
2010-04-07 14:08:29 UTC (rev 5586)
@@ -126,19 +126,21 @@
extractSubject();
}
- StringBuffer q = new StringBuffer();
-
- // add declarations
- q
- .append("declare namespace
nmwg='http://ggf.org/ns/nmwg/base/2.0/'; \n");
- q
- .append("declare namespace
nmwgt='http://ggf.org/ns/nmwg/topology/2.0/'; \n");
-
- // add for expression
- q.append("for $d in
/nmwg:store[@type='LSStore']/nmwg:data
\n");
+
if (!ipAddresses.isEmpty() || !domains.isEmpty() ||
!keywords.isEmpty()
|| !eventTypes.isEmpty()) {
+ StringBuffer q = new StringBuffer();
+
+ // add declarations
+ q
+ .append("declare namespace
nmwg='http://ggf.org/ns/nmwg/base/2.0/'; \n");
+ q
+ .append("declare namespace
nmwgt='http://ggf.org/ns/nmwg/topology/2.0/'; \n");
+
+ // add for expression
+ q.append("for $d in
/nmwg:store[@type='LSStore']/nmwg:data
\n");
+
// generate query conditions
q.append("where \n");
@@ -152,14 +154,17 @@
i += putCollectionToQueryBuffer(q, keywords,
"$d/nmwg:metadata//nmwg:parameter[@name='keyword']",
(i > 0), null);
+
+ q.append("return data($d/@metadataIdRef)");
+ query = q.toString();
+ //add return statemet
+
+ return query;
+
+ }else{
+ throw new PerfSONARException("error.ls.query","Lack
of specified subject elements(ip,domain,eventType,keyword)");
}
- // add return statemet
- q.append("return data($d/@metadataIdRef)");
-
- query = q.toString();
- return query;
-
}
/**
Modified:
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/GenericLSServiceEngine.java
===================================================================
---
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/GenericLSServiceEngine.java
2010-04-07 13:44:56 UTC (rev 5585)
+++
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/GenericLSServiceEngine.java
2010-04-07 14:08:29 UTC (rev 5586)
@@ -89,7 +89,7 @@
*/
public String getParameterFromKey(Metadata requestMetadata,
String parameterName) {
- if (requestMetadata.getChildren("key") == null) {
+ if
(requestMetadata.getChildren("key","http://ggf.org/ns/nmwg/base/2.0/") ==
null) {
return null;
}
for (Element key : requestMetadata.getChildren("key")) {
- [GEANT/SA2/ps-java-services] r5586 - trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice, svn-noreply, 04/07/2010
Archive powered by MHonArc 2.6.16.