perfsonar-dev - perfsonar: r4144 - trunk/geant2-java-rrd-ma/src/main/java/org/perfsonar/service/measurementArchive/rrdType
Subject: perfsonar development work
List archive
perfsonar: r4144 - trunk/geant2-java-rrd-ma/src/main/java/org/perfsonar/service/measurementArchive/rrdType
Chronological Thread
- From:
- To:
- Subject: perfsonar: r4144 - trunk/geant2-java-rrd-ma/src/main/java/org/perfsonar/service/measurementArchive/rrdType
- Date: Tue, 8 Jul 2008 11:19:12 -0400
Author: roman
Date: 2008-07-08 11:19:12 -0400 (Tue, 08 Jul 2008)
New Revision: 4144
Modified:
trunk/geant2-java-rrd-ma/src/main/java/org/perfsonar/service/measurementArchive/rrdType/RRDTypeMAServiceEngine.java
Log:
Checking xmldb access properties improved.
Modified:
trunk/geant2-java-rrd-ma/src/main/java/org/perfsonar/service/measurementArchive/rrdType/RRDTypeMAServiceEngine.java
===================================================================
---
trunk/geant2-java-rrd-ma/src/main/java/org/perfsonar/service/measurementArchive/rrdType/RRDTypeMAServiceEngine.java
2008-07-08 15:18:08 UTC (rev 4143)
+++
trunk/geant2-java-rrd-ma/src/main/java/org/perfsonar/service/measurementArchive/rrdType/RRDTypeMAServiceEngine.java
2008-07-08 15:19:12 UTC (rev 4144)
@@ -175,58 +175,22 @@
// handle STORE_DATA
// message type: MeasurementArchiveStoreRequest
+ checkXmlDbAccessProprties();
+ response = storeData(request);
- if (!dbStore.trim().equalsIgnoreCase("on")) {
-
- response = storeData(request, false);
- logger.debug(
- "RRDTypeMAServiceEngine.takeAction: "
- + "writing data into MA is switched off "
- + "(see 'service.ma.xmldb.db_store' property)");
-
- } else if (!dbStatus.trim().equalsIgnoreCase("on")) {
-
- response = storeData(request, false);
- logger.debug(
- "RRDTypeMAServiceEngine.takeAction: "
- + "xmldb is not setup in the configuration "
- + "(see 'component.ma.xmldb.db_status' property)");
-
- } else {
-
- response = storeData(request, true);
- }
-
} else if (actionType.equals(ActionType.STORE_KEY)) {
// handle STORE_KEY
+ checkXmlDbAccessProprties();
+ response = storeKey(request);
- if (!dbStore.trim().equalsIgnoreCase("on")) {
- response = storeData(request, false);
- logger.debug(
- "RRDTypeMAServiceEngine.takeAction: "
- + "writing data into MA is switched off "
- + "(see 'service.ma.xmldb.db_store' property)");
-
- } else if (!dbStatus.trim().equalsIgnoreCase("on")) {
-
- response = storeData(request, false);
- logger.debug(
- "RRDTypeMAServiceEngine.takeAction: "
- + "xmldb is not setup in the configuration "
- + "(see 'component.ma.xmldb.db_status' property)");
-
- } else {
-
- response = storeKey(request);
- }
-
} else if
(actionType.equals(ActionType.STORE_METADATA_CONFIGURATION)) {
// handle STORE_METADATA_CONFIGURATION
// replace complete metadata configuration file
// message type: CompleteMetadataStoreRequest
+ checkXmlDbAccessProprties();
response = replaceMetadataConfiguration(request);
} else if (actionType.equals(ActionType.ECHO)) {
@@ -256,21 +220,50 @@
}
- private static long seq = 0;
+ protected void checkXmlDbAccessProprties() throws PerfSONARException {
- public static String getSeq() {
+ if (!dbStatus.trim().equalsIgnoreCase("on")) {
- String strSeq = null;
- try {
- seq = seq + 1;
- strSeq = Long.toString(seq);
- } catch (Exception ex) {
- strSeq = "0";
- seq = 0;
+ logger.info(
+ "RRDTypeMAServiceEngine.checkXmlDbAccessProprties: "
+ + "xmldb is not setup in the configuration "
+ + "(see 'component.ma.xmldb.db_status' property)");
+ throw new PerfSONARException(
+ "error.ma.rrd.writing",
+ "RRDTypeMAServiceEngine.checkXmlDbAccessProprties: "
+ + "Reading data from xmldb is switched off in the MA "
+ + "(check the configuration)");
+
+ } else if (!dbStore.trim().equalsIgnoreCase("on")) {
+
+ logger.info(
+ "RRDTypeMAServiceEngine.checkXmlDbAccessProprties: "
+ + "writing data into MA is switched off "
+ + "(see 'service.ma.xmldb.db_store' property)");
+ throw new PerfSONARException(
+ "error.ma.rrd.writing",
+ "RRDTypeMAServiceEngine.checkXmlDbAccessProprties: "
+ + "Writing data or xmldb is switched off in the MA.");
+
+ }
+
}
- return strSeq;
+ private static long seq = 0;
+
+ public static String getSeq() {
+
+ String strSeq = null;
+ try {
+ seq = seq + 1;
+ strSeq = Long.toString(seq);
+ } catch (Exception ex) {
+ strSeq = "0";
+ seq = 0;
+ }
+
+ return strSeq;
}
@@ -314,12 +307,23 @@
protected NMWGStorageManager getMetadataConfigurationStorageManager()
throws PerfSONARException {
- if (dbStatus.trim().equalsIgnoreCase("on"))
+ if (dbStatus.trim().equalsIgnoreCase("on")) {
// xmldb is present
metadataConfig = new MetadataConfigurationStorageManager();
- else
+ } else {
// xmldb is not present
- metadataConfig = new SimpleMetadataConfigurationStorageManager();
+ //metadataConfig = new
SimpleMetadataConfigurationStorageManager();
+ //
+ // XML FILE IS NOT SUPPORTED NOW AS A METADATA CONFIGURATION
STORAGE !!!!!!!!
+ logger.error(
+
"RRDTypeMAServiceEngine.getMetadataConfigurationStorageManager: "
+ + "Xml database is not set up in the service
configuration "
+ + "(see 'component.ma.xmldb.db_status' property)");
+ throw new PerfSONARException(
+ "error.ma.rrd.writing",
+
"RRDTypeMAServiceEngine.getMetadataConfigurationStorageManager: "
+ + "Xml database is not set up in the service
configuration.");
+ }
metadataConfig.initStorage(null);
return metadataConfig;
@@ -422,7 +426,7 @@
}
- return message;
+ return message;
}
@@ -556,7 +560,7 @@
} else if (key == null) {
- throw new PerfSONARException(
+ throw new PerfSONARException(
"error.ma.query",
"RRDTypeMAServiceEngine._getKey: "
+ "no eventType or key element in metadata id="
@@ -635,23 +639,10 @@
*
* @throws PerfSONARException
*/
- protected Message storeData(Message request, boolean status)
- throws PerfSONARException {
+ protected Message storeData(Message request) throws PerfSONARException {
-
Message response = new Message();
- if (status == false) {
-
- throw new PerfSONARException(
- "error.ma.rrd.writing",
- "RRDTypeMAServiceEngine.storeData: "
- + "Writing data or xmldb is switched off in the MA "
- + "(check the configuration)");
-
- }
-
-
RRDStorageManager rrdStorageManager = new RRDStorageManager();
Map metadataMap = request.getMetadataMap();
@@ -790,7 +781,7 @@
Parameters ps = metadata.getParameters();
if (ps != null) {
- // checking file name parameter
+ // checking file name parameter
Parameter _f = ps.getParameterByName("file");
if (_f != null) {
f = new Parameter();
@@ -1113,10 +1104,6 @@
}
- //---------------------------------- private methods
-
-
-
private String getEventType(Metadata metadata, Message msg) {
String eventType = null;
- perfsonar: r4144 - trunk/geant2-java-rrd-ma/src/main/java/org/perfsonar/service/measurementArchive/rrdType, svnlog, 07/08/2008
Archive powered by MHonArc 2.6.16.