cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r491097 - in /cocoon/trunk/core/cocoon-configuration/cocoon-spring-configurator/src/main/java/org/apache/cocoon/spring/configurator: ResourceUtils.java impl/SettingsBeanFactoryPostProcessor.java
Date Fri, 29 Dec 2006 21:01:55 GMT
Author: cziegeler
Date: Fri Dec 29 13:01:55 2006
New Revision: 491097

URL: http://svn.apache.org/viewvc?view=rev&rev=491097
Log:
Display correct info message and show version

Modified:
    cocoon/trunk/core/cocoon-configuration/cocoon-spring-configurator/src/main/java/org/apache/cocoon/spring/configurator/ResourceUtils.java
    cocoon/trunk/core/cocoon-configuration/cocoon-spring-configurator/src/main/java/org/apache/cocoon/spring/configurator/impl/SettingsBeanFactoryPostProcessor.java

Modified: cocoon/trunk/core/cocoon-configuration/cocoon-spring-configurator/src/main/java/org/apache/cocoon/spring/configurator/ResourceUtils.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-configuration/cocoon-spring-configurator/src/main/java/org/apache/cocoon/spring/configurator/ResourceUtils.java?view=diff&rev=491097&r1=491096&r2=491097
==============================================================================
--- cocoon/trunk/core/cocoon-configuration/cocoon-spring-configurator/src/main/java/org/apache/cocoon/spring/configurator/ResourceUtils.java
(original)
+++ cocoon/trunk/core/cocoon-configuration/cocoon-spring-configurator/src/main/java/org/apache/cocoon/spring/configurator/ResourceUtils.java
Fri Dec 29 13:01:55 2006
@@ -194,4 +194,19 @@
             return ((Resource) o1).getFilename().compareTo(((Resource) o2).getFilename());
         }
     }
+
+    /**
+     * Return the properties added by Maven.
+     * @return Returns a properties object or null if the properties can't be found/read.
+     */
+    public static Properties getPOMProperties(String groupId, String versionId) {
+        final String resourceName = "META-INF/maven/" + groupId + "/" + versionId + "/pom.properties";
+        try {
+            final Properties p = new Properties();
+            p.load(Thread.currentThread().getContextClassLoader().getResourceAsStream(resourceName));
+            return p;
+        } catch (IOException ignore) {
+            return null;
+        }
+    }
 }

Modified: cocoon/trunk/core/cocoon-configuration/cocoon-spring-configurator/src/main/java/org/apache/cocoon/spring/configurator/impl/SettingsBeanFactoryPostProcessor.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-configuration/cocoon-spring-configurator/src/main/java/org/apache/cocoon/spring/configurator/impl/SettingsBeanFactoryPostProcessor.java?view=diff&rev=491097&r1=491096&r2=491097
==============================================================================
--- cocoon/trunk/core/cocoon-configuration/cocoon-spring-configurator/src/main/java/org/apache/cocoon/spring/configurator/impl/SettingsBeanFactoryPostProcessor.java
(original)
+++ cocoon/trunk/core/cocoon-configuration/cocoon-spring-configurator/src/main/java/org/apache/cocoon/spring/configurator/impl/SettingsBeanFactoryPostProcessor.java
Fri Dec 29 13:01:55 2006
@@ -157,7 +157,17 @@
             throw new IllegalArgumentException(msg);
         }
         */
-        this.servletContext.log("Apache Cocoon is running in mode: " + mode);
+        final Properties pomProps = ResourceUtils.getPOMProperties("org.apache.cocoon", "cocoon-spring-configurator");
+        final String version;
+        if ( pomProps != null ) {
+            version = pomProps.getProperty("version");
+        } else {
+            version = null;
+        }
+
+        this.servletContext.log("Apache Cocoon Spring Configurator " +
+                                (version != null ? "v" + version + " " : "") +
+                                "is running in mode '" + mode + "'.");
 
         // create an empty settings objects
         final MutableSettings s = new MutableSettings(mode);



Mime
View raw message