perfsonar-dev - [pS-dev] [GEANT/SA2/ps-java-services] r6044 - in trunk/perfsonar-java-sql-ma: . conf src/main src/main/java/org/perfsonar/service/measurementArchive/sqlType src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch src/main/java/org/perfsonar/service/measurementArchive/sqlType/store src/main/java/org/perfsonar/service/measurementArchive/sqlType/transaction src/main/resources src/main/resources/META-INF src/main/resources/META-INF/services src/test/java/org/perfsonar/service/measurementArchive/sqlType
Subject: perfsonar development work
List archive
[pS-dev] [GEANT/SA2/ps-java-services] r6044 - in trunk/perfsonar-java-sql-ma: . conf src/main src/main/java/org/perfsonar/service/measurementArchive/sqlType src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch src/main/java/org/perfsonar/service/measurementArchive/sqlType/store src/main/java/org/perfsonar/service/measurementArchive/sqlType/transaction src/main/resources src/main/resources/META-INF src/main/resources/META-INF/services src/test/java/org/perfsonar/service/measurementArchive/sqlType
Chronological Thread
- From:
- To:
- Subject: [pS-dev] [GEANT/SA2/ps-java-services] r6044 - in trunk/perfsonar-java-sql-ma: . conf src/main src/main/java/org/perfsonar/service/measurementArchive/sqlType src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch src/main/java/org/perfsonar/service/measurementArchive/sqlType/store src/main/java/org/perfsonar/service/measurementArchive/sqlType/transaction src/main/resources src/main/resources/META-INF src/main/resources/META-INF/services src/test/java/org/perfsonar/service/measurementArchive/sqlType
- Date: Wed, 28 Nov 2012 10:13:12 +0000 (GMT)
Author: nordunet.behrmann
Date: 2012-11-28 10:13:12 +0000 (Wed, 28 Nov 2012)
New Revision: 6044
Added:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/JdbcStorageManager.java
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/AbstractDataResultSetExtractor.java
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/BwctlDao.java
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/Dao.java
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/DaoJdbcTemplate.java
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/DaoProvider.java
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/DefaultDaoProvider.java
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/DiscardsDao.java
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/ErrorsDao.java
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/IperfDao.java
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/L2PathDao.java
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/OwampDao.java
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/ParseUtils.java
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/PingDao.java
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/UtilizationDao.java
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/transaction/
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/transaction/FallibleTransactionCallback.java
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/transaction/FallibleTransactionTemplate.java
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/transaction/ThrowableHolderException.java
trunk/perfsonar-java-sql-ma/src/main/resources/
trunk/perfsonar-java-sql-ma/src/main/resources/META-INF/
trunk/perfsonar-java-sql-ma/src/main/resources/META-INF/services/
trunk/perfsonar-java-sql-ma/src/main/resources/META-INF/services/org.perfsonar.service.measurementArchive.sqlType.dao.DaoProvider
Removed:
trunk/perfsonar-java-sql-ma/conf/ibatis-L2-status-domain.xml
trunk/perfsonar-java-sql-ma/conf/ibatis-L2-status-interdomain.xml
trunk/perfsonar-java-sql-ma/conf/ibatis-L2-status.xml
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-L2-status-domain.template.xml
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-L2-status-domain.xml
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-L2-status-interdomain.template.xml
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-L2-status-interdomain.xml
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-L2-status.xml
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-clmp-bwctl.template.xml
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-clmp-bwctl.xml
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-clmp-owamp.template.xml
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-clmp-owamp.xml
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-clmp-ping.template.xml
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-clmp-ping.xml
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-discards.template.xml
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-discards.xml
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-errors.template.xml
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-errors.xml
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-iperf.xml
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-owamp-aggregation.template.xml
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-owamp-aggregation.xml
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-utilization.template.xml
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-utilization.xml
trunk/perfsonar-java-sql-ma/conf/ibatis-clmp-bwctl.xml
trunk/perfsonar-java-sql-ma/conf/ibatis-clmp-owamp.xml
trunk/perfsonar-java-sql-ma/conf/ibatis-clmp-ping.xml
trunk/perfsonar-java-sql-ma/conf/ibatis-discards.xml
trunk/perfsonar-java-sql-ma/conf/ibatis-errors.xml
trunk/perfsonar-java-sql-ma/conf/ibatis-iperf.xml
trunk/perfsonar-java-sql-ma/conf/ibatis-owamp-aggregation.xml
trunk/perfsonar-java-sql-ma/conf/ibatis-utilization.xml
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/SQLStorageManager.java
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/BwctlResponseGenerator.java
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/DiscardsResponseGenerator.java
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/ErrorsResponseGenerator.java
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/GenericResponseGenerator.java
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/IperfResponseGenerator.java
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/L2PathStatusResponseGenerator.java
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/OwampResponseGenerator.java
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/PingResponseGenerator.java
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/ResponseGenerator.java
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/ResponseGeneratorFactory.java
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/UtilizationResponseGenerator.java
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/BwctlStoreRequestProcess.java
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/DiscardsStoreRequestProcess.java
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/ErrorsStoreRequestProcess.java
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/IperfStoreRequestProcess.java
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/L2PathStatusStoreRequestProcess.java
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/OwampStoreRequestProcess.java
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/PingStoreRequestProcess.java
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/StoreRequestProcess.java
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/StoreRequestProcessFactory.java
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/UtilizationStoreRequestProcess.java
trunk/perfsonar-java-sql-ma/src/test/java/org/perfsonar/service/measurementArchive/sqlType/OwampResponseGeneratorTest.java
trunk/perfsonar-java-sql-ma/src/test/java/org/perfsonar/service/measurementArchive/sqlType/OwampStoreRequestProcessTest.java
Modified:
trunk/perfsonar-java-sql-ma/conf/service.properties
trunk/perfsonar-java-sql-ma/pom.xml
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/SQLTypeMAServiceEngine.java
Log:
perfsonar-java-sq-ma: Rewrote SQL backend
The commit drops the obsolete Ibatis tool and instead uses plain JDBC
for interfacing with the RDBMS. A dash of Spring is added to reduce
the amount of boilerplate code and to simplify transaction management.
BoneCP is used as a database connection pool.
The user accessible ibatis mapping files are gone. The mapping from
NMWG datum elements to database columns is now hardcoded in SQL MA.
For each event type a DAO class codifies the mapping to and from
the database. DAOs are pluggable through a service provider interface
build on top of Java's ServiceLoader concept. Third party plugins
implement the Dao and DaoProvider interfaces and define a
META-INF/services/org.perfsonar.service.measurementArchive.sqlType.dao.DaoProvider
file in the JAR file. The JAR of the third party plugin can be dropped
into the lib folder of SQL MA.
The service.properties file is extended with the new service.ma.jdbc.*
properties. These define the JDBC connection parameters. The defaults
are those used in the old Ibatis files.
Deleted: trunk/perfsonar-java-sql-ma/conf/ibatis-L2-status-domain.xml
===================================================================
--- trunk/perfsonar-java-sql-ma/conf/ibatis-L2-status-domain.xml
2012-11-27 14:55:06 UTC (rev 6043)
+++ trunk/perfsonar-java-sql-ma/conf/ibatis-L2-status-domain.xml
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,127 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE sqlMap
- PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
- "http://www.ibatis.com/dtd/sql-map-2.dtd">
-
-
-<!-- $Id$ -->
-<!-- romradz -->
-
-
-<sqlMap namespace="Results">
-
-
- <!-- fetching -->
-
-
- <resultMap id="select-results" class="java.util.HashMap">
- <result property="status_oper" column="status_oper" />
- <result property="status_admin" column="status_admin" />
- <result property="timeValue" column="time" />
- </resultMap>
-
-
- <parameterMap id="select-parameters1" class="java.util.HashMap">
- <parameter property="pathId" />
- <parameter property="startTime" />
- <parameter property="endTime" />
- </parameterMap>
-
-
- <!-- this sql statement is prepared for mySQL database -->
- <select id="getResults1"
- parameterMap="select-parameters1" resultMap="select-results">
- <![CDATA[
- select distinct status_oper, status_admin, unix_timestamp(time) as
time
- from domain_link
- where id = ?
- and time >= from_unixtime(?)
- and time <= from_unixtime(?)
- order by time ASC
- ]]>
- </select>
-
- <!-- this sql statement is prepared for postgreSQL database -->
- <!-- uncomment if you use postgreSQL database instead of mySQL (and
comment mySQL counterpart above)-->
- <!--
- <select id="getResults1"
- parameterMap="select-parameters1" resultMap="select-results">
- <![CDATA[
- select distinct status_oper, status_admin, date_part('epoch', time)
as time
- from domain_link
- where id = ?
- and time >= to_timestamp(?)
- and time <= to_timestamp(?)
- order by time ASC
- ]]>
- </select>
- -->
-
-
- <parameterMap id="select-parameters2" class="java.util.HashMap">
- <parameter property="pathId" />
- <parameter property="pathId" />
- </parameterMap>
-
-
- <!-- this sql statement is prepared for mySQL database -->
- <select id="getResults2"
- parameterMap="select-parameters2" resultMap="select-results">
- <![CDATA[
- select distinct status_oper, status_admin, unix_timestamp(time) as
time
- from domain_link
- where id = ?
- and time = (select MAX(time) from domain_link where id = ?)
- ]]>
- </select>
-
- <!-- this sql statement is prepared for postgreSQL database -->
- <!-- uncomment if you use postgreSQL database instead of mySQL (and
comment mySQL counterpart above)-->
- <!--
- <select id="getResults2"
- parameterMap="select-parameters2" resultMap="select-results">
- <![CDATA[
- select distinct status_oper, status_admin, date_part('epoch', time)
as time
- from domain_link
- where id = ?
- and time = (select MAX(time) from domain_link where id = ?)
- ]]>
- </select>
- -->
-
-
- <!-- storing -->
-
-
-
- <parameterMap id="insert-parameters" class="java.util.HashMap">
- <parameter property="pathId" />
- <parameter property="timeValue" />
- <parameter property="stateOper" />
- <parameter property="stateAdmin" />
- </parameterMap>
-
-
- <!-- this sql statement is prepared for mySQL database -->
- <insert id="setResults"
- parameterMap="insert-parameters">
- <![CDATA[
- insert into domain_link (id, time, status_oper, status_admin)
- values (?, from_unixtime(?), ?, ?)
- ]]>
- </insert>
-
- <!-- this sql statement is prepared for postgreSQL database -->
- <!-- uncomment if you use postgreSQL database instead of mySQL (and
comment mySQL counterpart above)-->
- <!--
- <insert id="setResults"
- parameterMap="insert-parameters">
- <![CDATA[
- insert into domain_link (id, time, status_oper, status_admin)
- values (?, to_timestamp(?), ?, ?)
- ]]>
- </insert>
- -->
-
-
-</sqlMap>
Deleted: trunk/perfsonar-java-sql-ma/conf/ibatis-L2-status-interdomain.xml
===================================================================
--- trunk/perfsonar-java-sql-ma/conf/ibatis-L2-status-interdomain.xml
2012-11-27 14:55:06 UTC (rev 6043)
+++ trunk/perfsonar-java-sql-ma/conf/ibatis-L2-status-interdomain.xml
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,127 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE sqlMap
- PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
- "http://www.ibatis.com/dtd/sql-map-2.dtd">
-
-
-<!-- $Id$ -->
-<!-- romradz -->
-
-
-<sqlMap namespace="Results">
-
-
- <!-- fetching -->
-
-
- <resultMap id="select-results" class="java.util.HashMap">
- <result property="status_oper" column="status_oper" />
- <result property="status_admin" column="status_admin" />
- <result property="timeValue" column="time" />
- </resultMap>
-
-
- <parameterMap id="select-parameters1" class="java.util.HashMap">
- <parameter property="pathId" />
- <parameter property="startTime" />
- <parameter property="endTime" />
- </parameterMap>
-
-
- <!-- this sql statement is prepared for mySQL database -->
- <select id="getResults1"
- parameterMap="select-parameters1" resultMap="select-results">
- <![CDATA[
- select distinct status_oper, status_admin, unix_timestamp(time) as
time
- from interdomain_link
- where id = ?
- and time >= from_unixtime(?)
- and time <= from_unixtime(?)
- order by time ASC
- ]]>
- </select>
-
- <!-- this sql statement is prepared for postgreSQL database -->
- <!-- uncomment if you use postgreSQL database instead of mySQL (and
comment mySQL counterpart above)-->
- <!--
- <select id="getResults1"
- parameterMap="select-parameters1" resultMap="select-results">
- <![CDATA[
- select distinct status_oper, status_admin, date_part('epoch', time)
as time
- from interdomain_link
- where id = ?
- and time >= to_timestamp(?)
- and time <= to_timestamp(?)
- order by time ASC
- ]]>
- </select>
- -->
-
-
- <parameterMap id="select-parameters2" class="java.util.HashMap">
- <parameter property="pathId" />
- <parameter property="pathId" />
- </parameterMap>
-
-
- <!-- this sql statement is prepared for mySQL database -->
- <select id="getResults2"
- parameterMap="select-parameters2" resultMap="select-results">
- <![CDATA[
- select distinct status_oper, status_admin, unix_timestamp(time) as
time
- from interdomain_link
- where id = ?
- and time = (select MAX(time) from interdomain_link where id = ?)
- ]]>
- </select>
-
- <!-- this sql statement is prepared for postgreSQL database -->
- <!-- uncomment if you use postgreSQL database instead of mySQL (and
comment mySQL counterpart above)-->
- <!--
- <select id="getResults2"
- parameterMap="select-parameters2" resultMap="select-results">
- <![CDATA[
- select distinct status_oper, status_admin, date_part('epoch', time)
as time
- from interdomain_link
- where id = ?
- and time = (select MAX(time) from interdomain_link where id = ?)
- ]]>
- </select>
- -->
-
-
- <!-- storing -->
-
-
-
- <parameterMap id="insert-parameters" class="java.util.HashMap">
- <parameter property="pathId" />
- <parameter property="timeValue" />
- <parameter property="stateOper" />
- <parameter property="stateAdmin" />
- </parameterMap>
-
-
- <!-- this sql statement is prepared for mySQL database -->
- <insert id="setResults"
- parameterMap="insert-parameters">
- <![CDATA[
- insert into interdomain_link (id, time, status_oper, status_admin)
- values (?, from_unixtime(?), ?, ?)
- ]]>
- </insert>
-
- <!-- this sql statement is prepared for postgreSQL database -->
- <!-- uncomment if you use postgreSQL database instead of mySQL (and
comment mySQL counterpart above)-->
- <!--
- <insert id="setResults"
- parameterMap="insert-parameters">
- <![CDATA[
- insert into interdomain_link (id, time, status_oper, status_admin)
- values (?, to_timestamp(?), ?, ?)
- ]]>
- </insert>
- -->
-
-
-</sqlMap>
Deleted: trunk/perfsonar-java-sql-ma/conf/ibatis-L2-status.xml
===================================================================
--- trunk/perfsonar-java-sql-ma/conf/ibatis-L2-status.xml 2012-11-27
14:55:06 UTC (rev 6043)
+++ trunk/perfsonar-java-sql-ma/conf/ibatis-L2-status.xml 2012-11-28
10:13:12 UTC (rev 6044)
@@ -1,127 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE sqlMap
- PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
- "http://www.ibatis.com/dtd/sql-map-2.dtd">
-
-
-<!-- $Id$ -->
-<!-- romradz -->
-
-
-<sqlMap namespace="Results">
-
-
- <!-- fetching -->
-
-
- <resultMap id="select-results" class="java.util.HashMap">
- <result property="status_oper" column="status_oper" />
- <result property="status_admin" column="status_admin" />
- <result property="timeValue" column="time" />
- </resultMap>
-
-
- <parameterMap id="select-parameters1" class="java.util.HashMap">
- <parameter property="pathId" />
- <parameter property="startTime" />
- <parameter property="endTime" />
- </parameterMap>
-
-
- <!-- this sql statement is prepared for mySQL database -->
- <select id="getResults1"
- parameterMap="select-parameters1" resultMap="select-results">
- <![CDATA[
- select distinct status_oper, status_admin, unix_timestamp(time) as
time
- from perfsonar_links
- where id = ?
- and time >= from_unixtime(?)
- and time <= from_unixtime(?)
- order by time ASC
- ]]>
- </select>
-
- <!-- this sql statement is prepared for postgreSQL database -->
- <!-- uncomment if you use postgreSQL database instead of mySQL (and
comment mySQL counterpart above)-->
- <!--
- <select id="getResults1"
- parameterMap="select-parameters1" resultMap="select-results">
- <![CDATA[
- select distinct status_oper, status_admin, date_part('epoch', time)
as time
- from perfsonar_links
- where id = ?
- and time >= to_timestamp(?)
- and time <= to_timestamp(?)
- order by time ASC
- ]]>
- </select>
- -->
-
-
- <parameterMap id="select-parameters2" class="java.util.HashMap">
- <parameter property="pathId" />
- <parameter property="pathId" />
- </parameterMap>
-
-
- <!-- this sql statement is prepared for mySQL database -->
- <select id="getResults2"
- parameterMap="select-parameters2" resultMap="select-results">
- <![CDATA[
- select distinct status_oper, status_admin, unix_timestamp(time) as
time
- from perfsonar_links
- where id = ?
- and time = (select MAX(time) from perfsonar_links where id = ?)
- ]]>
- </select>
-
- <!-- this sql statement is prepared for postgreSQL database -->
- <!-- uncomment if you use postgreSQL database instead of mySQL (and
comment mySQL counterpart above)-->
- <!--
- <select id="getResults2"
- parameterMap="select-parameters2" resultMap="select-results">
- <![CDATA[
- select distinct status_oper, status_admin, date_part('epoch', time)
as time
- from perfsonar_links
- where id = ?
- and time = (select MAX(time) from perfsonar_links where id = ?)
- ]]>
- </select>
- -->
-
-
- <!-- storing -->
-
-
-
- <parameterMap id="insert-parameters" class="java.util.HashMap">
- <parameter property="pathId" />
- <parameter property="timeValue" />
- <parameter property="stateOper" />
- <parameter property="stateAdmin" />
- </parameterMap>
-
-
- <!-- this sql statement is prepared for mySQL database -->
- <insert id="setResults"
- parameterMap="insert-parameters">
- <![CDATA[
- insert into perfsonar_links (id, time, status_oper, status_admin)
- values (?, from_unixtime(?), ?, ?)
- ]]>
- </insert>
-
- <!-- this sql statement is prepared for postgreSQL database -->
- <!-- uncomment if you use postgreSQL database instead of mySQL (and
comment mySQL counterpart above)-->
- <!--
- <insert id="setResults"
- parameterMap="insert-parameters">
- <![CDATA[
- insert into perfsonar_links (id, time, status_oper, status_admin)
- values (?, to_timestamp(?), ?, ?)
- ]]>
- </insert>
- -->
-
-
-</sqlMap>
Deleted:
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-L2-status-domain.template.xml
===================================================================
---
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-L2-status-domain.template.xml
2012-11-27 14:55:06 UTC (rev 6043)
+++
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-L2-status-domain.template.xml
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE sqlMapConfig
- PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
- "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
-
-
-<!-- $Id$ -->
-<!-- romradz -->
-
-
-<sqlMapConfig>
-
- <settings useStatementNamespaces="false" />
-
- <transactionManager type="JDBC">
- <dataSource type="SIMPLE" >
- <property name="JDBC.Driver" value="_DRIVER_"/>
- <property name="JDBC.ConnectionURL" value="_URL_"/>
- <property name="JDBC.Username" value="_USERNAME_"/>
- <property name="JDBC.Password" value="_PASSWORD_"/>
- </dataSource>
- </transactionManager>
-
- <sqlMap resource="ibatis-L2-status-domain.xml"/>
-
-</sqlMapConfig>
\ No newline at end of file
Deleted:
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-L2-status-domain.xml
===================================================================
--- trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-L2-status-domain.xml
2012-11-27 14:55:06 UTC (rev 6043)
+++ trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-L2-status-domain.xml
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE sqlMapConfig
- PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
- "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
-
-
-<!-- $Id$ -->
-<!-- romradz -->
-
-
-<sqlMapConfig>
-
- <settings useStatementNamespaces="false" />
-
- <transactionManager type="JDBC">
- <dataSource type="SIMPLE" >
- <property name="JDBC.Driver" value="com.mysql.jdbc.Driver"/>
- <property name="JDBC.ConnectionURL"
value="jdbc:mysql://127.0.0.1/perfsonar_ma"/>
- <property name="JDBC.Username" value="perfsonar_ma"/>
- <property name="JDBC.Password" value="testpass"/>
- </dataSource>
- </transactionManager>
-
- <sqlMap resource="ibatis-L2-status-domain.xml"/>
-
-</sqlMapConfig>
\ No newline at end of file
Deleted:
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-L2-status-interdomain.template.xml
===================================================================
---
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-L2-status-interdomain.template.xml
2012-11-27 14:55:06 UTC (rev 6043)
+++
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-L2-status-interdomain.template.xml
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE sqlMapConfig
- PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
- "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
-
-
-<!-- $Id$ -->
-<!-- romradz -->
-
-
-<sqlMapConfig>
-
- <settings useStatementNamespaces="false" />
-
- <transactionManager type="JDBC">
- <dataSource type="SIMPLE" >
- <property name="JDBC.Driver" value="_DRIVER_"/>
- <property name="JDBC.ConnectionURL" value="_URL_"/>
- <property name="JDBC.Username" value="_USERNAME_"/>
- <property name="JDBC.Password" value="_PASSWORD_"/>
- </dataSource>
- </transactionManager>
-
- <sqlMap resource="ibatis-L2-status-interdomain.xml"/>
-
-</sqlMapConfig>
\ No newline at end of file
Deleted:
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-L2-status-interdomain.xml
===================================================================
---
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-L2-status-interdomain.xml
2012-11-27 14:55:06 UTC (rev 6043)
+++
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-L2-status-interdomain.xml
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE sqlMapConfig
- PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
- "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
-
-
-<!-- $Id$ -->
-<!-- romradz -->
-
-
-<sqlMapConfig>
-
- <settings useStatementNamespaces="false" />
-
- <transactionManager type="JDBC">
- <dataSource type="SIMPLE" >
- <property name="JDBC.Driver" value="com.mysql.jdbc.Driver"/>
- <property name="JDBC.ConnectionURL"
value="jdbc:mysql://127.0.0.1/perfsonar_ma"/>
- <property name="JDBC.Username" value="perfsonar_ma"/>
- <property name="JDBC.Password" value="testpass"/>
- </dataSource>
- </transactionManager>
-
- <sqlMap resource="ibatis-L2-status-interdomain.xml"/>
-
-</sqlMapConfig>
\ No newline at end of file
Deleted: trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-L2-status.xml
===================================================================
--- trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-L2-status.xml
2012-11-27 14:55:06 UTC (rev 6043)
+++ trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-L2-status.xml
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE sqlMapConfig
- PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
- "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
-
-
-<!-- $Id$ -->
-<!-- romradz -->
-
-
-<sqlMapConfig>
-
- <settings useStatementNamespaces="false" />
-
- <transactionManager type="JDBC">
- <dataSource type="SIMPLE" >
- <property name="JDBC.Driver" value="com.mysql.jdbc.Driver"/>
- <property name="JDBC.ConnectionURL"
value="jdbc:mysql://127.0.0.1/perfsonar_ma"/>
- <property name="JDBC.Username" value="perfsonar_ma"/>
- <property name="JDBC.Password" value="testpass"/>
- </dataSource>
- </transactionManager>
-
- <sqlMap resource="ibatis-L2-status.xml"/>
-
-</sqlMapConfig>
\ No newline at end of file
Deleted:
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-clmp-bwctl.template.xml
===================================================================
---
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-clmp-bwctl.template.xml
2012-11-27 14:55:06 UTC (rev 6043)
+++
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-clmp-bwctl.template.xml
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE sqlMapConfig
- PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
- "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
-
-
-<!-- $Id: ibatis-SqlMapConfig-utilization.xml 1212 2006-05-25 11:49:39Z
roman $ -->
-<!-- romradz -->
-
-
-<sqlMapConfig>
-
- <settings useStatementNamespaces="false" />
-
- <transactionManager type="JDBC">
- <dataSource type="SIMPLE" >
- <property name="JDBC.Driver" value="_DRIVER_"/>
- <property name="JDBC.ConnectionURL" value="_URL_"/>
- <property name="JDBC.Username" value="_USERNAME_"/>
- <property name="JDBC.Password" value="_PASSWORD_"/>
- </dataSource>
- </transactionManager>
-
- <sqlMap resource="ibatis-clmp-bwctl.xml"/>
-
-</sqlMapConfig>
Deleted: trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-clmp-bwctl.xml
===================================================================
--- trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-clmp-bwctl.xml
2012-11-27 14:55:06 UTC (rev 6043)
+++ trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-clmp-bwctl.xml
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE sqlMapConfig
- PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
- "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
-
-
-<!-- $Id$ -->
-<!-- romradz -->
-
-
-<sqlMapConfig>
-
- <settings useStatementNamespaces="false" />
-
- <transactionManager type="JDBC">
- <dataSource type="SIMPLE" >
- <property name="JDBC.Driver" value="com.mysql.jdbc.Driver"/>
- <property name="JDBC.ConnectionURL"
value="jdbc:mysql://127.0.0.1/perfsonar_ma"/>
- <property name="JDBC.Username" value="perfsonar_ma"/>
- <property name="JDBC.Password" value="testpass"/>
- </dataSource>
- </transactionManager>
-
- <sqlMap resource="ibatis-clmp-bwctl.xml"/>
-
-</sqlMapConfig>
Deleted:
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-clmp-owamp.template.xml
===================================================================
---
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-clmp-owamp.template.xml
2012-11-27 14:55:06 UTC (rev 6043)
+++
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-clmp-owamp.template.xml
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE sqlMapConfig
- PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
- "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
-
-
-<sqlMapConfig>
-
- <settings useStatementNamespaces="false" />
-
- <transactionManager type="JDBC">
- <dataSource type="SIMPLE" >
- <property name="JDBC.Driver" value="_DRIVER_"/>
- <property name="JDBC.ConnectionURL" value="_URL_"/>
- <property name="JDBC.Username" value="_USERNAME_"/>
- <property name="JDBC.Password" value="_PASSWORD_"/>
- </dataSource>
- </transactionManager>
-
- <sqlMap resource="ibatis-clmp-owamp.xml"/>
-
-</sqlMapConfig>
Deleted: trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-clmp-owamp.xml
===================================================================
--- trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-clmp-owamp.xml
2012-11-27 14:55:06 UTC (rev 6043)
+++ trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-clmp-owamp.xml
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE sqlMapConfig
- PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
- "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
-
-
-<sqlMapConfig>
-
- <settings useStatementNamespaces="false" />
-
- <transactionManager type="JDBC">
- <dataSource type="SIMPLE" >
- <property name="JDBC.Driver" value="com.mysql.jdbc.Driver"/>
- <property name="JDBC.ConnectionURL"
value="jdbc:mysql://127.0.0.1/perfsonar_ma"/>
- <property name="JDBC.Username" value="perfsonar_ma"/>
- <property name="JDBC.Password" value="testpass"/>
- </dataSource>
- </transactionManager>
-
- <sqlMap resource="ibatis-clmp-owamp.xml"/>
-
-</sqlMapConfig>
Deleted:
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-clmp-ping.template.xml
===================================================================
---
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-clmp-ping.template.xml
2012-11-27 14:55:06 UTC (rev 6043)
+++
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-clmp-ping.template.xml
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE sqlMapConfig
- PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
- "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
-
-
-<!-- $Id: ibatis-SqlMapConfig-utilization.xml 1212 2006-05-25 11:49:39Z
roman $ -->
-<!-- romradz -->
-
-
-<sqlMapConfig>
-
- <settings useStatementNamespaces="false" />
-
- <transactionManager type="JDBC">
- <dataSource type="SIMPLE" >
- <property name="JDBC.Driver" value="_DRIVER_"/>
- <property name="JDBC.ConnectionURL" value="_URL_"/>
- <property name="JDBC.Username" value="_USERNAME_"/>
- <property name="JDBC.Password" value="_PASSWORD_"/>
- </dataSource>
- </transactionManager>
-
- <sqlMap resource="ibatis-clmp-ping.xml"/>
-
-</sqlMapConfig>
Deleted: trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-clmp-ping.xml
===================================================================
--- trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-clmp-ping.xml
2012-11-27 14:55:06 UTC (rev 6043)
+++ trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-clmp-ping.xml
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE sqlMapConfig
- PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
- "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
-
-
-<!-- $Id$ -->
-<!-- romradz -->
-
-
-<sqlMapConfig>
-
- <settings useStatementNamespaces="false" />
-
- <transactionManager type="JDBC">
- <dataSource type="SIMPLE" >
- <property name="JDBC.Driver" value="com.mysql.jdbc.Driver"/>
- <property name="JDBC.ConnectionURL"
value="jdbc:mysql://127.0.0.1/perfsonar_ma"/>
- <property name="JDBC.Username" value="perfsonar_ma"/>
- <property name="JDBC.Password" value="testpass"/>
- </dataSource>
- </transactionManager>
-
- <sqlMap resource="ibatis-clmp-ping.xml"/>
-
-</sqlMapConfig>
Deleted:
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-discards.template.xml
===================================================================
---
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-discards.template.xml
2012-11-27 14:55:06 UTC (rev 6043)
+++
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-discards.template.xml
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE sqlMapConfig
- PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
- "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
-
-
-<!-- $Id$ -->
-<!-- romradz -->
-
-
-<sqlMapConfig>
-
- <settings useStatementNamespaces="false" />
-
- <transactionManager type="JDBC">
- <dataSource type="SIMPLE" >
- <property name="JDBC.Driver" value="_DRIVER_"/>
- <property name="JDBC.ConnectionURL" value="_URL_"/>
- <property name="JDBC.Username" value="_USERNAME_"/>
- <property name="JDBC.Password" value="_PASSWORD_"/>
- </dataSource>
- </transactionManager>
-
- <sqlMap resource="ibatis-discards.xml"/>
-
-</sqlMapConfig>
\ No newline at end of file
Deleted: trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-discards.xml
===================================================================
--- trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-discards.xml
2012-11-27 14:55:06 UTC (rev 6043)
+++ trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-discards.xml
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE sqlMapConfig
- PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
- "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
-
-
-<!-- $Id$ -->
-<!-- romradz -->
-
-
-<sqlMapConfig>
-
- <settings useStatementNamespaces="false" />
-
- <transactionManager type="JDBC">
- <dataSource type="SIMPLE" >
- <property name="JDBC.Driver" value="com.mysql.jdbc.Driver"/>
- <property name="JDBC.ConnectionURL"
value="jdbc:mysql://127.0.0.1/perfsonar_ma"/>
- <property name="JDBC.Username" value="perfsonar_ma"/>
- <property name="JDBC.Password" value="testpass"/>
- </dataSource>
- </transactionManager>
-
- <sqlMap resource="ibatis-discards.xml"/>
-
-</sqlMapConfig>
\ No newline at end of file
Deleted:
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-errors.template.xml
===================================================================
--- trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-errors.template.xml
2012-11-27 14:55:06 UTC (rev 6043)
+++ trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-errors.template.xml
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE sqlMapConfig
- PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
- "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
-
-
-<!-- $Id$ -->
-<!-- romradz -->
-
-
-<sqlMapConfig>
-
- <settings useStatementNamespaces="false" />
-
- <transactionManager type="JDBC">
- <dataSource type="SIMPLE" >
- <property name="JDBC.Driver" value="_DRIVER_"/>
- <property name="JDBC.ConnectionURL" value="_URL_"/>
- <property name="JDBC.Username" value="_USERNAME_"/>
- <property name="JDBC.Password" value="_PASSWORD_"/>
- </dataSource>
- </transactionManager>
-
- <sqlMap resource="ibatis-errors.xml"/>
-
-</sqlMapConfig>
\ No newline at end of file
Deleted: trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-errors.xml
===================================================================
--- trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-errors.xml
2012-11-27 14:55:06 UTC (rev 6043)
+++ trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-errors.xml
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE sqlMapConfig
- PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
- "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
-
-
-<!-- $Id$ -->
-<!-- romradz -->
-
-
-<sqlMapConfig>
-
- <settings useStatementNamespaces="false" />
-
- <transactionManager type="JDBC">
- <dataSource type="SIMPLE" >
- <property name="JDBC.Driver" value="com.mysql.jdbc.Driver"/>
- <property name="JDBC.ConnectionURL"
value="jdbc:mysql://127.0.0.1/perfsonar_ma"/>
- <property name="JDBC.Username" value="perfsonar_ma"/>
- <property name="JDBC.Password" value="testpass"/>
- </dataSource>
- </transactionManager>
-
- <sqlMap resource="ibatis-errors.xml"/>
-
-</sqlMapConfig>
\ No newline at end of file
Deleted: trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-iperf.xml
===================================================================
--- trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-iperf.xml
2012-11-27 14:55:06 UTC (rev 6043)
+++ trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-iperf.xml
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE sqlMapConfig
- PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
- "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
-
-
-<!-- $Id$ -->
-<!-- romradz -->
-
-
-<sqlMapConfig>
-
- <settings useStatementNamespaces="false" />
-
- <transactionManager type="JDBC">
- <dataSource type="SIMPLE" >
- <property name="JDBC.Driver" value="com.mysql.jdbc.Driver"/>
- <property name="JDBC.ConnectionURL"
value="jdbc:mysql://127.0.0.1/perfsonar_ma"/>
- <property name="JDBC.Username" value="perfsonar_ma"/>
- <property name="JDBC.Password" value="testpass"/>
- </dataSource>
- </transactionManager>
-
- <sqlMap resource="ibatis-iperf.xml"/>
-
-</sqlMapConfig>
\ No newline at end of file
Deleted:
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-owamp-aggregation.template.xml
===================================================================
---
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-owamp-aggregation.template.xml
2012-11-27 14:55:06 UTC (rev 6043)
+++
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-owamp-aggregation.template.xml
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE sqlMapConfig
- PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
- "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
-
-
-<sqlMapConfig>
-
- <settings useStatementNamespaces="false" />
-
- <transactionManager type="JDBC">
- <dataSource type="SIMPLE" >
- <property name="JDBC.Driver" value="_DRIVER_"/>
- <property name="JDBC.ConnectionURL" value="_URL_"/>
- <property name="JDBC.Username" value="_USERNAME_"/>
- <property name="JDBC.Password" value="_PASSWORD_"/>
- </dataSource>
- </transactionManager>
-
- <sqlMap resource="ibatis-owamp-aggregation.xml"/>
-
-</sqlMapConfig>
Deleted:
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-owamp-aggregation.xml
===================================================================
---
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-owamp-aggregation.xml
2012-11-27 14:55:06 UTC (rev 6043)
+++
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-owamp-aggregation.xml
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE sqlMapConfig
- PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
- "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
-
-
-<sqlMapConfig>
-
- <settings useStatementNamespaces="false" />
-
- <transactionManager type="JDBC">
- <dataSource type="SIMPLE" >
- <property name="JDBC.Driver" value="com.mysql.jdbc.Driver"/>
- <property name="JDBC.ConnectionURL"
value="jdbc:mysql://127.0.0.1/perfsonar_ma"/>
- <property name="JDBC.Username" value="perfsonar_ma"/>
- <property name="JDBC.Password" value="testpass"/>
- </dataSource>
- </transactionManager>
-
- <sqlMap resource="ibatis-owamp-aggregation.xml"/>
-
-</sqlMapConfig>
Deleted:
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-utilization.template.xml
===================================================================
---
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-utilization.template.xml
2012-11-27 14:55:06 UTC (rev 6043)
+++
trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-utilization.template.xml
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE sqlMapConfig
- PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
- "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
-
-
-<!-- $Id$ -->
-<!-- romradz -->
-
-
-<sqlMapConfig>
-
- <settings useStatementNamespaces="false" />
-
- <transactionManager type="JDBC">
- <dataSource type="SIMPLE" >
- <property name="JDBC.Driver" value="_DRIVER_"/>
- <property name="JDBC.ConnectionURL" value="_URL_"/>
- <property name="JDBC.Username" value="_USERNAME_"/>
- <property name="JDBC.Password" value="_PASSWORD_"/>
- </dataSource>
- </transactionManager>
-
- <sqlMap resource="ibatis-utilization.xml"/>
-
-</sqlMapConfig>
\ No newline at end of file
Deleted: trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-utilization.xml
===================================================================
--- trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-utilization.xml
2012-11-27 14:55:06 UTC (rev 6043)
+++ trunk/perfsonar-java-sql-ma/conf/ibatis-SqlMapConfig-utilization.xml
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE sqlMapConfig
- PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
- "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
-
-
-<!-- $Id$ -->
-<!-- romradz -->
-
-
-<sqlMapConfig>
-
- <settings useStatementNamespaces="false" />
-
- <transactionManager type="JDBC">
- <dataSource type="SIMPLE" >
- <property name="JDBC.Driver" value="com.mysql.jdbc.Driver"/>
- <property name="JDBC.ConnectionURL"
value="jdbc:mysql://127.0.0.1/perfsonar_ma"/>
- <property name="JDBC.Username" value="perfsonar_ma"/>
- <property name="JDBC.Password" value="testpass"/>
- </dataSource>
- </transactionManager>
-
- <sqlMap resource="ibatis-utilization.xml"/>
-
-</sqlMapConfig>
\ No newline at end of file
Deleted: trunk/perfsonar-java-sql-ma/conf/ibatis-clmp-bwctl.xml
===================================================================
--- trunk/perfsonar-java-sql-ma/conf/ibatis-clmp-bwctl.xml 2012-11-27
14:55:06 UTC (rev 6043)
+++ trunk/perfsonar-java-sql-ma/conf/ibatis-clmp-bwctl.xml 2012-11-28
10:13:12 UTC (rev 6044)
@@ -1,119 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE sqlMap
- PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
- "http://www.ibatis.com/dtd/sql-map-2.dtd">
-
-
-<!-- $Id: ibatis-utilization.xml 1213 2006-05-25 11:50:10Z roman $ -->
-<!-- romradz -->
-
-
-<sqlMap namespace="Results">
-
-
-
- <!-- fetching -->
-
-
- <resultMap id="select-results" class="java.util.HashMap">
- <result property="intervalEnd" column="intervalEnd" />
- <result property="intervalStart" column="intervalStart" />
- <result property="intervalUnit" column="intervalUnit" />
- <result property="numBytes" column="numBytes" />
- <result property="numBytesUnits" column="numBytesUnits" />
- <result property="tcpAdapterType" column="tcpAdapterType" />
- <result property="tcpMSSSize" column="tcpMSSSize" />
- <result property="timeType" column="timeType" />
- <result property="timeValue" column="timeValue" />
- <result property="value" column="value" />
- <result property="valueUnits" column="valueUnits" />
- <result property="tcpMSSUnit" column="tcpMSSUnit" />
- <result property="tcpMTUSize" column="tcpMTUSize" />
- <result property="tcpMTUUnit" column="tcpMTUUnit" />
- <result property="tcpWindowSize" column="tcpWindowSize" />
- <result property="tcpWindowUnit" column="tcpWindowUnit" />
- <result property="udpBufferSize" column="udpBufferSize" />
- <result property="udpBufferUnit" column="udpBufferUnit" />
- <result property="udpJitter" column="udpJitter" />
- <result property="udpJitterUnit" column="udpJitterUnit" />
- <result property="udpPacketLoss" column="udpPacketLoss" />
- <result property="udpPacketLossPercentage"
column="udpPacketLossPercentage" />
- <result property="udpPacketSent" column="udpPacketSent" />
-</resultMap>
-
- <parameterMap id="select-parameters1" class="java.util.HashMap">
- <parameter property="metadataId" />
- <parameter property="startTime" />
- <parameter property="endTime" />
- </parameterMap>
-
- <parameterMap id="select-parameters2" class="java.util.HashMap">
- <parameter property="metadataId" />
- </parameterMap>
-
- <select id="getResults1"
- parameterMap="select-parameters1" resultMap="select-results">
- <![CDATA[
- select intervalEnd, intervalStart, intervalUnit, numBytes,
numBytesUnits, tcpAdapterType, tcpMSSSize, timeType, timeValue, value,
valueUnits, tcpMSSUnit, tcpMTUSize, tcpMTUUnit, tcpWindowSize, tcpWindowUnit,
udpBufferSize, udpBufferUnit, udpJitter, udpJitterUnit, udpPacketLoss,
udpPacketLossPercentage, udpPacketSent
- from clmp_bwctl
- where metadataId = ?
- and timeValue >= ?
- and timeValue <= ?
- order by timeValue ASC
- ]]>
- </select>
-
-
- <select id="getResults2"
- parameterMap="select-parameters2" resultMap="select-results">
- <![CDATA[
- select intervalEnd, intervalStart, intervalUnit, numBytes,
numBytesUnits, tcpAdapterType, tcpMSSSize, timeType, timeValue, value,
valueUnits, tcpMSSUnit, tcpMTUSize, tcpMTUUnit, tcpWindowSize, tcpWindowUnit,
udpBufferSize, udpBufferUnit, udpJitter, udpJitterUnit, udpPacketLoss,
udpPacketLossPercentage, udpPacketSent
- from clmp_bwctl
- where metadataId = ?
- ]]>
- </select>
-
-
-
- <!-- storing -->
-
-
- <parameterMap id="insert-parameters" class="java.util.HashMap">
- <parameter property="metadataId" />
- <parameter property="intervalEnd" />
- <parameter property="intervalStart" />
- <parameter property="intervalUnit" />
- <parameter property="numBytes" />
- <parameter property="numBytesUnits" />
- <parameter property="tcpAdapterType" />
- <parameter property="tcpMSSSize" />
- <parameter property="timeType" />
- <parameter property="timeValue" />
- <parameter property="value" />
- <parameter property="valueUnits" />
- <parameter property="tcpMSSUnit" />
- <parameter property="tcpMTUSize" />
- <parameter property="tcpMTUUnit" />
- <parameter property="tcpWindowSize" />
- <parameter property="tcpWindowUnit" />
- <parameter property="udpBufferSize" />
- <parameter property="udpBufferUnit" />
- <parameter property="udpJitter" />
- <parameter property="udpJitterUnit" />
- <parameter property="udpPacketLoss" />
- <parameter property="udpPacketLossPercentage" />
- <parameter property="udpPacketSent" />
- </parameterMap>
-
-
- <insert id="setResults"
- parameterMap="insert-parameters">
- <![CDATA[
- insert into clmp_bwctl (metadataId, intervalEnd, intervalStart,
intervalUnit, numBytes, numBytesUnits, tcpAdapterType, tcpMSSSize, timeType,
timeValue, value, valueUnits, tcpMSSUnit, tcpMTUSize, tcpMTUUnit,
tcpWindowSize, tcpWindowUnit, udpBufferSize, udpBufferUnit, udpJitter,
udpJitterUnit, udpPacketLoss, udpPacketLossPercentage, udpPacketSent, ts )
- values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
?, ?, ?, ?, default)
- ]]>
- </insert>
-
-
-
-</sqlMap>
Deleted: trunk/perfsonar-java-sql-ma/conf/ibatis-clmp-owamp.xml
===================================================================
--- trunk/perfsonar-java-sql-ma/conf/ibatis-clmp-owamp.xml 2012-11-27
14:55:06 UTC (rev 6043)
+++ trunk/perfsonar-java-sql-ma/conf/ibatis-clmp-owamp.xml 2012-11-28
10:13:12 UTC (rev 6044)
@@ -1,91 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE sqlMap
- PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
- "http://www.ibatis.com/dtd/sql-map-2.dtd">
-
-
-<sqlMap namespace="Results">
-
-
-
- <!-- fetching -->
-
-
- <resultMap id="select-results" class="java.util.HashMap">
- <result property="receiveSynchronized" column="receiveSynchronized"
/>
- <result property="receiveTime" column="receiveTime" />
- <result property="receiveTimeError" column="receiveTimeError" />
- <result property="sendSynchronized" column="sendSynchronized" />
- <result property="sendTime" column="sendTime" />
- <result property="sendTimeError" column="sendTimeError" />
- <result property="seqNum" column="seqNum" />
- <!-- <result property="timeType" column="timeType" />
- <result property="timeValue" column="timeValue" />-->
- <result property="ttl" column="ttl" />
- </resultMap>
-
-
- <parameterMap id="select-parameters1" class="java.util.HashMap">
- <parameter property="metadataId" />
- <parameter property="startTime" />
- <parameter property="endTime" />
- </parameterMap>
-
-
- <parameterMap id="select-parameters2" class="java.util.HashMap">
- <parameter property="metadataId" />
- </parameterMap>
-
- <select id="getResults1"
- parameterMap="select-parameters1" resultMap="select-results">
- <![CDATA[
- select receiveSynchronized, receiveTime, receiveTimeError,
sendSynchronized, sendTime, sendTimeError, seqNum, timeType, timeValue, ttl
- from owamp
- where metadataId = ?
- and ts >= ?
- and ts <= ?
- order by ts ASC
- ]]>
- </select>
-
-
- <select id="getResults2"
- parameterMap="select-parameters2" resultMap="select-results">
- <![CDATA[
- select receiveSynchronized, receiveTime, receiveTimeError,
sendSynchronized, sendTime, sendTimeError, seqNum, ttl
- from owamp
- where metadataId = ?
- ]]>
- </select>
-
-
-
- <!-- storing -->
-
-
- <parameterMap id="insert-parameters" class="java.util.HashMap">
- <parameter property="metadataId" />
- <parameter property="receiveSynchronized" />
- <parameter property="receiveTime" />
- <parameter property="receiveTimeError" />
- <parameter property="sendSynchronized" />
- <parameter property="sendTime" />
- <parameter property="sendTimeError" />
- <parameter property="seqNum" />
- <!-- <parameter property="timeType" />
- <parameter property="timeValue" /> -->
- <parameter property="ttl" />
- </parameterMap>
-
-
- <insert id="setResults"
- parameterMap="insert-parameters">
- <![CDATA[
- insert into owamp (metadataId, receiveSynchronized, receiveTime,
receiveTimeError, sendSynchronized, sendTime, sendTimeError, seqNum, ttl, ts )
- values (?, ?, ?, ?, ?, ?, ?, ?, ?, default)
- ]]>
- </insert>
-
-
-
-</sqlMap>
Deleted: trunk/perfsonar-java-sql-ma/conf/ibatis-clmp-ping.xml
===================================================================
--- trunk/perfsonar-java-sql-ma/conf/ibatis-clmp-ping.xml 2012-11-27
14:55:06 UTC (rev 6043)
+++ trunk/perfsonar-java-sql-ma/conf/ibatis-clmp-ping.xml 2012-11-28
10:13:12 UTC (rev 6044)
@@ -1,98 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE sqlMap
- PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
- "http://www.ibatis.com/dtd/sql-map-2.dtd">
-
-
-<sqlMap namespace="Results">
-
- <!-- fetching -->
-
-
- <resultMap id="select-results" class="java.util.HashMap">
- <result property="seqNum" column="seqNum" />
- <result property="value" column="value" />
- <result property="valueUnits" column="valueUnits" />
- <result property="ttl" column="ttl" />
- <result property="numBytes" column="numBytes" />
- <result property="numBytesUnits" column="numBytesUnits" />
- <result property="timeValue" column="timeValue" />
- <result property="timeType" column="timeType" />
- </resultMap>
-
-
- <parameterMap id="select-parameters1" class="java.util.HashMap">
- <parameter property="metadataId" />
- <parameter property="startTime" />
- <parameter property="endTime" />
- </parameterMap>
-
- <!--
- <parameterMap id="select-parameters2" class="java.util.HashMap">
- <parameter property="metadataId" />
- </parameterMap>
- -->
- <parameterMap id="select-parameters2" class="java.util.HashMap">
- <parameter property="metadataId" />
- <parameter property="metadataId" />
- </parameterMap>
-
-
- <select id="getResults1"
- parameterMap="select-parameters1" resultMap="select-results">
- <![CDATA[
- select seqNum, value, valueUnits, ttl, numBytes, numBytesUnits,
timeValue, timeType
- from clmp_ping
- where metadataId = ?
- and timeValue >= ?
- and timeValue <= ?
- order by timeValue ASC
- ]]>
- </select>
-
- <!--
- <select id="getResults2"
- parameterMap="select-parameters2" resultMap="select-results">
- <![CDATA[
- select seqNum, value, valueUnits, ttl, numBytes, numBytesUnits,
timeValue, timeType
- from clmp_ping
- where metadataId = ?
- ]]>
- </select>
- -->
- <select id="getResults2"
- parameterMap="select-parameters2" resultMap="select-results">
- <![CDATA[
- select seqNum, value, valueUnits, ttl, numBytes, numBytesUnits,
timeValue, timeType
- from clmp_ping
- where metadataId = ?
- and timeValue = (select MAX(timeValue) from clmp_ping where
metadataId = ?)
- ]]>
- </select>
-
-
-
- <!-- storing -->
-
-
- <parameterMap id="insert-parameters" class="java.util.HashMap">
- <parameter property="metadataId" />
- <parameter property="seqNum" />
- <parameter property="value" />
- <parameter property="valueUnits" />
- <parameter property="ttl" />
- <parameter property="numBytes" />
- <parameter property="numBytesUnits" />
- <parameter property="timeValue" />
- <parameter property="timeType" />
- </parameterMap>
-
- <insert id="setResults"
- parameterMap="insert-parameters">
- <![CDATA[
- insert into clmp_ping (metadataId, seqNum, value, valueUnits, ttl,
numBytes, numBytesUnits, timeValue, timeType, ts )
- values (?, ?, ?, ?, ?, ?, ?, ?, ?, default)
- ]]>
- </insert>
-
-</sqlMap>
Deleted: trunk/perfsonar-java-sql-ma/conf/ibatis-discards.xml
===================================================================
--- trunk/perfsonar-java-sql-ma/conf/ibatis-discards.xml 2012-11-27
14:55:06 UTC (rev 6043)
+++ trunk/perfsonar-java-sql-ma/conf/ibatis-discards.xml 2012-11-28
10:13:12 UTC (rev 6044)
@@ -1,87 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE sqlMap
- PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
- "http://www.ibatis.com/dtd/sql-map-2.dtd">
-
-
-<!-- $Id$ -->
-<!-- romradz -->
-
-
-<sqlMap namespace="Results">
-
-
-
- <!-- fetching -->
-
-
-
- <resultMap id="select-results" class="java.util.HashMap">
- <result property="value" column="value" />
- <result property="timeValue" column="timeValue" />
- <result property="valueUnits" column="valueUnits" />
- </resultMap>
-
-
- <parameterMap id="select-parameters1" class="java.util.HashMap">
- <parameter property="metadataId" />
- <parameter property="startTime" />
- <parameter property="endTime" />
- </parameterMap>
-
-
- <select id="getResults1"
- parameterMap="select-parameters1" resultMap="select-results">
- <![CDATA[
- select value, timeValue, valueUnits
- from perfsonar_discards
- where metadataId = ?
- and timeValue >= ?
- and timeValue <= ?
- order by timeValue ASC
- ]]>
- </select>
-
-
-
- <parameterMap id="select-parameters2" class="java.util.HashMap">
- <parameter property="metadataId" />
- <parameter property="metadataId" />
- </parameterMap>
-
-
- <select id="getResults2"
- parameterMap="select-parameters2" resultMap="select-results">
- <![CDATA[
- select value, timeValue, valueUnits
- from perfsonar_discards
- where metadataId = ?
- and timeValue = (select MAX(timeValue) from perfsonar_discards where
metadataId = ?)
- ]]>
- </select>
-
-
-
- <!-- storing -->
-
-
-
- <parameterMap id="insert-parameters" class="java.util.HashMap">
- <parameter property="metadataId" />
- <parameter property="value" />
- <parameter property="valueUnits" />
- <parameter property="timeValue" />
- </parameterMap>
-
-
- <insert id="setResults"
- parameterMap="insert-parameters">
- <![CDATA[
- insert into perfsonar_discards (metadataId, value, valueUnits,
timeValue, ts)
- values (?, ?, ?, ?, default)
- ]]>
- </insert>
-
-
-
-</sqlMap>
Deleted: trunk/perfsonar-java-sql-ma/conf/ibatis-errors.xml
===================================================================
--- trunk/perfsonar-java-sql-ma/conf/ibatis-errors.xml 2012-11-27 14:55:06
UTC (rev 6043)
+++ trunk/perfsonar-java-sql-ma/conf/ibatis-errors.xml 2012-11-28 10:13:12
UTC (rev 6044)
@@ -1,87 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE sqlMap
- PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
- "http://www.ibatis.com/dtd/sql-map-2.dtd">
-
-
-<!-- $Id$ -->
-<!-- romradz -->
-
-
-<sqlMap namespace="Results">
-
-
-
- <!-- fetching -->
-
-
-
- <resultMap id="select-results" class="java.util.HashMap">
- <result property="value" column="value" />
- <result property="timeValue" column="timeValue" />
- <result property="valueUnits" column="valueUnits" />
- </resultMap>
-
-
- <parameterMap id="select-parameters1" class="java.util.HashMap">
- <parameter property="metadataId" />
- <parameter property="startTime" />
- <parameter property="endTime" />
- </parameterMap>
-
-
- <select id="getResults1"
- parameterMap="select-parameters1" resultMap="select-results">
- <![CDATA[
- select value, timeValue, valueUnits
- from perfsonar_errors
- where metadataId = ?
- and timeValue >= ?
- and timeValue <= ?
- order by timeValue ASC
- ]]>
- </select>
-
-
-
- <parameterMap id="select-parameters2" class="java.util.HashMap">
- <parameter property="metadataId" />
- <parameter property="metadataId" />
- </parameterMap>
-
-
- <select id="getResults2"
- parameterMap="select-parameters2" resultMap="select-results">
- <![CDATA[
- select value, timeValue, valueUnits
- from perfsonar_errors
- where metadataId = ?
- and timeValue = (select MAX(timeValue) from perfsonar_errors where
metadataId = ?)
- ]]>
- </select>
-
-
-
- <!-- storing -->
-
-
-
- <parameterMap id="insert-parameters" class="java.util.HashMap">
- <parameter property="metadataId" />
- <parameter property="value" />
- <parameter property="valueUnits" />
- <parameter property="timeValue" />
- </parameterMap>
-
-
- <insert id="setResults"
- parameterMap="insert-parameters">
- <![CDATA[
- insert into perfsonar_errors (metadataId, value, valueUnits,
timeValue, ts)
- values (?, ?, ?, ?, default)
- ]]>
- </insert>
-
-
-
-</sqlMap>
Deleted: trunk/perfsonar-java-sql-ma/conf/ibatis-iperf.xml
===================================================================
--- trunk/perfsonar-java-sql-ma/conf/ibatis-iperf.xml 2012-11-27 14:55:06
UTC (rev 6043)
+++ trunk/perfsonar-java-sql-ma/conf/ibatis-iperf.xml 2012-11-28 10:13:12
UTC (rev 6044)
@@ -1,99 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE sqlMap
- PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
- "http://www.ibatis.com/dtd/sql-map-2.dtd">
-
-
-<!-- $Id$ -->
-<!-- romradz -->
-
-
-<sqlMap namespace="Results">
-
-
-
- <!-- fetching -->
-
-
-
- <resultMap id="select-results" class="java.util.HashMap">
- <result property="value" column="value" />
- <result property="valueUnits" column="valueUnits" />
- <result property="numBytes" column="numBytes" />
- <result property="numBytesUnits" column="numBytesUnits" />
- <result property="time" column="time" />
- <result property="interv" column="interv" />
- <result property="throughput" column="throughput" />
- <result property="jitter" column="jitter" />
- <result property="loss" column="loss" />
- </resultMap>
-
-
- <parameterMap id="select-parameters1" class="java.util.HashMap">
- <parameter property="metadataId" />
- <parameter property="startTime" />
- <parameter property="endTime" />
- </parameterMap>
-
-
- <select id="getResults1"
- parameterMap="select-parameters1" resultMap="select-results">
- <![CDATA[
- select value, valueUnits, numBytes, numBytesUnits, time, interv,
throughput, jitter, loss
- from perfsonar_iperf
- where metadataId = ?
- and time >= ?
- and time <= ?
- order by time ASC
- ]]>
- </select>
-
-
-
- <parameterMap id="select-parameters2" class="java.util.HashMap">
- <parameter property="metadataId" />
- <parameter property="metadataId" />
- </parameterMap>
-
-
- <select id="getResults2"
- parameterMap="select-parameters2" resultMap="select-results">
- <![CDATA[
- select value, valueUnits, numBytes, numBytesUnits, time, interv,
throughput, jitter, loss
- from perfsonar_iperf
- where metadataId = ?
- and time = (select MAX(time) from perfsonar_iperf where metadataId =
?)
- ]]>
- </select>
-
-
-
- <!-- storing -->
-
-
-
- <parameterMap id="insert-parameters" class="java.util.HashMap">
- <parameter property="metadataId" />
- <parameter property="value" />
- <parameter property="valueUnits" />
- <parameter property="numBytes" />
- <parameter property="numBytesUnits" />
- <parameter property="time" />
- <parameter property="interv" />
- <parameter property="throughput" />
- <parameter property="jitter" />
- <parameter property="loss" />
- </parameterMap>
-
-
- <insert id="setResults"
- parameterMap="insert-parameters">
- <![CDATA[
- insert into perfsonar_iperf (metadataId, value, valueUnits,
numBytes, numBytesUnits, time, interv, throughput, jitter, loss, ts)
- values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, default)
- ]]>
- </insert>
-
-
-
-</sqlMap>
Deleted: trunk/perfsonar-java-sql-ma/conf/ibatis-owamp-aggregation.xml
===================================================================
--- trunk/perfsonar-java-sql-ma/conf/ibatis-owamp-aggregation.xml
2012-11-27 14:55:06 UTC (rev 6043)
+++ trunk/perfsonar-java-sql-ma/conf/ibatis-owamp-aggregation.xml
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,91 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE sqlMap
- PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
- "http://www.ibatis.com/dtd/sql-map-2.dtd">
-
-
-<sqlMap namespace="Results">
-
- <!-- fetching -->
-
- <resultMap id="select-results" class="java.util.HashMap">
- <result property="sender" column="sender" />
- <result property="receiver" column="receiver" />
- <result property="sent" column="sent" />
- <result property="loss" column="loss" />
- <result property="lostPercent" column="lostPercent" />
- <result property="duplicates" column="duplicates" />
- <result property="minDelay" column="minDelay" />
- <result property="medDelay" column="medDelay" />
- <result property="maxDelay" column="maxDelay" />
- <result property="delayUnits" column="delayUnits" />
- <result property="error" column="error" />
- <result property="errorUnits" column="errorUnits" />
- <result property="jitter" column="jitter" />
- <result property="jitterUnits" column="jitterUnits" />
- <result property="hops" column="hops" />
- </resultMap>
-
-
- <parameterMap id="select-parameters1" class="java.util.HashMap">
- <parameter property="metadataId" />
- <parameter property="startTime" />
- <parameter property="endTime" />
- </parameterMap>
-
-
- <parameterMap id="select-parameters2" class="java.util.HashMap">
- <parameter property="metadataId" />
- </parameterMap>
-
- <select id="getResults1" parameterMap="select-parameters1"
- resultMap="select-results">
- <![CDATA[
- select sender, receiver, sent, loss, lostPercent, duplicates,
minDelay, medDelay, maxDelay, delayUnits, error, errorUnits, jitter,
jitterUnits, hops
- from owamp_agg
- where metadataId = ?
- and ts >= ?
- and ts <= ?
- order by ts ASC
- ]]>
- </select>
-
- <select id="getResults2" parameterMap="select-parameters2"
- resultMap="select-results">
- <![CDATA[
- select sender, receiver, sent, loss, lostPercent, duplicates,
minDelay, medDelay, maxDelay, delayUnits, error, errorUnits, jitter,
jitterUnits, hops
- from owamp_agg
- where metadataId = ?
- ]]>
- </select>
-
-
- <!-- storing -->
-
- <parameterMap id="insert-parameters" class="java.util.HashMap">
- <parameter property="metadataId" />
- <parameter property="sender" />
- <parameter property="receiver" />
- <parameter property="sent" />
- <parameter property="loss" />
- <parameter property="lostPercent" />
- <parameter property="duplicates" />
- <parameter property="minDelay" />
- <parameter property="medDelay" />
- <parameter property="maxDelay" />
- <parameter property="delayUnits" />
- <parameter property="error" />
- <parameter property="errorUnits" />
- <parameter property="jitter" />
- <parameter property="jitterUnits" />
- <parameter property="hops" />
- </parameterMap>
-
- <insert id="setResults" parameterMap="insert-parameters">
- <![CDATA[
- insert into owamp_agg (metadataId, sender, receiver, sent, loss,
lostPercent, duplicates, minDelay, medDelay, maxDelay, delayUnits, error,
errorUnits, jitter, jitterUnits, hops, ts)
- values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, default)
- ]]>
- </insert>
-
-</sqlMap>
Deleted: trunk/perfsonar-java-sql-ma/conf/ibatis-utilization.xml
===================================================================
--- trunk/perfsonar-java-sql-ma/conf/ibatis-utilization.xml 2012-11-27
14:55:06 UTC (rev 6043)
+++ trunk/perfsonar-java-sql-ma/conf/ibatis-utilization.xml 2012-11-28
10:13:12 UTC (rev 6044)
@@ -1,87 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE sqlMap
- PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
- "http://www.ibatis.com/dtd/sql-map-2.dtd">
-
-
-<!-- $Id$ -->
-<!-- romradz -->
-
-
-<sqlMap namespace="Results">
-
-
-
- <!-- fetching -->
-
-
-
- <resultMap id="select-results" class="java.util.HashMap">
- <result property="value" column="value" />
- <result property="timeValue" column="timeValue" />
- <result property="valueUnits" column="valueUnits" />
- </resultMap>
-
-
- <parameterMap id="select-parameters1" class="java.util.HashMap">
- <parameter property="metadataId" />
- <parameter property="startTime" />
- <parameter property="endTime" />
- </parameterMap>
-
-
- <select id="getResults1"
- parameterMap="select-parameters1" resultMap="select-results">
- <![CDATA[
- select value, timeValue, valueUnits
- from perfsonar_utilization
- where metadataId = ?
- and timeValue >= ?
- and timeValue <= ?
- order by timeValue ASC
- ]]>
- </select>
-
-
-
- <parameterMap id="select-parameters2" class="java.util.HashMap">
- <parameter property="metadataId" />
- <parameter property="metadataId" />
- </parameterMap>
-
-
- <select id="getResults2"
- parameterMap="select-parameters2" resultMap="select-results">
- <![CDATA[
- select value, timeValue, valueUnits
- from perfsonar_utilization
- where metadataId = ?
- and timeValue = (select MAX(timeValue) from perfsonar_utilization
where metadataId = ?)
- ]]>
- </select>
-
-
-
- <!-- storing -->
-
-
-
- <parameterMap id="insert-parameters" class="java.util.HashMap">
- <parameter property="metadataId" />
- <parameter property="value" />
- <parameter property="valueUnits" />
- <parameter property="timeValue" />
- </parameterMap>
-
-
- <insert id="setResults"
- parameterMap="insert-parameters">
- <![CDATA[
- insert into perfsonar_utilization (metadataId, value, valueUnits,
timeValue, ts)
- values (?, ?, ?, ?, default)
- ]]>
- </insert>
-
-
-
-</sqlMap>
Modified: trunk/perfsonar-java-sql-ma/conf/service.properties
===================================================================
--- trunk/perfsonar-java-sql-ma/conf/service.properties 2012-11-27 14:55:06
UTC (rev 6043)
+++ trunk/perfsonar-java-sql-ma/conf/service.properties 2012-11-28 10:13:12
UTC (rev 6044)
@@ -154,3 +154,22 @@
# Description=Determines whether new data sent to the service is stored (on)
or not (off).
service.ma.xmldb.db_store=on
+
+#
-----------------------------------------------------------------------------------------------
+# Configuration of database settings
+
+# Group=JDBC
+# Description=The JDBC driver name
+service.ma.jdbc.driver=com.mysql.jdbc.Driver
+
+# Group=JDBC
+# Description=The JDBC connection URL
+service.ma.jdbc.url=jdbc:mysql://127.0.0.1/perfsonar_ma
+
+# Group=JDBC
+# Description=Database user name
+service.ma.jdbc.username=perfsonar_ma
+
+# Group=JDBC
+# Description=Database password
+service.ma.jdbc.password=testpass
\ No newline at end of file
Modified: trunk/perfsonar-java-sql-ma/pom.xml
===================================================================
--- trunk/perfsonar-java-sql-ma/pom.xml 2012-11-27 14:55:06 UTC (rev 6043)
+++ trunk/perfsonar-java-sql-ma/pom.xml 2012-11-28 10:13:12 UTC (rev 6044)
@@ -273,19 +273,14 @@
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>net.geant.perfsonar</groupId>
- <artifactId>ibatis-sqlmap</artifactId>
- <version>2.1.7.597</version>
- </dependency>
- <dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
- <version>5.0.3</version>
+ <version>5.1.9</version>
</dependency>
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
- <version>8.1-407.jdbc3</version>
+ <version>9.1-901.jdbc4</version>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -293,6 +288,30 @@
<version>4.4</version>
<scope>test</scope>
</dependency>
+
+ <dependency>
+ <groupId>com.jolbox</groupId>
+ <artifactId>bonecp</artifactId>
+ <version>0.7.1.RELEASE</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-jdbc</artifactId>
+ <version>3.1.3.RELEASE</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>1.5.10</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>13.0.1</version>
+ </dependency>
</dependencies>
<reporting>
<excludeDefaults>true</excludeDefaults>
Added:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/JdbcStorageManager.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/JdbcStorageManager.java
(rev 0)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/JdbcStorageManager.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -0,0 +1,232 @@
+package org.perfsonar.service.measurementArchive.sqlType;
+
+import com.jolbox.bonecp.BoneCPDataSource;
+import org.ggf.ns.nmwg.base.v2_0.Data;
+import org.ggf.ns.nmwg.base.v2_0.Element;
+import org.ggf.ns.nmwg.base.v2_0.Key;
+import org.ggf.ns.nmwg.base.v2_0.Message;
+import org.ggf.ns.nmwg.base.v2_0.Metadata;
+import org.perfsonar.base.auxiliary.AuxiliaryComponentManager;
+import org.perfsonar.base.auxiliary.ComponentNames;
+import
org.perfsonar.base.auxiliary.components.configuration.ConfigurationComponent;
+import org.perfsonar.base.auxiliary.components.logger.LoggerComponent;
+import org.perfsonar.base.exceptions.PerfSONARException;
+import org.perfsonar.service.base.storage.NMWGStorageManager;
+import org.perfsonar.service.base.util.ResultCodesUtil;
+import org.perfsonar.service.measurementArchive.sqlType.dao.Dao;
+import org.perfsonar.service.measurementArchive.sqlType.dao.DaoProvider;
+import
org.perfsonar.service.measurementArchive.sqlType.transaction.FallibleTransactionCallback;
+import
org.perfsonar.service.measurementArchive.sqlType.transaction.FallibleTransactionTemplate;
+import org.springframework.jdbc.datasource.DataSourceTransactionManager;
+import org.springframework.transaction.TransactionStatus;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.ServiceLoader;
+import java.util.Vector;
+
+import static com.google.common.base.Strings.nullToEmpty;
+
+/**
+ * NMWGStorageManager based on plain JDBC.
+ *
+ * Delegates all fetch and store operations to event type specific DAOs. This
+ * class only contains the logic to break down store and query messages into
+ * event type specific DAO operations.
+ *
+ * JdbcStorageManager instantiates and manages the lifetime of the JDBC data
+ * source (wrapped in a BoneCP connection pool) and wraps all fetch and store
+ * operations in Spring transactions.
+ */
+public final class JdbcStorageManager implements NMWGStorageManager
+{
+ private static final String SERVICE_MA_JDBC_DRIVER =
"service.ma.jdbc.driver";
+ private static final String SERVICE_MA_JDBC_URL = "service.ma.jdbc.url";
+ private static final String SERVICE_MA_JDBC_USERNAME =
"service.ma.jdbc.username";
+ private static final String SERVICE_MA_JDBC_PASSWORD =
"service.ma.jdbc.password";
+
+ private static JdbcStorageManager instance;
+
+ private final LoggerComponent logger;
+ private final BoneCPDataSource dataSource;
+ private final FallibleTransactionTemplate tx;
+ private final Map<String, Dao> daos = new HashMap<String, Dao>();
+
+ private final ServiceLoader<DaoProvider> providers =
ServiceLoader.load(DaoProvider.class);
+
+ public static synchronized JdbcStorageManager getInstance() throws
PerfSONARException
+ {
+ if (instance == null) {
+ instance = new JdbcStorageManager();
+ }
+ return instance;
+ }
+
+ private JdbcStorageManager() throws PerfSONARException
+ {
+ logger = (LoggerComponent)
+ AuxiliaryComponentManager.
+ getInstance().
+ getComponent(ComponentNames.LOGGER);
+
+ dataSource = createDataSource();
+ tx = new FallibleTransactionTemplate(new
DataSourceTransactionManager(dataSource));
+ }
+
+ private static BoneCPDataSource createDataSource() throws
PerfSONARException
+ {
+ ConfigurationComponent config = (ConfigurationComponent)
AuxiliaryComponentManager.
+ getInstance().
+ getComponent(ComponentNames.CONFIG);
+
+ String driver =
nullToEmpty(config.getProperty(SERVICE_MA_JDBC_DRIVER));
+ try {
+ Class.forName(driver);
+ } catch (ClassNotFoundException e) {
+ throw new PerfSONARException("error.ma.query", "Unsupported JDBC
driver: " + driver);
+ }
+
+ final BoneCPDataSource dataSource = new BoneCPDataSource();
+
dataSource.setJdbcUrl(nullToEmpty(config.getProperty(SERVICE_MA_JDBC_URL)));
+
dataSource.setUsername(nullToEmpty(config.getProperty(SERVICE_MA_JDBC_USERNAME)));
+
dataSource.setPassword(nullToEmpty(config.getProperty(SERVICE_MA_JDBC_PASSWORD)));
+
+ Runtime.getRuntime().addShutdownHook(
+ new Thread()
+ {
+ public void run()
+ {
+ dataSource.close();
+ }
+ }
+ );
+
+ return dataSource;
+ }
+
+ private synchronized Dao getDao(String eventType) throws
PerfSONARException
+ {
+ Dao dao = daos.get(eventType);
+ if (dao == null) {
+ dao = createDao(eventType);
+ daos.put(eventType, dao);
+ }
+ return dao;
+ }
+
+ private Dao createDao(String eventType) throws PerfSONARException
+ {
+ for (DaoProvider provider: providers) {
+ Dao dao = provider.createDao(eventType, dataSource);
+ if (dao != null) {
+ return dao;
+ }
+ }
+ throw new PerfSONARException("error.ma.query", "Unsupported event
type: " + eventType);
+ }
+
+ @Override
+ public void initStorage(Key dataRepository)
+ throws PerfSONARException
+ {
+ }
+
+ @Override
+ public Message fetch(final Message dataQuery)
+ throws PerfSONARException
+ {
+ if (dataQuery == null) {
+ throw new PerfSONARException(
+ "error.ma.query",
+ "SQLStorageManager.fetch: "
+ + "Query message is null");
+ }
+
+ return tx.execute(new FallibleTransactionCallback<Message,
PerfSONARException>() {
+ @Override
+ public Message doInFallibleTransaction(TransactionStatus
transactionStatus)
+ throws PerfSONARException
+ {
+ Message response = new Message();
+
+ Collection<Metadata> collection =
dataQuery.getMetadataMap().values();
+
+ for (Metadata md : collection) {
+ Key key = md.getKey();
+
+ String eventType =
md.getKey().getParameterByName("http://ggf.org/ns/nmwg/base/2.0/",
+
"eventType").getParameterValue();
+ Dao dao = getDao(eventType);
+
+ response.addChild(md);
+ response.addChild(dao.fetch(key));
+ }
+
+ return response;
+ }
+ });
+ }
+
+ @Override
+ public Message store(final Message dataSet)
+ throws PerfSONARException
+ {
+ if (dataSet == null) {
+ throw new PerfSONARException(
+ "error.ma.query",
+ "SQLStorageManager.store: Input request is null");
+ }
+
+ tx.execute(new FallibleTransactionCallback<Void,
PerfSONARException>() {
+ @Override
+ public Void doInFallibleTransaction(TransactionStatus
transactionStatus)
+ throws PerfSONARException
+ {
+ Collection<Metadata> collection =
dataSet.getMetadataMap().values();
+ for (Metadata md : collection) {
+ String eventType =
+
md.getKey().getParameterByName("http://ggf.org/ns/nmwg/base/2.0/",
+
"eventType").getParameterValue();
+ Dao dao = getDao(eventType);
+
+ Data data = dataSet.getDataArray()[0];
+
+ Vector datumVector = data.getDatum();
+ if (datumVector == null) {
+ throw new PerfSONARException(
+ "error.ma.query",
+ "SQLStorageManager.store: Data element with
id='" + data.getId() + "' is empty.");
+ }
+
+ for (Object datum: datumVector) {
+ dao.store(md, (Element) datum);
+ }
+ }
+ return null;
+ }
+ });
+
+ PerfSONARException pex = new PerfSONARException(
+ "success.ma.write",
+ "Data have been stored");
+ return ResultCodesUtil.createResultCodeMetadata(new Message(), pex);
+ }
+
+ @Override
+ public Message remove(Message dataSet) throws PerfSONARException
+ {
+ return null;
+ }
+
+ @Override
+ public void removeAll() throws PerfSONARException
+ {
+ }
+
+ @Override
+ public Message update(Message dataSet) throws PerfSONARException
+ {
+ return null;
+ }
+}
Deleted:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/SQLStorageManager.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/SQLStorageManager.java
2012-11-27 14:55:06 UTC (rev 6043)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/SQLStorageManager.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,335 +0,0 @@
-/**
- * $Id$
- * Project: perfSONAR
- */
-package org.perfsonar.service.measurementArchive.sqlType;
-
-
-import java.util.Map;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Collection;
-
-import java.io.Reader;
-
-import com.ibatis.sqlmap.client.SqlMapClient;
-import com.ibatis.sqlmap.client.SqlMapClientBuilder;
-import com.ibatis.common.resources.Resources;
-
-import org.perfsonar.service.base.storage.NMWGStorageManager;
-import org.perfsonar.service.base.util.ResultCodesUtil;
-
-import org.perfsonar.base.util.TimeDateUtil;
-
-import org.perfsonar.base.auxiliary.AuxiliaryComponentManager;
-import org.perfsonar.base.auxiliary.ComponentNames;
-import org.perfsonar.base.auxiliary.components.logger.LoggerComponent;
-
-import org.ggf.ns.nmwg.base.v2_0.Message;
-import org.ggf.ns.nmwg.base.v2_0.Key;
-import org.ggf.ns.nmwg.base.v2_0.Metadata;
-import org.ggf.ns.nmwg.base.v2_0.Data;
-import org.ggf.ns.nmwg.base.v2_0.Parameter;
-import org.ggf.ns.nmwg.base.v2_0.Parameters;
-
-import org.perfsonar.base.exceptions.PerfSONARException;
-
-import
org.perfsonar.service.measurementArchive.sqlType.fetch.ResponseGenerator;
-import
org.perfsonar.service.measurementArchive.sqlType.fetch.ResponseGeneratorFactory;
-
-import
org.perfsonar.service.measurementArchive.sqlType.store.StoreRequestProcess;
-import
org.perfsonar.service.measurementArchive.sqlType.store.StoreRequestProcessFactory;
-
-/**
- * SQL storage manager responsible for accessing an sql database.
- *
- * @author romradz
- */
-public class SQLStorageManager implements NMWGStorageManager
-{
-
-
- // ---------------------------------- class fields
-
-
- private LoggerComponent logger = null;
-
-
- // ---------------------------------- constructors
-
-
- public SQLStorageManager() throws PerfSONARException
- {
-
- try {
-
- this.logger = (LoggerComponent)
- AuxiliaryComponentManager.
- getInstance().
- getComponent(ComponentNames.LOGGER);
-
- } catch (PerfSONARException e) {
-
- throw new PerfSONARException(
- "error.common.no_logger",
- "SQLStorageManager.constructor: "
- + "Cannot get logger component");
-
- }
-
- }
-
-
- // ---------------------------------- methods
-
-
- @Override
- public void initStorage(Key dataRepository)
- throws PerfSONARException
- {
-
- //do nothing
-
- }
-
-
- @Override
- public Message fetch(Message dataQuery)
- throws PerfSONARException
- {
-
- if (dataQuery == null) {
- throw new PerfSONARException(
- "error.ma.query",
- "SQLStorageManager.fetch: "
- + "Query message is null");
- }
-
-
- Message response = new Message();
-
- Collection<Metadata> collection =
dataQuery.getMetadataMap().values();
-
- for (Metadata md : collection) {
-
- Key key = md.getKey();
-
- Map<String, Object> ibatisParams = new HashMap<String, Object>();
-
- Map parametersMap = key.getParametersMap();
- for (Object o : parametersMap.values()) {
-
- Parameters params = (Parameters) o;
- Parameter[] paramsArray = params.getParameterArray();
-
- for (Parameter p : paramsArray) {
-
- String pname = p.getParameterName();
- //String pvalue = p.getParameterValue();
- String pvalue;
-
- //logger.debug("SQLStorageManager.fetch: param [name,
value]: ["
- // + pname + ", " + pvalue + "]");
-
- if (pname.equals("startTime")) {
- long startTime;
- 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 if (pname.equals("endTime")) {
- long endTime;
- 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;
-
-
- // ibatis action
-
- try {
-
- String resource = (String) ibatisParams.get("ibatisConfig");
- SqlMapClient sqlMap;
- Reader reader = Resources.getResourceAsReader(resource);
- sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
-
- List resultList;
-
- if (ibatisParams.get("time") != null) {
-
- if (((String)
ibatisParams.get("time")).equalsIgnoreCase("now")) {
- resultList = sqlMap.queryForList("getResults2",
ibatisParams);
- } else {
- throw new PerfSONARException(
- "error.ma.query",
- "SQLStorageManager.fetch: "
- + "Uknown value of time parameter in the
request");
- }
- } else if (ibatisParams.get("startTime") != null &&
ibatisParams.get("endTime") != null) {
- resultList = sqlMap.queryForList("getResults1",
ibatisParams);
- } else {
- resultList = sqlMap.queryForList("getResults2",
ibatisParams);
- }
-
- //logger.debug("SQLStorageManager.fetch: "
- // + "The number of fetched rows from db for metadata "
- // + md.getId() + ": "
- // + resultList.size());
-
- String eventType = (String) ibatisParams.get("eventType");
- //logger.debug("SQLStorageManager.fetch: EventType: " +
eventType);
-
- ResponseGenerator responseGenerator =
- ResponseGeneratorFactory.getResponseGenerator(eventType);
- data = responseGenerator.getResponse(resultList);
-
- } catch (Exception ioex) {
-
- logger.error("SQLStorageManager.fetch: Unable to fetch data:
"
- + ioex.toString());
- throw new PerfSONARException(
- "error.sqlma.db_connection",
- "SQLStorageManager.fetch: Unable to fetch data"
- );
-
- }
-
- response.addChild(md);
- response.addChild(data);
-
- }
-
- return response;
-
- }
-
-
- @Override
- public Message store(Message dataSet)
- throws PerfSONARException
- {
-
- if (dataSet == null) {
- throw new PerfSONARException(
- "error.ma.query",
- "SQLStorageManager.store: Input request is null");
- }
-
- Message response = new Message();
-
- Collection<Metadata> collection = dataSet.getMetadataMap().values();
- for (Metadata md : collection) {
-
- Key key = md.getKey();
- Data data = dataSet.getDataArray()[0];
-
- // ibatis action
-
- Map ibatisParams = new HashMap();
-
- // moving parameters from key into ibatisParam map
- Parameter[] paramsArray =
key.getParameters().getParameterArray();
- for (Parameter param : paramsArray) {
- ibatisParams.put(param.getParameterName(),
param.getParameterValue());
- }
-
- String ibatisConfig = (String) ibatisParams.get("ibatisConfig");
-
- if (ibatisConfig == null) {
- throw new PerfSONARException(
- "error.sqlma.db_connection.ibatis",
- "SQLStorageManager.store: "
- + "No ibatisConfig parameter in the key");
- }
-
- if (ibatisConfig.trim().isEmpty()) {
- throw new PerfSONARException(
- "error.sqlma.db_connection.ibatis",
- "SQLStorageManager.store: "
- + "Empty ibatisConfig parameter in the key");
- }
-
-
- // getting data from Datum
- try {
-
- String resource = (String) ibatisParams.get("ibatisConfig");
- SqlMapClient sqlMap;
- Reader reader = Resources.getResourceAsReader(resource);
- sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
-
- String eventType = (String) ibatisParams.get("eventType");
- //logger.debug("SQLStorageManager.store: EventType: " +
eventType);
-
- StoreRequestProcess storeRequestProcess =
-
StoreRequestProcessFactory.getStoreRequestProcess(eventType);
- storeRequestProcess.process(sqlMap, data, ibatisParams);
-
- } catch (Exception ioex) {
-
- throw new PerfSONARException(
- "error.sqlma.db_connection",
- "SQLStorageManager.store: Problem generated by ibatis: "
- + ioex.toString());
-
- }
-
-
- }
-
- PerfSONARException pex = new PerfSONARException(
- "success.ma.write",
- "Data have been stored");
- response = ResultCodesUtil.createResultCodeMetadata(response, pex);
- return response;
-
- }
-
-
- @Override
- public Message remove(Message dataSet) throws PerfSONARException
- {
- return null;
- }
-
-
- @Override
- public void removeAll() throws PerfSONARException
- {
- }
-
-
- @Override
- public Message update(Message dataSet) throws PerfSONARException
- {
- return null;
- }
-
-
-} //SQLStorageManager
Modified:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/SQLTypeMAServiceEngine.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/SQLTypeMAServiceEngine.java
2012-11-27 14:55:06 UTC (rev 6043)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/SQLTypeMAServiceEngine.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -34,7 +34,6 @@
import org.perfsonar.service.base.storage.NMWGStorageManager;
import org.perfsonar.service.base.util.ResultCodesUtil;
import
org.perfsonar.service.measurementArchive.metadataConfig.MetadataConfigurationStorageManager;
-import
org.perfsonar.service.measurementArchive.eventTypeConfig.EventTypeConfigurationComponent;
/**
@@ -123,7 +122,7 @@
Message response = new Message();
- SQLStorageManager sqlStorageManager = new SQLStorageManager();
+ JdbcStorageManager storageManager = JdbcStorageManager.getInstance();
Message keyMessage = getKey(request);
@@ -146,7 +145,7 @@
dReq.addChild(dMet);
dMet.addChild(key);
- Message dMsg = sqlStorageManager.fetch(dReq);
+ Message dMsg = storageManager.fetch(dReq);
// putting in the response
@@ -180,7 +179,7 @@
Message response = new Message();
- SQLStorageManager sqlStorageManager = new SQLStorageManager();
+ JdbcStorageManager storageManager = JdbcStorageManager.getInstance();
Map metadataMap = request.getMetadataMap();
Collection<Data> collection = request.getDataMap().values();
@@ -204,7 +203,7 @@
//logger.debug("SQLTypeMAServiceEngine.storeData: "
// + "message for store method: " + msg.toString());
- response = sqlStorageManager.store(msg);
+ response = storageManager.store(msg);
}
@@ -240,23 +239,7 @@
Key key = metadata.getKey();
- if (key != null) {
- // check parameters in the key
- Parameter ibatisConfig = key.getParameterByName("ibatisConfig");
- if (ibatisConfig == null) {
- ibatisConfig = getIbatisConfig(eventType);
- if (ibatisConfig != null) {
- key.addParameter(ibatisConfig);
- }
- }
-
- if (ibatisConfig == null) {
- throw new PerfSONARException(
- "error.ma.query",
- "SQLTypeMAServiceEngine.getStoreKey: "
- + "No ibatisConfig parameter in the key");
- }
- } else {
+ if (key == null) {
// no key in the request
Message query = new Message();
query.addChild(metadata);
@@ -287,22 +270,7 @@
} else {
// metadata does not exist in xmldb
- // getting default ibatis parameter from service.properties
- String ibatisConfigStr;
- try {
- ibatisConfigStr =
-
configuration.getProperty("service.ma.sql.default_ibatis_config");
- } catch (Exception ex) {
- ibatisConfigStr = "";
- }
- Parameter ibatisConfig = null;
- if (!ibatisConfigStr.trim().isEmpty()) {
- ibatisConfig = new Parameter();
- ibatisConfig.setParameterName("ibatisConfig");
- ibatisConfig.setParameterValue(ibatisConfigStr);
- }
-
Key k = new Key();
Random rand = new Random((new Date()).getTime());
@@ -318,27 +286,6 @@
params.addParameter("eventType", eventType);
}
- if (ibatisConfig != null) {
- params.getParameterMap().remove("ibatisConfig");
- params.addChild(ibatisConfig);
-
- } else if (params.getParameterByName("ibatisConfig") ==
null) {
- ibatisConfig = getIbatisConfig(eventType);
- if (ibatisConfig != null) {
- params.addChild(ibatisConfig);
- }
- }
-
- if (params.getParameterByName("ibatisConfig") == null) {
- logger.error("SQLTypeMAServiceEngine.getStoreKey: "
- + "No default ibatis property in the key");
- throw new PerfSONARException(
- "error.ma.sql.db_connection.ibatis",
- "SQLTypeMAServiceEngine.getStoreKey: "
- + "No default ibatis property "
- + "in the service configuration file");
- }
-
k.addChild(params);
params.addParameter("metadataId", metadataId);
@@ -387,45 +334,6 @@
return newParameters;
}
-
- protected Parameter getIbatisConfig(String eventTypeStr)
- throws PerfSONARException
- {
- EventTypeConfigurationComponent eventTypeConfigurationComponent =
- (EventTypeConfigurationComponent)
- AuxiliaryComponentManager.
- getInstance().
- getComponent("eventType_config");
-
- org.perfsonar.service.measurementArchive.eventTypeConfig.EventType
eventType =
- eventTypeConfigurationComponent.getEventType(eventTypeStr);
-
- if (eventType == null) {
- throw new PerfSONARException(
- "error.ma.query",
- "SQLTypeMAServiceEngine.getIbatisConfig: "
- + "eventType " + eventTypeStr + " is not supported");
- }
-
- String ibatisConfigStr = eventType.getIbatisConfig();
-
- logger.debug(
- "SQLTypeMAServiceEngine.getIbatisConfig: "
- + "ibatisConfig parameter for eventType (" + eventTypeStr +
"): "
- + ibatisConfigStr);
-
- if (ibatisConfigStr == null || ibatisConfigStr.trim().isEmpty()) {
- return null;
- }
-
- Parameter ibatisConfig = new Parameter();
- ibatisConfig.setParameterName("ibatisConfig");
- ibatisConfig.setParameterValue(ibatisConfigStr);
-
- return ibatisConfig;
- }
-
-
protected Message replaceMetadataConfiguration(Message request)
throws PerfSONARException
{
@@ -561,7 +469,6 @@
}
-
protected void checkXmlDbAccessProprties() throws PerfSONARException
{
Added:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/AbstractDataResultSetExtractor.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/AbstractDataResultSetExtractor.java
(rev 0)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/AbstractDataResultSetExtractor.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -0,0 +1,37 @@
+package org.perfsonar.service.measurementArchive.sqlType.dao;
+
+import org.ggf.ns.nmwg.base.v2_0.Data;
+import org.ggf.ns.nmwg.base.v2_0.Element;
+import org.ggf.ns.nmwg.tools.iperf.v2_0.Datum;
+import org.springframework.jdbc.core.ResultSetExtractor;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+/**
+ * Abstract ResultSetExtractor mapping a ResultSet to an NMWG Data node.
+ *
+ * Subclasses have to implement the toDatum method.
+ */
+public abstract class AbstractDataResultSetExtractor implements
ResultSetExtractor<Data>
+{
+ @Override
+ public Data extractData(ResultSet rs) throws SQLException
+ {
+ Data data = new Data();
+ while (rs.next()) {
+ data.addChild(toDatum(rs));
+ }
+ return data;
+ }
+
+ protected void addToDatum(Datum datum, String attribute, ResultSet rs,
String column) throws SQLException
+ {
+ Object value = rs.getObject(column);
+ if (value != null) {
+ datum.addAttr(attribute, value.toString(), null);
+ }
+ }
+
+ protected abstract Element toDatum(ResultSet rs) throws SQLException;
+}
Added:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/BwctlDao.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/BwctlDao.java
(rev 0)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/BwctlDao.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -0,0 +1,129 @@
+package org.perfsonar.service.measurementArchive.sqlType.dao;
+
+import org.ggf.ns.nmwg.base.v2_0.Data;
+import org.ggf.ns.nmwg.base.v2_0.Element;
+import org.ggf.ns.nmwg.base.v2_0.Key;
+import org.ggf.ns.nmwg.base.v2_0.Metadata;
+import org.ggf.ns.nmwg.tools.bwctl.v2_0.Datum;
+import org.perfsonar.base.exceptions.PerfSONARException;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.jdbc.core.namedparam.SqlParameterSource;
+
+import javax.sql.DataSource;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Types;
+
+import static
org.perfsonar.service.measurementArchive.sqlType.dao.ParseUtils.parseLong;
+
+public class BwctlDao implements Dao
+{
+ private static final String NS_NMWG_BASE_2_0 =
"http://ggf.org/ns/nmwg/base/2.0/";
+
+ private final DaoJdbcTemplate jdbc;
+
+ public BwctlDao(DataSource dataSource) throws PerfSONARException
+ {
+ jdbc = new DaoJdbcTemplate(dataSource);
+ }
+
+ @Override
+ public void store(Metadata md, Element element)
+ throws PerfSONARException
+ {
+ Datum datum = (Datum) element;
+
+ SqlParameterSource parameters = new MapSqlParameterSource()
+ .addValue("metadataId",
+ md.getKey().getParameterByName(NS_NMWG_BASE_2_0,
"metadataId").getParameterValue(),
+ Types.VARCHAR)
+ .addValue("intervalEnd", datum.getIntervalEnd(), Types.VARCHAR)
+ .addValue("intervalStart", datum.getIntervalStart(),
Types.VARCHAR)
+ .addValue("intervalUnit", datum.getIntervalUnit(), Types.VARCHAR)
+ .addValue("numBytes", datum.getNumBytes(), Types.VARCHAR)
+ .addValue("numBytesUnits", datum.getNumBytesUnits(),
Types.VARCHAR)
+ .addValue("tcpAdapterType", datum.getTcpAdapterType(),
Types.VARCHAR)
+ .addValue("tcpMSSSize", datum.getTcpMSSSize(), Types.VARCHAR)
+ .addValue("timeType", datum.getTimeType(), Types.VARCHAR)
+ .addValue("timeValue", parseLong(datum.getTimeValue()).orNull(),
Types.VARCHAR)
+ .addValue("value", parseLong(datum.getValue()).orNull(),
Types.VARCHAR)
+ .addValue("valueUnits", datum.getValueUnits(), Types.VARCHAR)
+ .addValue("tcpMSSUnit", datum.getTcpMSSUnit(), Types.VARCHAR)
+ .addValue("tcpMTUSize", datum.getTcpMTUSize(), Types.VARCHAR)
+ .addValue("tcpMTUUnit", datum.getTcpMTUUnit(), Types.VARCHAR)
+ .addValue("tcpWindowSize", datum.getTcpWindowSize(),
Types.VARCHAR)
+ .addValue("tcpWindowUnit", datum.getTcpWindowUnit(),
Types.VARCHAR)
+ .addValue("udpBufferSize", datum.getUdpBufferSize(),
Types.VARCHAR)
+ .addValue("udpBufferUnit", datum.getUdpBufferUnit(),
Types.VARCHAR)
+ .addValue("udpJitter", datum.getUdpJitter(), Types.VARCHAR)
+ .addValue("udpJitterUnit", datum.getUdpJitterUnit(),
Types.VARCHAR)
+ .addValue("udpPacketLoss", datum.getUdpPacketLoss(),
Types.VARCHAR)
+ .addValue("udpPacketLossPercentage",
datum.getUdpPacketLossPercentage(), Types.VARCHAR)
+ .addValue("udpPacketSent", datum.getUdpPacketSent(),
Types.VARCHAR);
+
+ jdbc.update("INSERT INTO clmp_bwctl (metadataId, intervalEnd,
intervalStart, intervalUnit, numBytes, "
+ + "numBytesUnits, tcpAdapterType, tcpMSSSize,
timeType, timeValue, value, valueUnits, "
+ + "tcpMSSUnit, tcpMTUSize, tcpMTUUnit,
tcpWindowSize, tcpWindowUnit, udpBufferSize, "
+ + "udpBufferUnit, udpJitter, udpJitterUnit,
udpPacketLoss, udpPacketLossPercentage, "
+ + "udpPacketSent) VALUES (:metadataId, :intervalEnd,
:intervalStart, :intervalUnit, "
+ + ":numBytes, :numBytesUnits, :tcpAdapterType,
:tcpMSSSize, :timeType, :timeValue, "
+ + ":value, :valueUnits, :tcpMSSUnit, :tcpMTUSize,
:tcpMTUUnit, :tcpWindowSize, "
+ + ":tcpWindowUnit, :udpBufferSize, :udpBufferUnit,
:udpJitter, :udpJitterUnit, "
+ + ":udpPacketLoss, :udpPacketLossPercentage,
:udpPacketSent)", parameters);
+ }
+
+ @Override
+ public Data fetch(Key key)
+ throws PerfSONARException
+ {
+ return jdbc.select(key,
+ "SELECT intervalEnd, intervalStart, intervalUnit,
numBytes, numBytesUnits, "
+ + "tcpAdapterType, tcpMSSSize, timeType,
timeValue, value, valueUnits, "
+ + "tcpMSSUnit, tcpMTUSize, tcpMTUUnit,
tcpWindowSize, tcpWindowUnit, "
+ + "udpBufferSize, udpBufferUnit,
udpJitter, udpJitterUnit, udpPacketLoss, "
+ + "udpPacketLossPercentage, udpPacketSent "
+ + "FROM clmp_bwctl "
+ + "WHERE metadataId = :metadataId AND
timeValue BETWEEN :start AND :end "
+ + "ORDER BY timeValue ASC",
+ "SELECT intervalEnd, intervalStart, intervalUnit,
numBytes, numBytesUnits, "
+ + "tcpAdapterType, tcpMSSSize, timeType,
timeValue, value, valueUnits, "
+ + "tcpMSSUnit, tcpMTUSize, tcpMTUUnit,
tcpWindowSize, tcpWindowUnit, "
+ + "udpBufferSize, udpBufferUnit,
udpJitter, udpJitterUnit, udpPacketLoss, "
+ + "udpPacketLossPercentage, udpPacketSent "
+ + "FROM clmp_bwctl WHERE metadataId =
:metadataId",
+ new DataResultSetExtractor());
+ }
+
+ private static class DataResultSetExtractor extends
AbstractDataResultSetExtractor
+ {
+ @Override
+ protected Element toDatum(ResultSet rs) throws SQLException
+ {
+ Datum datum = new Datum();
+ datum.setIntervalEnd(rs.getString("intervalEnd"));
+ datum.setIntervalStart(rs.getString("intervalStart"));
+ datum.setIntervalUnit(rs.getString("intervalUnit"));
+ datum.setNumBytes(rs.getString("numBytes"));
+ datum.setNumBytesUnits(rs.getString("numBytesUnits"));
+ datum.setTimeType(rs.getString("timeType"));
+ datum.setTimeValue(rs.getString("timeValue"));
+ datum.setValue(rs.getString("value"));
+ datum.setValueUnits(rs.getString("valueUnits"));
+ datum.setTcpAdapterType(rs.getString("tcpAdapterType"));
+ datum.setTcpMSSSize(rs.getString("tcpMSSSize"));
+ datum.setTcpMSSUnit(rs.getString("tcpMSSUnit"));
+ datum.setTcpMTUUnit(rs.getString("tcpMTUUnit"));
+ datum.setTcpMTUSize(rs.getString("tcpMTUSize"));
+ datum.setTcpWindowSize(rs.getString("tcpWindowSize"));
+ datum.setTcpWindowUnit(rs.getString("tcpWindowUnit"));
+ datum.setUdpBufferSize(rs.getString("udpBufferSize"));
+ datum.setUdpBufferUnit(rs.getString("udpBufferUnit"));
+ datum.setUdpJitter(rs.getString("udpJitter"));
+ datum.setUdpJitterUnit(rs.getString("udpJitterUnit"));
+ datum.setUdpPacketLoss(rs.getString("udpPacketLoss"));
+
datum.setUdpPacketLossPercentage(rs.getString("udpPacketLossPercentage"));
+ datum.setUdpPacketSent(rs.getString("udpPacketSent"));
+ return datum;
+ }
+ }
+}
Added:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/Dao.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/Dao.java
(rev 0)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/Dao.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -0,0 +1,19 @@
+package org.perfsonar.service.measurementArchive.sqlType.dao;
+
+import org.ggf.ns.nmwg.base.v2_0.Data;
+import org.ggf.ns.nmwg.base.v2_0.Element;
+import org.ggf.ns.nmwg.base.v2_0.Key;
+import org.ggf.ns.nmwg.base.v2_0.Metadata;
+import org.perfsonar.base.exceptions.PerfSONARException;
+
+/**
+ * Data access object for a particular event type.
+ */
+public interface Dao
+{
+ Data fetch(Key key)
+ throws PerfSONARException;
+
+ void store(Metadata md, Element datum)
+ throws PerfSONARException;
+}
Added:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/DaoJdbcTemplate.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/DaoJdbcTemplate.java
(rev 0)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/DaoJdbcTemplate.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -0,0 +1,67 @@
+package org.perfsonar.service.measurementArchive.sqlType.dao;
+
+import org.ggf.ns.nmwg.base.v2_0.Data;
+import org.ggf.ns.nmwg.base.v2_0.Key;
+import org.ggf.ns.nmwg.base.v2_0.Parameter;
+import org.perfsonar.base.exceptions.PerfSONARException;
+import org.springframework.jdbc.core.ResultSetExtractor;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
+
+import javax.sql.DataSource;
+import java.sql.Types;
+
+/**
+ * Subclass of NamedParameterJdbcTemplate with functionality specific to SQL
MA DAOs.
+ */
+public class DaoJdbcTemplate
+ extends NamedParameterJdbcTemplate
+{
+ public static final String NS_NMWG_OPS_SELECT_2_0 =
"http://ggf.org/ns/nmwg/ops/select/2.0/";
+ public static final String NS_NMWG_BASE_2_0 =
"http://ggf.org/ns/nmwg/base/2.0/";
+
+ public DaoJdbcTemplate(DataSource dataSource)
+ {
+ super(dataSource);
+ }
+
+ /**
+ * Interprets query parameters in an NMWG key and executes either a
range query
+ * or a now query.
+ *
+ * @param key NMWG key.
+ * @param rangeSql SQL select statement with metadataId, start, and end
parameters.
+ * @param nowSql SQL select statement with a metadataId parameter.
+ * @param extractor ResultSetExtractor that maps a the ResultSet of the
query to an NMWG Data node.
+ * @return NMWG Data node produced by the extractor
+ * @throws PerfSONARException
+ */
+ public Data select(Key key, String rangeSql, String nowSql,
ResultSetExtractor<Data> extractor)
+ throws PerfSONARException
+ {
+ try {
+ Parameter startTime =
key.getParameterByName(NS_NMWG_OPS_SELECT_2_0, "startTime");
+ Parameter endTime =
key.getParameterByName(NS_NMWG_OPS_SELECT_2_0, "endTime");
+ Parameter time = key.getParameterByName(NS_NMWG_OPS_SELECT_2_0,
"time");
+ Parameter metadataId = key.getParameterByName(NS_NMWG_BASE_2_0,
"metadataId");
+
+ MapSqlParameterSource parameters =
+ new MapSqlParameterSource().addValue("metadataId",
metadataId.getParameterValue(), Types.VARCHAR);
+
+ if (time == null && startTime != null && endTime != null) {
+ parameters.addValue("start",
Long.parseLong(startTime.getParameterValue()), Types.INTEGER);
+ parameters.addValue("end",
Long.parseLong(endTime.getParameterValue()), Types.INTEGER);
+ return query(rangeSql, parameters, extractor);
+ } else {
+ if (time != null &&
!time.getParameterValue().equalsIgnoreCase("now")) {
+ throw new PerfSONARException("error.ma.query",
"SQLStorageManager.fetch: "
+ + "Unknown value of time parameter in the request");
+ }
+ return query(nowSql, parameters, extractor);
+ }
+ } catch (NumberFormatException e) {
+ throw new PerfSONARException("error.ma.query",
+ "SQLStorageManager.fetch: Invalid
time stamp: " + e.getMessage());
+ }
+ }
+}
Added:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/DaoProvider.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/DaoProvider.java
(rev 0)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/DaoProvider.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -0,0 +1,21 @@
+package org.perfsonar.service.measurementArchive.sqlType.dao;
+
+import org.perfsonar.base.exceptions.PerfSONARException;
+
+import javax.sql.DataSource;
+
+/**
+ * Service provider for Dao objects. A Dao returned by the provider should be
+ * able to participate in Spring managed transactions.
+ */
+public interface DaoProvider
+{
+ /**
+ * Returns a Dao for eventType or null if the eventType is not supported
by this provider.
+ * @param eventType NMWG event type
+ * @param dataSource JDBC DataSource
+ * @return A Dao for eventType or null
+ * @throws PerfSONARException
+ */
+ Dao createDao(String eventType, DataSource dataSource) throws
PerfSONARException;
+}
Added:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/DefaultDaoProvider.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/DefaultDaoProvider.java
(rev 0)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/DefaultDaoProvider.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -0,0 +1,43 @@
+package org.perfsonar.service.measurementArchive.sqlType.dao;
+
+import org.perfsonar.base.exceptions.PerfSONARException;
+
+import javax.sql.DataSource;
+
+public class DefaultDaoProvider implements DaoProvider
+{
+ private static final String EVENT_TYPE_BWCTL =
"http://ggf.org/ns/nmwg/tools/bwctl/2.0";
+ private static final String EVENT_TYPE_DISCARDS =
"http://ggf.org/ns/nmwg/characteristic/discards/2.0";
+ private static final String EVENT_TYPE_ERRORS =
"http://ggf.org/ns/nmwg/characteristic/errors/2.0";
+ private static final String EVENT_TYPE_IPERF =
"http://ggf.org/ns/nmwg/tools/iperf/2.0";
+ private static final String EVENT_TYPE_L2PATH =
"http://ggf.org/ns/nmwg/topology/l2/3.0/link/status";
+ private static final String EVENT_TYPE_OWAMP =
"http://ggf.org/ns/nmwg/tools/owamp/2.0";
+ private static final String EVENT_TYPE_PING =
"http://ggf.org/ns/nmwg/tools/ping/2.0";
+ private static final String EVENT_TYPE_UTILIZATION =
"http://ggf.org/ns/nmwg/characteristic/utilization/2.0";
+
+ @Override
+ public Dao createDao(String eventType, DataSource dataSource) throws
PerfSONARException
+ {
+ if (eventType.endsWith("/")) {
+ eventType = eventType.substring(0, eventType.length() - 1);
+ }
+ if (eventType.equals(EVENT_TYPE_BWCTL)) {
+ return new BwctlDao(dataSource);
+ } else if (eventType.equals(EVENT_TYPE_DISCARDS)) {
+ return new DiscardsDao(dataSource);
+ } else if (eventType.equals(EVENT_TYPE_ERRORS)) {
+ return new ErrorsDao(dataSource);
+ } else if (eventType.equals(EVENT_TYPE_IPERF)) {
+ return new IperfDao(dataSource);
+ } else if (eventType.equals(EVENT_TYPE_L2PATH)) {
+ return new L2PathDao(dataSource);
+ } else if (eventType.equals(EVENT_TYPE_OWAMP)) {
+ return new OwampDao(dataSource);
+ } else if (eventType.equals(EVENT_TYPE_PING)) {
+ return new PingDao(dataSource);
+ } else if (eventType.equals(EVENT_TYPE_UTILIZATION)) {
+ return new UtilizationDao(dataSource);
+ }
+ return null;
+ }
+}
Added:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/DiscardsDao.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/DiscardsDao.java
(rev 0)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/DiscardsDao.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -0,0 +1,79 @@
+package org.perfsonar.service.measurementArchive.sqlType.dao;
+
+import org.ggf.ns.nmwg.base.v2_0.Data;
+import org.ggf.ns.nmwg.base.v2_0.Element;
+import org.ggf.ns.nmwg.base.v2_0.Key;
+import org.ggf.ns.nmwg.base.v2_0.Metadata;
+import org.ggf.ns.nmwg.characteristic.discards.v2_0.Datum;
+import org.perfsonar.base.exceptions.PerfSONARException;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.jdbc.core.namedparam.SqlParameterSource;
+
+import javax.sql.DataSource;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Types;
+
+import static
org.perfsonar.service.measurementArchive.sqlType.dao.ParseUtils.parseFloat;
+import static
org.perfsonar.service.measurementArchive.sqlType.dao.ParseUtils.parseInteger;
+
+public class DiscardsDao implements Dao
+{
+ private static final String NS_NMWG_BASE_2_0 =
"http://ggf.org/ns/nmwg/base/2.0/";
+
+ private final DaoJdbcTemplate jdbc;
+
+ public DiscardsDao(DataSource dataSource) throws PerfSONARException
+ {
+ jdbc = new DaoJdbcTemplate(dataSource);
+ }
+
+ @Override
+ public void store(Metadata md, Element element)
+ throws PerfSONARException
+ {
+ Datum datum = (Datum) element;
+
+ SqlParameterSource parameters = new MapSqlParameterSource()
+ .addValue("metadataId",
+ md.getKey().getParameterByName(NS_NMWG_BASE_2_0,
"metadataId").getParameterValue(),
+ Types.VARCHAR)
+ .addValue("valueUnits", datum.getValueUnits(), Types.VARCHAR)
+ .addValue("timeValue",
parseInteger(datum.getTimeValue()).orNull(), Types.INTEGER)
+ .addValue("value", parseFloat(datum.getValue()).orNull(),
Types.FLOAT);
+
+ jdbc.update("INSERT INTO perfsonar_discards (metadataId, value,
valueUnits, timeValue) "
+ + "VALUES (:metadataId, :value, :valueUnits,
:timeValue)", parameters);
+ }
+
+ @Override
+ public Data fetch(Key key)
+ throws PerfSONARException
+ {
+ return jdbc.select(key,
+ "SELECT value, timeValue, valueUnits "
+ + "FROM perfsonar_discards "
+ + "WHERE metadataId = :metadataId AND
timeValue BETWEEN :start AND :end "
+ + "ORDER BY timeValue ASC",
+ "SELECT value, timeValue, valueUnits "
+ + "FROM perfsonar_discards "
+ + "WHERE metadataId = :metadataId"
+ + "AND timeValue = (SELECT MAX(timeValue)
FROM perfsonar_discards "
+ + "WHERE metadataId = :metadataId)",
+ new DataResultSetExtractor());
+ }
+
+ private static class DataResultSetExtractor extends
AbstractDataResultSetExtractor
+ {
+ @Override
+ protected Element toDatum(ResultSet rs) throws SQLException
+ {
+ Datum datum = new Datum();
+ datum.setValue(rs.getString("value"));
+ datum.setValueUnits(rs.getString("valueUnits"));
+ datum.setTimeValue(Integer.toString(rs.getInt("timeValue")));
+ datum.setTimeType("unix");
+ return datum;
+ }
+ }
+}
Added:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/ErrorsDao.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/ErrorsDao.java
(rev 0)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/ErrorsDao.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -0,0 +1,79 @@
+package org.perfsonar.service.measurementArchive.sqlType.dao;
+
+import org.ggf.ns.nmwg.base.v2_0.Data;
+import org.ggf.ns.nmwg.base.v2_0.Element;
+import org.ggf.ns.nmwg.base.v2_0.Key;
+import org.ggf.ns.nmwg.base.v2_0.Metadata;
+import org.ggf.ns.nmwg.characteristic.errors.v2_0.Datum;
+import org.perfsonar.base.exceptions.PerfSONARException;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.jdbc.core.namedparam.SqlParameterSource;
+
+import javax.sql.DataSource;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Types;
+
+import static
org.perfsonar.service.measurementArchive.sqlType.dao.ParseUtils.parseFloat;
+import static
org.perfsonar.service.measurementArchive.sqlType.dao.ParseUtils.parseInteger;
+
+public class ErrorsDao implements Dao
+{
+ private static final String NS_NMWG_BASE_2_0 =
"http://ggf.org/ns/nmwg/base/2.0/";
+
+ private final DaoJdbcTemplate jdbc;
+
+ public ErrorsDao(DataSource dataSource) throws PerfSONARException
+ {
+ jdbc = new DaoJdbcTemplate(dataSource);
+ }
+
+ @Override
+ public void store(Metadata md, Element element)
+ throws PerfSONARException
+ {
+ Datum datum = (Datum) element;
+
+ SqlParameterSource parameters = new MapSqlParameterSource()
+ .addValue("metadataId",
+ md.getKey().getParameterByName(NS_NMWG_BASE_2_0,
"metadataId").getParameterValue(),
+ Types.VARCHAR)
+ .addValue("valueUnits", datum.getValueUnits(), Types.VARCHAR)
+ .addValue("timeValue",
parseInteger(datum.getTimeValue()).orNull(), Types.INTEGER)
+ .addValue("value", parseFloat(datum.getValue()).orNull(),
Types.FLOAT);
+
+ jdbc.update("INSERT INTO perfsonar_errors (metadataId, value,
valueUnits, timeValue) "
+ + "VALUES (:metadataId, :value, :valueUnits,
:timeValue)", parameters);
+ }
+
+ @Override
+ public Data fetch(Key key)
+ throws PerfSONARException
+ {
+ return jdbc.select(key,
+ "SELECT value, timeValue, valueUnits "
+ + "FROM perfsonar_errors "
+ + "WHERE metadataId = :metadataId AND
timeValue BETWEEN :start AND :end "
+ + "ORDER BY timeValue ASC",
+ "SELECT value, timeValue, valueUnits "
+ + "FROM perfsonar_errors "
+ + "WHERE metadataId = :metadataId"
+ + "AND timeValue = (SELECT MAX(timeValue)
FROM perfsonar_errors "
+ + "WHERE metadataId = :metadataId)",
+ new DataResultSetExtractor());
+ }
+
+ private static class DataResultSetExtractor extends
AbstractDataResultSetExtractor
+ {
+ @Override
+ protected Element toDatum(ResultSet rs) throws SQLException
+ {
+ Datum datum = new Datum();
+ datum.setValue(rs.getString("value"));
+ datum.setValueUnits(rs.getString("valueUnits"));
+ datum.setTimeValue(rs.getString("timeValue"));
+ datum.setTimeType("unix");
+ return datum;
+ }
+ }
+}
Added:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/IperfDao.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/IperfDao.java
(rev 0)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/IperfDao.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -0,0 +1,97 @@
+package org.perfsonar.service.measurementArchive.sqlType.dao;
+
+import org.ggf.ns.nmwg.base.v2_0.Data;
+import org.ggf.ns.nmwg.base.v2_0.Element;
+import org.ggf.ns.nmwg.base.v2_0.Key;
+import org.ggf.ns.nmwg.base.v2_0.Metadata;
+import org.ggf.ns.nmwg.tools.iperf.v2_0.Datum;
+import org.perfsonar.base.exceptions.PerfSONARException;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.jdbc.core.namedparam.SqlParameterSource;
+
+import javax.sql.DataSource;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Types;
+
+import static
org.perfsonar.service.measurementArchive.sqlType.dao.ParseUtils.parseBigDecimal;
+import static
org.perfsonar.service.measurementArchive.sqlType.dao.ParseUtils.parseFloat;
+import static
org.perfsonar.service.measurementArchive.sqlType.dao.ParseUtils.parseInteger;
+import static
org.perfsonar.service.measurementArchive.sqlType.dao.ParseUtils.trim;
+
+public class IperfDao implements Dao
+{
+ private static final String NS_NMWG_BASE_2_0 =
"http://ggf.org/ns/nmwg/base/2.0/";
+
+ private final DaoJdbcTemplate jdbc;
+
+ public IperfDao(DataSource dataSource) throws PerfSONARException
+ {
+ jdbc = new DaoJdbcTemplate(dataSource);
+ }
+
+ @Override
+ public void store(Metadata md, Element element)
+ throws PerfSONARException
+ {
+ Datum datum = (Datum) element;
+
+ SqlParameterSource parameters = new MapSqlParameterSource()
+ .addValue("metadataId",
+ md.getKey().getParameterByName(NS_NMWG_BASE_2_0,
"metadataId").getParameterValue(),
+ Types.VARCHAR)
+ .addValue("time", parseInteger(datum.getTimeValue()).orNull(),
Types.INTEGER)
+ .addValue("value", parseFloat(datum.getValue()).orNull(),
Types.FLOAT)
+ .addValue("valueUnits", trim(datum.getValueUnits()).orNull(),
Types.VARCHAR)
+ .addValue("numBytes",
parseBigDecimal(datum.getNumBytes()).orNull(), Types.NUMERIC)
+ .addValue("numBytesUnits",
trim(datum.getNumBytesUnits()).orNull(), Types.VARCHAR)
+ .addValue("interv", trim(datum.getInterval()).orNull(),
Types.VARCHAR)
+ .addValue("throughput",
parseFloat(datum.getThroughput()).orNull(), Types.FLOAT)
+ .addValue("jitter", parseFloat(datum.getJitter()).orNull(),
Types.FLOAT)
+ .addValue("loss", trim(datum.getLoss()).orNull(), Types.VARCHAR);
+
+ jdbc.update("INSERT INTO perfsonar_iperf (metadataId, time, value, "
+ + "valueUnits, numBytes, numBytesUnits, interv,
throughput, jitter, "
+ + "loss) VALUES (:metadataId, :time, :value,
:valueUnits, :numBytes, :numBytesUnits, "
+ + ":interv, :throughput, :jitter, :loss)",
parameters);
+ }
+
+ @Override
+ public Data fetch(Key key)
+ throws PerfSONARException
+ {
+ return jdbc.select(key,
+ "SELECT value, valueUnits, numBytes,
numBytesUnits, time, "
+ + "interv, throughput, jitter, loss "
+ + "FROM perfsonar_iperf "
+ + "WHERE metadataId = :metadataId AND time
BETWEEN :start AND :end "
+ + "ORDER BY time ASC",
+ "SELECT value, valueUnits, numBytes,
numBytesUnits, time, "
+ + "interv, throughput, jitter, loss "
+ + "FROM perfsonar_iperf "
+ + "WHERE metadataId = :metadataId AND "
+ + "time = (SELECT MAX(time) "
+ + "FROM perfsonar_iperf WHERE metadataId =
:metadataId) "
+ + "ORDER BY time ASC",
+ new DataResultSetExtractor());
+ }
+
+ private static class DataResultSetExtractor extends
AbstractDataResultSetExtractor
+ {
+ @Override
+ protected Element toDatum(ResultSet rs) throws SQLException
+ {
+ Datum datum = new Datum();
+ addToDatum(datum, "value", rs, "value");
+ addToDatum(datum, "valueUnits", rs, "valueUnits");
+ addToDatum(datum, "numBytes", rs, "numBytes");
+ addToDatum(datum, "numBytesUnits", rs, "numBytesUnits");
+ addToDatum(datum, "timeValue", rs, "time");
+ addToDatum(datum, "interval", rs, "interv");
+ addToDatum(datum, "throughput", rs, "throughput");
+ addToDatum(datum, "jitter", rs, "jitter");
+ addToDatum(datum, "loss", rs, "loss");
+ return datum;
+ }
+ }
+}
Added:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/L2PathDao.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/L2PathDao.java
(rev 0)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/L2PathDao.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -0,0 +1,102 @@
+package org.perfsonar.service.measurementArchive.sqlType.dao;
+
+import org.ggf.ns.nmwg.base.v2_0.Data;
+import org.ggf.ns.nmwg.base.v2_0.Element;
+import org.ggf.ns.nmwg.base.v2_0.Key;
+import org.ggf.ns.nmwg.base.v2_0.Metadata;
+import org.ggf.ns.nmwg.event.status.base.v2_0.Datum;
+import org.ggf.ns.nmwg.event.status.base.v2_0.StateAdmin;
+import org.ggf.ns.nmwg.event.status.base.v2_0.StateOper;
+import org.perfsonar.base.exceptions.PerfSONARException;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.xml.sax.helpers.NamespaceSupport;
+
+import javax.sql.DataSource;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Types;
+import java.util.concurrent.TimeUnit;
+
+import static
org.perfsonar.service.measurementArchive.sqlType.dao.ParseUtils.parseIsoTime;
+import static
org.perfsonar.service.measurementArchive.sqlType.dao.ParseUtils.parseLong;
+
+public class L2PathDao implements Dao
+{
+ private static final String NS_NMWG_BASE_2_0 =
"http://ggf.org/ns/nmwg/base/2.0/";
+
+ private final DaoJdbcTemplate jdbc;
+
+ public L2PathDao(DataSource dataSource) throws PerfSONARException
+ {
+ jdbc = new DaoJdbcTemplate(dataSource);
+ }
+
+ @Override
+ public void store(Metadata md, Element element)
+ throws PerfSONARException
+ {
+ Datum datum = (Datum) element;
+
+ MapSqlParameterSource parameters = new MapSqlParameterSource()
+ .addValue("metadataId",
md.getKey().getParameterByName(NS_NMWG_BASE_2_0,
"metadataId").getParameterValue(),
+ Types.VARCHAR)
+ .addValue("stateAdmin", datum.getStateAdmin().getStateAdmin())
+ .addValue("stateOper", datum.getStateOper().getStateOper());
+
+ if (isIsoTime(datum.getTimeType())) {
+ parameters.addValue("timeValue",
parseIsoTime(datum.getTimeValue()).orNull());
+ } else {
+ parameters.addValue("timeValue",
+ parseLong(datum.getTimeValue())
+
.or(TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis())));
+ }
+
+ jdbc.update("INSERT INTO perfsonar_links (id, time, status_oper,
status_admin) "
+ + "VALUES (:metadataId, from_unixtime(:timeValue),
:stateOper, :stateAdmin)", parameters);
+ }
+
+ private boolean isIsoTime(String timeType)
+ {
+ return timeType != null && timeType.trim().equalsIgnoreCase("iso");
+ }
+
+ public Data fetch(Key key)
+ throws PerfSONARException
+ {
+ return jdbc.select(key,
+ "SELECT distinct status_oper, status_admin,
unix_timestamp(time) AS time "
+ + "FROM perfsonar_links "
+ + "WHERE id = :metadataId "
+ + "AND time BETWEEN from_unixtime(:start) AND
from_unixtime(:end) "
+ + "ORDER BY time ASC",
+ "SELECT distinct status_oper, status_admin,
unix_timestamp(time) AS time "
+ + "FROM perfsonar_links "
+ + "WHERE id = :metadataId "
+ + "AND time = (SELECT MAX(time) FROM
perfsonar_links WHERE id = :metadataId)",
+ new DataResultSetExtractor());
+ }
+
+ private static class DataResultSetExtractor extends
AbstractDataResultSetExtractor
+ {
+ @Override
+ protected Element toDatum(ResultSet rs) throws SQLException
+ {
+ Datum datum = new Datum();
+
+ StateOper stateOper = new StateOper();
+ stateOper.setStateOper(rs.getString("status_oper"));
+ datum.addChild(stateOper);
+
+ StateAdmin stateAdmin = new StateAdmin();
+ stateAdmin.setStateAdmin(rs.getString("status_admin"));
+ datum.addChild(stateAdmin);
+
+ NamespaceSupport support = new NamespaceSupport();
+ support.declarePrefix(datum.getPrefix(), datum.getUri());
+ datum.addAttr("timeValue", rs.getString("time"), support);
+ datum.addAttr("timeType", "unix", support);
+
+ return datum;
+ }
+ }
+}
Added:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/OwampDao.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/OwampDao.java
(rev 0)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/OwampDao.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -0,0 +1,157 @@
+package org.perfsonar.service.measurementArchive.sqlType.dao;
+
+import org.ggf.ns.nmwg.base.v2_0.Data;
+import org.ggf.ns.nmwg.base.v2_0.Element;
+import org.ggf.ns.nmwg.base.v2_0.Key;
+import org.ggf.ns.nmwg.base.v2_0.Metadata;
+import org.ggf.ns.nmwg.base.v2_0.Parameter;
+import org.ggf.ns.nmwg.tools.owamp.v2_0.Datum;
+import org.perfsonar.base.exceptions.PerfSONARException;
+import
org.perfsonar.service.measurementArchive.sqlType.nmwg.OwampAggregationDatum;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+
+import javax.sql.DataSource;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Types;
+
+import static
org.perfsonar.service.measurementArchive.sqlType.dao.ParseUtils.parseFloat;
+import static
org.perfsonar.service.measurementArchive.sqlType.dao.ParseUtils.parseInteger;
+import static
org.perfsonar.service.measurementArchive.sqlType.dao.ParseUtils.trim;
+
+public class OwampDao implements Dao
+{
+ private static final String NS_NMWG_BASE_2_0 =
"http://ggf.org/ns/nmwg/base/2.0/";
+ private static final String NS_NMWG_OWAMP_2_0 =
"http://ggf.org/ns/nmwg/tools/owamp/2.0/";
+
+ private final DaoJdbcTemplate jdbc;
+
+ private enum Output { RAW, SUMMARY }
+
+ public OwampDao(DataSource dataSource) throws PerfSONARException
+ {
+ jdbc = new DaoJdbcTemplate(dataSource);
+ }
+
+ private Output getOutput(Key key) throws PerfSONARException
+ {
+ Parameter output = key.getParameterByName(NS_NMWG_OWAMP_2_0,
"output");
+ if (output == null) {
+ output = key.getParameterByName("output");
+ }
+ if (output == null || output.getParameterValue().equals("raw")) {
+ return Output.RAW;
+ } else if (output.getParameterValue().equals("summary")) {
+ return Output.SUMMARY;
+ } else {
+ throw new PerfSONARException("Unsupported output type: " +
output.getParameterValue());
+ }
+ }
+
+ @Override
+ public void store(Metadata md, Element element)
+ throws PerfSONARException
+ {
+ Datum datum = (Datum) element;
+
+ MapSqlParameterSource parameters = new MapSqlParameterSource()
+ .addValue("metadataId",
+ md.getKey().getParameterByName(NS_NMWG_BASE_2_0,
"metadataId").getParameterValue(),
+ Types.VARCHAR);
+
+ switch (getOutput(md.getKey())) {
+ case RAW:
+ parameters
+ .addValue("receiveSynchronized",
parseInteger(datum.getReceiveSynchronized()).orNull(), Types.INTEGER)
+ .addValue("receiveTime",
trim(datum.getReceiveTime()).orNull(), Types.VARCHAR)
+ .addValue("receiveTimeError",
parseFloat(datum.getReceiveTimeError()).orNull(), Types.FLOAT)
+ .addValue("sendSynchronized",
parseInteger(datum.getSendSynchronized()).orNull(), Types.INTEGER)
+ .addValue("sendTime", trim(datum.getSendTime()).orNull(),
Types.VARCHAR)
+ .addValue("sendTimeError",
parseFloat(datum.getSendTimeError()).orNull(), Types.FLOAT)
+ .addValue("seqNum",
parseInteger(datum.getSeqNum()).orNull(), Types.INTEGER)
+ .addValue("ttl", parseInteger(datum.getTTL()).orNull(),
Types.INTEGER);
+
+ jdbc.update("INSERT INTO owamp (metadataId, receiveSynchronized,
receiveTime, receiveTimeError, "
+ + "sendSynchronized, sendTime,
sendTimeError, seqNum, ttl) "
+ + "VALUES (:metadataId,
:receiveSynchronized, :receiveTime, :receiveTimeError, "
+ + ":sendSynchronized, :sendTime,
:sendTimeError, :seqNum, :ttl)", parameters);
+ break;
+ case SUMMARY:
+ OwampAggregationDatum agg = (OwampAggregationDatum) datum;
+ parameters
+ .addValue("sender", trim(agg.getSender()).orNull(),
Types.VARCHAR)
+ .addValue("receiver", trim(agg.getReceiver()).orNull(),
Types.VARCHAR)
+ .addValue("sent", parseInteger(agg.getSent()).orNull(),
Types.INTEGER)
+ .addValue("loss", parseInteger(agg.getLoss()).orNull(),
Types.INTEGER)
+ .addValue("lostPercent",
parseFloat(agg.getLostPercent()).orNull(), Types.FLOAT)
+ .addValue("duplicates",
parseInteger(agg.getDuplicates()).orNull(), Types.INTEGER)
+ .addValue("minDelay",
parseFloat(agg.getMinDelay()).orNull(), Types.FLOAT)
+ .addValue("medDelay",
parseFloat(agg.getMedDelay()).orNull(), Types.FLOAT)
+ .addValue("maxDelay",
parseFloat(agg.getMaxDelay()).orNull(), Types.FLOAT)
+ .addValue("delayUnits", trim(agg.getDelayUnits()).orNull(),
Types.VARCHAR)
+ .addValue("error", parseFloat(agg.getError()).orNull(),
Types.FLOAT)
+ .addValue("errorUnits", trim(agg.getErrorUnits()).orNull(),
Types.VARCHAR)
+ .addValue("jitter", parseFloat(agg.getJitter()).orNull(),
Types.FLOAT)
+ .addValue("jitterUnits",
trim(agg.getJitterUnits()).orNull(), Types.VARCHAR)
+ .addValue("hops", parseInteger(agg.getHops()).orNull(),
Types.INTEGER);
+
+ jdbc.update("INSERT INTO owamp_agg (metadataId, sender,
receiver, sent, loss, lostPercent, "
+ + "duplicates, minDelay, medDelay, maxDelay,
delayUnits, error, errorUnits, jitter, "
+ + "jitterUnits, hops) VALUES (:metadataId,
:sender, :receiver, :sent, :loss, "
+ + ":lostPercent, :duplicates, :minDelay,
:medDelay, :maxDelay, :delayUnits, :error, "
+ + ":errorUnits, :jitter, :jitterUnits, :hops)",
parameters);
+ break;
+ }
+ }
+
+ @Override
+ public Data fetch(Key key)
+ throws PerfSONARException
+ {
+ switch (getOutput(key)) {
+ case RAW:
+ return jdbc.select(key,
+ "SELECT receiveSynchronized, receiveTime,
receiveTimeError, sendSynchronized, "
+ + "sendTime, sendTimeError, seqNum,
timeType, timeValue, ttl "
+ + "FROM owamp "
+ + "WHERE metadataId = :metadataId AND ts
BETWEEN :start AND :end "
+ + "ORDER by ts ASC",
+ "SELECT receiveSynchronized, receiveTime,
receiveTimeError, sendSynchronized, "
+ + "sendTime, sendTimeError, seqNum, ttl "
+ + "FROM owamp "
+ + "WHERE metadataId = :metadataId",
+ new DataResultSetExtractor());
+ case SUMMARY:
+ return jdbc.select(key,
+ "SELECT receiveSynchronized, receiveTime,
receiveTimeError, sendSynchronized, "
+ + "sendTime, sendTimeError, seqNum,
timeType, timeValue, ttl "
+ + "FROM owamp "
+ + "WHERE metadataId = :metadataId AND ts
BETWEEN :start AND :end "
+ + "ORDER by ts ASC",
+ "SELECT receiveSynchronized, receiveTime,
receiveTimeError, sendSynchronized, "
+ + "sendTime, sendTimeError, seqNum, ttl "
+ + "FROM owamp "
+ + "WHERE metadataId = :metadataId",
+ new DataResultSetExtractor());
+ }
+ throw new RuntimeException("Unreachable statement");
+ }
+
+ private static class DataResultSetExtractor extends
AbstractDataResultSetExtractor
+ {
+ @Override
+ protected Element toDatum(ResultSet rs) throws SQLException
+ {
+ Datum datum = new Datum();
+ datum.setSeqNum(rs.getString("seqNum"));
+ datum.setSendTime(rs.getString("sendTime"));
+ datum.setSendSynchronized(rs.getString("sendSynchronization"));
+ datum.setSendTimeError(rs.getString("sendTimeError"));
+ datum.setReceiveTime(rs.getString("receiveTime"));
+
datum.setReceiveSynchronized(rs.getString("receiveSynchronization"));
+ datum.setReceiveTimeError(rs.getString("receiveTimeError"));
+ datum.setTTL(rs.getString("ttl"));
+ return datum;
+ }
+ }
+}
Added:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/ParseUtils.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/ParseUtils.java
(rev 0)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/ParseUtils.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -0,0 +1,97 @@
+package org.perfsonar.service.measurementArchive.sqlType.dao;
+
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+import org.perfsonar.base.exceptions.PerfSONARException;
+import org.perfsonar.base.util.TimeDateUtil;
+
+import java.math.BigDecimal;
+
+import static com.google.common.base.Strings.emptyToNull;
+import static com.google.common.base.Strings.nullToEmpty;
+
+public final class ParseUtils
+{
+ private static final Function<String, Float> PARSE_FLOAT =
+ new Function<String, Float>()
+ {
+ public Float apply(String s)
+ {
+ return Float.parseFloat(s);
+ }
+ };
+ private static final Function<String, BigDecimal> PARSE_BIGDECIMAL =
+ new Function<String, BigDecimal>()
+ {
+ public BigDecimal apply(String s)
+ {
+ return new BigDecimal(s);
+ }
+ };
+ private static final Function<String, Integer> PARSE_INTEGER =
+ new Function<String, Integer>()
+ {
+ public Integer apply(String s)
+ {
+ return Integer.parseInt(s);
+ }
+ };
+ private static final Function<String, Long> PARSE_LONG =
+ new Function<String, Long>()
+ {
+ public Long apply(String s)
+ {
+ return Long.parseLong(s);
+ }
+ };
+
+ private ParseUtils()
+ {
+ }
+
+ private static <T> Optional<T> parse(String s, Function<String, T>
parser) throws PerfSONARException
+ {
+ try {
+ return trim(s).transform(parser);
+ } catch (NumberFormatException e) {
+ throw new PerfSONARException(
+ "error.parameter", e.getMessage(), e);
+ }
+ }
+
+ public static Optional<String> trim(String s)
+ {
+ return Optional.fromNullable(emptyToNull(nullToEmpty(s).trim()));
+ }
+
+ public static Optional<BigDecimal> parseBigDecimal(String s) throws
PerfSONARException
+ {
+ return parse(s, PARSE_BIGDECIMAL);
+ }
+
+ public static Optional<Integer> parseInteger(String s) throws
PerfSONARException
+ {
+ return parse(s, PARSE_INTEGER);
+ }
+
+ public static Optional<Long> parseLong(String s) throws
PerfSONARException
+ {
+ return parse(s, PARSE_LONG);
+ }
+
+ public static Optional<Float> parseFloat(String s) throws
PerfSONARException
+ {
+ return parse(s, PARSE_FLOAT);
+ }
+
+ public static Optional<Long> parseIsoTime(String s) throws
PerfSONARException
+ {
+ if (s != null) {
+ s = s.trim();
+ if (!s.isEmpty()) {
+ return Optional.of(TimeDateUtil.getUnixTime(s));
+ }
+ }
+ return Optional.absent();
+ }
+}
Added:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/PingDao.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/PingDao.java
(rev 0)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/PingDao.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -0,0 +1,91 @@
+package org.perfsonar.service.measurementArchive.sqlType.dao;
+
+import org.ggf.ns.nmwg.base.v2_0.Data;
+import org.ggf.ns.nmwg.base.v2_0.Element;
+import org.ggf.ns.nmwg.base.v2_0.Key;
+import org.ggf.ns.nmwg.base.v2_0.Metadata;
+import org.ggf.ns.nmwg.tools.ping.v2_0.Datum;
+import org.perfsonar.base.exceptions.PerfSONARException;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.jdbc.core.namedparam.SqlParameterSource;
+
+import javax.sql.DataSource;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Types;
+
+import static
org.perfsonar.service.measurementArchive.sqlType.dao.ParseUtils.parseFloat;
+import static
org.perfsonar.service.measurementArchive.sqlType.dao.ParseUtils.parseInteger;
+import static
org.perfsonar.service.measurementArchive.sqlType.dao.ParseUtils.parseLong;
+
+public class PingDao implements Dao
+{
+ private static final String NS_NMWG_BASE_2_0 =
"http://ggf.org/ns/nmwg/base/2.0/";
+
+ private final DaoJdbcTemplate jdbc;
+
+ public PingDao(DataSource dataSource) throws PerfSONARException
+ {
+ jdbc = new DaoJdbcTemplate(dataSource);
+ }
+
+ @Override
+ public void store(Metadata md, Element element)
+ throws PerfSONARException
+ {
+ Datum datum = (Datum) element;
+
+ SqlParameterSource parameters = new MapSqlParameterSource()
+ .addValue("metadataId",
+ md.getKey().getParameterByName(NS_NMWG_BASE_2_0,
"metadataId").getParameterValue(),
+ Types.VARCHAR)
+ .addValue("numBytes",
parseInteger(datum.getNumBytes()).orNull(), Types.INTEGER)
+ .addValue("numBytesUnits", datum.getNumBytesUnits(),
Types.VARCHAR)
+ .addValue("value", parseFloat(datum.getValue()).orNull(),
Types.FLOAT)
+ .addValue("valueUnits", datum.getValueUnits(), Types.VARCHAR)
+ .addValue("seqNum", parseInteger(datum.getSeqNum()).orNull(),
Types.INTEGER)
+ .addValue("timeType", datum.getTimeType(), Types.VARCHAR)
+ .addValue("timeValue", parseLong(datum.getTimeValue()).orNull(),
Types.INTEGER)
+ .addValue("ttl", parseInteger(datum.getTTL()).orNull(),
Types.INTEGER);
+
+ jdbc.update("INSERT INTO clmp_ping (metadataId, seqNum, value,
valueUnits, ttl, numBytes, numBytesUnits, "
+ + "timeValue, timeType) "
+ + "VALUES (:metadataId, :seqNum, :value,
:valueUnits, :ttl, :numBytes, :numBytesUnits, "
+ + ":timeValue, :timeType)", parameters);
+ }
+
+ @Override
+ public Data fetch(Key key)
+ throws PerfSONARException
+ {
+ return jdbc.select(key,
+ "SELECT seqNum, value, valueUnits, ttl, numBytes,
numBytesUnits, timeValue, "
+ + "timeType FROM clmp_ping "
+ + "WHERE metadataId = :metadataId AND
timeValue BETWEEN :start AND :end "
+ + "ORDER BY timeValue ASC",
+ "SELECT seqNum, value, valueUnits, ttl, numBytes,
numBytesUnits, timeValue, "
+ + "timeType FROM clmp_ping "
+ + "WHERE metadataId = :metadataId "
+ + "AND timeValue = (SELECT MAX(timeValue)
from clmp_ping WHERE "
+ + "metadataId = :metadataId)",
+ new DataResultSetExtractor());
+ }
+
+ private static class DataResultSetExtractor extends
AbstractDataResultSetExtractor
+ {
+ @Override
+ protected Element toDatum(ResultSet rs) throws SQLException
+ {
+ Datum datum = new Datum();
+ datum.setNumBytes(rs.getString("numBytes"));
+ datum.setNumBytesUnits(rs.getString("numBytesUnits"));
+ datum.setSeqNum(rs.getString("seqNum"));
+ datum.setValue(rs.getString("value"));
+ datum.setValueUnits(rs.getString("valueUnits"));
+ datum.setTTL(rs.getString("ttl"));
+ datum.setTimeType(rs.getString("timeType"));
+ datum.setTimeValue(rs.getString("timeValue"));
+ return datum;
+ }
+ }
+}
Added:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/UtilizationDao.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/UtilizationDao.java
(rev 0)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao/UtilizationDao.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -0,0 +1,77 @@
+package org.perfsonar.service.measurementArchive.sqlType.dao;
+
+import org.ggf.ns.nmwg.base.v2_0.Data;
+import org.ggf.ns.nmwg.base.v2_0.Element;
+import org.ggf.ns.nmwg.base.v2_0.Key;
+import org.ggf.ns.nmwg.base.v2_0.Metadata;
+import org.ggf.ns.nmwg.characteristic.utilization.v2_0.Datum;
+import org.perfsonar.base.exceptions.PerfSONARException;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.jdbc.core.namedparam.SqlParameterSource;
+
+import javax.sql.DataSource;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Types;
+
+import static
org.perfsonar.service.measurementArchive.sqlType.dao.ParseUtils.parseFloat;
+import static
org.perfsonar.service.measurementArchive.sqlType.dao.ParseUtils.parseInteger;
+
+public class UtilizationDao implements Dao
+{
+ private static final String NS_NMWG_BASE_2_0 =
"http://ggf.org/ns/nmwg/base/2.0/";
+
+ private final DaoJdbcTemplate jdbc;
+
+ public UtilizationDao(DataSource dataSource) throws PerfSONARException
+ {
+ jdbc = new DaoJdbcTemplate(dataSource);
+ }
+
+ @Override
+ public void store(Metadata md, Element element)
+ throws PerfSONARException
+ {
+ Datum datum = (Datum) element;
+
+ SqlParameterSource parameters = new MapSqlParameterSource()
+ .addValue("metadataId",
md.getKey().getParameterByName(NS_NMWG_BASE_2_0,
"metadataId").getParameterValue(),
+ Types.VARCHAR)
+ .addValue("valueUnits", datum.getValueUnits(), Types.VARCHAR)
+ .addValue("timeValue",
parseInteger(datum.getTimeValue()).orNull(), Types.INTEGER)
+ .addValue("value", parseFloat(datum.getValue()).orNull(),
Types.FLOAT);
+
+ jdbc.update("INSERT INTO perfsonar_utilization (metadataId, value,
valueUnits, timeValue) "
+ + "VALUES (:metadataId, :value, :valueUnits,
:timeValue)", parameters);
+ }
+
+ public Data fetch(Key key)
+ throws PerfSONARException
+ {
+ return jdbc.select(key,
+ "SELECT value, timeValue, valueUnits "
+ + "FROM perfsonar_utilization "
+ + "WHERE metadataId = :metadataId AND
timeValue BETWEEN :start AND :end "
+ + "ORDER BY timeValue ASC",
+ "SELECT value, timeValue, valueUnits "
+ + "FROM perfsonar_utilization "
+ + "WHERE metadataId = :metadataId "
+ + "AND timeValue = (SELECT MAX(timeValue)
FROM perfsonar_utilization "
+ + "WHERE metadataId = :metadataId)",
+ new DataResultSetExtractor());
+ }
+
+ private static class DataResultSetExtractor extends
AbstractDataResultSetExtractor
+ {
+ @Override
+ protected Element toDatum(ResultSet rs) throws SQLException
+ {
+ Datum datum = new Datum();
+ datum.setValue(rs.getString("value"));
+ datum.setValueUnits(rs.getString("valueUnits"));
+ datum.setTimeValue(rs.getString("timeValue"));
+ datum.setTimeType("unix");
+ return datum;
+ }
+ }
+}
Deleted:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/BwctlResponseGenerator.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/BwctlResponseGenerator.java
2012-11-27 14:55:06 UTC (rev 6043)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/BwctlResponseGenerator.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,94 +0,0 @@
-package org.perfsonar.service.measurementArchive.sqlType.fetch;
-
-
-import java.util.List;
-import java.util.Map;
-
-import org.ggf.ns.nmwg.base.v2_0.Data;
-import org.ggf.ns.nmwg.tools.bwctl.v2_0.Datum;
-import org.perfsonar.base.exceptions.PerfSONARException;
-
-/**
- * Creates the response of service for bwctl data.
- *
- * @author fernandes
- */
-
-public class BwctlResponseGenerator extends ResponseGenerator
-{
- public BwctlResponseGenerator() throws PerfSONARException
- {
- super();
- }
-
- @Override
- public Data getResponse(List<Map<String, Object>> resultList)
- {
- Data data = new Data();
-
- for (Map<String, Object> resultMap: resultList) {
- Datum datum = new Datum();
-
- for (Map.Entry<String, Object> entry : resultMap.entrySet()) {
- if (entry.getValue() != null) {
- String column = entry.getKey();
- String value = entry.getValue().toString();
-
- if (column.equals("intervalEnd")) {
- datum.setIntervalEnd(value);
- } else if (column.equals("intervalStart")) {
- datum.setIntervalStart(value);
- } else if (column.equals("intervalUnit")) {
- datum.setIntervalUnit(value);
- } else if (column.equals("numBytes")) {
- datum.setNumBytes(value);
- } else if (column.equals("numBytesUnits")) {
- datum.setNumBytesUnits(value);
- } else if (column.equals("timeType")) {
- datum.setTimeType(value);
- } else if (column.equals("timeValue")) {
- datum.setTimeValue(value);
- } else if (column.equals("value")) {
- datum.setValue(value);
- } else if (column.equals("valueUnits")) {
- datum.setValueUnits(value);
- } else if (column.equals("tcpAdapterType")) {
- datum.setTcpAdapterType(value);
- } else if (column.equals("tcpMSSSize")) {
- datum.setTcpMSSSize(value);
- } else if (column.equals("tcpMSSUnit")) {
- datum.setTcpMSSUnit(value);
- } else if (column.equals("tcpMTUUnit")) {
- datum.setTcpMTUUnit(value);
- } else if (column.equals("tcpMTUSize")) {
- datum.setTcpMTUSize(value);
- } else if (column.equals("tcpWindowSize")) {
- datum.setTcpWindowSize(value);
- } else if (column.equals("tcpWindowUnit")) {
- datum.setTcpWindowUnit(value);
- } else if (column.equals("udpBufferSize")) {
- datum.setUdpBufferSize(value);
- } else if (column.equals("udpBufferUnit")) {
- datum.setUdpBufferUnit(value);
- } else if (column.equals("udpJitter")) {
- datum.setUdpJitter(value);
- } else if (column.equals("udpJitterUnit")) {
- datum.setUdpJitterUnit(value);
- } else if (column.equals("udpPacketLoss")) {
- datum.setUdpPacketLoss(value);
- } else if (column.equals("udpPacketLossPercentage")) {
- datum.setUdpPacketLossPercentage(value);
- } else if (column.equals("udpPacketSent")) {
- datum.setUdpPacketSent(value);
- }
- }
- }
-
- data.addChild(datum);
- }
-
- return data;
- }
-
-
-} //BwctlResponseGenerator
Deleted:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/DiscardsResponseGenerator.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/DiscardsResponseGenerator.java
2012-11-27 14:55:06 UTC (rev 6043)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/DiscardsResponseGenerator.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,59 +0,0 @@
-/**
- * $Id$
- * Project: perfSONAR
- */
-package org.perfsonar.service.measurementArchive.sqlType.fetch;
-
-
-import java.util.List;
-import java.util.Map;
-
-import org.ggf.ns.nmwg.base.v2_0.Data;
-import org.ggf.ns.nmwg.characteristic.discards.v2_0.Datum;
-
-import org.perfsonar.base.exceptions.PerfSONARException;
-
-/**
- * Creates the service response for discards metric.
- *
- * @author romradz
- */
-public class DiscardsResponseGenerator extends ResponseGenerator
-{
- public DiscardsResponseGenerator() throws PerfSONARException
- {
- super();
- }
-
- @Override
- public Data getResponse(List<Map<String, Object>> resultList)
- {
- Data data = new Data();
-
- for (Map<String, Object> resultMap : resultList) {
- Datum datum = new Datum();
-
- for (Map.Entry<String, Object> entry : resultMap.entrySet()) {
- if (entry.getValue() != null) {
- String column = entry.getKey();
- String value = entry.getValue().toString();
-
- if (column.equals("value")) {
- datum.setValue(value);
- } else if (column.equals("valueUnits")) {
- datum.setValueUnits(value);
- } else if (column.equals("timeValue")) {
- datum.setTimeValue(value);
- datum.setTimeType("unix");
- }
- }
- }
-
- data.addChild(datum);
- }
-
- return data;
- }
-
-
-} //DiscardsResponseGenerator
Deleted:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/ErrorsResponseGenerator.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/ErrorsResponseGenerator.java
2012-11-27 14:55:06 UTC (rev 6043)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/ErrorsResponseGenerator.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,60 +0,0 @@
-/**
- * $Id$
- * Project: perfSONAR
- */
-package org.perfsonar.service.measurementArchive.sqlType.fetch;
-
-
-import java.util.List;
-import java.util.Map;
-
-import org.ggf.ns.nmwg.base.v2_0.Data;
-import org.ggf.ns.nmwg.characteristic.errors.v2_0.Datum;
-
-import org.perfsonar.base.exceptions.PerfSONARException;
-
-/**
- * Creates the service response for errors metric.
- *
- * @author romradz
- */
-public class ErrorsResponseGenerator extends ResponseGenerator
-{
- public ErrorsResponseGenerator() throws PerfSONARException
- {
- super();
- }
-
- @Override
- public Data getResponse(List<Map<String, Object>> resultList)
- {
- Data data = new Data();
-
- for (Map<String, Object> resultMap: resultList) {
- Datum datum = new Datum();
-
- for (Map.Entry<String, Object> entry : resultMap.entrySet()) {
- if (entry.getValue() != null) {
- String column = entry.getKey();
- String value = entry.getValue().toString();
-
- if (column.equals("value")) {
- datum.setValue(value);
- } else if (column.equals("valueUnits")) {
- datum.setValueUnits(value);
- } else if (column.equals("timeValue")) {
- datum.setTimeValue(value);
- datum.setTimeType("unix");
- }
- }
- }
-
- data.addChild(datum);
- }
-
- return data;
-
- }
-
-
-} //ErrorsResponseGenerator
Deleted:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/GenericResponseGenerator.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/GenericResponseGenerator.java
2012-11-27 14:55:06 UTC (rev 6043)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/GenericResponseGenerator.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,57 +0,0 @@
-/**
- * $Id$
- * Project: perfSONAR
- */
-package org.perfsonar.service.measurementArchive.sqlType.fetch;
-
-
-import java.util.List;
-import java.util.Map;
-
-import org.ggf.ns.nmwg.base.v2_0.Data;
-import org.ggf.ns.nmwg.base.v2_0.Datum;
-
-import org.perfsonar.base.exceptions.PerfSONARException;
-
-/**
- * Creates the srevice response.
- *
- * @author romradz
- */
-public class GenericResponseGenerator extends ResponseGenerator
-{
- public GenericResponseGenerator() throws PerfSONARException
- {
- super();
- }
-
- @Override
- public Data getResponse(List<Map<String, Object>> resultList)
- {
- Data data = new Data();
-
- for (Map<String, Object> resultMap : resultList) {
- Datum datum = new Datum();
-
- for (Map.Entry<String, Object> entry : resultMap.entrySet()) {
- if (entry.getValue() != null) {
- String column = entry.getKey();
- String value = entry.getValue().toString();
-
- if (column.equals("value")) {
- datum.setValue(value);
- } else if (column.equals("valueUnits")) {
- datum.setValueUnits(value);
- } else if (column.equals("timeValue")) {
- datum.setTimeValue(value);
- datum.setTimeType("unix");
- }
- }
- }
-
- data.addChild(datum);
- }
-
- return data;
- }
-}
Deleted:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/IperfResponseGenerator.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/IperfResponseGenerator.java
2012-11-27 14:55:06 UTC (rev 6043)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/IperfResponseGenerator.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,73 +0,0 @@
-/**
- * $Id$
- * Project: perfSONAR
- */
-package org.perfsonar.service.measurementArchive.sqlType.fetch;
-
-
-import java.util.List;
-import java.util.Map;
-
-import org.ggf.ns.nmwg.base.v2_0.Data;
-import org.ggf.ns.nmwg.tools.iperf.v2_0.Datum;
-
-import org.perfsonar.base.exceptions.PerfSONARException;
-
-/**
- * Creates the service response for iperf data.
- *
- * @author romradz
- */
-public class IperfResponseGenerator extends ResponseGenerator
-{
- public IperfResponseGenerator() throws PerfSONARException
- {
- super();
- }
-
- @Override
- public Data getResponse(List<Map<String, Object>> resultList)
- {
- Data data = new Data();
-
- for (Map<String, Object> resultMap : resultList) {
-
- Datum datum = new Datum();
-
- for (Map.Entry<String, Object> entry : resultMap.entrySet()) {
- if (entry.getValue() != null) {
- String column = entry.getKey();
- String value = entry.getValue().toString();
-
- if (column.equals("value")) {
- datum.addAttr("value", value, null);
- } else if (column.equals("valueUnits")) {
- datum.addAttr("valueUnits", value, null);
- } else if (column.equals("numBytes")) {
- datum.addAttr("numBytes", value, null);
- } else if (column.equals("numBytesUnits")) {
- datum.addAttr("numBytesUnits", value, null);
- } else if (column.equals("time")) {
- datum.addAttr("timeValue", value, null);
- datum.addAttr("timeType", "unix", null);
- } else if (column.equals("interv")) {
- datum.addAttr("interval", value, null);
- } else if (column.equals("throughput")) {
- datum.addAttr("throughput", value, null);
- } else if (column.equals("jitter")) {
- datum.addAttr("jitter", value, null);
- } else if (column.equals("loss")) {
- datum.addAttr("loss", value, null);
- }
- }
- }
-
- data.addChild(datum);
- }
-
- return data;
-
- }
-
-
-} //IperfResponseGenerator
Deleted:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/L2PathStatusResponseGenerator.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/L2PathStatusResponseGenerator.java
2012-11-27 14:55:06 UTC (rev 6043)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/L2PathStatusResponseGenerator.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,71 +0,0 @@
-/**
- * $Id$
- * Project: perfSONAR
- */
-package org.perfsonar.service.measurementArchive.sqlType.fetch;
-
-
-import java.util.List;
-import java.util.Map;
-
-import org.ggf.ns.nmwg.base.v2_0.Data;
-import org.ggf.ns.nmwg.event.status.base.v2_0.Datum;
-import org.ggf.ns.nmwg.event.status.base.v2_0.StateAdmin;
-import org.ggf.ns.nmwg.event.status.base.v2_0.StateOper;
-
-import org.xml.sax.helpers.NamespaceSupport;
-
-import org.perfsonar.base.exceptions.PerfSONARException;
-
-/**
- * Creates the response of service for L2 path status metric.
- *
- * @author romradz
- */
-public class L2PathStatusResponseGenerator extends ResponseGenerator
-{
- public L2PathStatusResponseGenerator() throws PerfSONARException
- {
- super();
- }
-
- @Override
- public Data getResponse(List<Map<String, Object>> resultList)
- {
- Data data = new Data();
-
- for (Map<String, Object> resultMap : resultList) {
- Datum datum = new Datum();
-
- for (Map.Entry<String, Object> entry : resultMap.entrySet()) {
- if (entry.getValue() != null) {
- String column = entry.getKey();
- String strValue = entry.getValue().toString();
-
- if (column.equals("status_oper")) {
- StateOper stateOper = new StateOper();
- stateOper.setStateOper(strValue);
- datum.addChild(stateOper);
- } else if (column.equals("status_admin")) {
- StateAdmin stateAdmin = new StateAdmin();
- stateAdmin.setStateAdmin(strValue);
- datum.addChild(stateAdmin);
- } else if (column.equals("valueUnits")) {
-
- } else if (column.equals("timeValue")) {
- NamespaceSupport support = new NamespaceSupport();
- support.declarePrefix(datum.getPrefix(),
datum.getUri());
- datum.addAttr("timeValue", strValue, support);
- datum.addAttr("timeType", "unix", support);
- }
- }
- }
-
- data.addChild(datum);
- }
-
- return data;
- }
-
-
-} //L2PathStatusResponseGenerator
Deleted:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/OwampResponseGenerator.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/OwampResponseGenerator.java
2012-11-27 14:55:06 UTC (rev 6043)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/OwampResponseGenerator.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,170 +0,0 @@
-package org.perfsonar.service.measurementArchive.sqlType.fetch;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import org.ggf.ns.nmwg.base.v2_0.Data;
-import org.ggf.ns.nmwg.tools.owamp.v2_0.Datum;
-import org.perfsonar.base.exceptions.PerfSONARException;
-import
org.perfsonar.service.measurementArchive.sqlType.nmwg.OwampAggregationDatum;
-
-/**
- * Creates the response of service for owamp data.
- *
- * @author fernandes
- * @author <a
href="mailto:">Piotr
Pikusa</a>
- */
-
-public class OwampResponseGenerator extends ResponseGenerator
-{
- public OwampResponseGenerator() throws PerfSONARException
- {
- super();
- }
-
- /**
- * Constructor only for test purposes.
- *
- * @param t
- */
- public OwampResponseGenerator(String t)
- {
- super(t);
- }
-
- @Override
- public Data getResponse(List<Map<String, Object>> resultList)
- {
- Data data = new Data();
-
- // This is true when resultList contains data from owamp table and is
- // false when it contains data from owamp_agg
- boolean owamp = true;
-
- // First check if results are for ordinary OWAMP (owamp table) or
OWAMP
- // Aggregate (owamp_agg) table
- if (!resultList.isEmpty()) {
- Collection<String> kCollection = resultList.get(0).keySet();
- for (String columnName : kCollection) {
- if (columnName.equals("seqNum")
- || columnName.equals("sendTime")
- || columnName.equals("sendSynchronized")
- || columnName.equals("sendTimeError")
- || columnName.equals("receiveTime")
- || columnName.equals("receiveSynchronized")
- || columnName.equals("receiveTimeError")
- || columnName.equals("ttl")) {
- owamp = true;
- } else if (columnName.equals("sender")
- || columnName.equals("receiver")
- || columnName.equals("sent")
- || columnName.equals("loss")
- || columnName.equals("lostPercent")
- || columnName.equals("duplicates")
- || columnName.equals("minDelay")
- || columnName.equals("medDelay")
- || columnName.equals("maxDelay")
- || columnName.equals("delayUnits")
- || columnName.equals("error")
- || columnName.equals("errorUnits")
- || columnName.equals("jitter")
- || columnName.equals("jitterUnits")
- || columnName.equals("hops")) {
- owamp = false;
- }
- }
- }
-
- System.out.println("Here 1");
- for (Map<String, Object> resultMap : resultList) {
- System.out.println("Here 2");
-
- if (owamp) {
- Datum datum = new Datum();
-
- for (Map.Entry<String, Object> entry : resultMap.entrySet())
{
- if (entry.getValue() != null) {
- String column = entry.getKey();
- String value = entry.getValue().toString();
-
- System.out.println("Here 4");
- if (column.equals("seqNum")) {
- datum.setSeqNum(value);
- } else if (column.equals("sendTime")) {
- datum.setSendTime(value);
- } else if (column.equals("sendSynchronized")) {
- datum.setSendSynchronized(value);
- } else if (column.equals("sendTimeError")) {
- datum.setSendTimeError(value);
- } else if (column.equals("receiveTime")) {
- datum.setReceiveTime(value);
- } else if (column.equals("receiveSynchronized")) {
- datum.setReceiveSynchronized(value);
- } else if (column.equals("receiveTimeError")) {
- datum.setReceiveTimeError(value);
- } else if (column.equals("ttl")) {
- datum.setTTL(value);
- }
- // else if (column.equals("timeType"))
- // datum.setTimeType(strValue);
- // else if (column.equals("timeValue"))
- // datum.setTimeValue(strValue);
- }
- }
- data.addChild(datum);
- } else {
- OwampAggregationDatum datum = new OwampAggregationDatum();
-
-
- for (Map.Entry<String, Object> entry : resultMap.entrySet())
{
- if (entry.getValue() != null) {
- String column = entry.getKey();
- String value = entry.getValue().toString();
-
- System.out.println("Here 4");
- if (column.equals("sender")) {
- datum.setSender(value);
- } else if (column.equals("receiver")) {
- datum.setReceiver(value);
- } else if (column.equals("sent")) {
- datum.setSent(value);
- } else if (column.equals("loss")) {
- datum.setLoss(value);
- } else if (column.equals("lostPercent")) {
- datum.setLostPercent(value);
- } else if (column.equals("duplicates")) {
- datum.setDuplicates(value);
- } else if (column.equals("minDelay")) {
- datum.setMinDelay(value);
- } else if (column.equals("medDelay")) {
- datum.setMedDelay(value);
- } else if (column.equals("maxDelay")) {
- datum.setMaxDelay(value);
- } else if (column.equals("error")) {
- datum.setError(value);
- } else if (column.equals("delayUnits")) {
- datum.setDelayUnits(value);
- } else if (column.equals("errorUnits")) {
- datum.setErrorUnits(value);
- } else if (column.equals("jitter")) {
- datum.setJitter(value);
- } else if (column.equals("jitterUnits")) {
- datum.setJitterUnits(value);
- } else if (column.equals("hops")) {
- datum.setHops(value);
- }
- // else if (column.equals("timeType"))
- // datum.setTimeType(strValue);
- // else if (column.equals("timeValue"))
- // datum.setTimeValue(strValue);
- }
- }
-
- data.addChild(datum);
- }
- }
- System.out.println("Here 6");
- return data;
- }
-}
Deleted:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/PingResponseGenerator.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/PingResponseGenerator.java
2012-11-27 14:55:06 UTC (rev 6043)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/PingResponseGenerator.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,64 +0,0 @@
-package org.perfsonar.service.measurementArchive.sqlType.fetch;
-
-
-import java.util.List;
-import java.util.Map;
-
-import org.ggf.ns.nmwg.base.v2_0.Data;
-import org.ggf.ns.nmwg.tools.ping.v2_0.Datum;
-import org.perfsonar.base.exceptions.PerfSONARException;
-
-/**
- * Creates the response of service for ping data.
- *
- * @author fernandes
- */
-
-public class PingResponseGenerator extends ResponseGenerator
-{
- public PingResponseGenerator() throws PerfSONARException
- {
- super();
- }
-
- @Override
- public Data getResponse(List<Map<String, Object>> resultList)
- {
- Data data = new Data();
-
- for (Map<String, Object> resultMap : resultList) {
- Datum datum = new Datum();
-
- for (Map.Entry<String, Object> entry : resultMap.entrySet()) {
- if (entry.getValue() != null) {
- String column = entry.getKey();
- String value = entry.getValue().toString();
-
- if (column.equals("numBytes")) {
- datum.setNumBytes(value);
- } else if (column.equals("numBytesUnits")) {
- datum.setNumBytesUnits(value);
- } else if (column.equals("seqNum")) {
- datum.setSeqNum(value);
- } else if (column.equals("value")) {
- datum.setValue(value);
- } else if (column.equals("valueUnits")) {
- datum.setValueUnits(value);
- } else if (column.equals("ttl")) {
- datum.setTTL(value);
- } else if (column.equals("timeType")) {
- datum.setTimeType(value);
- } else if (column.equals("timeValue")) {
- datum.setTimeValue(value);
- }
- }
- }
-
- data.addChild(datum);
- }
-
- return data;
- }
-
-
-} //PingResponseGenerator
Deleted:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/ResponseGenerator.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/ResponseGenerator.java
2012-11-27 14:55:06 UTC (rev 6043)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/ResponseGenerator.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,37 +0,0 @@
-/**
- * $Id$
- * Project: perfSONAR
- */
-package org.perfsonar.service.measurementArchive.sqlType.fetch;
-
-
-import java.util.List;
-import java.util.Map;
-
-import org.ggf.ns.nmwg.base.v2_0.Data;
-
-import org.perfsonar.base.exceptions.PerfSONARException;
-
-/**
- * Creates the response of service.
- *
- * @author romradz
- */
-public abstract class ResponseGenerator
-{
- public ResponseGenerator() throws PerfSONARException
- {
- }
-
- /**
- * Contstructor only for test purposes. It is implemented because when
unitTest run it cannot get loggger from
- * main constructor.
- *
- * @param t
- */
- public ResponseGenerator(String t)
- {
- }
-
- public abstract Data getResponse(List<Map<String, Object>> resultList);
-}
Deleted:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/ResponseGeneratorFactory.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/ResponseGeneratorFactory.java
2012-11-27 14:55:06 UTC (rev 6043)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/ResponseGeneratorFactory.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,118 +0,0 @@
-/**
- * $Id$
- * Project: perfSONAR
- */
-
-package org.perfsonar.service.measurementArchive.sqlType.fetch;
-
-
-import org.perfsonar.base.auxiliary.AuxiliaryComponentManager;
-import org.perfsonar.base.auxiliary.ComponentNames;
-import org.perfsonar.base.auxiliary.components.logger.LoggerComponent;
-
-import org.perfsonar.base.exceptions.PerfSONARException;
-
-import org.perfsonar.service.measurementArchive.eventTypeConfig.EventType;
-import
org.perfsonar.service.measurementArchive.eventTypeConfig.EventTypeConfigurationComponent;
-
-
-/**
- * Creates relevant ResponseGenerator object
- * according to the value of eventType.
- *
- * @author romradz
- */
-public final class ResponseGeneratorFactory
-{
- private ResponseGeneratorFactory()
- {
- }
-
- public static ResponseGenerator getResponseGenerator(String
eventTypeName)
- throws PerfSONARException
- {
-
-
- LoggerComponent logger = (LoggerComponent)
- AuxiliaryComponentManager.
- getInstance().
- getComponent(ComponentNames.LOGGER);
-
- EventTypeConfigurationComponent eventTypeConfigurationComponent =
- (EventTypeConfigurationComponent)
- AuxiliaryComponentManager.
- getInstance().
- getComponent("eventType_config");
-
-
- EventType eventType =
- eventTypeConfigurationComponent.getEventType(eventTypeName);
-
- if (eventType == null) {
- throw new PerfSONARException(
- "error.ma.query",
- "ResponseGeneratorFactory.getResponseGenerator: "
- + "eventType " + eventTypeName + " is not supported");
- }
-
-
- String className = eventType.getResponseGenerator();
-
- //logger.debug(
- // "ResponseGeneratorFactory.getResponseGenerator: "
- // + "class name for eventType (" + eventTypeName + "): "
- // + className);
-
- if (className == null || className.trim().isEmpty()) {
- throw new PerfSONARException(
- "error.ma.metadata_query_mapping_configuration",
- "ResponseGeneratorFactory.getResponseGenerator: "
- + "Could not find class name for eventType "
- + eventTypeName);
- }
-
-
- ResponseGenerator responseGenerator;
-
- try {
-
- responseGenerator =
- (ResponseGenerator)
- Class.forName(className).newInstance();
-
- } catch (Exception ex) {
-
- logger.error(
- "ResponseGeneratorFactory.getResponseGenerator: "
- + "Unable to create an object of : "
- + className + ": "
- + ex.toString());
- throw new PerfSONARException(
- "error.ma.metadata_query_mapping_configuration",
- "ResponseGeneratorFactory.getResponseGenerator: "
- + "Unable to create an object of "
- + className);
-
- }
-
-
- if (responseGenerator == null) {
-
- logger.error(
- "ResponseGeneratorFactory.getResponseGenerator: "
- + "Could not create a responseGenerator object for "
- + "eventType: " + eventTypeName);
- throw new PerfSONARException(
- "error.ma.metadata_query_mapping_configuration",
- "ResponseGeneratorFactory.getResponseGenerator: "
- + "Could not create a responseGenerator for "
- + "eventType: " + eventTypeName);
-
- }
-
- return responseGenerator;
-
- }
-
-
-} //ResponseGeneratorFactory
Deleted:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/UtilizationResponseGenerator.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/UtilizationResponseGenerator.java
2012-11-27 14:55:06 UTC (rev 6043)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/UtilizationResponseGenerator.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,57 +0,0 @@
-/**
- * $Id$
- * Project: perfSONAR
- */
-package org.perfsonar.service.measurementArchive.sqlType.fetch;
-
-
-import java.util.List;
-import java.util.Map;
-
-import org.ggf.ns.nmwg.base.v2_0.Data;
-import org.ggf.ns.nmwg.characteristic.utilization.v2_0.Datum;
-
-import org.perfsonar.base.exceptions.PerfSONARException;
-
-/**
- * Creates the service response for utilization metric.
- *
- * @author romradz
- */
-public class UtilizationResponseGenerator extends ResponseGenerator
-{
- public UtilizationResponseGenerator() throws PerfSONARException
- {
- super();
- }
-
- @Override
- public Data getResponse(List<Map<String, Object>> resultList)
- {
- Data data = new Data();
-
- for (Map<String, Object> resultMap : resultList) {
- Datum datum = new Datum();
-
- for (Map.Entry<String, Object> entry : resultMap.entrySet()) {
- if (entry.getValue() != null) {
- String column = entry.getKey();
- String strValue = entry.getValue().toString();
-
- if (column.equals("value")) {
- datum.setValue(strValue);
- } else if (column.equals("valueUnits")) {
- datum.setValueUnits(strValue);
- } else if (column.equals("timeValue")) {
- datum.setTimeValue(strValue);
- datum.setTimeType("unix");
- }
- }
- }
-
- data.addChild(datum);
- }
-
- return data;
- }
-}
Deleted:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/BwctlStoreRequestProcess.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/BwctlStoreRequestProcess.java
2012-11-27 14:55:06 UTC (rev 6043)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/BwctlStoreRequestProcess.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,101 +0,0 @@
-/**
- * $Id$
- * Project: perfSONAR
- */
-package org.perfsonar.service.measurementArchive.sqlType.store;
-
-
-import java.util.Map;
-
-import org.ggf.ns.nmwg.base.v2_0.Element;
-import org.ggf.ns.nmwg.tools.bwctl.v2_0.Datum;
-import org.perfsonar.base.exceptions.PerfSONARException;
-
-/**
- * Moves data from nmwg data element into ibatis map structure.
- *
- * @author fernandes
- */
-public class BwctlStoreRequestProcess extends StoreRequestProcess
-{
-
-
- // -------------------------------------- constructors
-
-
- public BwctlStoreRequestProcess() throws PerfSONARException
- {
-
- super();
-
- }
-
-
- // -------------------------------------- public methods
-
-
- @Override
- public Map<String, Object> prepareStoreParameters(Element datum,
Map<String, Object> ibatisParams)
- {
-
-
- String intervalEnd = ((Datum) datum).getIntervalEnd();
- String intervalStart = ((Datum) datum).getIntervalStart();
- String intervalUnit = ((Datum) datum).getIntervalUnit();
- String numBytes = ((Datum) datum).getNumBytes();
- String numBytesUnits = ((Datum) datum).getNumBytesUnits();
- String tcpAdapterType = ((Datum) datum).getTcpAdapterType();
- String tcpMSSSize = ((Datum) datum).getTcpMSSSize();
- String timeType = ((Datum) datum).getTimeType();
- String timeValue = ((Datum) datum).getTimeValue();
- String value = ((Datum) datum).getValue();
- String valueUnits = ((Datum) datum).getValueUnits();
- String tcpMSSUnit = ((Datum) datum).getTcpMSSUnit();
- String tcpMTUSize = ((Datum) datum).getTcpMTUSize();
- String tcpMTUUnit = ((Datum) datum).getTcpMTUUnit();
- String tcpWindowSize = ((Datum) datum).getTcpWindowSize();
- String tcpWindowUnit = ((Datum) datum).getTcpWindowUnit();
- String udpBufferSize = ((Datum) datum).getUdpBufferSize();
- String udpBufferUnit = ((Datum) datum).getUdpBufferUnit();
- String udpJitter = ((Datum) datum).getUdpJitter();
- String udpJitterUnit = ((Datum) datum).getUdpJitterUnit();
- String udpPacketLoss = ((Datum) datum).getUdpPacketLoss();
- String udpPacketLossPercentage = ((Datum)
datum).getUdpPacketLossPercentage();
- String udpPacketSent = ((Datum) datum).getUdpPacketSent();
-
- try {
-
- ibatisParams.put("intervalEnd", intervalEnd);
- ibatisParams.put("intervalStart", intervalStart);
- ibatisParams.put("intervalUnit", intervalUnit);
- ibatisParams.put("numBytes", numBytes);
- ibatisParams.put("numBytesUnits", numBytesUnits);
- ibatisParams.put("tcpAdapterType", tcpAdapterType);
- ibatisParams.put("tcpMSSSize", tcpMSSSize);
- ibatisParams.put("timeType", timeType);
- ibatisParams.put("timeValue", Long.parseLong(timeValue));
- ibatisParams.put("value", Long.parseLong(value));
- ibatisParams.put("valueUnits", valueUnits);
- ibatisParams.put("tcpMSSUnit", tcpMSSUnit);
- ibatisParams.put("tcpMTUSize", tcpMTUSize);
- ibatisParams.put("tcpMTUUnit", tcpMTUUnit);
- ibatisParams.put("tcpWindowSize", tcpWindowSize);
- ibatisParams.put("tcpWindowUnit", tcpWindowUnit);
- ibatisParams.put("udpBufferSize", udpBufferSize);
- ibatisParams.put("udpBufferUnit", udpBufferUnit);
- ibatisParams.put("udpJitter", udpJitter);
- ibatisParams.put("udpJitterUnit", udpJitterUnit);
- ibatisParams.put("udpPacketLoss", udpPacketLoss);
- ibatisParams.put("udpPacketLossPercentage",
udpPacketLossPercentage);
- ibatisParams.put("udpPacketSent", udpPacketSent);
-
- } catch (Exception ex) {
- logger.debug("BwctlStoreRequestProcess.process: " +
ex.toString());
- }
-
- return ibatisParams;
-
- }
-
-
-} //BwctlStoreRequestProcess
Deleted:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/DiscardsStoreRequestProcess.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/DiscardsStoreRequestProcess.java
2012-11-27 14:55:06 UTC (rev 6043)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/DiscardsStoreRequestProcess.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,63 +0,0 @@
-/**
- * $Id$
- * Project: perfSONAR
- */
-package org.perfsonar.service.measurementArchive.sqlType.store;
-
-
-import java.util.Map;
-
-import org.ggf.ns.nmwg.base.v2_0.Element;
-import org.ggf.ns.nmwg.base.v2_0.Datum;
-
-import org.perfsonar.base.exceptions.PerfSONARException;
-
-/**
- * Moves data from nmwg data element into ibatis map structure.
- *
- * @author romradz
- */
-public class DiscardsStoreRequestProcess extends StoreRequestProcess
-{
-
-
- // -------------------------------------- constructors
-
-
- public DiscardsStoreRequestProcess() throws PerfSONARException
- {
-
- super();
-
- }
-
-
- // -------------------------------------- public methods
-
-
- @Override
- public Map<String, Object> prepareStoreParameters(Element datum,
Map<String, Object> ibatisParams)
- {
-
- String strValue = ((Datum) datum).getValue();
- String valueUnits = ((Datum) datum).getValueUnits();
- String timeValue = ((Datum) datum).getTimeValue();
-
- ibatisParams.put("valueUnits", valueUnits);
- ibatisParams.put("timeValue", Integer.parseInt(timeValue));
-
- try {
- // or a float
- ibatisParams.put("value", Float.parseFloat(strValue));
- } catch (Exception ex) {
-
//logger.debug("DiscardsStoreRequestProcess.prepareStoreParameters: " +
ex.toString());
- // value is a string ...
- ibatisParams.put("value", strValue);
- }
-
- return ibatisParams;
-
- }
-
-
-} //DiscardsStoreRequestProcess
Deleted:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/ErrorsStoreRequestProcess.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/ErrorsStoreRequestProcess.java
2012-11-27 14:55:06 UTC (rev 6043)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/ErrorsStoreRequestProcess.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,63 +0,0 @@
-/**
- * $Id$
- * Project: perfSONAR
- */
-package org.perfsonar.service.measurementArchive.sqlType.store;
-
-
-import java.util.Map;
-
-import org.ggf.ns.nmwg.base.v2_0.Element;
-import org.ggf.ns.nmwg.base.v2_0.Datum;
-
-import org.perfsonar.base.exceptions.PerfSONARException;
-
-/**
- * Moves data from nmwg data element into ibatis map structure.
- *
- * @author romradz
- */
-public class ErrorsStoreRequestProcess extends StoreRequestProcess
-{
-
-
- // -------------------------------------- constructors
-
-
- public ErrorsStoreRequestProcess() throws PerfSONARException
- {
-
- super();
-
- }
-
-
- // -------------------------------------- public methods
-
-
- @Override
- public Map<String, Object> prepareStoreParameters(Element datum,
Map<String, Object> ibatisParams)
- {
-
- String strValue = ((Datum) datum).getValue();
- String valueUnits = ((Datum) datum).getValueUnits();
- String timeValue = ((Datum) datum).getTimeValue();
-
- ibatisParams.put("valueUnits", valueUnits);
- ibatisParams.put("timeValue", Integer.parseInt(timeValue));
-
- try {
- // or a float
- ibatisParams.put("value", Float.parseFloat(strValue));
- } catch (Exception ex) {
-
//logger.debug("ErrorsStoreRequestProcess.prepareStoreParameters: " +
ex.toString());
- // value is a string ...
- ibatisParams.put("value", strValue);
- }
-
- return ibatisParams;
-
- }
-
-
-} //ErrorsStoreRequestProcess
Deleted:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/IperfStoreRequestProcess.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/IperfStoreRequestProcess.java
2012-11-27 14:55:06 UTC (rev 6043)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/IperfStoreRequestProcess.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,103 +0,0 @@
-/**
- * $Id$
- * Project: perfSONAR
- */
-package org.perfsonar.service.measurementArchive.sqlType.store;
-
-
-import java.util.Map;
-
-import org.ggf.ns.nmwg.base.v2_0.Element;
-import org.ggf.ns.nmwg.tools.iperf.v2_0.Datum;
-
-import org.perfsonar.base.exceptions.PerfSONARException;
-
-/**
- * Moves data from nmwg data element into ibatis map structure.
- *
- * @author romradz
- */
-public class IperfStoreRequestProcess extends StoreRequestProcess
-{
-
-
- // -------------------------------------- constructors
-
-
- public IperfStoreRequestProcess() throws PerfSONARException
- {
-
- super();
-
- }
-
-
- // -------------------------------------- public methods
-
-
- @Override
- public Map<String, Object> prepareStoreParameters(Element datum,
Map<String, Object> ibatisParams)
- {
-
- String strValue = ((Datum) datum).getValue();
- String valueUnits = ((Datum) datum).getValueUnits();
- String timeValue = ((Datum) datum).getTimeValue();
- String numBytes = ((Datum) datum).getNumBytes();
- String numBytesUnits = ((Datum) datum).getNumBytesUnits();
- String interval = ((Datum) datum).getInterval();
- String throughput = ((Datum) datum).getThroughput();
- String jitter = ((Datum) datum).getJitter();
- String loss = ((Datum) datum).getLoss();
-
- if (valueUnits.trim().isEmpty()) {
- valueUnits = null;
- }
- if (numBytes.trim().isEmpty()) {
- numBytes = null;
- }
- if (numBytesUnits.trim().isEmpty()) {
- numBytesUnits = null;
- }
- if (interval.trim().isEmpty()) {
- interval = null;
- }
- if (loss.trim().isEmpty()) {
- loss = null;
- }
-
- ibatisParams.put("valueUnits", valueUnits);
- ibatisParams.put("time", Integer.parseInt(timeValue));
- ibatisParams.put("numBytes", numBytes);
- ibatisParams.put("numBytesUnits", numBytesUnits);
- ibatisParams.put("interv", interval);
- ibatisParams.put("loss", loss);
-
- try {
- ibatisParams.put("value", Float.parseFloat(strValue));
- } catch (Exception ex) {
- //logger.debug("IperfStoreRequestProcess.store: " +
ex.toString());
- // value is a string ...
- //ibatisParams.put("value", strValue);
- ibatisParams.put("value", null);
- }
-
- try {
- ibatisParams.put("throughput", Float.parseFloat(throughput));
- } catch (Exception ex) {
- //logger.debug("IperfStoreRequestProcess.store: " +
ex.toString());
- ibatisParams.put("throughput", null);
- }
-
- try {
- ibatisParams.put("jitter", Float.parseFloat(jitter));
- } catch (Exception ex) {
- //logger.debug("IperfStoreRequestProcess.store: " +
ex.toString());
- ibatisParams.put("jitter", null);
- }
-
- return ibatisParams;
-
- }
-
-
-} //IperfStoreRequestProcess
Deleted:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/L2PathStatusStoreRequestProcess.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/L2PathStatusStoreRequestProcess.java
2012-11-27 14:55:06 UTC (rev 6043)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/L2PathStatusStoreRequestProcess.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,98 +0,0 @@
-/**
- * $Id$
- * Project: perfSONAR
- */
-package org.perfsonar.service.measurementArchive.sqlType.store;
-
-
-import java.util.Map;
-import java.util.Date;
-import java.util.concurrent.TimeUnit;
-
-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;
-
-/**
- * Moves data from nmwg data element into ibatis map structure.
- *
- * @author romradz
- */
-public class L2PathStatusStoreRequestProcess extends StoreRequestProcess
-{
-
-
- // -------------------------------------- constructors
-
-
- public L2PathStatusStoreRequestProcess() throws PerfSONARException
- {
-
- super();
-
- }
-
-
- // -------------------------------------- public methods
-
-
- @Override
- public Map<String, Object> prepareStoreParameters(Element datum,
Map<String, Object> 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().isEmpty()) {
- 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<String, Object>
ibatisParams)
- {
-
- int timeValueInt;
- if (timeValue.isEmpty()) {
- timeValueInt = (int) TimeUnit.MILLISECONDS.toSeconds(new
Date().getTime());
- ibatisParams.put("timeValue", timeValueInt);
- } else {
- ibatisParams.put("timeValue", Integer.parseInt(timeValue));
- }
-
- }
-
-
- protected void handleIsoTimeValue(String timeValue, Map<String, Object>
ibatisParams)
- {
-
- try {
-
- long timeValueLong = TimeDateUtil.getUnixTime(timeValue);
- ibatisParams.put("timeValue", (int) timeValueLong);
-
- } catch (Exception ex) {
- }
-
- }
-
-
-} //L2PathStatusStoreRequestProcess
Deleted:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/OwampStoreRequestProcess.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/OwampStoreRequestProcess.java
2012-11-27 14:55:06 UTC (rev 6043)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/OwampStoreRequestProcess.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,158 +0,0 @@
-/**
- * $Id$
- * Project: perfSONAR
- */
-package org.perfsonar.service.measurementArchive.sqlType.store;
-
-import java.util.Map;
-
-import org.ggf.ns.nmwg.base.v2_0.Element;
-import org.perfsonar.base.exceptions.PerfSONARException;
-import
org.perfsonar.service.measurementArchive.sqlType.nmwg.OwampAggregationDatum;
-
-/**
- * Moves data from nmwg data element into ibatis map structure.
- *
- * @author fernandes
- */
-public class OwampStoreRequestProcess extends StoreRequestProcess
-{
-
- // -------------------------------------- constructors
-
- public OwampStoreRequestProcess() throws PerfSONARException
- {
-
- super();
-
- }
-
- /**
- * For test purposes only.
- *
- * @param test
- */
- public OwampStoreRequestProcess(String test)
- {
-
- super(test);
-
- }
-
- // -------------------------------------- public methods
-
- @Override
- public Map<String, Object> prepareStoreParameters(Element datum,
- Map<String, Object>
ibatisParams)
- {
-
- String seqNum = ((OwampAggregationDatum) datum).getSeqNum();
- System.out.println("DatumgetSeqNum: " + ((OwampAggregationDatum)
datum).getSeqNum() + "wow");
- String sendTime = ((OwampAggregationDatum) datum).getSendTime();
- String sendSynchronized = ((OwampAggregationDatum)
datum).getSendSynchronized();
- String sendTimeError = ((OwampAggregationDatum)
datum).getSendTimeError();
- String receiveTime = ((OwampAggregationDatum)
datum).getReceiveTime();
- String receiveSynchronized = ((OwampAggregationDatum)
datum).getReceiveSynchronized();
- String receiveTimeError = ((OwampAggregationDatum)
datum).getReceiveTimeError();
- String ttl = ((OwampAggregationDatum) datum).getTTL();
-
- // String timeType = ((Datum)datum).getTimeType();
- // String timeValue = ((Datum)datum).getTimeValue();
-
- boolean datumType = false; // default false mans it is Datum from
OWAMP Aggregation Datum
- try {
-
- // NMWG DATUM
- if (receiveSynchronized != null
- && !receiveSynchronized.trim().isEmpty()) {
- ibatisParams.put("receiveSynchronized", Integer
- .parseInt(receiveSynchronized));
- datumType = true;
- }
-
- if (receiveTime != null && !receiveTime.trim().isEmpty()) {
- ibatisParams.put("receiveTime", receiveTime);
- datumType = true;
- }
- if (receiveTimeError != null &&
!receiveTimeError.trim().isEmpty()) {
- ibatisParams.put("receiveTimeError", Float
- .parseFloat(receiveTimeError));
- datumType = true;
- }
- if (sendSynchronized != null &&
!sendSynchronized.trim().isEmpty()) {
- ibatisParams.put("sendSynchronized", Integer
- .parseInt(sendSynchronized));
- datumType = true;
- }
- if (sendTime != null && !sendTime.trim().isEmpty()) {
- ibatisParams.put("sendTime", sendTime);
- datumType = true;
- }
- if (sendTimeError != null && !sendTimeError.trim().isEmpty()) {
- ibatisParams.put("sendTimeError", Float
- .parseFloat(sendTimeError));
- datumType = true;
- }
- if (seqNum != null && !seqNum.trim().isEmpty()) {
- ibatisParams.put("seqNum", Integer.parseInt(seqNum));
- datumType = true;
- }
- // ibatisParams.put("timeType", timeType);
- // ibatisParams.put("timeValue", Long.parseLong(timeValue));
- if (ttl != null && !ttl.trim().isEmpty()) {
- ibatisParams.put("ttl", Integer.parseInt(ttl));
- datumType = true;
- }
-
- System.out.println("DATUM TYPE! " + datumType);
-
- if (!datumType) {
- System.out.println("I AM HERE!");
- // OWAMP AGGREGATION DATUM
- ibatisParams.put("sender", ((OwampAggregationDatum) datum)
- .getSender());
- ibatisParams.put("receiver", ((OwampAggregationDatum) datum)
- .getReceiver());
- ibatisParams.put("sent", Integer
- .parseInt(((OwampAggregationDatum) datum).getSent()));
- ibatisParams.put("loss", Integer
- .parseInt(((OwampAggregationDatum) datum).getLoss()));
- ibatisParams.put("lostPercent", Float
- .parseFloat(((OwampAggregationDatum) datum)
- .getLostPercent()));
- ibatisParams.put("duplicates", Integer
- .parseInt(((OwampAggregationDatum)
datum).getDuplicates()));
- ibatisParams.put("minDelay", Float
- .parseFloat(((OwampAggregationDatum)
datum).getMinDelay()));
- ibatisParams.put("medDelay", Float
- .parseFloat(((OwampAggregationDatum)
datum).getMedDelay()));
- ibatisParams.put("maxDelay", Float
- .parseFloat(((OwampAggregationDatum)
datum).getMaxDelay()));
- ibatisParams.put("delayUnits", ((OwampAggregationDatum)
datum)
- .getDelayUnits());
- ibatisParams.put("error", Float
- .parseFloat(((OwampAggregationDatum) datum).getError()));
- ibatisParams.put("errorUnits", ((OwampAggregationDatum)
datum)
- .getErrorUnits());
- ibatisParams.put("jitter", Float
- .parseFloat(((OwampAggregationDatum)
datum).getJitter()));
- ibatisParams.put("jitterUnits", ((OwampAggregationDatum)
datum)
- .getJitterUnits());
- ibatisParams.put("hops", Integer
- .parseInt(((OwampAggregationDatum) datum).getHops()));
-
- }
-
- } catch (Exception ex) {
- // logger.debug("OwampStoreRequestProcess.process: " +
- // ex.toString());
- System.out.println("EERRRRRRRRRORRRRRRRR!!!!!!!!11");
- ex.printStackTrace();
-
- }
-
- return ibatisParams;
-
- }
-
-} // OwampStoreRequestProcess
Deleted:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/PingStoreRequestProcess.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/PingStoreRequestProcess.java
2012-11-27 14:55:06 UTC (rev 6043)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/PingStoreRequestProcess.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,72 +0,0 @@
-/**
- * $Id$
- * Project: perfSONAR
- */
-package org.perfsonar.service.measurementArchive.sqlType.store;
-
-
-import java.util.Map;
-
-import org.ggf.ns.nmwg.base.v2_0.Element;
-import org.ggf.ns.nmwg.tools.ping.v2_0.Datum;
-import org.perfsonar.base.exceptions.PerfSONARException;
-
-/**
- * Moves data from nmwg data element into ibatis map structure.
- *
- * @author fernandes
- */
-public class PingStoreRequestProcess extends StoreRequestProcess
-{
-
-
- // -------------------------------------- constructors
-
-
- public PingStoreRequestProcess() throws PerfSONARException
- {
-
- super();
-
- }
-
-
- // -------------------------------------- public methods
-
-
- @Override
- public Map<String, Object> prepareStoreParameters(Element datum,
Map<String, Object> ibatisParams)
- {
-
-
- String seqNum = ((Datum) datum).getSeqNum();
- String numBytes = ((Datum) datum).getNumBytes();
- String numBytesUnits = ((Datum) datum).getNumBytesUnits();
- String value = ((Datum) datum).getValue();
- String valueUnits = ((Datum) datum).getValueUnits();
- String ttl = ((Datum) datum).getTTL();
- String timeType = ((Datum) datum).getTimeType();
- String timeValue = ((Datum) datum).getTimeValue();
-
- try {
-
- ibatisParams.put("numBytes", Integer.parseInt(numBytes));
- ibatisParams.put("numBytesUnits", numBytesUnits);
- ibatisParams.put("value", Float.parseFloat(value));
- ibatisParams.put("valueUnits", valueUnits);
- ibatisParams.put("seqNum", Integer.parseInt(seqNum));
- ibatisParams.put("timeType", timeType);
- ibatisParams.put("timeValue", Long.parseLong(timeValue));
- ibatisParams.put("ttl", Integer.parseInt(ttl));
-
- // or a float
- } catch (Exception ex) {
- logger.debug("SQLStorageManager.store: " + ex.toString());
- }
-
- return ibatisParams;
-
- }
-
-
-} //PingRequestProcess
Deleted:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/StoreRequestProcess.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/StoreRequestProcess.java
2012-11-27 14:55:06 UTC (rev 6043)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/StoreRequestProcess.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,105 +0,0 @@
-/**
- * $Id$
- * Project: perfSONAR
- */
-package org.perfsonar.service.measurementArchive.sqlType.store;
-
-
-import java.util.Map;
-import java.util.Vector;
-
-import org.ggf.ns.nmwg.base.v2_0.Element;
-import org.ggf.ns.nmwg.base.v2_0.Data;
-
-import com.ibatis.sqlmap.client.SqlMapClient;
-
-import org.perfsonar.base.auxiliary.AuxiliaryComponentManager;
-import org.perfsonar.base.auxiliary.ComponentNames;
-import org.perfsonar.base.auxiliary.components.logger.LoggerComponent;
-
-import org.perfsonar.base.exceptions.PerfSONARException;
-
-/**
- * Abstract class for moving data from Data element into ibatis map
structure.
- *
- * @author romradz
- */
-public abstract class StoreRequestProcess
-{
-
-
- // -------------------------------------- class fields
-
-
- protected LoggerComponent logger = null;
-
-
- // -------------------------------------- constructors
-
-
- public StoreRequestProcess() throws PerfSONARException
- {
-
- try {
-
- this.logger = (LoggerComponent)
- AuxiliaryComponentManager.
- getInstance().
- getComponent(ComponentNames.LOGGER);
-
- } catch (PerfSONARException e) {
-
- throw new PerfSONARException(
- "error.common.no_logger",
- "UtilizationStoreRequestProcess.constructor: "
- + "Cannot get logger component");
-
- }
-
- }
-
- /**
- * For test purposes only. Otherwise UnitTests cannot be made with this
class because main constructor cannot
- * find the logger.
- *
- * @param test
- */
- public StoreRequestProcess(String test)
- {
-
- }
-
-
- // -------------------------------------- public methods
-
-
- public void process(SqlMapClient sqlMap, Data data, Map<String, Object>
ibatisParams)
- throws Exception
- {
-
- Vector datumVector = data.getDatum();
- if (datumVector == null) {
- logger.debug("StoreRequestProcess.process: "
- + "Data element with id='" + data.getId() + "' is empty.");
- return;
- }
-
- for (Object aDatumVector : datumVector) {
-
- Element datum = (Element) aDatumVector;
- prepareStoreParameters(datum, ibatisParams);
-
- sqlMap.insert("setResults", ibatisParams);
-
- }
-
- }
-
-
- // -------------------------------------- public abstract methods
-
-
- public abstract Map<String, Object> prepareStoreParameters(Element
datum, Map<String, Object> ibatisParams);
-
-
-} //StoreRequestProcess
Deleted:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/StoreRequestProcessFactory.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/StoreRequestProcessFactory.java
2012-11-27 14:55:06 UTC (rev 6043)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/StoreRequestProcessFactory.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,115 +0,0 @@
-/**
- * $Id$
- * Project: perfSONAR
- */
-
-package org.perfsonar.service.measurementArchive.sqlType.store;
-
-
-import org.perfsonar.base.auxiliary.AuxiliaryComponentManager;
-import org.perfsonar.base.auxiliary.ComponentNames;
-import org.perfsonar.base.auxiliary.components.logger.LoggerComponent;
-
-import org.perfsonar.base.exceptions.PerfSONARException;
-
-import org.perfsonar.service.measurementArchive.eventTypeConfig.EventType;
-import
org.perfsonar.service.measurementArchive.eventTypeConfig.EventTypeConfigurationComponent;
-
-
-/**
- * @author romradz
- */
-public final class StoreRequestProcessFactory
-{
- private StoreRequestProcessFactory()
- {
- }
-
- public static StoreRequestProcess getStoreRequestProcess(String
eventTypeName)
- throws PerfSONARException
- {
-
-
- LoggerComponent logger = (LoggerComponent)
- AuxiliaryComponentManager.
- getInstance().
- getComponent(ComponentNames.LOGGER);
-
- EventTypeConfigurationComponent eventTypeConfigurationComponent =
- (EventTypeConfigurationComponent)
- AuxiliaryComponentManager.
- getInstance().
- getComponent("eventType_config");
-
-
- EventType eventType =
- eventTypeConfigurationComponent.getEventType(eventTypeName);
-
- if (eventType == null) {
- throw new PerfSONARException(
- "error.ma.query",
- "StoreRequestProcessFactory.getStoreRequestProcess: "
- + "eventType " + eventTypeName + " is not supported");
- }
-
-
- String className = eventType.getStoreRequestProcess();
-
- logger.debug(
- "StoreRequestProcessFactory.getStoreRequestProcess: "
- + "class name for eventType (" + eventTypeName + "): "
- + className);
-
- if (className == null || className.trim().isEmpty()) {
- throw new PerfSONARException(
- "error.ma.metadata_query_mapping_configuration",
- "StoreRequestProcessFactory.getStoreRequestProcess: "
- + "Could not find class name for eventType "
- + eventTypeName);
- }
-
-
- StoreRequestProcess storeRequestProcess;
-
- try {
-
- storeRequestProcess =
- (StoreRequestProcess)
- Class.forName(className).newInstance();
-
- } catch (Exception ex) {
-
- logger.error(
- "StoreRequestProcessFactory.getResponseGenerator: "
- + "Unable to create an object of : "
- + className + ": "
- + ex.toString());
- throw new PerfSONARException(
- "error.ma.metadata_query_mapping_configuration",
- "StoreRequestProcessFactory.getResponseGenerator: "
- + "Unable to create an object of "
- + className);
-
- }
-
-
- if (storeRequestProcess == null) {
-
- logger.error(
- "StoreRequestProcessFactory.getResponseGenerator: "
- + "Could not create a responseGenerator object for "
- + "eventType: " + eventTypeName);
- throw new PerfSONARException(
- "error.ma.metadata_query_mapping_configuration",
- "StoreRequestProcessFactory.getResponseGenerator: "
- + "Could not create a responseGenerator for "
- + "eventType: " + eventTypeName);
-
- }
-
- return storeRequestProcess;
-
- }
-
-
-} //StoreRequestProcessFactory
Deleted:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/UtilizationStoreRequestProcess.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/UtilizationStoreRequestProcess.java
2012-11-27 14:55:06 UTC (rev 6043)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/UtilizationStoreRequestProcess.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,63 +0,0 @@
-/**
- * $Id$
- * Project: perfSONAR
- */
-package org.perfsonar.service.measurementArchive.sqlType.store;
-
-
-import java.util.Map;
-
-import org.ggf.ns.nmwg.base.v2_0.Element;
-import org.ggf.ns.nmwg.base.v2_0.Datum;
-
-import org.perfsonar.base.exceptions.PerfSONARException;
-
-/**
- * Moves data from nmwg data element into ibatis map structure.
- *
- * @author romradz
- */
-public class UtilizationStoreRequestProcess extends StoreRequestProcess
-{
-
-
- // -------------------------------------- constructors
-
-
- public UtilizationStoreRequestProcess() throws PerfSONARException
- {
-
- super();
-
- }
-
-
- // -------------------------------------- public methods
-
-
- @Override
- public Map<String, Object> prepareStoreParameters(Element datum,
Map<String, Object> ibatisParams)
- {
-
- String strValue = ((Datum) datum).getValue();
- String valueUnits = ((Datum) datum).getValueUnits();
- String timeValue = ((Datum) datum).getTimeValue();
-
- ibatisParams.put("valueUnits", valueUnits);
- ibatisParams.put("timeValue", Integer.parseInt(timeValue));
-
- try {
- // or a float
- ibatisParams.put("value", Float.parseFloat(strValue));
- } catch (Exception ex) {
- //logger.debug("SQLStorageManager.store: " + ex.toString());
- // value is a string ...
- ibatisParams.put("value", strValue);
- }
-
- return ibatisParams;
-
- }
-
-
-} //UtilizationStoreRequestProcess
Added:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/transaction/FallibleTransactionCallback.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/transaction/FallibleTransactionCallback.java
(rev 0)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/transaction/FallibleTransactionCallback.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -0,0 +1,21 @@
+package org.perfsonar.service.measurementArchive.sqlType.transaction;
+
+import org.springframework.transaction.TransactionStatus;
+import org.springframework.transaction.support.TransactionCallback;
+
+public abstract class FallibleTransactionCallback<T, E extends Exception>
implements TransactionCallback<T>
+{
+ @Override
+ public T doInTransaction(TransactionStatus status)
+ {
+ try {
+ return doInFallibleTransaction(status);
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new ThrowableHolderException(e);
+ }
+ }
+
+ protected abstract T doInFallibleTransaction(TransactionStatus status)
throws E;
+}
Added:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/transaction/FallibleTransactionTemplate.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/transaction/FallibleTransactionTemplate.java
(rev 0)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/transaction/FallibleTransactionTemplate.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -0,0 +1,33 @@
+package org.perfsonar.service.measurementArchive.sqlType.transaction;
+
+import org.springframework.transaction.PlatformTransactionManager;
+import org.springframework.transaction.TransactionDefinition;
+import org.springframework.transaction.support.TransactionTemplate;
+
+public class FallibleTransactionTemplate extends TransactionTemplate
+{
+ public FallibleTransactionTemplate()
+ {
+ }
+
+ public FallibleTransactionTemplate(PlatformTransactionManager
transactionManager)
+ {
+ super(transactionManager);
+ }
+
+ public FallibleTransactionTemplate(PlatformTransactionManager
transactionManager,
+ TransactionDefinition
transactionDefinition)
+ {
+ super(transactionManager, transactionDefinition);
+ }
+
+ public <T, E extends Exception> T execute(FallibleTransactionCallback<T,
E> action)
+ throws E
+ {
+ try {
+ return super.execute(action);
+ } catch (ThrowableHolderException e) {
+ throw (E) e.getCause();
+ }
+ }
+}
Added:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/transaction/ThrowableHolderException.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/transaction/ThrowableHolderException.java
(rev 0)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/transaction/ThrowableHolderException.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -0,0 +1,15 @@
+package org.perfsonar.service.measurementArchive.sqlType.transaction;
+
+class ThrowableHolderException extends RuntimeException
+{
+ public ThrowableHolderException(Throwable throwable)
+ {
+ super(throwable);
+ }
+
+ @Override
+ public String toString()
+ {
+ return getCause().toString();
+ }
+}
Added:
trunk/perfsonar-java-sql-ma/src/main/resources/META-INF/services/org.perfsonar.service.measurementArchive.sqlType.dao.DaoProvider
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/resources/META-INF/services/org.perfsonar.service.measurementArchive.sqlType.dao.DaoProvider
(rev 0)
+++
trunk/perfsonar-java-sql-ma/src/main/resources/META-INF/services/org.perfsonar.service.measurementArchive.sqlType.dao.DaoProvider
2012-11-28 10:13:12 UTC (rev 6044)
@@ -0,0 +1,3 @@
+org.perfsonar.service.measurementArchive.sqlType.dao.DefaultDaoProvider
+
+
Deleted:
trunk/perfsonar-java-sql-ma/src/test/java/org/perfsonar/service/measurementArchive/sqlType/OwampResponseGeneratorTest.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/test/java/org/perfsonar/service/measurementArchive/sqlType/OwampResponseGeneratorTest.java
2012-11-27 14:55:06 UTC (rev 6043)
+++
trunk/perfsonar-java-sql-ma/src/test/java/org/perfsonar/service/measurementArchive/sqlType/OwampResponseGeneratorTest.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,132 +0,0 @@
-package org.perfsonar.service.measurementArchive.sqlType;
-
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.ggf.ns.nmwg.base.v2_0.Data;
-import org.ggf.ns.nmwg.tools.owamp.v2_0.Datum;
-import org.junit.Assert;
-import org.junit.Test;
-import
org.perfsonar.service.measurementArchive.sqlType.fetch.OwampResponseGenerator;
-import
org.perfsonar.service.measurementArchive.sqlType.nmwg.OwampAggregationDatum;
-
-
-public class OwampResponseGeneratorTest
-{
-
- /**
- * This test should verify if returned Datum is valid.
- */
- @Test
- public void shouldReturnDatum()
- {
- //given
- Map<String, Object> row = new HashMap<String, Object>();
- row.put("seqNum", "1");
- row.put("sendTime", "1.0");
- row.put("sendSynchronized", "1");
- row.put("sendTimeError", "1.0");
- row.put("receiveTime", "1.0");
- row.put("receiveTimeError", "1.0");
- row.put("receiveSynchronized", "1");
- row.put("ttl", "1");
-
- Datum datum = new Datum();
- datum.setSeqNum((String) row.get("seqNum"));
- datum.setSendTime((String) row.get("sendTime"));
- datum.setSendSynchronized((String) row.get("sendSynchronized"));
- datum.setSendTimeError((String) row.get("sendTimeError"));
- datum.setReceiveTime((String) row.get("receiveTime"));
- datum.setReceiveTimeError((String) row.get("receiveTimeError"));
- datum.setReceiveSynchronized((String)
row.get("receiveSynchronized"));
- datum.setTTL((String) row.get("ttl"));
-
- List<Map<String, Object>> list = new ArrayList<Map<String,
Object>>();
- list.add(row);
-
- String s = "";
- java.util.Vector datumTest;
-
- //when
- try {
- Data d = new OwampResponseGenerator("test").getResponse(list);
- datumTest = d.getDatum();
- s = datumTest.toString();
- s = s.substring(1, s.length() - 1); //This is because
vector.toString() method begins and ends with "[]" brackets, while
Datum.toString() not.
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- //then
- Assert.assertEquals(datum.toString(), s);
-
- }
-
- @Test
- public void shouldReturnOwampAggregaionDatum()
- {
- //given
- Map<String, Object> row = new HashMap<String, Object>();
- row.put("sender", "1");
- row.put("receiver", "1");
- row.put("sent", "1");
- row.put("loss", "1");
- row.put("lostPercent", "1.0");
- row.put("duplicates", "1");
- row.put("minDelay", "1.0");
- row.put("medDelay", "1.0");
- row.put("maxDelay", "1.0");
- row.put("delayUnits", "1");
- row.put("error", "1");
- row.put("errorUnits", "1");
- row.put("jitter", "1");
- row.put("jitterUnits", "1");
- row.put("hops", "1");
-
- OwampAggregationDatum datum = new OwampAggregationDatum();
- datum.setSender((String) row.get("sender"));
- datum.setReceiver((String) row.get("receiver"));
- datum.setSent((String) row.get("sent"));
- datum.setLoss((String) row.get("loss"));
- datum.setLostPercent((String) row.get("lostPercent"));
- datum.setDuplicates((String) row.get("duplicates"));
- datum.setDelayUnits((String) row.get("minDelay"));
- datum.setMinDelay((String) row.get("minDelay"));
- datum.setMedDelay((String) row.get("medDelay"));
- datum.setMaxDelay((String) row.get("maxDelay"));
- datum.setDelayUnits((String) row.get("delayUnits"));
- datum.setError((String) row.get("error"));
- datum.setErrorUnits((String) row.get("errorUnits"));
- datum.setJitter((String) row.get("jitter"));
- datum.setJitterUnits((String) row.get("jitterUnits"));
- datum.setHops((String) row.get("hops"));
-
- List<Map<String, Object>> list = new ArrayList<Map<String,
Object>>();
- list.add(row);
-
- String s = "";
- java.util.Vector datumTest;
-
- //when
- try {
- Data d = new OwampResponseGenerator("test").getResponse(list);
- datumTest = d.getDatum();
- s = datumTest.toString();
- s = s.substring(1, s.length() - 1); //This is because
vector.toString() method begins and ends with "[]" brackets, while
Datum.toString() not.
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- //then
-
- //System.out.println(datum.toString());
- //System.out.println(s);
- Assert.assertEquals(datum.toString(), s);
-
- }
-
-
-}
Deleted:
trunk/perfsonar-java-sql-ma/src/test/java/org/perfsonar/service/measurementArchive/sqlType/OwampStoreRequestProcessTest.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/test/java/org/perfsonar/service/measurementArchive/sqlType/OwampStoreRequestProcessTest.java
2012-11-27 14:55:06 UTC (rev 6043)
+++
trunk/perfsonar-java-sql-ma/src/test/java/org/perfsonar/service/measurementArchive/sqlType/OwampStoreRequestProcessTest.java
2012-11-28 10:13:12 UTC (rev 6044)
@@ -1,101 +0,0 @@
-package org.perfsonar.service.measurementArchive.sqlType;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.junit.Assert;
-import org.junit.Test;
-import
org.perfsonar.service.measurementArchive.sqlType.nmwg.OwampAggregationDatum;
-import
org.perfsonar.service.measurementArchive.sqlType.store.OwampStoreRequestProcess;
-
-public class OwampStoreRequestProcessTest
-{
-
- @Test
- public void shouldReturnIbatisParamsWhenDatumIsGiven()
- {
-
- // given
- OwampAggregationDatum datum = new OwampAggregationDatum();
- datum.setSeqNum("1");
- datum.setSendTime("time1");
- datum.setSendSynchronized("1");
- datum.setSendTimeError("1.0");
- datum.setReceiveTime("time2");
- datum.setReceiveTimeError("1.0");
- datum.setReceiveSynchronized("1");
- datum.setTTL("1");
-
- Map<String, Object> ibatisParams = new HashMap<String, Object>();
- ibatisParams.put("receiveSynchronized", Integer.parseInt(datum
- .getReceiveSynchronized()));
- ibatisParams.put("receiveTime", datum.getReceiveTime());
- ibatisParams.put("receiveTimeError", Float.parseFloat(datum
- .getReceiveTimeError()));
- ibatisParams.put("sendSynchronized", Integer.parseInt(datum
- .getSendSynchronized()));
- ibatisParams.put("sendTime", datum.getSendTime());
- ibatisParams.put("sendTimeError", Float.parseFloat(datum
- .getSendTimeError()));
- ibatisParams.put("seqNum", Integer.parseInt(datum.getSeqNum()));
- ibatisParams.put("ttl", Integer.parseInt(datum.getTTL()));
-
- // when
- Map<String, Object> ibatisParamsTest = new OwampStoreRequestProcess(
- "test").prepareStoreParameters(datum,
- new HashMap<String, Object>());
-
- // then
- Assert.assertEquals(ibatisParams, ibatisParamsTest);
-
- }
-
-
- @Test
- public void shouldReturnIbatisParamsWhenOwampAggregationDatumIsGiven()
- {
- OwampAggregationDatum datum = new OwampAggregationDatum();
- datum.setSender("sender");
- datum.setReceiver("receiver");
- datum.setSent("1");
- datum.setLoss("2");
- datum.setLostPercent("1.0");
- datum.setDuplicates("2");
- datum.setMinDelay("1.0");
- datum.setMedDelay("2.0");
- datum.setMaxDelay("3.0");
- datum.setDelayUnits("mps");
- datum.setError("1.0");
- datum.setErrorUnits("mps");
- datum.setJitter("1.0");
- datum.setJitterUnits("mps");
- datum.setHops("10");
-
-
- Map<String, Object> ibatisParams = new HashMap<String, Object>();
- ibatisParams.put("sender", datum.getSender());
- ibatisParams.put("receiver", datum.getReceiver());
- ibatisParams.put("sent", Integer.parseInt(datum.getSent()));
- ibatisParams.put("loss", Integer.parseInt(datum.getLoss()));
- ibatisParams.put("lostPercent",
Float.parseFloat(datum.getLostPercent()));
- ibatisParams.put("duplicates",
Integer.parseInt(datum.getDuplicates()));
- ibatisParams.put("minDelay", Float.parseFloat(datum.getMinDelay()));
- ibatisParams.put("medDelay", Float.parseFloat(datum.getMedDelay()));
- ibatisParams.put("maxDelay", Float.parseFloat(datum.getMaxDelay()));
- ibatisParams.put("delayUnits", datum.getDelayUnits());
- ibatisParams.put("error", Float.parseFloat(datum.getError()));
- ibatisParams.put("errorUnits", datum.getErrorUnits());
- ibatisParams.put("jitter", Float.parseFloat(datum.getJitter()));
- ibatisParams.put("jitterUnits", datum.getJitterUnits());
- ibatisParams.put("hops", Integer.parseInt(datum.getHops()));
-
- // when
- Map<String, Object> ibatisParamsTest = new
OwampStoreRequestProcess("test").prepareStoreParameters(datum, new
HashMap<String, Object>());
-
- // then
- Assert.assertEquals(ibatisParams, ibatisParamsTest);
-
- }
-
-
-}
\ No newline at end of file
- [pS-dev] [GEANT/SA2/ps-java-services] r6044 - in trunk/perfsonar-java-sql-ma: . conf src/main src/main/java/org/perfsonar/service/measurementArchive/sqlType src/main/java/org/perfsonar/service/measurementArchive/sqlType/dao src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch src/main/java/org/perfsonar/service/measurementArchive/sqlType/store src/main/java/org/perfsonar/service/measurementArchive/sqlType/transaction src/main/resources src/main/resources/META-INF src/main/resources/META-INF/services src/test/java/org/perfsonar/service/measurementArchive/sqlType, svn-noreply, 11/28/2012
Archive powered by MHonArc 2.6.16.