Skip to Content.
Sympa Menu

perfsonar-dev - [pS-dev] [GEANT/SA2/ps-java-services] r6052 - in trunk: perfsonar-java-sql-ma perfsonar_base perfson ar_base/src/main/java/org/perfsonar/service/measurementA rchive/eventTypeConfig

Subject: perfsonar development work

List archive

[pS-dev] [GEANT/SA2/ps-java-services] r6052 - in trunk: perfsonar-java-sql-ma perfsonar_base perfson ar_base/src/main/java/org/perfsonar/service/measurementA rchive/eventTypeConfig


Chronological Thread 
  • From:
  • To:
  • Subject: [pS-dev] [GEANT/SA2/ps-java-services] r6052 - in trunk: perfsonar-java-sql-ma perfsonar_base perfson ar_base/src/main/java/org/perfsonar/service/measurementA rchive/eventTypeConfig
  • Date: Tue, 4 Dec 2012 15:07:27 +0000 (GMT)

Author: nordunet.behrmann
Date: 2012-12-04 15:07:27 +0000 (Tue, 04 Dec 2012)
New Revision: 6052

Modified:
trunk/perfsonar-java-sql-ma/pom.xml
trunk/perfsonar_base/pom.xml

trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/eventTypeConfig/EventTypeConfigurationComponent.java
Log:
perfsonar_base, perfsonar-java-sql-ma: Remove ibatis-common dependency

PerfSONAR base 1 still used the iBATIS common library, although only a
minor utility class was used. This patch refactors the code to use
Google Guava instead. Thus iBATIS is now dropped completely.

Modified: trunk/perfsonar-java-sql-ma/pom.xml
===================================================================
--- trunk/perfsonar-java-sql-ma/pom.xml 2012-12-04 13:50:04 UTC (rev 6051)
+++ trunk/perfsonar-java-sql-ma/pom.xml 2012-12-04 15:07:27 UTC (rev 6052)
@@ -244,12 +244,6 @@
<artifactId>slf4j-log4j12</artifactId>
<version>1.5.10</version>
</dependency>
-
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>13.0.1</version>
- </dependency>
</dependencies>
<reporting>
<excludeDefaults>true</excludeDefaults>

Modified: trunk/perfsonar_base/pom.xml
===================================================================
--- trunk/perfsonar_base/pom.xml 2012-12-04 13:50:04 UTC (rev 6051)
+++ trunk/perfsonar_base/pom.xml 2012-12-04 15:07:27 UTC (rev 6052)
@@ -373,9 +373,9 @@
</dependency>

<dependency>
- <groupId>net.geant.perfsonar</groupId>
- <artifactId>ibatis-common</artifactId>
- <version>2.1.7.597</version>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>13.0.1</version>
</dependency>

<dependency>

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/eventTypeConfig/EventTypeConfigurationComponent.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/eventTypeConfig/EventTypeConfigurationComponent.java
2012-12-04 13:50:04 UTC (rev 6051)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/eventTypeConfig/EventTypeConfigurationComponent.java
2012-12-04 15:07:27 UTC (rev 6052)
@@ -9,6 +9,7 @@
import java.io.InputStream;
import java.net.URL;

+import com.google.common.io.Resources;
import org.apache.commons.digester.Digester;
import org.apache.commons.digester.xmlrules.DigesterLoader;
import org.perfsonar.base.auxiliary.AuxiliaryComponent;
@@ -16,10 +17,8 @@
import org.perfsonar.base.auxiliary.ComponentNames;
import org.perfsonar.base.auxiliary.components.logger.LoggerComponent;
import org.perfsonar.base.exceptions.PerfSONARException;
+import org.xml.sax.SAXException;

-import com.ibatis.common.resources.Resources;
-
-
/**
* Auxiliary component that keeps the configuration
* about eventTypes (nmwg element) supported by the service.
@@ -49,129 +48,94 @@

public EventTypeConfigurationComponent() throws PerfSONARException
{
-
try {
-
this.logger = (LoggerComponent)
AuxiliaryComponentManager.
getInstance().
getComponent(ComponentNames.LOGGER);
-
} catch (PerfSONARException e) {
-
throw new PerfSONARException(
"error.common.no_logger",
"EventTypeConfigurationComponent.initComponent: "
+ "Cannot get logger component");
-
}
-
}

-
// ---------------------------------- public methods


@Override
public void initComponent() throws PerfSONARException
{
+ URL digesterRulesURL;
+ digesterRulesURL = getResource(DIGESTER_RULES);

-
- // getting configuration data using commons digester
-
- URL digesterRulesURL = null;
- try {
- digesterRulesURL = Resources.getResourceURL(DIGESTER_RULES);
- } catch (IOException ioex) {
- logger.debug("EventTypeConfigurationComponent.initComponent: "
- + ioex.toString());
- }
- if (digesterRulesURL == null) {
- logger.debug("EventTypeConfigurationComponent.initComponent: "
- + "Could not find xml config file " + DIGESTER_RULES);
- throw new PerfSONARException(
- "error.common",
- "EventTypeConfigurationComponent.initComponent: "
- + "Could not find xml config file " + DIGESTER_RULES);
- }
-
-
InputStream digesterInputStream = null;
try {
- digesterInputStream =
Resources.getResourceAsStream(DIGESTER_INPUT);
- } catch (IOException ioex) {
- logger.debug("EventTypeConfigurationComponent.initComponent: "
- + ioex.toString());
- }
- if (digesterInputStream == null) {
- logger.debug("EventTypeConfigurationComponent.initComponent: "
- + "Could not find xml file " + DIGESTER_INPUT);
- throw new PerfSONARException(
- "error.common",
- "EventTypeConfigurationComponent.initComponent: "
- + "Could not create an input stream of xml config file "
- + DIGESTER_INPUT);
- }
+ digesterInputStream = getResource(DIGESTER_INPUT).openStream();

-
- Digester digester = DigesterLoader.createDigester(digesterRulesURL);
-
- try {
-
+ Digester digester =
DigesterLoader.createDigester(digesterRulesURL);
eventTypeConfiguration =
(EventTypeConfiguration) digester.parse(digesterInputStream);
- digesterInputStream.close();
-
//logger.debug("EventTypeConfigurationComponent.initComponent: "
// + eventTypeConfiguration.getEventType("utilization");
+ digesterInputStream.close();
+ digesterInputStream = null;
+ } catch (IOException e) {
+ logger.debug("EventTypeConfigurationComponent.initComponent: " +
e.toString());
+ } catch (SAXException e) {
+ logger.debug("EventTypeConfigurationComponent.initComponent: " +
"Could not parse " + DIGESTER_INPUT + ": "
+ + e.toString());
+ throw new PerfSONARException(
+ "error.common",
+ "EventTypeConfigurationComponent.initComponent: "
+ + "Could not parse " + DIGESTER_INPUT, e);
+ } finally {
+ if (digesterInputStream != null) {
+ try {
+ digesterInputStream.close();
+ } catch (IOException e) {
+
logger.debug("EventTypeConfigurationComponent.initComponent: "
+ + "Could not parse " + DIGESTER_INPUT
+ + ": " + e.toString());
+ }
+ }
+ }
+ }

- } catch (Exception ex) {
-
+ private URL getResource(String resourceName) throws PerfSONARException
+ {
+ try {
+ return Resources.getResource(resourceName);
+ } catch (IllegalArgumentException e) {
logger.debug("EventTypeConfigurationComponent.initComponent: "
- + "Could not parse " + DIGESTER_INPUT
- + ": " + ex.toString());
+ + "Could not find xml config file " + resourceName);
throw new PerfSONARException(
"error.common",
"EventTypeConfigurationComponent.initComponent: "
- + "Could not parse " + DIGESTER_INPUT);
-
+ + "Could not find xml config file " + resourceName, e);
}
-
}

-
@Override
public String getComponentName()
{
-
return componentName;
-
}

-
@Override
public void setComponentName(String name)
{
-
componentName = name;
-
}

-
public EventType getEventType(String name)
{
-
return eventTypeConfiguration.getEventType(name);
-
}

-
public EventTypeConfiguration getEventTypeConfiguration()
{
-
return eventTypeConfiguration;
-
}
-
-
} //EventTypeConfigurationComponent



  • [pS-dev] [GEANT/SA2/ps-java-services] r6052 - in trunk: perfsonar-java-sql-ma perfsonar_base perfson ar_base/src/main/java/org/perfsonar/service/measurementA rchive/eventTypeConfig, svn-noreply, 12/04/2012

Archive powered by MHonArc 2.6.16.

Top of Page