perfsonar-dev - perfsonar: r3282 - in trunk/perfsonar_base: . src/main/java/org/perfsonar/service/base/engine src/main/java/org/perfsonar/service/base/messages src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator
Subject: perfsonar development work
List archive
perfsonar: r3282 - in trunk/perfsonar_base: . src/main/java/org/perfsonar/service/base/engine src/main/java/org/perfsonar/service/base/messages src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator
Chronological Thread
- From:
- To:
- Subject: perfsonar: r3282 - in trunk/perfsonar_base: . src/main/java/org/perfsonar/service/base/engine src/main/java/org/perfsonar/service/base/messages src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator
- Date: Wed, 30 Jan 2008 20:32:39 -0500
Author: fernandes
Date: 2008-01-30 20:32:38 -0500 (Wed, 30 Jan 2008)
New Revision: 3282
Added:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/MeasurementArchiveStoreKeyRequest.java
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/BwctlQueryGenerator.java
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/PingQueryGenerator.java
Modified:
trunk/perfsonar_base/
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/engine/ActionType.java
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/OwampQueryGenerator.java
Log:
Modifications for SQL-MA to support OWAMP, BWCTL and Ping namespaces.
SQL-MA now has the MeasurementArchiveStoreKeyRequest functionality which
allows dynamic addition of metadatas to the metadata configuration database.
Table creation statements for mysql have been added but are commented out.
Ant targets weren't modified yet.
Property changes on: trunk/perfsonar_base
___________________________________________________________________
Name: svn:ignore
+ .classpath
.project
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/engine/ActionType.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/engine/ActionType.java
2008-01-31 01:28:47 UTC (rev 3281)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/engine/ActionType.java
2008-01-31 01:32:38 UTC (rev 3282)
@@ -39,7 +39,12 @@
public static final String STORE_DATA = "STORE_DATA";
-
+ /**
+ * Action type to store keys
+ */
+ public static final String STORE_KEY = "STORE_KEY";
+
+
// --------------------------------------------- Lookup Service Actions
Added:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/MeasurementArchiveStoreKeyRequest.java
Added:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/BwctlQueryGenerator.java
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/OwampQueryGenerator.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/OwampQueryGenerator.java
2008-01-31 01:28:47 UTC (rev 3281)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/OwampQueryGenerator.java
2008-01-31 01:32:38 UTC (rev 3282)
@@ -1,13 +1,14 @@
package
org.perfsonar.service.measurementArchive.metadataConfig.queryGenerator;
+import java.util.HashMap;
+import java.util.Set;
+
import org.ggf.ns.nmwg.base.v2_0.Message;
import org.ggf.ns.nmwg.base.v2_0.Metadata;
-import org.ggf.ns.nmwg.base.v2_0.Parameter;
import org.ggf.ns.nmwg.base.v2_0.Parameters;
import org.ggf.ns.nmwg.tools.owamp.v2_0.Subject;
import org.ggf.ns.nmwg.topology.v2_0.EndPointPair;
-
import org.perfsonar.base.auxiliary.AuxiliaryComponentManager;
import org.perfsonar.base.auxiliary.ComponentNames;
import org.perfsonar.base.auxiliary.components.logger.LoggerComponent;
@@ -33,8 +34,9 @@
protected LoggerComponent logger = null;
+ private final String[] parameters = { "count", "dscp", "phb",
+ "wait", "endDelay", "timeOut", "padding", "portRange",
"direction" };
-
// -------------------------------------- constructors
@@ -69,7 +71,7 @@
* stored in Message object.
*/
public String getMetadataQuery(Message query)
- throws PerfSONARException, PerfSONARException {
+ throws PerfSONARException {
if (query == null)
@@ -78,10 +80,8 @@
"OwampQueryGenerator.getMetadataQuery: "
+ "Input message is null");
- String metaId = "";
String src = "";
String dst = "";
- String direction = "";
String eventType = "";
Metadata metadata = null;
@@ -99,26 +99,27 @@
+ ex.toString());
}
+ HashMap<String, String> parametersMap = new HashMap<String,String>();
if (metadata != null) {
- metaId = metadata.getId().trim();
eventType = (metadata.getEventType() != null ?
metadata.getEventType().getEventType().trim() : "");
Subject subject = (Subject) metadata.getSubject();
EndPointPair end = subject.getEndPointPair();
Parameters params = metadata.getParameters();
- Parameter paramDirection =
params.getParameterByName("direction");
-
+ for(String parameter : parameters){
+ if(params.getParameterByName(parameter) != null)
+ parametersMap.put(parameter,
+
(params.getParameterByName(parameter).getParameterValue() != null ?
+
params.getParameterByName(parameter).getParameterValue().trim() : ""));
+ }
if (end != null) {
src = (end.getSourceElement() != null ?
end.getSourceElement().getValue().trim() : "");
dst = (end.getDestinationElement() != null ?
end.getDestinationElement().getValue().trim() : "");
}
- if (paramDirection != null)
- direction = (paramDirection.getParameterValue() != null ?
paramDirection.getParameterValue().trim() : "");
-
}
String xQuery = "\n"
@@ -131,9 +132,6 @@
+ " for $i in //nmwg:metadata \n"
+ " where 1
\n";
-
- if (!(metaId.equals("allMetadatas")))
- xQuery += "and $i[(@id='" + metaId + "')]";
if (eventType != "")
xQuery += "and $i/nmwg:eventType[(text()='" + eventType +
"')]";
@@ -143,11 +141,16 @@
if (dst != "")
xQuery += "and
$i/owamp:subject/nmwgt:endPointPair/nmwgt:dst[@value='"
+ dst + "']";
-
- if (direction != "")
- xQuery += "and $i/owamp:parameters/nmwg:parameter[(text()='"
+ direction + "' and @name='direction') "
- + "or (@value='" + direction + "' and
@name='direction')]";
-
+
+ Set<String> keySet = parametersMap.keySet();
+ for(String key : keySet){
+ String v = parametersMap.get(key);
+ if(v.length() > 0){
+ xQuery += "and
$i/owamp:parameters/nmwg:parameter[(text()='" + v + "' and @name='"+key+"') "
+ + "or (@value='" + v + "' and
@name='"+key+"')]";
+ }
+ }
+
xQuery += "\n"
+ " return $i
\n"
+ "
\n"
Added:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/PingQueryGenerator.java
- perfsonar: r3282 - in trunk/perfsonar_base: . src/main/java/org/perfsonar/service/base/engine src/main/java/org/perfsonar/service/base/messages src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator, svnlog, 01/30/2008
Archive powered by MHonArc 2.6.16.