Skip to Content.
Sympa Menu

perfsonar-dev - r1347 - trunk/perfsonar/src/org/perfsonar/service/measurementArchive/rrdStorageManager

Subject: perfsonar development work

List archive

r1347 - trunk/perfsonar/src/org/perfsonar/service/measurementArchive/rrdStorageManager


Chronological Thread 
  • From:
  • To:
  • Subject: r1347 - trunk/perfsonar/src/org/perfsonar/service/measurementArchive/rrdStorageManager
  • Date: Fri, 30 Jun 2006 08:17:45 -0400

Author: roman
Date: 2006-06-30 08:17:44 -0400 (Fri, 30 Jun 2006)
New Revision: 1347

Modified:

trunk/perfsonar/src/org/perfsonar/service/measurementArchive/rrdStorageManager/SimpleMetadataConfigurationStorageManager.java
Log:
Now the service reads the rrd metadata config file once (during handling the
first request) and keep it in the static variable.
This prevents the situation when the rrd metadata config file is read/parsed
every time new request has come.

Modified:
trunk/perfsonar/src/org/perfsonar/service/measurementArchive/rrdStorageManager/SimpleMetadataConfigurationStorageManager.java
===================================================================
---
trunk/perfsonar/src/org/perfsonar/service/measurementArchive/rrdStorageManager/SimpleMetadataConfigurationStorageManager.java
2006-06-30 10:40:56 UTC (rev 1346)
+++
trunk/perfsonar/src/org/perfsonar/service/measurementArchive/rrdStorageManager/SimpleMetadataConfigurationStorageManager.java
2006-06-30 12:17:44 UTC (rev 1347)
@@ -71,6 +71,8 @@
*/
private String xmlFile = null;

+ private static Document metaConfigDoc = null;
+
protected LoggerComponent logger = null;

protected ConfigurationComponent configuration = null;
@@ -137,8 +139,7 @@

try {

- InputSource in = new InputSource(new
FileInputStream(this.xmlFile));
- XPathResult result = getXPathResults(in, query);
+ XPathResult result = getXPathResults(query);

Transformer serializer =
TransformerFactory.newInstance().newTransformer();
serializer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION,
"yes");
@@ -223,14 +224,31 @@
}


+ public Document getMetaConfigDocument() throws Exception {

- public XPathResult getXPathResults(InputSource in, String query)
- throws Exception {
+ //logger.debug(
+ //
"SimpleMetadataConfigurationStorageManager.getMetaConfigDocument: "
+ // + "metaConfigDoc is " + metaConfigDoc);

+ if (metaConfigDoc != null)
+ return metaConfigDoc;
+
+ InputSource in = new InputSource(new FileInputStream(this.xmlFile));
+
DocumentBuilderFactory dfactory =
DocumentBuilderFactory.newInstance();
dfactory.setNamespaceAware(true);
- Document doc = dfactory.newDocumentBuilder().parse(in);
+ metaConfigDoc = dfactory.newDocumentBuilder().parse(in);

+ return metaConfigDoc;
+
+ }
+
+
+ public XPathResult getXPathResults(String query)
+ throws Exception {
+
+ Document doc = getMetaConfigDocument();
+
XPathEvaluator evaluator = new XPathEvaluatorImpl(doc);
XPathNSResolver resolver = evaluator.createNSResolver(doc);

@@ -273,8 +291,7 @@

try {

- InputSource in = new InputSource(new
FileInputStream(this.xmlFile));
- XPathResult result = getXPathResults(in, xpathQuery);
+ XPathResult result = getXPathResults(xpathQuery);

Transformer serializer =
TransformerFactory.newInstance().newTransformer();
serializer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION,
"yes");



  • r1347 - trunk/perfsonar/src/org/perfsonar/service/measurementArchive/rrdStorageManager, svnlog, 06/30/2006

Archive powered by MHonArc 2.6.16.

Top of Page