perfsonar-dev - perfsonar: r4366 - in trunk/geant2-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType: . store
Subject: perfsonar development work
List archive
perfsonar: r4366 - in trunk/geant2-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType: . store
Chronological Thread
- From:
- To:
- Subject: perfsonar: r4366 - in trunk/geant2-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType: . store
- Date: Wed, 20 Aug 2008 10:40:56 -0400
Author: roman
Date: 2008-08-20 10:40:56 -0400 (Wed, 20 Aug 2008)
New Revision: 4366
Modified:
trunk/geant2-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/SQLTypeMAServiceEngine.java
trunk/geant2-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/StoreRequestProcessFactory.java
Log:
changes related with new ibatisConfig parameters in eventType config file
Modified:
trunk/geant2-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/SQLTypeMAServiceEngine.java
===================================================================
---
trunk/geant2-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/SQLTypeMAServiceEngine.java
2008-08-20 14:39:01 UTC (rev 4365)
+++
trunk/geant2-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/SQLTypeMAServiceEngine.java
2008-08-20 14:40:56 UTC (rev 4366)
@@ -19,9 +19,11 @@
import org.ggf.ns.nmwg.base.v2_0.Parameters;
import org.perfsonar.base.exceptions.PerfSONARException;
+import org.perfsonar.base.auxiliary.AuxiliaryComponentManager;
import org.perfsonar.service.base.util.ResultCodesUtil;
import
org.perfsonar.service.measurementArchive.metadataConfig.MetadataConfigurationStorageManager;
+import
org.perfsonar.service.measurementArchive.eventTypeConfig.EventTypeConfigurationComponent;
import
org.perfsonar.service.measurementArchive.rrdType.RRDTypeMAServiceEngine;
@@ -177,19 +179,24 @@
// check parameters in the key
- Parameter ibatisConfig = key.getParameterByName("ibatisConfig");
- if (ibatisConfig == null)
+ Parameter eventType = key.getParameterByName("eventType");
+ if (eventType == null)
throw new PerfSONARException(
"error.ma.query",
"SQLTypeMAServiceEngine.getStoreKey: "
- + "No ibatisConfig parameter in the key");
+ + "No eventType parameter in the key");
- Parameter eventType = key.getParameterByName("eventType");
- if (eventType == null)
+ Parameter ibatisConfig = key.getParameterByName("ibatisConfig");
+ if (ibatisConfig == null) {
+ ibatisConfig = getIbatisConfig(eventType);
+ if (ibatisConfig != null) key.addParameter(ibatisConfig);
+ }
+
+ if (ibatisConfig == null)
throw new PerfSONARException(
"error.ma.query",
"SQLTypeMAServiceEngine.getStoreKey: "
- + "No eventType parameter in the key");
+ + "No ibatisConfig parameter in the key");
} else {
@@ -270,8 +277,14 @@
params.getParameterMap().remove("ibatisConfig");
params.addChild(ibatisConfig);
+ } else if (params.getParameterByName("ibatisConfig") ==
null) {
+
+ ibatisConfig =
getIbatisConfig(params.getParameterByName("eventType"));
+ if (ibatisConfig != null) params.addChild(ibatisConfig);
+
}
+
if (params.getParameterByName("ibatisConfig") == null) {
logger.error("SQLTypeMAServiceEngine.getStoreKey: "
+ "No default ibatis property in the key");
@@ -321,6 +334,46 @@
}
+ protected Parameter getIbatisConfig(Parameter eventTypeParameter)
+ throws PerfSONARException {
+
+ if (eventTypeParameter == null) return null;
+ String eventTypeStr = eventTypeParameter.getParameterValue();
+
+ EventTypeConfigurationComponent eventTypeConfigurationComponent =
+ (EventTypeConfigurationComponent)
+ AuxiliaryComponentManager.
+ getInstance().
+ getComponent("eventType_config");
+
+ org.perfsonar.service.measurementArchive.eventTypeConfig.EventType
eventType =
+ eventTypeConfigurationComponent.getEventType(eventTypeStr);
+
+ if (eventType == null)
+ throw new PerfSONARException(
+ "error.ma.query",
+ "SQLTypeMAServiceEngine.getStoreKey: "
+ + "eventType " + eventTypeStr + " is not supported");
+
+
+ String ibatisConfigStr = eventType.getIbatisConfig();
+
+ logger.debug(
+ "SQLTypeMAServiceEngine.getStoreKey: "
+ + "ibatisConfig parameter for eventType (" + eventTypeStr +
"): "
+ + ibatisConfigStr);
+
+ if (ibatisConfigStr == null || ibatisConfigStr.trim().equals(""))
+ return null;
+
+ Parameter ibatisConfig = new Parameter();
+ ibatisConfig.setParameterName("ibatisConfig");
+ ibatisConfig.setParameterValue(ibatisConfigStr);
+
+ return ibatisConfig;
+ }
+
+
protected Message replaceMetadataConfiguration(Message request)
throws PerfSONARException {
Modified:
trunk/geant2-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/StoreRequestProcessFactory.java
===================================================================
---
trunk/geant2-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/StoreRequestProcessFactory.java
2008-08-20 14:39:01 UTC (rev 4365)
+++
trunk/geant2-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/StoreRequestProcessFactory.java
2008-08-20 14:40:56 UTC (rev 4366)
@@ -70,7 +70,7 @@
try {
- storeRequestProcess =
+ storeRequestProcess =
(StoreRequestProcess)
Class.forName(className).newInstance();
- perfsonar: r4366 - in trunk/geant2-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType: . store, svnlog, 08/20/2008
Archive powered by MHonArc 2.6.16.