perfsonar-dev - perfsonar: r4420 - trunk/geant2-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store
Subject: perfsonar development work
List archive
perfsonar: r4420 - trunk/geant2-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store
Chronological Thread
- From:
- To:
- Subject: perfsonar: r4420 - trunk/geant2-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store
- Date: Mon, 1 Sep 2008 06:37:29 -0400
Author: roman
Date: 2008-09-01 06:37:28 -0400 (Mon, 01 Sep 2008)
New Revision: 4420
Modified:
trunk/geant2-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/L2PathStatusStoreRequestProcess.java
Log:
Store requests for L2 path status data support ISO time format
example data element:
<nmwg:data id="data2" metadataIdRef="link-md2">
<ifevt:datum timeType="ISO" timeValue="2008-09-01T11:20:11+01:00">
<ifevt:stateAdmin>TEST-20080901</ifevt:stateAdmin>
<ifevt:stateOper>up</ifevt:stateOper>
</ifevt:datum>
</nmwg:data>
Modified:
trunk/geant2-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/L2PathStatusStoreRequestProcess.java
===================================================================
---
trunk/geant2-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/L2PathStatusStoreRequestProcess.java
2008-08-31 17:57:24 UTC (rev 4419)
+++
trunk/geant2-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/L2PathStatusStoreRequestProcess.java
2008-09-01 10:37:28 UTC (rev 4420)
@@ -11,6 +11,7 @@
import org.ggf.ns.nmwg.base.v2_0.Element;
import org.ggf.ns.nmwg.event.status.base.v2_0.Datum;
+import org.perfsonar.base.util.TimeDateUtil;
import org.perfsonar.base.exceptions.PerfSONARException;
/**
@@ -40,7 +41,32 @@
public Map prepareStoreParameters(Element datum, Map ibatisParams) {
+ String timeType = ((Datum)datum).getTimeType();
String timeValue = ((Datum)datum).getTimeValue();
+
+ if (timeType == null) {
+ handleUnixTimeValue(timeValue, ibatisParams);
+ } else if (timeType.trim().equalsIgnoreCase("iso")) {
+ handleIsoTimeValue(timeValue, ibatisParams);
+ } else if (timeType.trim().equalsIgnoreCase("unix")) {
+ handleUnixTimeValue(timeValue, ibatisParams);
+ } else if (timeType.trim().equals("")) {
+ handleUnixTimeValue(timeValue, ibatisParams);
+ } else
+ handleUnixTimeValue(timeValue, ibatisParams);
+
+ String stateAdmin = ((Datum)datum).getStateAdmin().getStateAdmin();
+ String stateOper = ((Datum)datum).getStateOper().getStateOper();
+
+ ibatisParams.put("stateAdmin", stateAdmin);
+ ibatisParams.put("stateOper", stateOper);
+
+ return ibatisParams;
+
+ }
+
+ protected void handleUnixTimeValue(String timeValue, Map ibatisParams) {
+
int timeValueInt;
if (timeValue.equals("")) {
timeValueInt = (int)((new Date()).getTime() / 1000);
@@ -49,14 +75,20 @@
ibatisParams.put("timeValue", Integer.parseInt(timeValue));
}
- String stateAdmin = ((Datum)datum).getStateAdmin().getStateAdmin();
- String stateOper = ((Datum)datum).getStateOper().getStateOper();
+ }
- ibatisParams.put("stateAdmin", stateAdmin);
- ibatisParams.put("stateOper", stateOper);
- return ibatisParams;
+ protected void handleIsoTimeValue(String timeValue, Map ibatisParams) {
+ try {
+
+ long timeValueLong = TimeDateUtil.getUnixTime(timeValue);
+ ibatisParams.put("timeValue", (int)timeValueLong);
+
+ } catch (Exception ex) {
+ ;
+ }
+
}
- perfsonar: r4420 - trunk/geant2-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store, svnlog, 09/01/2008
Archive powered by MHonArc 2.6.16.