Skip to Content.
Sympa Menu

perfsonar-dev - perfsonar: r2352 - in trunk/perfsonar/src/org/perfsonar: commons/util service/measurementArchive/rrdType

Subject: perfsonar development work

List archive

perfsonar: r2352 - in trunk/perfsonar/src/org/perfsonar: commons/util service/measurementArchive/rrdType


Chronological Thread 
  • From:
  • To:
  • Subject: perfsonar: r2352 - in trunk/perfsonar/src/org/perfsonar: commons/util service/measurementArchive/rrdType
  • Date: Wed, 25 Apr 2007 06:19:42 -0400

Author: roman
Date: 2007-04-25 06:19:42 -0400 (Wed, 25 Apr 2007)
New Revision: 2352

Added:
trunk/perfsonar/src/org/perfsonar/commons/util/TimeDateUtil.java
Modified:

trunk/perfsonar/src/org/perfsonar/service/measurementArchive/rrdType/RRDStorageManager.java
Log:

- support of iso time type in the request updated
- new util class for time/date conversion





Added: trunk/perfsonar/src/org/perfsonar/commons/util/TimeDateUtil.java


Property changes on:
trunk/perfsonar/src/org/perfsonar/commons/util/TimeDateUtil.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native

Modified:
trunk/perfsonar/src/org/perfsonar/service/measurementArchive/rrdType/RRDStorageManager.java
===================================================================
---
trunk/perfsonar/src/org/perfsonar/service/measurementArchive/rrdType/RRDStorageManager.java
2007-04-24 15:06:42 UTC (rev 2351)
+++
trunk/perfsonar/src/org/perfsonar/service/measurementArchive/rrdType/RRDStorageManager.java
2007-04-25 10:19:42 UTC (rev 2352)
@@ -7,6 +7,8 @@

import org.perfsonar.service.commons.storage.NMWGStorageManager;

+import org.perfsonar.commons.util.TimeDateUtil;
+
import org.perfsonar.commons.auxiliary.AuxiliaryComponentManager;
import org.perfsonar.commons.auxiliary.ComponentNames;
import
org.perfsonar.commons.auxiliary.components.configuration.ConfigurationComponent;
@@ -16,7 +18,6 @@
import org.perfsonar.service.commons.exceptions.RequestException;
import org.perfsonar.service.commons.exceptions.DataFormatException;

-import org.ggf.ns.nmwg.base.v2_0.Element;
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.Key;
@@ -35,11 +36,7 @@
import java.util.Map;
import java.util.Iterator;
import java.util.Vector;
-import java.util.NoSuchElementException;

-import org.joda.time.format.ISODateTimeFormat;
-import org.joda.time.format.DateTimeFormatter;
-import org.joda.time.DateTime;


/**
@@ -282,69 +279,7 @@
}


- /**
- * Returns unix time value.
- *
- * @author romradz
- */
- public static String getUnixTime(Parameter timeParemeter)
- throws DataFormatException {

- Vector pchildren = timeParemeter.getChildrenByType("time");
- Element subelement = null;
- try {
- subelement = (Element) pchildren.firstElement();
- } catch (NoSuchElementException nseex) {
- ;
- }
-
- if (subelement == null)
- return null;
-
- if (!subelement.getLocalName().equals("time"))
- throw new DataFormatException(
- "error.ma.query",
- "RRDStorageManager.getUnixTime: wrong type of parameter;
"
- + "it should be time type");
-
- Time time = (Time) subelement;
- String unixTimeString = "";
-
- if (time.getType().trim().equalsIgnoreCase("unix")) {
-
- unixTimeString = time.getValue();
-
- } else if (time.getType().trim().equalsIgnoreCase("iso")) {
-
- String isoTimeString = time.getValue();
- try {
-
- DateTimeFormatter dtf =
ISODateTimeFormat.dateTimeParser();
- DateTime dt = dtf.parseDateTime(isoTimeString);
- unixTimeString = Long.toString(dt.getMillis()/1000);
-
- } catch (Exception ex) {
- throw new DataFormatException(
- "error.ma.query",
- "RRDStorageManager.getUnixTime: ISO time
coversion is wrong; "
- + ex.toString());
- }
-
- } else {
-
- throw new DataFormatException(
- "error.ma.query",
- "RRDStorageManager.getUnixTime: "
- + "Time type " + time.getType() + "is not supported");
-
- }
-
- return unixTimeString;
-
- }
-
-
-
// ---------------------------------- protected methods


@@ -404,7 +339,7 @@


try {
- _startTime = getUnixTime(startTime);
+ _startTime = TimeDateUtil.getUnixTime(startTime);
if (_startTime == null)
//defaultly unix time is used in the request
//if time element in parameter is missing
@@ -416,7 +351,7 @@
}

try {
- _endTime = getUnixTime(endTime);
+ _endTime = TimeDateUtil.getUnixTime(endTime);
if (_endTime == null)
//defaultly unix time is used in the request
//if time element in parameter is missing



  • perfsonar: r2352 - in trunk/perfsonar/src/org/perfsonar: commons/util service/measurementArchive/rrdType, svnlog, 04/25/2007

Archive powered by MHonArc 2.6.16.

Top of Page