perfsonar-dev - perfsonar: r2437 - in trunk/perfsonar/src/org/perfsonar/service/measurementArchive: rrdType sqlType
Subject: perfsonar development work
List archive
perfsonar: r2437 - in trunk/perfsonar/src/org/perfsonar/service/measurementArchive: rrdType sqlType
Chronological Thread
- From:
- To:
- Subject: perfsonar: r2437 - in trunk/perfsonar/src/org/perfsonar/service/measurementArchive: rrdType sqlType
- Date: Thu, 31 May 2007 07:53:33 -0400
Author: roman
Date: 2007-05-31 07:53:32 -0400 (Thu, 31 May 2007)
New Revision: 2437
Modified:
trunk/perfsonar/src/org/perfsonar/service/measurementArchive/rrdType/RRDStorageManager.java
trunk/perfsonar/src/org/perfsonar/service/measurementArchive/rrdType/RRDTypeMAServiceEngine.java
trunk/perfsonar/src/org/perfsonar/service/measurementArchive/sqlType/SQLStorageManager.java
Log:
SQL MA and RRD MA updated in order to generate keys with parameters elements
of different namespaces
example:
<nmwg:key id="localhost.648d2dab:10c33bffe91:-7fa9">
<select:parameters id="param1"
xmlns:select="http://ggf.org/ns/nmwg/ops/select/2.0/">
<nmwg:parameter name="time">now</nmwg:parameter>
</select:parameters>
<nmwg:parameters id="localhost.648d2dab:10c33bffe91:-7fa8">
<nmwg:parameter
name="eventType">http://ggf.org/ns/nmwg/characteristic/utilization/2.0</nmwg:parameter>
<nmwg:parameter name="metadataId">meta1-test</nmwg:parameter>
<nmwg:parameter
name="ibatisConfig">ibatis-SqlMapConfig-utilization.xml</nmwg:parameter>
</nmwg:parameters>
</nmwg:key>
Modified:
trunk/perfsonar/src/org/perfsonar/service/measurementArchive/rrdType/RRDStorageManager.java
===================================================================
---
trunk/perfsonar/src/org/perfsonar/service/measurementArchive/rrdType/RRDStorageManager.java
2007-05-28 14:41:38 UTC (rev 2436)
+++
trunk/perfsonar/src/org/perfsonar/service/measurementArchive/rrdType/RRDStorageManager.java
2007-05-31 11:53:32 UTC (rev 2437)
@@ -316,20 +316,23 @@
Metadata md = (Metadata) it.next();
Key key = md.getKey();
- Parameter startTime =
key.getParameterByName("startTime");
- Parameter endTime =
key.getParameterByName("endTime");
- Parameter consolidationFunction =
key.getParameterByName("consolidationFunction");
- Parameter resolution =
key.getParameterByName("resolution");
- Parameter file = key.getParameterByName("file");
- Parameter dataSource =
key.getParameterByName("dataSource");
- Parameter valueUnits =
key.getParameterByName("valueUnits");
+ //select parameter elements
+ Parameter startTime =
key.getParameterByName("http://ggf.org/ns/nmwg/ops/select/2.0/", "startTime");
+ Parameter endTime =
key.getParameterByName("http://ggf.org/ns/nmwg/ops/select/2.0/", "endTime");
+ Parameter consolidationFunction =
key.getParameterByName("http://ggf.org/ns/nmwg/ops/select/2.0/",
"consolidationFunction");
+ Parameter resolution =
key.getParameterByName("http://ggf.org/ns/nmwg/ops/select/2.0/",
"resolution");
- Parameter dataSourceStep =
key.getParameterByName("dataSourceStep");
- Parameter dataSourceType =
key.getParameterByName("dataSourceType");
- Parameter dataSourceHeartbeat =
key.getParameterByName("dataSourceHeartbeat");
- Parameter dataSourceMinValue =
key.getParameterByName("dataSourceMinValue");
- Parameter dataSourceMaxValue =
key.getParameterByName("dataSourceMaxValue");
+ //nmwg parameter elements
+ Parameter file =
key.getParameterByName("http://ggf.org/ns/nmwg/base/2.0/", "file");
+ Parameter dataSource =
key.getParameterByName("http://ggf.org/ns/nmwg/base/2.0/", "dataSource");
+ Parameter valueUnits =
key.getParameterByName("http://ggf.org/ns/nmwg/base/2.0/", "valueUnits");
+ Parameter dataSourceStep =
key.getParameterByName("http://ggf.org/ns/nmwg/base/2.0/", "dataSourceStep");
+ Parameter dataSourceType =
key.getParameterByName("http://ggf.org/ns/nmwg/base/2.0/", "dataSourceType");
+ Parameter dataSourceHeartbeat =
key.getParameterByName("http://ggf.org/ns/nmwg/base/2.0/",
"dataSourceHeartbeat");
+ Parameter dataSourceMinValue =
key.getParameterByName("http://ggf.org/ns/nmwg/base/2.0/",
"dataSourceMinValue");
+ Parameter dataSourceMaxValue =
key.getParameterByName("http://ggf.org/ns/nmwg/base/2.0/",
"dataSourceMaxValue");
+
// ---------------
String _startTime = null;
Modified:
trunk/perfsonar/src/org/perfsonar/service/measurementArchive/rrdType/RRDTypeMAServiceEngine.java
===================================================================
---
trunk/perfsonar/src/org/perfsonar/service/measurementArchive/rrdType/RRDTypeMAServiceEngine.java
2007-05-28 14:41:38 UTC (rev 2436)
+++
trunk/perfsonar/src/org/perfsonar/service/measurementArchive/rrdType/RRDTypeMAServiceEngine.java
2007-05-31 11:53:32 UTC (rev 2437)
@@ -431,13 +431,12 @@
for (Object d : message.getDataMap().values()) {
- if (((Data)d).getKey() != null) {
+ Key key = null;
+ if ((key = ((Data)d).getKey()) != null) {
- Key k = ((Data)d).getKey();
+ key = ((Data)d).getKey();
+ key.setParameters(params);
- for (Object p : params.getParameterMap().values())
- k.addParameter((Parameter)p);
-
}
}
@@ -446,14 +445,10 @@
} else {
- if (metadata.getKey() != null) {
+ Key key = null;
- Key k = metadata.getKey();
- Key key2 = new Key();
+ if ((key = metadata.getKey()) != null) {
- Parameter[] params = k.getParameters().getParameterArray();
- for (int i = 0; i < params.length; i++)
- key2.addParameter(params[i]);
if (data == null) {
@@ -463,7 +458,7 @@
// this new metadata is created to not corrupt
// already existed id
Metadata metadata2 = new Metadata();
- metadata2.setKey(key2);
+ metadata2.setKey(key);
//long seed = (new Date()).getTime();
//int intId = (new Random(seed)).nextInt();
@@ -476,7 +471,7 @@
}
- data.addChild(key2);
+ data.addChild(key);
}
Modified:
trunk/perfsonar/src/org/perfsonar/service/measurementArchive/sqlType/SQLStorageManager.java
===================================================================
---
trunk/perfsonar/src/org/perfsonar/service/measurementArchive/sqlType/SQLStorageManager.java
2007-05-28 14:41:38 UTC (rev 2436)
+++
trunk/perfsonar/src/org/perfsonar/service/measurementArchive/sqlType/SQLStorageManager.java
2007-05-31 11:53:32 UTC (rev 2437)
@@ -116,54 +116,59 @@
for (Metadata md : collection) {
Key key = md.getKey();
- Parameters params = key.getParameters();
- Parameter[] paramsArray = params.getParameterArray();
- Map ibatisParams = new HashMap();
+ Map ibatisParams = new HashMap();
- for (int i = 0; i < paramsArray.length; i++) {
+ Map parametersMap = key.getParametersMap();
+ for (Object o : parametersMap.values()) {
- Parameter p = paramsArray[i];
- String pname = p.getParameterName();
- //String pvalue = p.getParameterValue();
- String pvalue = "";
+ Parameters params = (Parameters) o;
+ Parameter[] paramsArray = params.getParameterArray();
+
+ for (int i = 0; i < paramsArray.length; i++) {
- //logger.debug("SQLStorageManager.fetch: param [name,
value]: ["
- // + pname + ", " + pvalue + "]");
+ Parameter p = paramsArray[i];
+ String pname = p.getParameterName();
+ //String pvalue = p.getParameterValue();
+ String pvalue = "";
- if (pname.equals("startTime")) {
- long startTime = 0;
- pvalue = TimeDateUtil.getUnixTime(p);
- try {
- startTime = Long.parseLong(pvalue);
- } catch (NumberFormatException nfex) {
- throw new PerfSONARException(
- "error.ma.query",
- "SQLStorageManager.fetch: "
- + "startTime parameter in the request "
- + "has wrong format");
- }
- ibatisParams.put(pname, startTime);
+ //logger.debug("SQLStorageManager.fetch: param [name,
value]: ["
+ // + pname + ", " + pvalue + "]");
- } else if (pname.equals("endTime")) {
- long endTime = 0;
- pvalue = TimeDateUtil.getUnixTime(p);
- try {
- endTime = Long.parseLong(pvalue);
- } catch (NumberFormatException nfex) {
- throw new PerfSONARException(
- "error.ma.query",
- "SQLStorageManager.fetch: "
- + "endTime parameter in the request "
- + "has wrong format");
- }
- ibatisParams.put(pname, endTime);
+ if (pname.equals("startTime")) {
+ long startTime = 0;
+ pvalue = TimeDateUtil.getUnixTime(p);
+ try {
+ startTime = Long.parseLong(pvalue);
+ } catch (NumberFormatException nfex) {
+ throw new PerfSONARException(
+ "error.ma.query",
+
"SQLStorageManager.fetch: "
+ + "startTime
parameter in the request "
+ + "has wrong format");
+ }
+ ibatisParams.put(pname, startTime);
- } else {
- pvalue = p.getParameterValue();
- ibatisParams.put(pname, pvalue);
- }
+ } else if (pname.equals("endTime")) {
+ long endTime = 0;
+ pvalue = TimeDateUtil.getUnixTime(p);
+ try {
+ endTime = Long.parseLong(pvalue);
+ } catch (NumberFormatException nfex) {
+ throw new PerfSONARException(
+ "error.ma.query",
+
"SQLStorageManager.fetch: "
+ + "endTime parameter
in the request "
+ + "has wrong format");
+ }
+ ibatisParams.put(pname, endTime);
+ } else {
+ pvalue = p.getParameterValue();
+ ibatisParams.put(pname, pvalue);
+ }
+
+ }
}
Data data = null;
- perfsonar: r2437 - in trunk/perfsonar/src/org/perfsonar/service/measurementArchive: rrdType sqlType, svnlog, 05/31/2007
Archive powered by MHonArc 2.6.16.