perfsonar-dev - perfsonar: r2359 - in trunk/perfsonar/src/org/perfsonar: commons/util service/measurementArchive/rrdType service/measurementArchive/sqlType
Subject: perfsonar development work
List archive
perfsonar: r2359 - in trunk/perfsonar/src/org/perfsonar: commons/util service/measurementArchive/rrdType service/measurementArchive/sqlType
Chronological Thread
- From:
- To:
- Subject: perfsonar: r2359 - in trunk/perfsonar/src/org/perfsonar: commons/util service/measurementArchive/rrdType service/measurementArchive/sqlType
- Date: Thu, 26 Apr 2007 06:35:27 -0400
Author: roman
Date: 2007-04-26 06:35:26 -0400 (Thu, 26 Apr 2007)
New Revision: 2359
Modified:
trunk/perfsonar/src/org/perfsonar/commons/util/TimeDateUtil.java
trunk/perfsonar/src/org/perfsonar/service/measurementArchive/rrdType/RRDStorageManager.java
trunk/perfsonar/src/org/perfsonar/service/measurementArchive/sqlType/SQLStorageManager.java
Log:
- support of iso time type in RRD MA improved
- support of iso time type in SQL MA added
Modified: trunk/perfsonar/src/org/perfsonar/commons/util/TimeDateUtil.java
===================================================================
--- trunk/perfsonar/src/org/perfsonar/commons/util/TimeDateUtil.java
2007-04-25 14:09:48 UTC (rev 2358)
+++ trunk/perfsonar/src/org/perfsonar/commons/util/TimeDateUtil.java
2007-04-26 10:35:26 UTC (rev 2359)
@@ -54,6 +54,23 @@
public static String getUnixTime(Parameter timeParemeter)
throws DataFormatException {
+ if (timeParemeter == null)
+ throw new DataFormatException(
+ "error.parameter",
+ "TimeDateUtil.getUnixTime: parameter is null");
+
+ String unixTime = _getUnixTime(timeParemeter);
+ if (unixTime == null)
+ unixTime = timeParemeter.getParameterValue();
+
+ return unixTime;
+
+ }
+
+
+ protected static String _getUnixTime(Parameter timeParemeter)
+ throws DataFormatException {
+
Vector pchildren = timeParemeter.getChildrenByType("time");
Element subelement = null;
try {
@@ -67,8 +84,8 @@
if (!subelement.getLocalName().equals("time"))
throw new DataFormatException(
- "error.ma.query",
- "TimeDateUtil.getUnixTime: wrong type of parameter; "
+ "error.parameter",
+ "TimeDateUtil._getUnixTime: wrong type of parameter; "
+ "it should be time type");
Time time = (Time) subelement;
@@ -89,16 +106,16 @@
} catch (Exception ex) {
throw new DataFormatException(
- "error.ma.query",
- "TimeDateUtil.getUnixTime: ISO time coversion is
wrong; "
+ "error.parameter",
+ "TimeDateUtil._getUnixTime: ISO time coversion is
wrong; "
+ ex.toString());
}
} else {
throw new DataFormatException(
- "error.ma.query",
- "TimeDateUtil.getUnixTime: "
+ "error.parameter",
+ "TimeDateUtil._getUnixTime: "
+ "Time type " + time.getType() + "is not supported");
}
Modified:
trunk/perfsonar/src/org/perfsonar/service/measurementArchive/rrdType/RRDStorageManager.java
===================================================================
---
trunk/perfsonar/src/org/perfsonar/service/measurementArchive/rrdType/RRDStorageManager.java
2007-04-25 14:09:48 UTC (rev 2358)
+++
trunk/perfsonar/src/org/perfsonar/service/measurementArchive/rrdType/RRDStorageManager.java
2007-04-26 10:35:26 UTC (rev 2359)
@@ -340,10 +340,6 @@
try {
_startTime = TimeDateUtil.getUnixTime(startTime);
- if (_startTime == null)
- //defaultly unix time is used in the request
- //if time element in parameter is missing
- _startTime = startTime.getParameterValue();
} catch (DataFormatException dfex) {
throw new DataFormatException(dfex.getResultCode(),
dfex.getMessage());
} catch (Exception ex) {
@@ -352,10 +348,6 @@
try {
_endTime = TimeDateUtil.getUnixTime(endTime);
- if (_endTime == null)
- //defaultly unix time is used in the request
- //if time element in parameter is missing
- _endTime = endTime.getParameterValue();
} catch (DataFormatException dfex) {
throw new DataFormatException(dfex.getResultCode(),
dfex.getMessage());
} catch (Exception ex) {
Modified:
trunk/perfsonar/src/org/perfsonar/service/measurementArchive/sqlType/SQLStorageManager.java
===================================================================
---
trunk/perfsonar/src/org/perfsonar/service/measurementArchive/sqlType/SQLStorageManager.java
2007-04-25 14:09:48 UTC (rev 2358)
+++
trunk/perfsonar/src/org/perfsonar/service/measurementArchive/sqlType/SQLStorageManager.java
2007-04-26 10:35:26 UTC (rev 2359)
@@ -20,6 +20,8 @@
import org.perfsonar.service.commons.storage.NMWGStorageManager;
import org.perfsonar.service.commons.util.ResultCodesUtil;
+import org.perfsonar.commons.util.TimeDateUtil;
+
import org.perfsonar.commons.auxiliary.AuxiliaryComponentManager;
import org.perfsonar.commons.auxiliary.ComponentNames;
import org.perfsonar.commons.auxiliary.components.logger.LoggerComponent;
@@ -125,13 +127,15 @@
Parameter p = paramsArray[i];
String pname = p.getParameterName();
- String pvalue = p.getParameterValue();
+ //String pvalue = p.getParameterValue();
+ String pvalue = "";
//logger.debug("SQLStorageManager.fetch: param [name,
value]: ["
// + pname + ", " + pvalue + "]");
if (pname.equals("startTime")) {
long startTime = 0;
+ pvalue = TimeDateUtil.getUnixTime(p);
try {
startTime = Long.parseLong(pvalue);
} catch (NumberFormatException nfex) {
@@ -145,6 +149,7 @@
} else if (pname.equals("endTime")) {
long endTime = 0;
+ pvalue = TimeDateUtil.getUnixTime(p);
try {
endTime = Long.parseLong(pvalue);
} catch (NumberFormatException nfex) {
@@ -157,6 +162,7 @@
ibatisParams.put(pname, endTime);
} else {
+ pvalue = p.getParameterValue();
ibatisParams.put(pname, pvalue);
}
- perfsonar: r2359 - in trunk/perfsonar/src/org/perfsonar: commons/util service/measurementArchive/rrdType service/measurementArchive/sqlType, svnlog, 04/26/2007
Archive powered by MHonArc 2.6.16.