perfsonar-dev - [pS-dev] [GEANT/SA2/ps-java-services] r6011 - in trunk/perfsonar-java-sql-ma/src: main/java/org/perfsonar/service/measurementArchive/sqlType main/java/org/perfsonar/service/measurementArchive/sqlType/fetch main/java/org/perfsonar/service/measurementArchive/sqlType/nmwg main/java/org/perfsonar/service/measurementArchive/sqlType/store test/java/org/perfsonar/service/measurementArchive/sqlType
Subject: perfsonar development work
List archive
[pS-dev] [GEANT/SA2/ps-java-services] r6011 - in trunk/perfsonar-java-sql-ma/src: main/java/org/perfsonar/service/measurementArchive/sqlType main/java/org/perfsonar/service/measurementArchive/sqlType/fetch main/java/org/perfsonar/service/measurementArchive/sqlType/nmwg main/java/org/perfsonar/service/measurementArchive/sqlType/store test/java/org/perfsonar/service/measurementArchive/sqlType
Chronological Thread
- From:
- To:
- Subject: [pS-dev] [GEANT/SA2/ps-java-services] r6011 - in trunk/perfsonar-java-sql-ma/src: main/java/org/perfsonar/service/measurementArchive/sqlType main/java/org/perfsonar/service/measurementArchive/sqlType/fetch main/java/org/perfsonar/service/measurementArchive/sqlType/nmwg main/java/org/perfsonar/service/measurementArchive/sqlType/store test/java/org/perfsonar/service/measurementArchive/sqlType
- Date: Fri, 5 Oct 2012 10:22:46 +0100 (BST)
Author: nordunet.behrmann
Date: 2012-10-05 10:22:46 +0100 (Fri, 05 Oct 2012)
New Revision: 6011
Modified:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/BaseChainingMergerFactory.java
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/NMWGInterfaceBaseChaining.java
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/SQLTypeMAServiceEngine.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/nmwg/OwampAggregationDatum.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
Log:
perfsonar-java-sql-ma: Reformat code
Among other things, this should get rid of any tab indentation.
Issue: PSSERVICES-588
Modified:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/BaseChainingMergerFactory.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/BaseChainingMergerFactory.java
2012-10-05 09:22:44 UTC (rev 6010)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/BaseChainingMergerFactory.java
2012-10-05 09:22:46 UTC (rev 6011)
@@ -11,10 +11,10 @@
import java.util.Set;
/**
- * Factory class which can be used to get the appropriate
- * object for merging the base chaining.
+ * Factory class which can be used to get the appropriate
+ * object for merging the base chaining.
*
- * @author romradz
+ * @author romradz
*/
public class BaseChainingMergerFactory
{
@@ -28,7 +28,7 @@
Set baseChainingMergers = new HashSet();
- String[] mergerNamesArray = mergerNames.split("\\s*,\\s*");
+ String[] mergerNamesArray = mergerNames.split("\\s*,\\s*");
for (String aMergerNamesArray : mergerNamesArray) {
Modified:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/NMWGInterfaceBaseChaining.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/NMWGInterfaceBaseChaining.java
2012-10-05 09:22:44 UTC (rev 6010)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/NMWGInterfaceBaseChaining.java
2012-10-05 09:22:46 UTC (rev 6011)
@@ -31,33 +31,31 @@
/**
- * This class handles base chaining of NMWG Interface element for MA
requests
+ * This class handles base chaining of NMWG Interface element for MA requests
*
- * @author romradz
- *
+ * @author romradz
*/
-public class NMWGInterfaceBaseChaining extends BaseChaining {
+public class NMWGInterfaceBaseChaining extends BaseChaining
+{
-
// ---------------------------------- constructors
+ public NMWGInterfaceBaseChaining() throws PerfSONARException
+ {
- public NMWGInterfaceBaseChaining() throws PerfSONARException {
-
super();
}
-
// ---------------------------------- public methods
-
@Override
- public void merge(Metadata metadata1, Metadata metadata2, Metadata
newMetadata) {
+ public void merge(Metadata metadata1, Metadata metadata2, Metadata
newMetadata)
+ {
Subject m1_subject = metadata1.getSubject();
@@ -78,80 +76,79 @@
}
-
// ---------------------------------- protected methods
-
protected void mergeMetadataWithUtilSubject(
- Metadata metadata1, Metadata metadata2, Metadata newMetadata) {
+ Metadata metadata1, Metadata metadata2, Metadata newMetadata)
+ {
org.ggf.ns.nmwg.characteristic.utilization.v2_0.Subject m1_subject =
(org.ggf.ns.nmwg.characteristic.utilization.v2_0.Subject)
metadata1.getSubject();
org.ggf.ns.nmwg.topology.v2_0.Interface m1_interf = null;
EventType m1_eventType = metadata1.getEventType();
- IpAddress m1_ipAddress = null;
- HostName m1_hostName = null;
- IfName m1_ifName = null;
- IfDescription m1_ifDescription = null;
- IfAddress m1_ifAddress = null;
- IfIndex m1_ifIndex = null;
- Type m1_type = null;
- Direction m1_direction = null;
- AuthRealm m1_authRealm = null;
- ClassOfService m1_classOfService = null;
- Capacity m1_capacity = null;
+ IpAddress m1_ipAddress = null;
+ HostName m1_hostName = null;
+ IfName m1_ifName = null;
+ IfDescription m1_ifDescription = null;
+ IfAddress m1_ifAddress = null;
+ IfIndex m1_ifIndex = null;
+ Type m1_type = null;
+ Direction m1_direction = null;
+ AuthRealm m1_authRealm = null;
+ ClassOfService m1_classOfService = null;
+ Capacity m1_capacity = null;
if (m1_subject != null) {
m1_interf = m1_subject.getInterface();
if (m1_interf != null) {
- m1_ipAddress = m1_interf.getIpAddressElement();
- m1_hostName = m1_interf.getHostNameElement();
- m1_ifName = m1_interf.getIfNameElement();
- m1_ifDescription = m1_interf.getIfDescriptionElement();
- m1_ifAddress = m1_interf.getIfAddressElement();
- m1_ifIndex = m1_interf.getIfIndexElement();
- m1_type = m1_interf.getTypeElement();
- m1_direction = m1_interf.getDirectionElement();
- m1_authRealm = m1_interf.getAuthRealmElement();
- m1_classOfService = m1_interf.getClassOfServiceElement();
- m1_capacity = m1_interf.getCapacityElement();
+ m1_ipAddress = m1_interf.getIpAddressElement();
+ m1_hostName = m1_interf.getHostNameElement();
+ m1_ifName = m1_interf.getIfNameElement();
+ m1_ifDescription = m1_interf.getIfDescriptionElement();
+ m1_ifAddress = m1_interf.getIfAddressElement();
+ m1_ifIndex = m1_interf.getIfIndexElement();
+ m1_type = m1_interf.getTypeElement();
+ m1_direction = m1_interf.getDirectionElement();
+ m1_authRealm = m1_interf.getAuthRealmElement();
+ m1_classOfService = m1_interf.getClassOfServiceElement();
+ m1_capacity = m1_interf.getCapacityElement();
}
}
org.ggf.ns.nmwg.characteristic.utilization.v2_0.Subject m2_subject =
(org.ggf.ns.nmwg.characteristic.utilization.v2_0.Subject)
metadata2.getSubject();
- org.ggf.ns.nmwg.topology.v2_0.Interface m2_interf = null;
+ org.ggf.ns.nmwg.topology.v2_0.Interface m2_interf = null;
EventType m2_eventType = metadata2.getEventType();
- IpAddress m2_ipAddress = null;
- HostName m2_hostName = null;
- IfName m2_ifName = null;
- IfDescription m2_ifDescription = null;
- IfAddress m2_ifAddress = null;
- IfIndex m2_ifIndex = null;
- Type m2_type = null;
- Direction m2_direction = null;
- AuthRealm m2_authRealm = null;
- ClassOfService m2_classOfService = null;
- Capacity m2_capacity = null;
+ IpAddress m2_ipAddress = null;
+ HostName m2_hostName = null;
+ IfName m2_ifName = null;
+ IfDescription m2_ifDescription = null;
+ IfAddress m2_ifAddress = null;
+ IfIndex m2_ifIndex = null;
+ Type m2_type = null;
+ Direction m2_direction = null;
+ AuthRealm m2_authRealm = null;
+ ClassOfService m2_classOfService = null;
+ Capacity m2_capacity = null;
if (m2_subject != null) {
m2_interf = m2_subject.getInterface();
if (m2_interf != null) {
- m2_ipAddress = m2_interf.getIpAddressElement();
- m2_hostName = m2_interf.getHostNameElement();
- m2_ifName = m2_interf.getIfNameElement();
- m2_ifDescription = m2_interf.getIfDescriptionElement();
- m2_ifAddress = m2_interf.getIfAddressElement();
- m2_ifIndex = m2_interf.getIfIndexElement();
- m2_type = m2_interf.getTypeElement();
- m2_direction = m2_interf.getDirectionElement();
- m2_authRealm = m2_interf.getAuthRealmElement();
- m2_classOfService = m2_interf.getClassOfServiceElement();
- m2_capacity = m2_interf.getCapacityElement();
+ m2_ipAddress = m2_interf.getIpAddressElement();
+ m2_hostName = m2_interf.getHostNameElement();
+ m2_ifName = m2_interf.getIfNameElement();
+ m2_ifDescription = m2_interf.getIfDescriptionElement();
+ m2_ifAddress = m2_interf.getIfAddressElement();
+ m2_ifIndex = m2_interf.getIfIndexElement();
+ m2_type = m2_interf.getTypeElement();
+ m2_direction = m2_interf.getDirectionElement();
+ m2_authRealm = m2_interf.getAuthRealmElement();
+ m2_classOfService = m2_interf.getClassOfServiceElement();
+ m2_capacity = m2_interf.getCapacityElement();
}
}
@@ -159,7 +156,7 @@
// comparing and adding
- if (m1_subject != null || m2_subject != null ) {
+ if (m1_subject != null || m2_subject != null) {
if (newMetadata.getSubject() == null) {
newMetadata.setSubject(new
org.ggf.ns.nmwg.characteristic.utilization.v2_0.Subject());
}
@@ -184,44 +181,44 @@
}
- if (m1_subject != null ) {
+ if (m1_subject != null) {
if (m1_interf != null) {
org.ggf.ns.nmwg.topology.v2_0.Interface newInterf =
((org.ggf.ns.nmwg.characteristic.utilization.v2_0.Subject)
newMetadata.getSubject()).getInterface();
- if (m1_ipAddress != null)
newInterf.setIpAddressElement(m1_ipAddress);
- if (m1_hostName != null)
newInterf.setHostNameElement(m1_hostName);
- if (m1_ifName != null)
newInterf.setIfNameElement(m1_ifName);
- if (m1_ifDescription != null)
newInterf.setIfDescriptionElement(m1_ifDescription);
- if (m1_ifAddress != null)
newInterf.setIfAddressElement(m1_ifAddress);
- if (m1_ifIndex != null)
newInterf.setIfIndexElement(m1_ifIndex);
- if (m1_type != null)
newInterf.setTypeElement(m1_type);
- if (m1_direction != null)
newInterf.setDirectionElement(m1_direction);
- if (m1_authRealm != null)
newInterf.setAuthRealmElement(m1_authRealm);
- if (m1_classOfService != null)
newInterf.setClassOfServiceElement(m1_classOfService);
- if (m1_capacity != null)
newInterf.setCapacityElement(m1_capacity);
+ if (m1_ipAddress != null)
newInterf.setIpAddressElement(m1_ipAddress);
+ if (m1_hostName != null)
newInterf.setHostNameElement(m1_hostName);
+ if (m1_ifName != null) newInterf.setIfNameElement(m1_ifName);
+ if (m1_ifDescription != null)
newInterf.setIfDescriptionElement(m1_ifDescription);
+ if (m1_ifAddress != null)
newInterf.setIfAddressElement(m1_ifAddress);
+ if (m1_ifIndex != null)
newInterf.setIfIndexElement(m1_ifIndex);
+ if (m1_type != null) newInterf.setTypeElement(m1_type);
+ if (m1_direction != null)
newInterf.setDirectionElement(m1_direction);
+ if (m1_authRealm != null)
newInterf.setAuthRealmElement(m1_authRealm);
+ if (m1_classOfService != null)
newInterf.setClassOfServiceElement(m1_classOfService);
+ if (m1_capacity != null)
newInterf.setCapacityElement(m1_capacity);
}
}
- if (m2_subject != null ) {
+ if (m2_subject != null) {
if (m2_interf != null) {
org.ggf.ns.nmwg.topology.v2_0.Interface newInterf =
((org.ggf.ns.nmwg.characteristic.utilization.v2_0.Subject)
newMetadata.getSubject()).getInterface();
- if (m2_ipAddress != null)
newInterf.setIpAddressElement(m2_ipAddress);
- if (m2_hostName != null)
newInterf.setHostNameElement(m2_hostName);
- if (m2_ifName != null)
newInterf.setIfNameElement(m2_ifName);
- if (m2_ifDescription != null)
newInterf.setIfDescriptionElement(m2_ifDescription);
- if (m2_ifAddress != null)
newInterf.setIfAddressElement(m2_ifAddress);
- if (m2_ifIndex != null)
newInterf.setIfIndexElement(m2_ifIndex);
- if (m2_type != null)
newInterf.setTypeElement(m2_type);
- if (m2_direction != null)
newInterf.setDirectionElement(m2_direction);
- if (m2_authRealm != null)
newInterf.setAuthRealmElement(m2_authRealm);
- if (m2_classOfService != null)
newInterf.setClassOfServiceElement(m2_classOfService);
- if (m2_capacity != null)
newInterf.setCapacityElement(m2_capacity);
+ if (m2_ipAddress != null)
newInterf.setIpAddressElement(m2_ipAddress);
+ if (m2_hostName != null)
newInterf.setHostNameElement(m2_hostName);
+ if (m2_ifName != null) newInterf.setIfNameElement(m2_ifName);
+ if (m2_ifDescription != null)
newInterf.setIfDescriptionElement(m2_ifDescription);
+ if (m2_ifAddress != null)
newInterf.setIfAddressElement(m2_ifAddress);
+ if (m2_ifIndex != null)
newInterf.setIfIndexElement(m2_ifIndex);
+ if (m2_type != null) newInterf.setTypeElement(m2_type);
+ if (m2_direction != null)
newInterf.setDirectionElement(m2_direction);
+ if (m2_authRealm != null)
newInterf.setAuthRealmElement(m2_authRealm);
+ if (m2_classOfService != null)
newInterf.setClassOfServiceElement(m2_classOfService);
+ if (m2_capacity != null)
newInterf.setCapacityElement(m2_capacity);
}
}
@@ -229,9 +226,9 @@
}
-
protected void mergeMetadataWithSelectSubject(
- Metadata metadata1, Metadata metadata2, Metadata newMetadata) {
+ Metadata metadata1, Metadata metadata2, Metadata newMetadata)
+ {
org.ggf.ns.nmwg.ops.select.v2_0.Subject m1_subject =
(org.ggf.ns.nmwg.ops.select.v2_0.Subject) metadata1.getSubject();
@@ -242,7 +239,7 @@
EventType m2_eventType = metadata2.getEventType();
- if (m1_subject != null || m2_subject != null ) {
+ if (m1_subject != null || m2_subject != null) {
if (newMetadata.getSubject() == null) {
newMetadata.setSubject(new
org.ggf.ns.nmwg.ops.select.v2_0.Subject());
}
@@ -251,11 +248,11 @@
(org.ggf.ns.nmwg.ops.select.v2_0.Subject)
newMetadata.getSubject();
- if (m1_subject != null )
+ if (m1_subject != null)
if (!m1_subject.getMetadataIdRef().isEmpty())
newSubject.setMetadataIdRef(m1_subject.getMetadataIdRef());
- if (m2_subject != null )
+ if (m2_subject != null)
if (!m2_subject.getMetadataIdRef().isEmpty())
newSubject.setMetadataIdRef(m2_subject.getMetadataIdRef());
@@ -290,6 +287,4 @@
}
-
-
} //NMWGInterfaceBaseChaining
\ No newline at end of file
Modified:
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-10-05 09:22:44 UTC (rev 6010)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/SQLStorageManager.java
2012-10-05 09:22:46 UTC (rev 6011)
@@ -43,11 +43,12 @@
import
org.perfsonar.service.measurementArchive.sqlType.store.StoreRequestProcessFactory;
/**
- * SQL storage manager responsible for accessing an sql database.
+ * SQL storage manager responsible for accessing an sql database.
*
- * @author romradz
+ * @author romradz
*/
-public class SQLStorageManager implements NMWGStorageManager {
+public class SQLStorageManager implements NMWGStorageManager
+{
// ---------------------------------- class fields
@@ -59,20 +60,21 @@
// ---------------------------------- constructors
- public SQLStorageManager() throws PerfSONARException {
+ public SQLStorageManager() throws PerfSONARException
+ {
try {
this.logger = (LoggerComponent)
AuxiliaryComponentManager.
getInstance().
- getComponent(ComponentNames.LOGGER);
+ getComponent(ComponentNames.LOGGER);
} catch (PerfSONARException e) {
throw new PerfSONARException(
- "error.common.no_logger",
- "SQLStorageManager.constructor: "
+ "error.common.no_logger",
+ "SQLStorageManager.constructor: "
+ "Cannot get logger component");
}
@@ -85,7 +87,8 @@
@Override
public void initStorage(Key dataRepository)
- throws PerfSONARException {
+ throws PerfSONARException
+ {
//do nothing
@@ -94,16 +97,17 @@
@Override
public Message fetch(Message dataQuery)
- throws PerfSONARException {
+ throws PerfSONARException
+ {
if (dataQuery == null)
throw new PerfSONARException(
- "error.ma.query",
- "SQLStorageManager.fetch: "
+ "error.ma.query",
+ "SQLStorageManager.fetch: "
+ "Query message is null");
- Message response= new Message();
+ Message response = new Message();
Collection<Metadata> collection =
dataQuery.getMetadataMap().values();
@@ -180,12 +184,12 @@
if (ibatisParams.get("time") != null) {
- if
(((String)ibatisParams.get("time")).equalsIgnoreCase("now")) {
+ if (((String)
ibatisParams.get("time")).equalsIgnoreCase("now")) {
resultList = sqlMap.queryForList("getResults2",
ibatisParams);
} else {
throw new PerfSONARException(
- "error.ma.query",
- "SQLStorageManager.fetch: "
+ "error.ma.query",
+ "SQLStorageManager.fetch: "
+ "Uknown value of time parameter in the
request");
}
} else if (ibatisParams.get("startTime") != null &&
ibatisParams.get("endTime") != null) {
@@ -199,7 +203,7 @@
// + md.getId() + ": "
// + resultList.size());
- String eventType = (String)ibatisParams.get("eventType");
+ String eventType = (String) ibatisParams.get("eventType");
//logger.debug("SQLStorageManager.fetch: EventType: " +
eventType);
ResponseGenerator responseGenerator =
@@ -209,11 +213,11 @@
} catch (Exception ioex) {
logger.error("SQLStorageManager.fetch: Unable to fetch data:
"
- + ioex.toString());
+ + ioex.toString());
throw new PerfSONARException(
- "error.sqlma.db_connection",
- "SQLStorageManager.fetch: Unable to fetch data"
- );
+ "error.sqlma.db_connection",
+ "SQLStorageManager.fetch: Unable to fetch data"
+ );
}
@@ -229,14 +233,15 @@
@Override
public Message store(Message dataSet)
- throws PerfSONARException {
+ throws PerfSONARException
+ {
if (dataSet == null)
throw new PerfSONARException(
- "error.ma.query",
- "SQLStorageManager.store: Input request is null");
+ "error.ma.query",
+ "SQLStorageManager.store: Input request is null");
- Message response= new Message();
+ Message response = new Message();
Collection<Metadata> collection = dataSet.getMetadataMap().values();
for (Metadata md : collection) {
@@ -258,14 +263,14 @@
if (ibatisConfig == null)
throw new PerfSONARException(
- "error.sqlma.db_connection.ibatis",
- "SQLStorageManager.store: "
+ "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: "
+ "error.sqlma.db_connection.ibatis",
+ "SQLStorageManager.store: "
+ "Empty ibatisConfig parameter in the key");
@@ -277,7 +282,7 @@
Reader reader = Resources.getResourceAsReader(resource);
sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
- String eventType = (String)ibatisParams.get("eventType");
+ String eventType = (String) ibatisParams.get("eventType");
//logger.debug("SQLStorageManager.store: EventType: " +
eventType);
StoreRequestProcess storeRequestProcess =
@@ -287,8 +292,8 @@
} catch (Exception ioex) {
throw new PerfSONARException(
- "error.sqlma.db_connection",
- "SQLStorageManager.store: Problem generated by
ibatis: "
+ "error.sqlma.db_connection",
+ "SQLStorageManager.store: Problem generated by ibatis: "
+ ioex.toString());
}
@@ -297,8 +302,8 @@
}
PerfSONARException pex = new PerfSONARException(
- "success.ma.write",
- "Data have been stored");
+ "success.ma.write",
+ "Data have been stored");
response = ResultCodesUtil.createResultCodeMetadata(response, pex);
return response;
@@ -306,21 +311,23 @@
@Override
- public Message remove(Message dataSet) throws PerfSONARException {
+ public Message remove(Message dataSet) throws PerfSONARException
+ {
return null;
}
@Override
- public void removeAll() throws PerfSONARException {
+ public void removeAll() throws PerfSONARException
+ {
}
@Override
- public Message update(Message dataSet) throws PerfSONARException {
+ public Message update(Message dataSet) throws PerfSONARException
+ {
return null;
}
-
} //SQLStorageManager
\ No newline at end of file
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-10-05 09:22:44 UTC (rev 6010)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/SQLTypeMAServiceEngine.java
2012-10-05 09:22:46 UTC (rev 6011)
@@ -38,37 +38,35 @@
/**
- * Class implementing the Measurement Archive Service Engine which deals
with
- * SQL database
+ * Class implementing the Measurement Archive Service Engine which deals with
+ * SQL database
*
- * @see org.perfsonar.service.base.engine
- *
- * @author romradz
- *
+ * @author romradz
+ * @see org.perfsonar.service.base.engine
*/
public class SQLTypeMAServiceEngine implements ServiceEngine
{
/**
- * Type of service angine.
+ * Type of service angine.
*/
protected String serviceEngineType = null;
/**
- * The object to log control/debugging messages
+ * The object to log control/debugging messages
*/
protected LoggerComponent logger = null;
/**
- * This object provides access to the service configuration
- * (service.properties)
+ * This object provides access to the service configuration
+ * (service.properties)
*/
protected ConfigurationComponent configuration = null;
/**
- * This object provides access to metadata configuration
+ * This object provides access to metadata configuration
*/
protected NMWGStorageManager metadataConfig = null;
@@ -78,24 +76,25 @@
/**
- * This variable is used to detect if there is more than one
- * data triggers in the request.
+ * This variable is used to detect if there is more than one
+ * data triggers in the request.
*/
protected boolean firstRunDone = false;
public static final String SELECT_NAMESPACE =
"http://ggf.org/ns/nmwg/ops/select/2.0";
- public static final String ECHO_SELF_TEST_NAMESPACE =
"http://schemas.perfsonar.net/tools/admin/selftest/";
- public static final String ECHO_XMLDB_ACCESS_TEST_NAMESPACE =
"http://schemas.perfsonar.net/tools/admin/selftest/1.0/xmldb-access-test";
+ public static final String ECHO_SELF_TEST_NAMESPACE =
"http://schemas.perfsonar.net/tools/admin/selftest/";
+ public static final String ECHO_XMLDB_ACCESS_TEST_NAMESPACE =
"http://schemas.perfsonar.net/tools/admin/selftest/1.0/xmldb-access-test";
public static final String ECHO_XMLDB_CONTENT_TEST_NAMESPACE =
"http://schemas.perfsonar.net/tools/admin/selftest/1.0/xmldb-content-test";
- public static final String ECHO_RANDOM_FETCH_TEST_NAMESPACE =
"http://schemas.perfsonar.net/tools/admin/selftest/1.0/random-fetch-test";
+ public static final String ECHO_RANDOM_FETCH_TEST_NAMESPACE =
"http://schemas.perfsonar.net/tools/admin/selftest/1.0/random-fetch-test";
// ---------------------------------- constructors
- public SQLTypeMAServiceEngine() throws PerfSONARException {
+ public SQLTypeMAServiceEngine() throws PerfSONARException
+ {
this.serviceEngineType = "service.MeasurementArchive.SQLType";
this.logger = getLogger();
@@ -115,7 +114,8 @@
// ---------------------------------- methods
- protected Message getData(Message request) throws PerfSONARException {
+ protected Message getData(Message request) throws PerfSONARException
+ {
Message response = new Message();
@@ -169,7 +169,8 @@
}
- protected Message storeData(Message request) throws PerfSONARException {
+ protected Message storeData(Message request) throws PerfSONARException
+ {
Message response = new Message();
@@ -204,7 +205,8 @@
public Message storeKey(Message request)
- throws PerfSONARException {
+ throws PerfSONARException
+ {
metadataConfig.store(request);
return generateResultCodeResponse("success.ma.write", "Key has been
stored");
@@ -212,7 +214,8 @@
protected Key getStoreKey(Metadata metadata)
- throws PerfSONARException {
+ throws PerfSONARException
+ {
EventType eventTypeObj = metadata.getEventType();
if (eventTypeObj == null)
@@ -240,8 +243,8 @@
if (ibatisConfig == null)
throw new PerfSONARException(
- "error.ma.query",
- "SQLTypeMAServiceEngine.getStoreKey: "
+ "error.ma.query",
+ "SQLTypeMAServiceEngine.getStoreKey: "
+ "No ibatisConfig parameter in the key");
} else {
@@ -310,20 +313,20 @@
params.getParameterMap().remove("ibatisConfig");
params.addChild(ibatisConfig);
- } else if (params.getParameterByName("ibatisConfig") ==
null) {
+ } 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");
+ + "No default ibatis property in the key");
throw new PerfSONARException(
- "error.ma.sql.db_connection.ibatis",
- "SQLTypeMAServiceEngine.getStoreKey: "
+ "error.ma.sql.db_connection.ibatis",
+ "SQLTypeMAServiceEngine.getStoreKey: "
+ "No default ibatis property "
+ "in the service configuration file");
- }
+ }
k.addChild(params);
@@ -366,7 +369,8 @@
}
- private Parameters copyParameters(Parameters parameters) {
+ private Parameters copyParameters(Parameters parameters)
+ {
Parameters newParameters = new Parameters();
newParameters.setUri(parameters.getUri());
@@ -389,21 +393,21 @@
(EventTypeConfigurationComponent)
AuxiliaryComponentManager.
getInstance().
- getComponent("eventType_config");
+ getComponent("eventType_config");
org.perfsonar.service.measurementArchive.eventTypeConfig.EventType
eventType =
eventTypeConfigurationComponent.getEventType(eventTypeStr);
if (eventType == null)
throw new PerfSONARException(
- "error.ma.query",
- "SQLTypeMAServiceEngine.getIbatisConfig: "
+ "error.ma.query",
+ "SQLTypeMAServiceEngine.getIbatisConfig: "
+ "eventType " + eventTypeStr + " is not supported");
String ibatisConfigStr = eventType.getIbatisConfig();
logger.debug(
- "SQLTypeMAServiceEngine.getIbatisConfig: "
+ "SQLTypeMAServiceEngine.getIbatisConfig: "
+ "ibatisConfig parameter for eventType (" + eventTypeStr +
"): "
+ ibatisConfigStr);
@@ -419,12 +423,13 @@
protected Message replaceMetadataConfiguration(Message request)
- throws PerfSONARException {
+ throws PerfSONARException
+ {
if (!isFirstRunDone()) metadataConfig.removeAll();
-
((MetadataConfigurationStorageManager)metadataConfig).storeMetadataElements(request);
-
((MetadataConfigurationStorageManager)metadataConfig).storeDataElements(request);
+ ((MetadataConfigurationStorageManager)
metadataConfig).storeMetadataElements(request);
+ ((MetadataConfigurationStorageManager)
metadataConfig).storeDataElements(request);
storeData(request);
@@ -438,49 +443,49 @@
}
-
////////////////////////////////////////////////////////////////
// Methods below are inlined from old RRD MA
//
/**
- * Method which provides access the type of ServiceEngine.
- * It implements the method definition in ServiceEngine Interface
+ * Method which provides access the type of ServiceEngine.
+ * It implements the method definition in ServiceEngine Interface
+ * <p/>
+ * It does not return null
*
- * It does not return null
- * @return String containing ServiceEngine Type
- *
- * @see org.perfsonar.service.base.engine.ServiceEngine#getType()
+ * @return String containing ServiceEngine Type
+ * @see org.perfsonar.service.base.engine.ServiceEngine#getType()
*/
@Override
- public String getType() {
+ public String getType()
+ {
return this.serviceEngineType;
}
- protected boolean isFirstRunDone() {
+ protected boolean isFirstRunDone()
+ {
return firstRunDone;
}
/**
- * Method to accept requests for action. It implements
- * the method definition in ServiceEngine Interface.
- * It does not return null.
+ * Method to accept requests for action. It implements
+ * the method definition in ServiceEngine Interface.
+ * It does not return null.
*
- * @param actionType string specifying the type of action required
- * on the given input
- * @param Message object containing the request
- * @return Message object containing the response
- *
- * @throws PerfSONARException
- *
- * @see org.perfsonar.service.base.engine.ServiceEngine
+ * @param actionType string specifying the type of action required
+ * on the given input
+ * @param Message object containing the request
+ * @return Message object containing the response
+ * @throws PerfSONARException
+ * @see org.perfsonar.service.base.engine.ServiceEngine
*/
@Override
public Message takeAction(String actionType, Message request)
- throws PerfSONARException {
+ throws PerfSONARException
+ {
logger.debug("SQLTypeMAServiceEngine.takeAction: "
+ "Received a request of type - "
@@ -549,7 +554,8 @@
}
- protected void checkXmlDbAccessProprties() throws PerfSONARException {
+ protected void checkXmlDbAccessProprties() throws PerfSONARException
+ {
if (!dbStatus.trim().equalsIgnoreCase("on")) {
@@ -581,7 +587,8 @@
private static long seq = 0;
- public static String getSeq() {
+ public static String getSeq()
+ {
String strSeq;
try {
@@ -596,10 +603,11 @@
}
- protected LoggerComponent getLogger() throws PerfSONARException {
+ protected LoggerComponent getLogger() throws PerfSONARException
+ {
try {
- return (LoggerComponent)AuxiliaryComponentManager.getInstance().
+ return (LoggerComponent) AuxiliaryComponentManager.getInstance().
getComponent(ComponentNames.LOGGER);
} catch (PerfSONARException e) {
throw new PerfSONARException(
@@ -610,10 +618,11 @@
}
- protected ConfigurationComponent getConfiguration() throws
PerfSONARException {
+ protected ConfigurationComponent getConfiguration() throws
PerfSONARException
+ {
try {
- return configuration =
(ConfigurationComponent)AuxiliaryComponentManager.getInstance().
+ return configuration = (ConfigurationComponent)
AuxiliaryComponentManager.getInstance().
getComponent(ComponentNames.CONFIG);
} catch (PerfSONARException e) {
throw new PerfSONARException(
@@ -624,7 +633,8 @@
}
- protected void setProperties() throws PerfSONARException {
+ protected void setProperties() throws PerfSONARException
+ {
// checking if using xml db is allowed
dbStatus = configuration.getProperty("component.ma.xmldb.db_status");
@@ -633,14 +643,14 @@
}
/**
- * Returns a key for a request message.
+ * Returns a key for a request message.
*
- * @param Message object containing the request
- * @return Message object containing the response with a key
- *
- * @throws PerfSONARException
+ * @param Message object containing the request
+ * @return Message object containing the response with a key
+ * @throws PerfSONARException
*/
- protected Message getKey(Message request) throws PerfSONARException {
+ protected Message getKey(Message request) throws PerfSONARException
+ {
//process the base chaining
request = messageProcess(request);
@@ -679,10 +689,10 @@
for (Message m : messageVector) {
for (Object meta : m.getMetadataMap().values())
- response.addChild((Metadata)meta);
+ response.addChild((Metadata) meta);
for (Object data : m.getDataMap().values())
- response.addChild((Data)data);
+ response.addChild((Data) data);
}
@@ -692,16 +702,16 @@
/**
- * Removes base chaining (chains of metadata blocks linked by
- * metadataIdRef attribute) from the message.
+ * Removes base chaining (chains of metadata blocks linked by
+ * metadataIdRef attribute) from the message.
*
- * @param Message object to be processed
- * @return Message processed message object
- *
- * @throws PerfSONARException
+ * @param Message object to be processed
+ * @return Message processed message object
+ * @throws PerfSONARException
*/
protected Message messageProcess(Message message)
- throws PerfSONARException {
+ throws PerfSONARException
+ {
String mergerNames = null;
try {
@@ -734,19 +744,20 @@
/**
- * Method used in getKey method. Helps to find a key for a request
message.
+ * Method used in getKey method. Helps to find a key for a request
message.
*
- * @throws PerfSONARException
+ * @throws PerfSONARException
*/
protected void _getKey(Metadata metadata,
Data data,
Map metadataMap,
Message message,
NMWGStorageManager metadataConfig)
- throws PerfSONARException {
+ throws PerfSONARException
+ {
- if (metadata.getSubject() != null ) {
+ if (metadata.getSubject() != null) {
if (metadata.getSubject().getMetadataIdRef().isEmpty()) {
@@ -765,10 +776,10 @@
getEventType(metadata, msg);
for (Object m : msg.getMetadataMap().values())
- message.addChild((Metadata)m);
+ message.addChild((Metadata) m);
for (Object d : msg.getDataMap().values())
- message.addChild((Data)d);
+ message.addChild((Data) d);
} else {
@@ -791,7 +802,7 @@
for (Object d : message.getDataMap().values()) {
- Key key = ((Data)d).getKey();
+ Key key = ((Data) d).getKey();
if (key != null) {
key.setParameters(params);
}
@@ -854,10 +865,10 @@
getEventType(metadata, msg);
for (Object m : msg.getMetadataMap().values())
- message.addChild((Metadata)m);
+ message.addChild((Metadata) m);
for (Object d : msg.getDataMap().values())
- message.addChild((Data)d);
+ message.addChild((Data) d);
} else if (key == null) {
@@ -875,7 +886,8 @@
}
- protected Message getEcho(Message request) throws PerfSONARException {
+ protected Message getEcho(Message request) throws PerfSONARException
+ {
// this method will be used for advanced types of echo request
@@ -887,7 +899,7 @@
String testName;
try {
- testName =
eventTypeStr.substring(eventTypeStr.lastIndexOf("/")+1,
eventTypeStr.length());
+ testName = eventTypeStr.substring(eventTypeStr.lastIndexOf("/")
+ 1, eventTypeStr.length());
} catch (Exception ex) {
testName = "test";
}
@@ -909,11 +921,14 @@
}
- protected Message executeXmlDBSimpleTest(Message request, String
testName) throws PerfSONARException {
+ protected Message executeXmlDBSimpleTest(Message request, String
testName) throws PerfSONARException
+ {
String serviceType =
configuration.getProperty("service.r.service_type");
String serviceName = null;
- try { serviceName = configuration.getProperty("service.name"); }
catch (Exception ex) {
+ try {
+ serviceName = configuration.getProperty("service.name");
+ } catch (Exception ex) {
}
if (serviceName == null) serviceName = "pS" + serviceType;
@@ -946,14 +961,16 @@
}
-
protected final static String _codeResponse1 = "Fetching data from the
relational database is correct.";
- protected Message executeRandomFetchTest(Message request, String
testName) throws PerfSONARException {
+ protected Message executeRandomFetchTest(Message request, String
testName) throws PerfSONARException
+ {
String serviceType =
configuration.getProperty("service.r.service_type");
String serviceName = null;
- try { serviceName = configuration.getProperty("service.name"); }
catch (Exception ex) {
+ try {
+ serviceName = configuration.getProperty("service.name");
+ } catch (Exception ex) {
}
if (serviceName == null) serviceName = "pS" + serviceType;
@@ -1006,7 +1023,8 @@
}
- protected Message executeSelfTest(Message request) throws
PerfSONARException {
+ protected Message executeSelfTest(Message request) throws
PerfSONARException
+ {
Message responseMessage = new Message();
@@ -1038,7 +1056,8 @@
}
- protected Message getTestEchoRequest(String eventType) throws
PerfSONARException {
+ protected Message getTestEchoRequest(String eventType) throws
PerfSONARException
+ {
Message message = new Message();
message.setType("EchoRequest");
@@ -1055,18 +1074,18 @@
}
- protected void buildSelfTestResponseMessage(Iterator it, Data data) {
+ protected void buildSelfTestResponseMessage(Iterator it, Data data)
+ {
while (it.hasNext()) {
- data.setChild((Element)it.next());
+ data.setChild((Element) it.next());
}
}
-
-
protected Message generateResultCodeResponse(String resultCodeId, String
resultCodeDescription)
- throws PerfSONARException {
+ throws PerfSONARException
+ {
Message response = new Message();
@@ -1079,7 +1098,8 @@
}
- private String getEventType(Metadata metadata, Message msg) {
+ private String getEventType(Metadata metadata, Message msg)
+ {
String eventType = null;
try {
@@ -1088,7 +1108,7 @@
}
for (Object d : msg.getDataMap().values()) {
- Key key = ((Data)d).getKey();
+ Key key = ((Data) d).getKey();
if (key.getParameters().getParameterMap().get("eventType") ==
null)
key.addParameter("eventType", eventType);
}
@@ -1098,7 +1118,4 @@
}
-
-
-
} //SQLTypeMAServiceEngine
\ No newline at end of file
Modified:
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-10-05 09:22:44 UTC (rev 6010)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/BwctlResponseGenerator.java
2012-10-05 09:22:46 UTC (rev 6011)
@@ -11,36 +11,35 @@
import org.perfsonar.base.exceptions.PerfSONARException;
/**
- * Creates the response of service for bwctl data.
+ * Creates the response of service for bwctl data.
*
- * @author fernandes
+ * @author fernandes
*/
-public class BwctlResponseGenerator extends ResponseGenerator {
+public class BwctlResponseGenerator extends ResponseGenerator
+{
-
// -------------------------------------- constructors
+ public BwctlResponseGenerator() throws PerfSONARException
+ {
- public BwctlResponseGenerator() throws PerfSONARException {
+ super();
- super();
-
}
-
// -------------------------------------- public methods
-
@Override
- public Data getResponse(List resultList) throws Exception {
+ public Data getResponse(List resultList) throws Exception
+ {
- Data data = new Data();
+ Data data = new Data();
for (Object aResultList : resultList) {
@@ -103,10 +102,9 @@
}
- return data;
+ return data;
}
-
} //BwctlResponseGenerator
Modified:
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-10-05 09:22:44 UTC (rev 6010)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/DiscardsResponseGenerator.java
2012-10-05 09:22:46 UTC (rev 6011)
@@ -16,32 +16,31 @@
import org.perfsonar.base.exceptions.PerfSONARException;
/**
- * Creates the service response for discards metric.
+ * Creates the service response for discards metric.
*
- * @author romradz
+ * @author romradz
*/
-public class DiscardsResponseGenerator extends ResponseGenerator {
+public class DiscardsResponseGenerator extends ResponseGenerator
+{
-
// -------------------------------------- constructors
+ public DiscardsResponseGenerator() throws PerfSONARException
+ {
- public DiscardsResponseGenerator() throws PerfSONARException {
+ super();
- super();
-
}
-
// -------------------------------------- public methods
-
@Override
- public Data getResponse(List resultList) throws Exception {
+ public Data getResponse(List resultList) throws Exception
+ {
Data data = new Data();
@@ -100,5 +99,4 @@
}
-
} //DiscardsResponseGenerator
Modified:
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-10-05 09:22:44 UTC (rev 6010)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/ErrorsResponseGenerator.java
2012-10-05 09:22:46 UTC (rev 6011)
@@ -16,32 +16,31 @@
import org.perfsonar.base.exceptions.PerfSONARException;
/**
- * Creates the service response for errors metric.
+ * Creates the service response for errors metric.
*
- * @author romradz
+ * @author romradz
*/
-public class ErrorsResponseGenerator extends ResponseGenerator {
+public class ErrorsResponseGenerator extends ResponseGenerator
+{
-
// -------------------------------------- constructors
+ public ErrorsResponseGenerator() throws PerfSONARException
+ {
- public ErrorsResponseGenerator() throws PerfSONARException {
+ super();
- super();
-
}
-
// -------------------------------------- public methods
-
@Override
- public Data getResponse(List resultList) throws Exception {
+ public Data getResponse(List resultList) throws Exception
+ {
Data data = new Data();
@@ -100,5 +99,4 @@
}
-
} //ErrorsResponseGenerator
Modified:
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-10-05 09:22:44 UTC (rev 6010)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/GenericResponseGenerator.java
2012-10-05 09:22:46 UTC (rev 6011)
@@ -16,32 +16,31 @@
import org.perfsonar.base.exceptions.PerfSONARException;
/**
- * Creates the srevice response.
+ * Creates the srevice response.
*
- * @author romradz
+ * @author romradz
*/
-public class GenericResponseGenerator extends ResponseGenerator {
+public class GenericResponseGenerator extends ResponseGenerator
+{
-
// -------------------------------------- constructors
+ public GenericResponseGenerator() throws PerfSONARException
+ {
- public GenericResponseGenerator() throws PerfSONARException {
+ super();
- super();
-
}
-
// -------------------------------------- public methods
-
@Override
- public Data getResponse(List resultList) throws Exception {
+ public Data getResponse(List resultList) throws Exception
+ {
Data data = new Data();
@@ -100,5 +99,4 @@
}
-
} //GenericResponseGenerator
Modified:
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-10-05 09:22:44 UTC (rev 6010)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/IperfResponseGenerator.java
2012-10-05 09:22:46 UTC (rev 6011)
@@ -16,32 +16,31 @@
import org.perfsonar.base.exceptions.PerfSONARException;
/**
- * Creates the service response for iperf data.
+ * Creates the service response for iperf data.
*
- * @author romradz
+ * @author romradz
*/
-public class IperfResponseGenerator extends ResponseGenerator {
+public class IperfResponseGenerator extends ResponseGenerator
+{
-
// -------------------------------------- constructors
+ public IperfResponseGenerator() throws PerfSONARException
+ {
- public IperfResponseGenerator() throws PerfSONARException {
-
super();
}
-
// -------------------------------------- public methods
-
@Override
- public Data getResponse(List resultList) throws Exception {
+ public Data getResponse(List resultList) throws Exception
+ {
Data data = new Data();
@@ -111,5 +110,4 @@
}
-
} //IperfResponseGenerator
Modified:
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-10-05 09:22:44 UTC (rev 6010)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/L2PathStatusResponseGenerator.java
2012-10-05 09:22:46 UTC (rev 6011)
@@ -20,32 +20,31 @@
import org.perfsonar.base.exceptions.PerfSONARException;
/**
- * Creates the response of service for L2 path status metric.
+ * Creates the response of service for L2 path status metric.
*
- * @author romradz
+ * @author romradz
*/
-public class L2PathStatusResponseGenerator extends ResponseGenerator {
+public class L2PathStatusResponseGenerator extends ResponseGenerator
+{
-
// -------------------------------------- constructors
+ public L2PathStatusResponseGenerator() throws PerfSONARException
+ {
- public L2PathStatusResponseGenerator() throws PerfSONARException {
+ super();
- super();
-
}
-
// -------------------------------------- public methods
-
@Override
- public Data getResponse(List resultList) throws Exception {
+ public Data getResponse(List resultList) throws Exception
+ {
Data data = new Data();
@@ -121,5 +120,4 @@
}
-
} //L2PathStatusResponseGenerator
Modified:
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-10-05 09:22:44 UTC (rev 6010)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/OwampResponseGenerator.java
2012-10-05 09:22:46 UTC (rev 6011)
@@ -17,74 +17,78 @@
* @author <a
href="mailto:">Piotr
Pikusa</a>
*/
-public class OwampResponseGenerator extends ResponseGenerator {
+public class OwampResponseGenerator extends ResponseGenerator
+{
- // -------------------------------------- constructors
+ // -------------------------------------- constructors
- public OwampResponseGenerator() throws PerfSONARException {
+ public OwampResponseGenerator() throws PerfSONARException
+ {
- super();
+ super();
- }
-
- /**
- * Constructor only for test purposes
- * @param t
- */
- public OwampResponseGenerator(String t){
+ }
- super(t);
+ /**
+ * Constructor only for test purposes
+ *
+ * @param t
+ */
+ public OwampResponseGenerator(String t)
+ {
- }
+ super(t);
+ }
- // -------------------------------------- public methods
- @Override
- public Data getResponse(List resultList) throws Exception {
+ // -------------------------------------- public methods
- Data data = new Data();
+ @Override
+ public Data getResponse(List resultList) throws Exception
+ {
- // This is true when resultList contains data from owamp
table and is
- // false when it contains data from owamp_agg
- boolean owamp = true;
+ Data data = new Data();
- // First check if results are for ordinary OWAMP (owamp
table) or OWAMP
- // Aggregate (owamp_agg) table
- if (!resultList.isEmpty()) {
- Collection<String> kCollection = ((Map)
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;
- }
- }
- }
+ // This is true when resultList contains data from owamp table and is
+ // false when it contains data from owamp_agg
+ boolean owamp = true;
- System.out.println("Here 1");
+ // First check if results are for ordinary OWAMP (owamp table) or
OWAMP
+ // Aggregate (owamp_agg) table
+ if (!resultList.isEmpty()) {
+ Collection<String> kCollection = ((Map)
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 (Object aResultList : resultList) {
System.out.println("Here 2");
@@ -211,7 +215,7 @@
}
}
- System.out.println("Here 6");
- return data;
- }
+ System.out.println("Here 6");
+ return data;
+ }
} // OwampResponseGenerator
Modified:
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-10-05 09:22:44 UTC (rev 6010)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/PingResponseGenerator.java
2012-10-05 09:22:46 UTC (rev 6011)
@@ -11,36 +11,35 @@
import org.perfsonar.base.exceptions.PerfSONARException;
/**
- * Creates the response of service for ping data.
+ * Creates the response of service for ping data.
*
- * @author fernandes
+ * @author fernandes
*/
-public class PingResponseGenerator extends ResponseGenerator {
+public class PingResponseGenerator extends ResponseGenerator
+{
-
// -------------------------------------- constructors
+ public PingResponseGenerator() throws PerfSONARException
+ {
- public PingResponseGenerator() throws PerfSONARException {
+ super();
- super();
-
}
-
// -------------------------------------- public methods
-
@Override
- public Data getResponse(List resultList) throws Exception {
+ public Data getResponse(List resultList) throws Exception
+ {
- Data data = new Data();
+ Data data = new Data();
for (Object aResultList : resultList) {
@@ -96,5 +95,4 @@
}
-
} //PingResponseGenerator
Modified:
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-10-05 09:22:44 UTC (rev 6010)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/ResponseGenerator.java
2012-10-05 09:22:46 UTC (rev 6011)
@@ -16,62 +16,59 @@
import org.perfsonar.base.exceptions.PerfSONARException;
/**
- * Creates the response of service.
+ * Creates the response of service.
*
- * @author romradz
+ * @author romradz
*/
-public abstract class ResponseGenerator {
+public abstract class ResponseGenerator
+{
-
// -------------------------------------- class fields
-
protected LoggerComponent logger = null;
-
// -------------------------------------- constructors
+ public ResponseGenerator() throws PerfSONARException
+ {
- public ResponseGenerator() throws PerfSONARException {
-
try {
logger = (LoggerComponent)
AuxiliaryComponentManager.
getInstance().
- getComponent(ComponentNames.LOGGER);
+ getComponent(ComponentNames.LOGGER);
} catch (PerfSONARException e) {
throw new PerfSONARException(
"error.common.no_logger",
- "ResponseGenerator.constructor: "
+ "ResponseGenerator.constructor: "
+ "Cannot get logger component");
}
- }
-
- /**
- * 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){
-
- }
+ }
+ /**
+ * 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 methods
+ // -------------------------------------- public abstract methods
public abstract Data getResponse(List resultList) throws Exception;
-
} //ResponseGenerator
Modified:
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-10-05 09:22:44 UTC (rev 6010)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/ResponseGeneratorFactory.java
2012-10-05 09:22:46 UTC (rev 6011)
@@ -17,29 +17,30 @@
/**
- * Creates relevant ResponseGenerator object
- * according to the value of eventType.
+ * Creates relevant ResponseGenerator object
+ * according to the value of eventType.
*
- * @author romradz
+ * @author romradz
*/
-public class ResponseGeneratorFactory {
+public class ResponseGeneratorFactory
+{
-
public static ResponseGenerator getResponseGenerator(String
eventTypeName)
- throws PerfSONARException {
+ throws PerfSONARException
+ {
LoggerComponent logger = (LoggerComponent)
AuxiliaryComponentManager.
getInstance().
- getComponent(ComponentNames.LOGGER);
+ getComponent(ComponentNames.LOGGER);
EventTypeConfigurationComponent eventTypeConfigurationComponent =
(EventTypeConfigurationComponent)
AuxiliaryComponentManager.
getInstance().
- getComponent("eventType_config");
+ getComponent("eventType_config");
EventType eventType =
@@ -47,8 +48,8 @@
if (eventType == null)
throw new PerfSONARException(
- "error.ma.query",
- "ResponseGeneratorFactory.getResponseGenerator: "
+ "error.ma.query",
+ "ResponseGeneratorFactory.getResponseGenerator: "
+ "eventType " + eventTypeName + " is not supported");
@@ -61,8 +62,8 @@
if (className == null || className.trim().isEmpty())
throw new PerfSONARException(
- "error.ma.metadata_query_mapping_configuration",
- "ResponseGeneratorFactory.getResponseGenerator: "
+ "error.ma.metadata_query_mapping_configuration",
+ "ResponseGeneratorFactory.getResponseGenerator: "
+ "Could not find class name for eventType "
+ eventTypeName);
@@ -78,13 +79,13 @@
} catch (Exception ex) {
logger.error(
- "ResponseGeneratorFactory.getResponseGenerator: "
+ "ResponseGeneratorFactory.getResponseGenerator: "
+ "Unable to create an object of : "
+ className + ": "
+ ex.toString());
throw new PerfSONARException(
- "error.ma.metadata_query_mapping_configuration",
- "ResponseGeneratorFactory.getResponseGenerator: "
+ "error.ma.metadata_query_mapping_configuration",
+ "ResponseGeneratorFactory.getResponseGenerator: "
+ "Unable to create an object of "
+ className);
@@ -94,12 +95,12 @@
if (responseGenerator == null) {
logger.error(
- "ResponseGeneratorFactory.getResponseGenerator: "
+ "ResponseGeneratorFactory.getResponseGenerator: "
+ "Could not create a responseGenerator object for "
+ "eventType: " + eventTypeName);
throw new PerfSONARException(
- "error.ma.metadata_query_mapping_configuration",
- "ResponseGeneratorFactory.getResponseGenerator: "
+ "error.ma.metadata_query_mapping_configuration",
+ "ResponseGeneratorFactory.getResponseGenerator: "
+ "Could not create a responseGenerator for "
+ "eventType: " + eventTypeName);
@@ -110,5 +111,4 @@
}
-
} //ResponseGeneratorFactory
Modified:
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-10-05 09:22:44 UTC (rev 6010)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/UtilizationResponseGenerator.java
2012-10-05 09:22:46 UTC (rev 6011)
@@ -16,32 +16,31 @@
import org.perfsonar.base.exceptions.PerfSONARException;
/**
- * Creates the service response for utilization metric.
+ * Creates the service response for utilization metric.
*
- * @author romradz
+ * @author romradz
*/
-public class UtilizationResponseGenerator extends ResponseGenerator {
+public class UtilizationResponseGenerator extends ResponseGenerator
+{
-
// -------------------------------------- constructors
+ public UtilizationResponseGenerator() throws PerfSONARException
+ {
- public UtilizationResponseGenerator() throws PerfSONARException {
-
super();
}
-
// -------------------------------------- public methods
-
@Override
- public Data getResponse(List resultList) throws Exception {
+ public Data getResponse(List resultList) throws Exception
+ {
Data data = new Data();
@@ -100,5 +99,4 @@
}
-
} //UtilizationResponseGenerator
Modified:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/nmwg/OwampAggregationDatum.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/nmwg/OwampAggregationDatum.java
2012-10-05 09:22:44 UTC (rev 6010)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/nmwg/OwampAggregationDatum.java
2012-10-05 09:22:46 UTC (rev 6011)
@@ -3,13 +3,13 @@
/**
* This describes the datum format of a ping measurement.
*
- * @author Piotr Pikusa
- * @version $Id$
- * @see org.ggf.ns.nmwg.base.v2_0.Element
- * @see org.ggf.ns.nmwg.base.v2_0.Datum
- * @see org.ggf.ns.nmwg.time.v2_0.Time
- * @see org.w3c.dom.Document
- * @see org.w3c.dom.Element
+ * @author Piotr Pikusa
+ * @version $Id$
+ * @see org.ggf.ns.nmwg.base.v2_0.Element
+ * @see org.ggf.ns.nmwg.base.v2_0.Datum
+ * @see org.ggf.ns.nmwg.time.v2_0.Time
+ * @see org.w3c.dom.Document
+ * @see org.w3c.dom.Element
*/
import org.xml.sax.ContentHandler;
@@ -18,626 +18,654 @@
import org.ggf.ns.nmwg.time.v2_0.Time;
import org.xml.sax.helpers.NamespaceSupport;
-public class OwampAggregationDatum extends
org.ggf.ns.nmwg.tools.owamp.v2_0.Datum{
+public class OwampAggregationDatum extends
org.ggf.ns.nmwg.tools.owamp.v2_0.Datum
+{
- public static final String FILENAME =
"org/perfsonar/service/measurementArchive/sqlType/nmwg/OwampAggregationDatum.java";
-
- /**
- * attribute for Sender
- */
- protected String sender;
+ public static final String FILENAME =
"org/perfsonar/service/measurementArchive/sqlType/nmwg/OwampAggregationDatum.java";
- /**
- * attribute for receiver
- */
- protected String receiver;
+ /**
+ * attribute for Sender
+ */
+ protected String sender;
- /**
- * attribute for sent
- */
- protected String sent;
+ /**
+ * attribute for receiver
+ */
+ protected String receiver;
- /**
- * attribute for loss
- */
- protected String loss;
+ /**
+ * attribute for sent
+ */
+ protected String sent;
- /**
- * attribute for RECVTIME (Receive timestamp)
- */
- protected String duplicates;
+ /**
+ * attribute for loss
+ */
+ protected String loss;
- /**
- * attribute for Lost in percrent
- */
- protected String lostPercent;
+ /**
+ * attribute for RECVTIME (Receive timestamp)
+ */
+ protected String duplicates;
- /**
- * attribute for minimum dealy
- */
- protected String minDelay;
+ /**
+ * attribute for Lost in percrent
+ */
+ protected String lostPercent;
- /**
- * attribute for medium delay
- */
- protected String medDelay;
+ /**
+ * attribute for minimum dealy
+ */
+ protected String minDelay;
- protected String maxDelay;
+ /**
+ * attribute for medium delay
+ */
+ protected String medDelay;
- protected String delayUnits;
+ protected String maxDelay;
- protected String error;
+ protected String delayUnits;
- protected String errorUnits;
+ protected String error;
- protected String jitter;
+ protected String errorUnits;
- protected String jitterUnits;
+ protected String jitter;
- protected String hops;
+ protected String jitterUnits;
- public String getSender() {
- return sender;
- }
+ protected String hops;
- public void setSender(String sender) {
- this.sender = sender;
- }
+ public String getSender()
+ {
+ return sender;
+ }
- public String getReceiver() {
- return receiver;
- }
+ public void setSender(String sender)
+ {
+ this.sender = sender;
+ }
- public void setReceiver(String receiver) {
- this.receiver = receiver;
- }
+ public String getReceiver()
+ {
+ return receiver;
+ }
- public String getSent() {
- return sent;
- }
+ public void setReceiver(String receiver)
+ {
+ this.receiver = receiver;
+ }
- public void setSent(String sent) {
- this.sent = sent;
- }
+ public String getSent()
+ {
+ return sent;
+ }
- public String getLoss() {
- return loss;
- }
+ public void setSent(String sent)
+ {
+ this.sent = sent;
+ }
- public void setLoss(String loss) {
- this.loss = loss;
- }
+ public String getLoss()
+ {
+ return loss;
+ }
- public String getDuplicates() {
- return duplicates;
- }
+ public void setLoss(String loss)
+ {
+ this.loss = loss;
+ }
- public void setDuplicates(String duplicates) {
- this.duplicates = duplicates;
- }
+ public String getDuplicates()
+ {
+ return duplicates;
+ }
- public String getLostPercent() {
- return lostPercent;
- }
+ public void setDuplicates(String duplicates)
+ {
+ this.duplicates = duplicates;
+ }
- public void setLostPercent(String lostPercent) {
- this.lostPercent = lostPercent;
- }
+ public String getLostPercent()
+ {
+ return lostPercent;
+ }
- public String getMinDelay() {
- return minDelay;
- }
+ public void setLostPercent(String lostPercent)
+ {
+ this.lostPercent = lostPercent;
+ }
- public void setMinDelay(String minDelay) {
- this.minDelay = minDelay;
- }
+ public String getMinDelay()
+ {
+ return minDelay;
+ }
- public String getMedDelay() {
- return medDelay;
- }
+ public void setMinDelay(String minDelay)
+ {
+ this.minDelay = minDelay;
+ }
- public void setMedDelay(String medDelay) {
- this.medDelay = medDelay;
- }
+ public String getMedDelay()
+ {
+ return medDelay;
+ }
- public String getMaxDelay() {
- return maxDelay;
- }
+ public void setMedDelay(String medDelay)
+ {
+ this.medDelay = medDelay;
+ }
- public void setMaxDelay(String maxDelay) {
- this.maxDelay = maxDelay;
- }
+ public String getMaxDelay()
+ {
+ return maxDelay;
+ }
- public String getDelayUnits() {
- return delayUnits;
- }
+ public void setMaxDelay(String maxDelay)
+ {
+ this.maxDelay = maxDelay;
+ }
- public void setDelayUnits(String delayUnits) {
- this.delayUnits = delayUnits;
- }
+ public String getDelayUnits()
+ {
+ return delayUnits;
+ }
- public String getError() {
- return error;
- }
+ public void setDelayUnits(String delayUnits)
+ {
+ this.delayUnits = delayUnits;
+ }
- public void setError(String error) {
- this.error = error;
- }
+ public String getError()
+ {
+ return error;
+ }
- public String getErrorUnits() {
- return errorUnits;
- }
+ public void setError(String error)
+ {
+ this.error = error;
+ }
- public void setErrorUnits(String errorUnits) {
- this.errorUnits = errorUnits;
- }
+ public String getErrorUnits()
+ {
+ return errorUnits;
+ }
- public String getJitter() {
- return jitter;
- }
+ public void setErrorUnits(String errorUnits)
+ {
+ this.errorUnits = errorUnits;
+ }
- public void setJitter(String jitter) {
- this.jitter = jitter;
- }
+ public String getJitter()
+ {
+ return jitter;
+ }
- public String getJitterUnits() {
- return jitterUnits;
- }
+ public void setJitter(String jitter)
+ {
+ this.jitter = jitter;
+ }
- public void setJitterUnits(String jitterUnits) {
- this.jitterUnits = jitterUnits;
- }
+ public String getJitterUnits()
+ {
+ return jitterUnits;
+ }
- public String getHops() {
- return hops;
- }
+ public void setJitterUnits(String jitterUnits)
+ {
+ this.jitterUnits = jitterUnits;
+ }
- public void setHops(String hops) {
- this.hops = hops;
- }
+ public String getHops()
+ {
+ return hops;
+ }
- /**
- * The constructor initializes the variables and sets xml element
- * information (when applicable).
- */
- public OwampAggregationDatum() {
- sender = "";
- receiver = "";
- sent = "";
- loss = "";
- duplicates = "";
- lostPercent = "";
- minDelay = "";
- medDelay = "";
+ public void setHops(String hops)
+ {
+ this.hops = hops;
+ }
- parent = null;
- id = "";
- completed = false;
+ /**
+ * The constructor initializes the variables and sets xml element
+ * information (when applicable).
+ */
+ public OwampAggregationDatum()
+ {
+ sender = "";
+ receiver = "";
+ sent = "";
+ loss = "";
+ duplicates = "";
+ lostPercent = "";
+ minDelay = "";
+ medDelay = "";
- localName = "datum";
- uri = "http://ggf.org/ns/nmwg/tools/owamp/2.0/";
- qName = "owamp:datum";
- prefix = "owamp";
- fileName =
"org/perfsonar/service/measurementArchive/sqlType/nmwg/OwampAggregationDatum.java";
- }
+ parent = null;
+ id = "";
+ completed = false;
- @Override
- public boolean addAttr(String attr, String value, NamespaceSupport nss) {
-
-
- if (attr.equals("value")) {
- setValue(value);
- }
- //OWAMP SUMMARY DATUM PARAMETERS
- else if (attr.equals("valueUnits")) {
- setValueUnits(value);
- } else if (attr.equals("numBytes")) {
- setNumBytes(value);
- } else if (attr.equals("numBytesUnits")) {
- setNumBytesUnits(value);
- } else if (attr.equals("sender")) {
- setSender(value);
- } else if (attr.equals("receiver")) {
- setReceiver(value);
- } else if (attr.equals("sent")) {
- setSent(value);
- } else if (attr.equals("loss")) {
- setLoss(value);
- } else if (attr.equals("lostPercent")) {
- setLostPercent(value);
- } else if (attr.equals("duplicates")) {
- setDuplicates(value);
- } else if (attr.equals("minDelay")) {
- setMinDelay(value);
- } else if (attr.equals("medDelay")) {
- setMedDelay(value);
- } else if (attr.equals("maxDelay")) {
- setMaxDelay(value);
- } else if (attr.equals("delayUnits")) {
- setDelayUnits(value);
- } else if (attr.equals("error")) {
- setError(value);
- } else if (attr.equals("errorUnits")) {
- setErrorUnits(value);
- } else if (attr.equals("jitter")) {
- setJitter(value);
- } else if (attr.equals("jitterUnits")) {
- setJitterUnits(value);
- } else if (attr.equals("hops")) {
- setHops(value);
- }
- //OWAMP DATUM PARAMETERS
- else if(attr.equals("seqNum")) {
- setSeqNum(value);
- }
- else if(attr.equals("sendTime")) {
- setSendTime(value);
- }
- else if(attr.equals("sendSynchronized")) {
- setSendSynchronized(value);
- }
- else if(attr.equals("sendTimeError")) {
- setSendTimeError(value);
- }
- else if(attr.equals("receiveTime")) {
- setReceiveTime(value);
- }
- else if(attr.equals("receiveSynchronized")) {
- setReceiveSynchronized(value);
- }
- else if(attr.equals("receiveTimeError")) {
- setReceiveTimeError(value);
- }
- else if(attr.equals("ttl")) {
- setTTL(value);
- }
- else if (attr.contains("xmlns")) {
- if (attr.split(":").length == 1) {
- if (nss.getURI("") == null) {
- nss.declarePrefix("", value);
- }
- if ((prefix.isEmpty()) &&
!(value.equals(uri))) {
- uri = value;
- }
- } else {
- if (nss.getURI(attr.split(":")[1]) == null) {
- nss.declarePrefix(attr.split(":")[1],
value);
- }
- if ((prefix.equals(attr.split(":")[1])) &&
!(value.equals(uri))) {
- uri = value;
- }
- }
- } else {
- System.err
- .println("Error: "
- + getFileName()
- + " addAttr(String,
String, NamespaceSupport) unrecognized attribute pair: "
- + attr + " - " +
value);
- return false;
- }
- return true;
- }
+ localName = "datum";
+ uri = "http://ggf.org/ns/nmwg/tools/owamp/2.0/";
+ qName = "owamp:datum";
+ prefix = "owamp";
+ fileName =
"org/perfsonar/service/measurementArchive/sqlType/nmwg/OwampAggregationDatum.java";
+ }
- /**
- * The only allowable child for a datum element is the time.
- */
- @Override
- public boolean addChild(Element newChild) {
- if (newChild.getLocalName().equals("time")) {
- setTime((Time) newChild);
- } else {
- System.err.println("Error: " + getFileName()
- + " addChild(Element) unrecognized
child: " + newChild);
- return false;
- }
- return true;
- }
+ @Override
+ public boolean addAttr(String attr, String value, NamespaceSupport nss)
+ {
- /**
- * Converts the contents of this object into an xml tag.
- */
- @Override
+
+ if (attr.equals("value")) {
+ setValue(value);
+ }
+ //OWAMP SUMMARY DATUM PARAMETERS
+ else if (attr.equals("valueUnits")) {
+ setValueUnits(value);
+ } else if (attr.equals("numBytes")) {
+ setNumBytes(value);
+ } else if (attr.equals("numBytesUnits")) {
+ setNumBytesUnits(value);
+ } else if (attr.equals("sender")) {
+ setSender(value);
+ } else if (attr.equals("receiver")) {
+ setReceiver(value);
+ } else if (attr.equals("sent")) {
+ setSent(value);
+ } else if (attr.equals("loss")) {
+ setLoss(value);
+ } else if (attr.equals("lostPercent")) {
+ setLostPercent(value);
+ } else if (attr.equals("duplicates")) {
+ setDuplicates(value);
+ } else if (attr.equals("minDelay")) {
+ setMinDelay(value);
+ } else if (attr.equals("medDelay")) {
+ setMedDelay(value);
+ } else if (attr.equals("maxDelay")) {
+ setMaxDelay(value);
+ } else if (attr.equals("delayUnits")) {
+ setDelayUnits(value);
+ } else if (attr.equals("error")) {
+ setError(value);
+ } else if (attr.equals("errorUnits")) {
+ setErrorUnits(value);
+ } else if (attr.equals("jitter")) {
+ setJitter(value);
+ } else if (attr.equals("jitterUnits")) {
+ setJitterUnits(value);
+ } else if (attr.equals("hops")) {
+ setHops(value);
+ }
+ //OWAMP DATUM PARAMETERS
+ else if (attr.equals("seqNum")) {
+ setSeqNum(value);
+ } else if (attr.equals("sendTime")) {
+ setSendTime(value);
+ } else if (attr.equals("sendSynchronized")) {
+ setSendSynchronized(value);
+ } else if (attr.equals("sendTimeError")) {
+ setSendTimeError(value);
+ } else if (attr.equals("receiveTime")) {
+ setReceiveTime(value);
+ } else if (attr.equals("receiveSynchronized")) {
+ setReceiveSynchronized(value);
+ } else if (attr.equals("receiveTimeError")) {
+ setReceiveTimeError(value);
+ } else if (attr.equals("ttl")) {
+ setTTL(value);
+ } else if (attr.contains("xmlns")) {
+ if (attr.split(":").length == 1) {
+ if (nss.getURI("") == null) {
+ nss.declarePrefix("", value);
+ }
+ if ((prefix.isEmpty()) && !(value.equals(uri))) {
+ uri = value;
+ }
+ } else {
+ if (nss.getURI(attr.split(":")[1]) == null) {
+ nss.declarePrefix(attr.split(":")[1], value);
+ }
+ if ((prefix.equals(attr.split(":")[1])) &&
!(value.equals(uri))) {
+ uri = value;
+ }
+ }
+ } else {
+ System.err
+ .println("Error: "
+ + getFileName()
+ + " addAttr(String, String, NamespaceSupport)
unrecognized attribute pair: "
+ + attr + " - " + value);
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * The only allowable child for a datum element is the time.
+ */
+ @Override
+ public boolean addChild(Element newChild)
+ {
+ if (newChild.getLocalName().equals("time")) {
+ setTime((Time) newChild);
+ } else {
+ System.err.println("Error: " + getFileName()
+ + " addChild(Element) unrecognized child: " + newChild);
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Converts the contents of this object into an xml tag.
+ */
+ @Override
public ContentHandler toXML(ContentHandler handler, NamespaceSupport nss)
- throws Exception {
- try {
- handler.startElement(getUri(), getLocalName(),
getQName(),
- getAttributes(nss));
- handler = getChildren(handler, nss);
- handler.endElement(getUri(), getLocalName(),
getQName());
+ throws Exception
+ {
+ try {
+ handler.startElement(getUri(), getLocalName(), getQName(),
+ getAttributes(nss));
+ handler = getChildren(handler, nss);
+ handler.endElement(getUri(), getLocalName(), getQName());
- if (getCompleted()) {
- nss.popContext();
- unSetCompleted();
- }
- } catch (Exception e) {
- System.err
- .println("Error: "
- + getFileName()
- + "
toXML(ContentHandler, NamespaceSupport) XML formulation error.");
- }
- return handler;
- }
+ if (getCompleted()) {
+ nss.popContext();
+ unSetCompleted();
+ }
+ } catch (Exception e) {
+ System.err
+ .println("Error: "
+ + getFileName()
+ + " toXML(ContentHandler, NamespaceSupport) XML
formulation error.");
+ }
+ return handler;
+ }
- /**
- * Converts items into attributes for an xml tag.
- */
- @Override
- public AttributesImpl getAttributes(NamespaceSupport nss) {
- AttributesImpl atts = new AttributesImpl();
+ /**
+ * Converts items into attributes for an xml tag.
+ */
+ @Override
+ public AttributesImpl getAttributes(NamespaceSupport nss)
+ {
+ AttributesImpl atts = new AttributesImpl();
- //SUMMARY DAT
- if (!(getValue().isEmpty())) {
- atts.addAttribute(getUri(), "value", "value",
"CDATA", getValue());
- }
- if (!(getValueUnits().isEmpty())) {
- atts.addAttribute(getUri(), "valueUnits",
"valueUnits", "CDATA",
- getValueUnits());
- }
- if (!(getNumBytes().isEmpty())) {
- atts.addAttribute(getUri(), "numBytes", "numBytes",
"CDATA",
- getNumBytes());
- }
- if (!(getNumBytesUnits().isEmpty())) {
- atts.addAttribute(getUri(), "numBytesUnits",
"numBytesUnits",
- "CDATA", getNumBytesUnits());
- }
- if (!(getTimeType().isEmpty())) {
- atts.addAttribute(getUri(), "timeType", "timeType",
"CDATA",
- getTimeType());
- }
- if (!(getTimeValue().isEmpty())) {
- atts.addAttribute(getUri(), "timeValue", "timeValue",
"CDATA",
- getTimeValue());
- }
- /* Add Specific Attributes from here */
- if (!(getSender().isEmpty())) {
- atts.addAttribute(getUri(), "sender", "sender",
"CDATA",
- getSender());
- }
- if (!(getReceiver().isEmpty())) {
- atts.addAttribute(getUri(), "receiver", "receiver",
"CDATA",
- getReceiver());
- }
- if (!(getSent().isEmpty())) {
- atts.addAttribute(getUri(), "sent", "sent",
- "CDATA", getSent());
- }
- if (!(getLoss().isEmpty())) {
- atts.addAttribute(getUri(), "loss", "loss",
- "CDATA", getLoss());
- }
- if (!(getLostPercent().isEmpty())) {
- atts.addAttribute(getUri(), "lostPercent",
"lostPercent", "CDATA",
- getLostPercent());
- }
- if (!(getDuplicates().isEmpty())) {
- atts.addAttribute(getUri(), "duplicates",
- "duplicates", "CDATA",
getDuplicates());
- }
- if (!(getMinDelay().isEmpty())) {
- atts.addAttribute(getUri(), "minDelay", "minDelay",
- "CDATA", getMinDelay());
- }
- if (!(getMedDelay().isEmpty())) {
- atts.addAttribute(getUri(), "medDelay", "medDelay",
"CDATA", getMedDelay());
- }
- if (!(getMaxDelay().isEmpty())) {
- atts.addAttribute(getUri(), "maxDelay", "maxDelay",
"CDATA", getMaxDelay());
- }
- if (!(getDelayUnits().isEmpty())) {
- atts.addAttribute(getUri(), "delayUnits",
"delayUnits", "CDATA", getDelayUnits());
- }
- if (!(getError().isEmpty())) {
- atts.addAttribute(getUri(), "error", "error",
"CDATA", getError());
- }
- if (!(getErrorUnits().isEmpty())) {
- atts.addAttribute(getUri(), "errorUnits",
"errorUnits", "CDATA", getErrorUnits());
- }
- if (!(getJitter().isEmpty())) {
- atts.addAttribute(getUri(), "jitter", "jitter",
"CDATA", getJitter());
- }
- if (!(getJitterUnits().isEmpty())) {
- atts.addAttribute(getUri(), "jitterUnits",
"jitterUnits", "CDATA", getJitterUnits());
- }
- if (!(getHops().isEmpty())) {
- atts.addAttribute(getUri(), "hops", "hops", "CDATA",
getHops());
- }
-
- //REGULAR DATUM
- if(!(getValue().isEmpty())) {
- atts.addAttribute(getUri(), "value", "value",
"CDATA", getValue());
- }
- if(!(getValueUnits().isEmpty())) {
- atts.addAttribute(getUri(), "valueUnits",
"valueUnits", "CDATA", getValueUnits());
- }
- if(!(getNumBytes().isEmpty())) {
- atts.addAttribute(getUri(), "numBytes", "numBytes",
"CDATA", getNumBytes());
- }
- if(!(getNumBytesUnits().isEmpty())) {
- atts.addAttribute(getUri(), "numBytesUnits",
"numBytesUnits", "CDATA", getNumBytesUnits());
- }
- if(!(getTimeType().isEmpty())) {
- atts.addAttribute(getUri(), "timeType", "timeType",
"CDATA", getTimeType());
- }
- if(!(getTimeValue().isEmpty())) {
- atts.addAttribute(getUri(), "timeValue", "timeValue",
"CDATA", getTimeValue());
- }
- if(!(getSeqNum().isEmpty())) {
- atts.addAttribute(getUri(), "seqNum", "seqNum",
"CDATA", getSeqNum());
- }
- if(!(getSendTime().isEmpty())) {
- atts.addAttribute(getUri(), "sendTime", "sendTime",
"CDATA", getSendTime());
- }
- if(!(getSendSynchronized().isEmpty())) {
- atts.addAttribute(getUri(), "sendSynchronized",
"sendSynchronized", "CDATA", getSendSynchronized());
- }
- if(!(getSendTimeError().isEmpty())) {
- atts.addAttribute(getUri(), "sendTimeError",
"sendTimeError", "CDATA", getSendTimeError());
- }
- if(!(getReceiveTime().isEmpty())) {
- atts.addAttribute(getUri(), "receiveTime",
"receiveTime", "CDATA", getReceiveTime());
- }
- if(!(getReceiveSynchronized().isEmpty())) {
- atts.addAttribute(getUri(), "receiveSynchronized",
"receiveSynchronized", "CDATA", getReceiveSynchronized());
- }
- if(!(getReceiveTimeError().isEmpty())) {
- atts.addAttribute(getUri(), "receiveTimeError",
"receiveTimeError", "CDATA", getReceiveTimeError());
- }
- if(!(getTTL().isEmpty())) {
- atts.addAttribute(getUri(), "ttl", "ttl", "CDATA",
getTTL());
- }
+ //SUMMARY DAT
+ if (!(getValue().isEmpty())) {
+ atts.addAttribute(getUri(), "value", "value", "CDATA",
getValue());
+ }
+ if (!(getValueUnits().isEmpty())) {
+ atts.addAttribute(getUri(), "valueUnits", "valueUnits", "CDATA",
+ getValueUnits());
+ }
+ if (!(getNumBytes().isEmpty())) {
+ atts.addAttribute(getUri(), "numBytes", "numBytes", "CDATA",
+ getNumBytes());
+ }
+ if (!(getNumBytesUnits().isEmpty())) {
+ atts.addAttribute(getUri(), "numBytesUnits", "numBytesUnits",
+ "CDATA", getNumBytesUnits());
+ }
+ if (!(getTimeType().isEmpty())) {
+ atts.addAttribute(getUri(), "timeType", "timeType", "CDATA",
+ getTimeType());
+ }
+ if (!(getTimeValue().isEmpty())) {
+ atts.addAttribute(getUri(), "timeValue", "timeValue", "CDATA",
+ getTimeValue());
+ }
+ /* Add Specific Attributes from here */
+ if (!(getSender().isEmpty())) {
+ atts.addAttribute(getUri(), "sender", "sender", "CDATA",
+ getSender());
+ }
+ if (!(getReceiver().isEmpty())) {
+ atts.addAttribute(getUri(), "receiver", "receiver", "CDATA",
+ getReceiver());
+ }
+ if (!(getSent().isEmpty())) {
+ atts.addAttribute(getUri(), "sent", "sent",
+ "CDATA", getSent());
+ }
+ if (!(getLoss().isEmpty())) {
+ atts.addAttribute(getUri(), "loss", "loss",
+ "CDATA", getLoss());
+ }
+ if (!(getLostPercent().isEmpty())) {
+ atts.addAttribute(getUri(), "lostPercent", "lostPercent",
"CDATA",
+ getLostPercent());
+ }
+ if (!(getDuplicates().isEmpty())) {
+ atts.addAttribute(getUri(), "duplicates",
+ "duplicates", "CDATA", getDuplicates());
+ }
+ if (!(getMinDelay().isEmpty())) {
+ atts.addAttribute(getUri(), "minDelay", "minDelay",
+ "CDATA", getMinDelay());
+ }
+ if (!(getMedDelay().isEmpty())) {
+ atts.addAttribute(getUri(), "medDelay", "medDelay", "CDATA",
getMedDelay());
+ }
+ if (!(getMaxDelay().isEmpty())) {
+ atts.addAttribute(getUri(), "maxDelay", "maxDelay", "CDATA",
getMaxDelay());
+ }
+ if (!(getDelayUnits().isEmpty())) {
+ atts.addAttribute(getUri(), "delayUnits", "delayUnits", "CDATA",
getDelayUnits());
+ }
+ if (!(getError().isEmpty())) {
+ atts.addAttribute(getUri(), "error", "error", "CDATA",
getError());
+ }
+ if (!(getErrorUnits().isEmpty())) {
+ atts.addAttribute(getUri(), "errorUnits", "errorUnits", "CDATA",
getErrorUnits());
+ }
+ if (!(getJitter().isEmpty())) {
+ atts.addAttribute(getUri(), "jitter", "jitter", "CDATA",
getJitter());
+ }
+ if (!(getJitterUnits().isEmpty())) {
+ atts.addAttribute(getUri(), "jitterUnits", "jitterUnits",
"CDATA", getJitterUnits());
+ }
+ if (!(getHops().isEmpty())) {
+ atts.addAttribute(getUri(), "hops", "hops", "CDATA", getHops());
+ }
-
-
- if (nss.getURI(getPrefix()) == null) {
- nss.pushContext();
- if (getPrefix().isEmpty()) {
- atts.addAttribute(getUri(), "xmlns", "xmlns",
"CDATA", getUri());
- } else {
- atts.addAttribute(getUri(), "xmlns:" +
getPrefix(), "xmlns:"
- + getPrefix(), "CDATA",
getUri());
- }
- nss.declarePrefix(getPrefix(), getUri());
- setCompleted();
- }
+ //REGULAR DATUM
+ if (!(getValue().isEmpty())) {
+ atts.addAttribute(getUri(), "value", "value", "CDATA",
getValue());
+ }
+ if (!(getValueUnits().isEmpty())) {
+ atts.addAttribute(getUri(), "valueUnits", "valueUnits", "CDATA",
getValueUnits());
+ }
+ if (!(getNumBytes().isEmpty())) {
+ atts.addAttribute(getUri(), "numBytes", "numBytes", "CDATA",
getNumBytes());
+ }
+ if (!(getNumBytesUnits().isEmpty())) {
+ atts.addAttribute(getUri(), "numBytesUnits", "numBytesUnits",
"CDATA", getNumBytesUnits());
+ }
+ if (!(getTimeType().isEmpty())) {
+ atts.addAttribute(getUri(), "timeType", "timeType", "CDATA",
getTimeType());
+ }
+ if (!(getTimeValue().isEmpty())) {
+ atts.addAttribute(getUri(), "timeValue", "timeValue", "CDATA",
getTimeValue());
+ }
+ if (!(getSeqNum().isEmpty())) {
+ atts.addAttribute(getUri(), "seqNum", "seqNum", "CDATA",
getSeqNum());
+ }
+ if (!(getSendTime().isEmpty())) {
+ atts.addAttribute(getUri(), "sendTime", "sendTime", "CDATA",
getSendTime());
+ }
+ if (!(getSendSynchronized().isEmpty())) {
+ atts.addAttribute(getUri(), "sendSynchronized",
"sendSynchronized", "CDATA", getSendSynchronized());
+ }
+ if (!(getSendTimeError().isEmpty())) {
+ atts.addAttribute(getUri(), "sendTimeError", "sendTimeError",
"CDATA", getSendTimeError());
+ }
+ if (!(getReceiveTime().isEmpty())) {
+ atts.addAttribute(getUri(), "receiveTime", "receiveTime",
"CDATA", getReceiveTime());
+ }
+ if (!(getReceiveSynchronized().isEmpty())) {
+ atts.addAttribute(getUri(), "receiveSynchronized",
"receiveSynchronized", "CDATA", getReceiveSynchronized());
+ }
+ if (!(getReceiveTimeError().isEmpty())) {
+ atts.addAttribute(getUri(), "receiveTimeError",
"receiveTimeError", "CDATA", getReceiveTimeError());
+ }
+ if (!(getTTL().isEmpty())) {
+ atts.addAttribute(getUri(), "ttl", "ttl", "CDATA", getTTL());
+ }
- return atts;
- }
- /**
- * Chases children references down to print out all related xml tags.
- */
- @Override
+ if (nss.getURI(getPrefix()) == null) {
+ nss.pushContext();
+ if (getPrefix().isEmpty()) {
+ atts.addAttribute(getUri(), "xmlns", "xmlns", "CDATA",
getUri());
+ } else {
+ atts.addAttribute(getUri(), "xmlns:" + getPrefix(), "xmlns:"
+ + getPrefix(), "CDATA", getUri());
+ }
+ nss.declarePrefix(getPrefix(), getUri());
+ setCompleted();
+ }
+
+ return atts;
+ }
+
+ /**
+ * Chases children references down to print out all related xml tags.
+ */
+ @Override
public ContentHandler getChildren(ContentHandler handler,
- NamespaceSupport nss) throws Exception {
- if (getTime() != null) {
- handler = getTime().toXML(handler, nss);
- }
- return handler;
- }
+ NamespaceSupport nss) throws Exception
+ {
+ if (getTime() != null) {
+ handler = getTime().toXML(handler, nss);
+ }
+ return handler;
+ }
- /**
- * Given a DOM element (a parent), construct the children elements.
- */
- @Override
- public void getDOM(org.w3c.dom.Element parent) {
- org.w3c.dom.Document doc = parent.getOwnerDocument();
- org.w3c.dom.Element datum = doc.createElementNS(getUri(),
getQName());
- parent.appendChild(datum);
- if (!(getValue().isEmpty())) {
- datum.setAttribute("value", getValue());
- }
- if (!(getValueUnits().isEmpty())) {
- datum.setAttribute("valueUnits", getValueUnits());
- }
- if (!(getTimeType().isEmpty())) {
- datum.setAttribute("timeType", getTimeType());
- }
- if (!(getTimeValue().isEmpty())) {
- datum.setAttribute("timeValue", getTimeValue());
- }
- if (!(getNumBytes().isEmpty())) {
- datum.setAttribute("numBytes", getNumBytes());
- }
- if (!(getNumBytesUnits().isEmpty())) {
- datum.setAttribute("numBytesUnits",
getNumBytesUnits());
- }
- /* Add Specific Attributes from here */
- if (!(getSent().isEmpty())) {
- datum.setAttribute("sent", getSent());
- }
- if (!(getReceiver().isEmpty())) {
- datum.setAttribute("receiver", getReceiver());
- }
- if (!(getSender().isEmpty())) {
- datum.setAttribute("sender", getSender());
- }
- if (!(getLoss().isEmpty())) {
- datum.setAttribute("loss", getLoss());
- }
- if (!(getLostPercent().isEmpty())) {
- datum.setAttribute("lostPercent", getLostPercent());
- }
- if (!(getDuplicates().isEmpty())) {
- datum.setAttribute("duplicates", getDuplicates());
- }
- if (!(getMinDelay().isEmpty())) {
- datum.setAttribute("minDelay", getMinDelay());
- }
- if (!(getMedDelay().isEmpty())) {
- datum.setAttribute("medDelay", getMedDelay());
- }
- if (!(getMaxDelay().isEmpty())) {
- datum.setAttribute("maxDelay", getMaxDelay());
- }
- if (!(getDelayUnits().isEmpty())) {
- datum.setAttribute("delayUnits", getDelayUnits());
- }
- if (!(getError().isEmpty())) {
- datum.setAttribute("error", getError());
- }
- if (!(getErrorUnits().isEmpty())) {
- datum.setAttribute("errorUnits", getErrorUnits());
- }
- if (!(getJitter().isEmpty())) {
- datum.setAttribute("jitter", getJitter());
- }
- if (!(getJitterUnits().isEmpty())) {
- datum.setAttribute("jitterUnits", getJitterUnits());
- }
- if (!(getHops().isEmpty())) {
- datum.setAttribute("hops", getHops());
- }
+ /**
+ * Given a DOM element (a parent), construct the children elements.
+ */
+ @Override
+ public void getDOM(org.w3c.dom.Element parent)
+ {
+ org.w3c.dom.Document doc = parent.getOwnerDocument();
+ org.w3c.dom.Element datum = doc.createElementNS(getUri(),
getQName());
+ parent.appendChild(datum);
+ if (!(getValue().isEmpty())) {
+ datum.setAttribute("value", getValue());
+ }
+ if (!(getValueUnits().isEmpty())) {
+ datum.setAttribute("valueUnits", getValueUnits());
+ }
+ if (!(getTimeType().isEmpty())) {
+ datum.setAttribute("timeType", getTimeType());
+ }
+ if (!(getTimeValue().isEmpty())) {
+ datum.setAttribute("timeValue", getTimeValue());
+ }
+ if (!(getNumBytes().isEmpty())) {
+ datum.setAttribute("numBytes", getNumBytes());
+ }
+ if (!(getNumBytesUnits().isEmpty())) {
+ datum.setAttribute("numBytesUnits", getNumBytesUnits());
+ }
+ /* Add Specific Attributes from here */
+ if (!(getSent().isEmpty())) {
+ datum.setAttribute("sent", getSent());
+ }
+ if (!(getReceiver().isEmpty())) {
+ datum.setAttribute("receiver", getReceiver());
+ }
+ if (!(getSender().isEmpty())) {
+ datum.setAttribute("sender", getSender());
+ }
+ if (!(getLoss().isEmpty())) {
+ datum.setAttribute("loss", getLoss());
+ }
+ if (!(getLostPercent().isEmpty())) {
+ datum.setAttribute("lostPercent", getLostPercent());
+ }
+ if (!(getDuplicates().isEmpty())) {
+ datum.setAttribute("duplicates", getDuplicates());
+ }
+ if (!(getMinDelay().isEmpty())) {
+ datum.setAttribute("minDelay", getMinDelay());
+ }
+ if (!(getMedDelay().isEmpty())) {
+ datum.setAttribute("medDelay", getMedDelay());
+ }
+ if (!(getMaxDelay().isEmpty())) {
+ datum.setAttribute("maxDelay", getMaxDelay());
+ }
+ if (!(getDelayUnits().isEmpty())) {
+ datum.setAttribute("delayUnits", getDelayUnits());
+ }
+ if (!(getError().isEmpty())) {
+ datum.setAttribute("error", getError());
+ }
+ if (!(getErrorUnits().isEmpty())) {
+ datum.setAttribute("errorUnits", getErrorUnits());
+ }
+ if (!(getJitter().isEmpty())) {
+ datum.setAttribute("jitter", getJitter());
+ }
+ if (!(getJitterUnits().isEmpty())) {
+ datum.setAttribute("jitterUnits", getJitterUnits());
+ }
+ if (!(getHops().isEmpty())) {
+ datum.setAttribute("hops", getHops());
+ }
- if (getTime() != null) {
- getTime().getDOM(datum);
- }
-
-
- //REGULAR DATUM
- if(!(getSeqNum().isEmpty())) {
- datum.setAttribute("seqNum", getSeqNum());
- }
- if(!(getSendTime().isEmpty())) {
- datum.setAttribute("sendTime", getSendTime());
- }
- if(!(getSendSynchronized().isEmpty())) {
- datum.setAttribute("sendSynchronized",
getSendSynchronized());
- }
- if(!(getSendTimeError().isEmpty())) {
- datum.setAttribute("sendTimeError",
getSendTimeError());
- }
- if(!(getReceiveTime().isEmpty())) {
- datum.setAttribute("receiveTime", getReceiveTime());
- }
- if(!(getReceiveSynchronized().isEmpty())) {
- datum.setAttribute("receiveSynchronized",
getReceiveSynchronized());
- }
- if(!(getReceiveTimeError().isEmpty())) {
- datum.setAttribute("receiveTimeError",
getReceiveTimeError());
- }
- if(!(getTTL().isEmpty())) {
- datum.setAttribute("ttl", getTTL());
- }
-
- if(getTime() != null) {
- getTime().getDOM(datum);
- }
+ if (getTime() != null) {
+ getTime().getDOM(datum);
+ }
- }
-
-
-
- @Override
- public String toString() {
- return getFileName() + ": ---> " + getValue() +" sender=" +
sender + ", receiver="
- + receiver + ", sent=" + sent + ", loss=" +
loss
- + ", duplicates=" + duplicates + ",
lostPercent=" + lostPercent
- + ", minDelay=" + minDelay + ", medDelay=" +
medDelay
- + ", maxDelay=" + maxDelay + ", delayUnits="
+ delayUnits
- + ", error=" + error + ", errorUnits=" +
errorUnits
- + ", jitter=" + jitter + ", jitterUnits=" +
jitterUnits
- + ", hops=" + hops;
- }
+ //REGULAR DATUM
+ if (!(getSeqNum().isEmpty())) {
+ datum.setAttribute("seqNum", getSeqNum());
+ }
+ if (!(getSendTime().isEmpty())) {
+ datum.setAttribute("sendTime", getSendTime());
+ }
+ if (!(getSendSynchronized().isEmpty())) {
+ datum.setAttribute("sendSynchronized", getSendSynchronized());
+ }
+ if (!(getSendTimeError().isEmpty())) {
+ datum.setAttribute("sendTimeError", getSendTimeError());
+ }
+ if (!(getReceiveTime().isEmpty())) {
+ datum.setAttribute("receiveTime", getReceiveTime());
+ }
+ if (!(getReceiveSynchronized().isEmpty())) {
+ datum.setAttribute("receiveSynchronized",
getReceiveSynchronized());
+ }
+ if (!(getReceiveTimeError().isEmpty())) {
+ datum.setAttribute("receiveTimeError", getReceiveTimeError());
+ }
+ if (!(getTTL().isEmpty())) {
+ datum.setAttribute("ttl", getTTL());
+ }
+
+ if (getTime() != null) {
+ getTime().getDOM(datum);
+ }
+
+ }
+
+
+ @Override
+ public String toString()
+ {
+ return getFileName() + ": ---> " + getValue() + " sender=" + sender
+ ", receiver="
+ + receiver + ", sent=" + sent + ", loss=" + loss
+ + ", duplicates=" + duplicates + ", lostPercent=" + lostPercent
+ + ", minDelay=" + minDelay + ", medDelay=" + medDelay
+ + ", maxDelay=" + maxDelay + ", delayUnits=" + delayUnits
+ + ", error=" + error + ", errorUnits=" + errorUnits
+ + ", jitter=" + jitter + ", jitterUnits=" + jitterUnits
+ + ", hops=" + hops;
+ }
}
Modified:
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-10-05 09:22:44 UTC (rev 6010)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/BwctlStoreRequestProcess.java
2012-10-05 09:22:46 UTC (rev 6011)
@@ -12,59 +12,58 @@
import org.perfsonar.base.exceptions.PerfSONARException;
/**
- * Moves data from nmwg data element into ibatis map structure
+ * Moves data from nmwg data element into ibatis map structure
*
- * @author fernandes
+ * @author fernandes
*/
-public class BwctlStoreRequestProcess extends StoreRequestProcess {
+public class BwctlStoreRequestProcess extends StoreRequestProcess
+{
-
// -------------------------------------- constructors
+ public BwctlStoreRequestProcess() throws PerfSONARException
+ {
- public BwctlStoreRequestProcess() throws PerfSONARException {
-
super();
}
-
// -------------------------------------- public methods
-
@Override
- public Map prepareStoreParameters(Element datum, Map ibatisParams) {
+ public Map prepareStoreParameters(Element datum, Map 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();
+ 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{
+ try {
ibatisParams.put("intervalEnd", intervalEnd);
ibatisParams.put("intervalStart", intervalStart);
@@ -89,7 +88,7 @@
ibatisParams.put("udpPacketLoss", udpPacketLoss);
ibatisParams.put("udpPacketLossPercentage",
udpPacketLossPercentage);
ibatisParams.put("udpPacketSent", udpPacketSent);
-
+
} catch (Exception ex) {
logger.debug("BwctlStoreRequestProcess.process: " +
ex.toString());
}
@@ -99,5 +98,4 @@
}
-
} //BwctlStoreRequestProcess
Modified:
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-10-05 09:22:44 UTC (rev 6010)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/DiscardsStoreRequestProcess.java
2012-10-05 09:22:46 UTC (rev 6011)
@@ -13,36 +13,35 @@
import org.perfsonar.base.exceptions.PerfSONARException;
/**
- * Moves data from nmwg data element into ibatis map structure
+ * Moves data from nmwg data element into ibatis map structure
*
- * @author romradz
+ * @author romradz
*/
-public class DiscardsStoreRequestProcess extends StoreRequestProcess {
+public class DiscardsStoreRequestProcess extends StoreRequestProcess
+{
-
// -------------------------------------- constructors
+ public DiscardsStoreRequestProcess() throws PerfSONARException
+ {
- public DiscardsStoreRequestProcess() throws PerfSONARException {
-
super();
}
-
// -------------------------------------- public methods
-
@Override
- public Map prepareStoreParameters(Element datum, Map ibatisParams) {
+ public Map prepareStoreParameters(Element datum, Map ibatisParams)
+ {
- String strValue = ((Datum)datum).getValue();
- String valueUnits = ((Datum)datum).getValueUnits();
- String timeValue = ((Datum)datum).getTimeValue();
+ 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));
@@ -61,5 +60,4 @@
}
-
} //DiscardsStoreRequestProcess
Modified:
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-10-05 09:22:44 UTC (rev 6010)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/ErrorsStoreRequestProcess.java
2012-10-05 09:22:46 UTC (rev 6011)
@@ -13,36 +13,35 @@
import org.perfsonar.base.exceptions.PerfSONARException;
/**
- * Moves data from nmwg data element into ibatis map structure
+ * Moves data from nmwg data element into ibatis map structure
*
- * @author romradz
+ * @author romradz
*/
-public class ErrorsStoreRequestProcess extends StoreRequestProcess {
+public class ErrorsStoreRequestProcess extends StoreRequestProcess
+{
-
// -------------------------------------- constructors
+ public ErrorsStoreRequestProcess() throws PerfSONARException
+ {
- public ErrorsStoreRequestProcess() throws PerfSONARException {
-
super();
}
-
// -------------------------------------- public methods
-
@Override
- public Map prepareStoreParameters(Element datum, Map ibatisParams) {
+ public Map prepareStoreParameters(Element datum, Map ibatisParams)
+ {
- String strValue = ((Datum)datum).getValue();
- String valueUnits = ((Datum)datum).getValueUnits();
- String timeValue = ((Datum)datum).getTimeValue();
+ 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));
@@ -61,5 +60,4 @@
}
-
} //ErrorsStoreRequestProcess
Modified:
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-10-05 09:22:44 UTC (rev 6010)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/IperfStoreRequestProcess.java
2012-10-05 09:22:46 UTC (rev 6011)
@@ -13,48 +13,47 @@
import org.perfsonar.base.exceptions.PerfSONARException;
/**
- * Moves data from nmwg data element into ibatis map structure
+ * Moves data from nmwg data element into ibatis map structure
*
- * @author romradz
+ * @author romradz
*/
-public class IperfStoreRequestProcess extends StoreRequestProcess {
+public class IperfStoreRequestProcess extends StoreRequestProcess
+{
-
// -------------------------------------- constructors
+ public IperfStoreRequestProcess() throws PerfSONARException
+ {
- public IperfStoreRequestProcess() throws PerfSONARException {
-
super();
}
-
// -------------------------------------- public methods
-
@Override
- public Map prepareStoreParameters(Element datum, Map ibatisParams) {
+ public Map prepareStoreParameters(Element datum, Map 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();
+ 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 (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;
+ if (interval.trim().isEmpty()) interval = null;
+ if (loss.trim().isEmpty()) loss = null;
ibatisParams.put("valueUnits", valueUnits);
ibatisParams.put("time", Integer.parseInt(timeValue));
@@ -91,5 +90,4 @@
}
-
} //IperfStoreRequestProcess
\ No newline at end of file
Modified:
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-10-05 09:22:44 UTC (rev 6010)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/L2PathStatusStoreRequestProcess.java
2012-10-05 09:22:46 UTC (rev 6011)
@@ -15,35 +15,34 @@
import org.perfsonar.base.exceptions.PerfSONARException;
/**
- * Moves data from nmwg data element into ibatis map structure
+ * Moves data from nmwg data element into ibatis map structure
*
- * @author romradz
+ * @author romradz
*/
-public class L2PathStatusStoreRequestProcess extends StoreRequestProcess {
+public class L2PathStatusStoreRequestProcess extends StoreRequestProcess
+{
-
// -------------------------------------- constructors
+ public L2PathStatusStoreRequestProcess() throws PerfSONARException
+ {
- public L2PathStatusStoreRequestProcess() throws PerfSONARException {
-
super();
}
-
// -------------------------------------- public methods
-
@Override
- public Map prepareStoreParameters(Element datum, Map ibatisParams) {
+ public Map prepareStoreParameters(Element datum, Map ibatisParams)
+ {
- String timeType = ((Datum)datum).getTimeType();
- String timeValue = ((Datum)datum).getTimeValue();
+ String timeType = ((Datum) datum).getTimeType();
+ String timeValue = ((Datum) datum).getTimeValue();
if (timeType == null) {
handleUnixTimeValue(timeValue, ibatisParams);
@@ -56,8 +55,8 @@
} else
handleUnixTimeValue(timeValue, ibatisParams);
- String stateAdmin = ((Datum)datum).getStateAdmin().getStateAdmin();
- String stateOper = ((Datum)datum).getStateOper().getStateOper();
+ String stateAdmin = ((Datum) datum).getStateAdmin().getStateAdmin();
+ String stateOper = ((Datum) datum).getStateOper().getStateOper();
ibatisParams.put("stateAdmin", stateAdmin);
ibatisParams.put("stateOper", stateOper);
@@ -66,11 +65,12 @@
}
- protected void handleUnixTimeValue(String timeValue, Map ibatisParams) {
+ protected void handleUnixTimeValue(String timeValue, Map ibatisParams)
+ {
int timeValueInt;
if (timeValue.isEmpty()) {
- timeValueInt = (int)((new Date()).getTime() / 1000);
+ timeValueInt = (int) ((new Date()).getTime() / 1000);
ibatisParams.put("timeValue", timeValueInt);
} else {
ibatisParams.put("timeValue", Integer.parseInt(timeValue));
@@ -79,12 +79,13 @@
}
- protected void handleIsoTimeValue(String timeValue, Map ibatisParams) {
+ protected void handleIsoTimeValue(String timeValue, Map ibatisParams)
+ {
try {
long timeValueLong = TimeDateUtil.getUnixTime(timeValue);
- ibatisParams.put("timeValue", (int)timeValueLong);
+ ibatisParams.put("timeValue", (int) timeValueLong);
} catch (Exception ex) {
}
@@ -92,5 +93,4 @@
}
-
} //L2PathStatusStoreRequestProcess
Modified:
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-10-05 09:22:44 UTC (rev 6010)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/OwampStoreRequestProcess.java
2012-10-05 09:22:46 UTC (rev 6011)
@@ -16,140 +16,144 @@
*
* @author fernandes
*/
-public class OwampStoreRequestProcess extends StoreRequestProcess {
+public class OwampStoreRequestProcess extends StoreRequestProcess
+{
- // -------------------------------------- constructors
+ // -------------------------------------- constructors
- public OwampStoreRequestProcess() throws PerfSONARException {
+ public OwampStoreRequestProcess() throws PerfSONARException
+ {
- super();
+ super();
- }
+ }
- /**
- * For test purposes only.
- *
- * @param test
- */
- public OwampStoreRequestProcess(String test) {
+ /**
+ * For test purposes only.
+ *
+ * @param test
+ */
+ public OwampStoreRequestProcess(String test)
+ {
- super(test);
+ super(test);
- }
+ }
- // -------------------------------------- public methods
+ // -------------------------------------- public methods
- @Override
+ @Override
public Map<String, Object> prepareStoreParameters(Element datum,
- Map<String, Object> ibatisParams) {
+ 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 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();
+ // String timeType = ((Datum)datum).getTimeType();
+ // String timeValue = ((Datum)datum).getTimeValue();
- boolean datumType = false; // default false mans it is Datum
from OWAMP Aggregation Datum
- try {
+ 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;
- }
+ // 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;
- }
+ 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 != true){
- 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()));
+ System.out.println("DATUM TYPE! " + datumType);
- }
-
- } catch (Exception ex) {
- // logger.debug("OwampStoreRequestProcess.process: " +
- // ex.toString());
- System.out.println("EERRRRRRRRRORRRRRRRR!!!!!!!!11");
- ex.printStackTrace();
+ if (datumType != true) {
+ 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()));
- }
+ }
- return ibatisParams;
+ } catch (Exception ex) {
+ // logger.debug("OwampStoreRequestProcess.process: " +
+ // ex.toString());
+ System.out.println("EERRRRRRRRRORRRRRRRR!!!!!!!!11");
+ ex.printStackTrace();
- }
+ }
+ return ibatisParams;
+
+ }
+
} // OwampStoreRequestProcess
Modified:
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-10-05 09:22:44 UTC (rev 6010)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/PingStoreRequestProcess.java
2012-10-05 09:22:46 UTC (rev 6011)
@@ -12,44 +12,43 @@
import org.perfsonar.base.exceptions.PerfSONARException;
/**
- * Moves data from nmwg data element into ibatis map structure
+ * Moves data from nmwg data element into ibatis map structure
*
- * @author fernandes
+ * @author fernandes
*/
-public class PingStoreRequestProcess extends StoreRequestProcess {
+public class PingStoreRequestProcess extends StoreRequestProcess
+{
-
// -------------------------------------- constructors
+ public PingStoreRequestProcess() throws PerfSONARException
+ {
- public PingStoreRequestProcess() throws PerfSONARException {
-
super();
}
-
// -------------------------------------- public methods
-
@Override
- public Map prepareStoreParameters(Element datum, Map ibatisParams) {
+ public Map prepareStoreParameters(Element datum, Map 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();
+ 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{
+ try {
ibatisParams.put("numBytes", Integer.parseInt(numBytes));
ibatisParams.put("numBytesUnits", numBytesUnits);
@@ -70,5 +69,4 @@
}
-
} //PingRequestProcess
Modified:
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-10-05 09:22:44 UTC (rev 6010)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/StoreRequestProcess.java
2012-10-05 09:22:46 UTC (rev 6011)
@@ -20,40 +20,38 @@
import org.perfsonar.base.exceptions.PerfSONARException;
/**
- * Abstract class for moving data from Data element into ibatis map
structure.
+ * Abstract class for moving data from Data element into ibatis map
structure.
*
- * @author romradz
+ * @author romradz
*/
-public abstract class StoreRequestProcess {
+public abstract class StoreRequestProcess
+{
-
// -------------------------------------- class fields
-
protected LoggerComponent logger = null;
-
// -------------------------------------- constructors
+ public StoreRequestProcess() throws PerfSONARException
+ {
- public StoreRequestProcess() throws PerfSONARException {
-
try {
this.logger = (LoggerComponent)
AuxiliaryComponentManager.
getInstance().
- getComponent(ComponentNames.LOGGER);
+ getComponent(ComponentNames.LOGGER);
} catch (PerfSONARException e) {
throw new PerfSONARException(
- "error.common.no_logger",
- "UtilizationStoreRequestProcess.constructor: "
+ "error.common.no_logger",
+ "UtilizationStoreRequestProcess.constructor: "
+ "Cannot get logger component");
}
@@ -62,25 +60,26 @@
/**
* 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 StoreRequestProcess(String test)
+ {
+
}
-
// -------------------------------------- public methods
-
public void process(SqlMapClient sqlMap, Data data, Map ibatisParams)
- throws Exception {
+ throws Exception
+ {
Vector datumVector = data.getDatum();
if (datumVector == null) {
logger.debug("StoreRequestProcess.process: "
- + "Data element with id='" + data.getId() + "' is
empty.");
+ + "Data element with id='" + data.getId() + "' is empty.");
return;
}
@@ -96,13 +95,10 @@
}
-
// -------------------------------------- public abstract methods
-
public abstract Map<String, Object> prepareStoreParameters(Element
datum, Map<String, Object> ibatisParams);
-
} //StoreRequestProcess
Modified:
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-10-05 09:22:44 UTC (rev 6010)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/StoreRequestProcessFactory.java
2012-10-05 09:22:46 UTC (rev 6011)
@@ -17,28 +17,27 @@
/**
- *
- *
- * @author romradz
+ * @author romradz
*/
-public class StoreRequestProcessFactory {
+public class StoreRequestProcessFactory
+{
-
public static StoreRequestProcess getStoreRequestProcess(String
eventTypeName)
- throws PerfSONARException {
+ throws PerfSONARException
+ {
LoggerComponent logger = (LoggerComponent)
AuxiliaryComponentManager.
getInstance().
- getComponent(ComponentNames.LOGGER);
+ getComponent(ComponentNames.LOGGER);
EventTypeConfigurationComponent eventTypeConfigurationComponent =
(EventTypeConfigurationComponent)
AuxiliaryComponentManager.
getInstance().
- getComponent("eventType_config");
+ getComponent("eventType_config");
EventType eventType =
@@ -46,22 +45,22 @@
if (eventType == null)
throw new PerfSONARException(
- "error.ma.query",
- "StoreRequestProcessFactory.getStoreRequestProcess: "
+ "error.ma.query",
+ "StoreRequestProcessFactory.getStoreRequestProcess: "
+ "eventType " + eventTypeName + " is not supported");
String className = eventType.getStoreRequestProcess();
logger.debug(
- "StoreRequestProcessFactory.getStoreRequestProcess: "
+ "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: "
+ "error.ma.metadata_query_mapping_configuration",
+ "StoreRequestProcessFactory.getStoreRequestProcess: "
+ "Could not find class name for eventType "
+ eventTypeName);
@@ -77,13 +76,13 @@
} catch (Exception ex) {
logger.error(
- "StoreRequestProcessFactory.getResponseGenerator: "
+ "StoreRequestProcessFactory.getResponseGenerator: "
+ "Unable to create an object of : "
+ className + ": "
+ ex.toString());
throw new PerfSONARException(
- "error.ma.metadata_query_mapping_configuration",
- "StoreRequestProcessFactory.getResponseGenerator: "
+ "error.ma.metadata_query_mapping_configuration",
+ "StoreRequestProcessFactory.getResponseGenerator: "
+ "Unable to create an object of "
+ className);
@@ -93,12 +92,12 @@
if (storeRequestProcess == null) {
logger.error(
- "StoreRequestProcessFactory.getResponseGenerator: "
+ "StoreRequestProcessFactory.getResponseGenerator: "
+ "Could not create a responseGenerator object for "
+ "eventType: " + eventTypeName);
throw new PerfSONARException(
- "error.ma.metadata_query_mapping_configuration",
- "StoreRequestProcessFactory.getResponseGenerator: "
+ "error.ma.metadata_query_mapping_configuration",
+ "StoreRequestProcessFactory.getResponseGenerator: "
+ "Could not create a responseGenerator for "
+ "eventType: " + eventTypeName);
@@ -109,5 +108,4 @@
}
-
} //StoreRequestProcessFactory
Modified:
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-10-05 09:22:44 UTC (rev 6010)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/UtilizationStoreRequestProcess.java
2012-10-05 09:22:46 UTC (rev 6011)
@@ -13,36 +13,35 @@
import org.perfsonar.base.exceptions.PerfSONARException;
/**
- * Moves data from nmwg data element into ibatis map structure
+ * Moves data from nmwg data element into ibatis map structure
*
- * @author romradz
+ * @author romradz
*/
-public class UtilizationStoreRequestProcess extends StoreRequestProcess {
+public class UtilizationStoreRequestProcess extends StoreRequestProcess
+{
-
// -------------------------------------- constructors
+ public UtilizationStoreRequestProcess() throws PerfSONARException
+ {
- public UtilizationStoreRequestProcess() throws PerfSONARException {
-
super();
}
-
// -------------------------------------- public methods
-
@Override
- public Map prepareStoreParameters(Element datum, Map ibatisParams) {
+ public Map prepareStoreParameters(Element datum, Map ibatisParams)
+ {
- String strValue = ((Datum)datum).getValue();
- String valueUnits = ((Datum)datum).getValueUnits();
- String timeValue = ((Datum)datum).getTimeValue();
+ 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));
@@ -61,5 +60,4 @@
}
-
} //UtilizationStoreRequestProcess
Modified:
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-10-05 09:22:44 UTC (rev 6010)
+++
trunk/perfsonar-java-sql-ma/src/test/java/org/perfsonar/service/measurementArchive/sqlType/OwampResponseGeneratorTest.java
2012-10-05 09:22:46 UTC (rev 6011)
@@ -14,117 +14,119 @@
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, String> row = new HashMap<String, String>();
- 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(row.get("seqNum"));
- datum.setSendTime(row.get("sendTime"));
- datum.setSendSynchronized(row.get("sendSynchronized"));
- datum.setSendTimeError(row.get("sendTimeError"));
+public class OwampResponseGeneratorTest
+{
+
+ /**
+ * This test should verify if returned Datum is valid.
+ */
+ @Test
+ public void shouldReturnDatum()
+ {
+ //given
+ Map<String, String> row = new HashMap<String, String>();
+ 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(row.get("seqNum"));
+ datum.setSendTime(row.get("sendTime"));
+ datum.setSendSynchronized(row.get("sendSynchronized"));
+ datum.setSendTimeError(row.get("sendTimeError"));
datum.setReceiveTime(row.get("receiveTime"));
- datum.setReceiveTimeError(row.get("receiveTimeError"));
- datum.setReceiveSynchronized(row.get("receiveSynchronized"));
- datum.setTTL(row.get("ttl"));
-
- List<Map<String, String>> list = new
ArrayList<Map<String,String>>();
- list.add(row);
+ datum.setReceiveTimeError(row.get("receiveTimeError"));
+ datum.setReceiveSynchronized(row.get("receiveSynchronized"));
+ datum.setTTL(row.get("ttl"));
- String s = "";
- java.util.Vector datumTest;
+ List<Map<String, String>> list = new ArrayList<Map<String,
String>>();
+ list.add(row);
- //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();
- }
+ String s = "";
+ java.util.Vector datumTest;
- //then
- Assert.assertEquals(datum.toString(), s);
+ //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();
+ }
- }
-
- @Test
- public void shouldReturnOwampAggregaionDatum(){
- //given
- Map<String, String> row = new HashMap<String, String>();
- 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(row.get("sender"));
- datum.setReceiver(row.get("receiver"));
- datum.setSent(row.get("sent"));
- datum.setLoss(row.get("loss"));
- datum.setLostPercent(row.get("lostPercent"));
- datum.setDuplicates(row.get("duplicates"));
- datum.setDelayUnits(row.get("minDelay"));
- datum.setMinDelay(row.get("minDelay"));
- datum.setMedDelay(row.get("medDelay"));
- datum.setMaxDelay(row.get("maxDelay"));
- datum.setDelayUnits(row.get("delayUnits"));
- datum.setError(row.get("error"));
- datum.setErrorUnits(row.get("errorUnits"));
- datum.setJitter(row.get("jitter"));
- datum.setJitterUnits(row.get("jitterUnits"));
- datum.setHops(row.get("hops"));
-
- List<Map<String, String>> list = new
ArrayList<Map<String,String>>();
- list.add(row);
+ //then
+ Assert.assertEquals(datum.toString(), s);
- 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();
- }
+ @Test
+ public void shouldReturnOwampAggregaionDatum()
+ {
+ //given
+ Map<String, String> row = new HashMap<String, String>();
+ 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");
- //then
+ OwampAggregationDatum datum = new OwampAggregationDatum();
+ datum.setSender(row.get("sender"));
+ datum.setReceiver(row.get("receiver"));
+ datum.setSent(row.get("sent"));
+ datum.setLoss(row.get("loss"));
+ datum.setLostPercent(row.get("lostPercent"));
+ datum.setDuplicates(row.get("duplicates"));
+ datum.setDelayUnits(row.get("minDelay"));
+ datum.setMinDelay(row.get("minDelay"));
+ datum.setMedDelay(row.get("medDelay"));
+ datum.setMaxDelay(row.get("maxDelay"));
+ datum.setDelayUnits(row.get("delayUnits"));
+ datum.setError(row.get("error"));
+ datum.setErrorUnits(row.get("errorUnits"));
+ datum.setJitter(row.get("jitter"));
+ datum.setJitterUnits(row.get("jitterUnits"));
+ datum.setHops(row.get("hops"));
- //System.out.println(datum.toString());
- //System.out.println(s);
- Assert.assertEquals(datum.toString(), s);
-
- }
-
-
+ List<Map<String, String>> list = new ArrayList<Map<String,
String>>();
+ 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);
+
+ }
+
+
}
Modified:
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-10-05 09:22:44 UTC (rev 6010)
+++
trunk/perfsonar-java-sql-ma/src/test/java/org/perfsonar/service/measurementArchive/sqlType/OwampStoreRequestProcessTest.java
2012-10-05 09:22:46 UTC (rev 6011)
@@ -9,91 +9,94 @@
import
org.perfsonar.service.measurementArchive.sqlType.nmwg.OwampAggregationDatum;
import
org.perfsonar.service.measurementArchive.sqlType.store.OwampStoreRequestProcess;
-public class OwampStoreRequestProcessTest {
+public class OwampStoreRequestProcessTest
+{
- @Test
- public void shouldReturnIbatisParamsWhenDatumIsGiven() {
+ @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");
+ // 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()));
+ 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>());
+ // when
+ Map<String, Object> ibatisParamsTest = new OwampStoreRequestProcess(
+ "test").prepareStoreParameters(datum,
+ new HashMap<String, Object>());
- // then
- Assert.assertEquals(ibatisParams, ibatisParamsTest);
+ // 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>());
+ @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");
- // then
- Assert.assertEquals(ibatisParams, ibatisParamsTest);
- }
-
-
+ 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] r6011 - in trunk/perfsonar-java-sql-ma/src: main/java/org/perfsonar/service/measurementArchive/sqlType main/java/org/perfsonar/service/measurementArchive/sqlType/fetch main/java/org/perfsonar/service/measurementArchive/sqlType/nmwg main/java/org/perfsonar/service/measurementArchive/sqlType/store test/java/org/perfsonar/service/measurementArchive/sqlType, svn-noreply, 10/05/2012
Archive powered by MHonArc 2.6.16.