Author: ppitonak(a)redhat.com
Date: 2010-07-30 08:29:04 -0400 (Fri, 30 Jul 2010)
New Revision: 18291
Added:
root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/VersionBean.java
root/tests/metamer/trunk/application/src/main/resources/version.properties
Modified:
root/tests/metamer/trunk/application/pom.xml
root/tests/metamer/trunk/application/src/main/webapp/index.xhtml
root/tests/metamer/trunk/application/src/main/webapp/templates/list.xhtml
root/tests/metamer/trunk/application/src/main/webapp/templates/template.xhtml
Log:
* added version bean so that application's version can be shown on pages
Modified: root/tests/metamer/trunk/application/pom.xml
===================================================================
--- root/tests/metamer/trunk/application/pom.xml 2010-07-30 12:10:15 UTC (rev 18290)
+++ root/tests/metamer/trunk/application/pom.xml 2010-07-30 12:29:04 UTC (rev 18291)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
- <!--
+<!--
JBoss, Home of Professional Open Source Copyright 2010, Red Hat, Inc. and
individual contributors by the
@authors tag. See the copyright.txt in the distribution for a full listing of
individual contributors. This is
free software; you can redistribute it and/or modify it under the terms of the
GNU Lesser General Public License
@@ -117,19 +117,30 @@
<build>
<finalName>metamer</finalName>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+
<plugins>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
</plugin>
<plugin>
- <artifactId>maven-war-plugin</artifactId>
- <configuration>
- <attachClasses>true</attachClasses>
- </configuration>
- </plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <attachClasses>true</attachClasses>
+ </configuration>
+ </plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
@@ -144,6 +155,41 @@
</connectors>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>buildnumber-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>validate</phase>
+ <goals>
+ <goal>create</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <doCheck>false</doCheck>
+ <doUpdate>false</doUpdate>
+ <revisionOnScmFailure>unknown</revisionOnScmFailure>
+ <timestampFormat>{0,date,MMM dd, yyyy H:mm:ss
zzz}</timestampFormat>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <attachClasses>true</attachClasses>
+ <archive>
+ <manifest>
+
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
+
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
+ </manifest>
+ <manifestEntries>
+ <SCM-Revision>${buildNumber}</SCM-Revision>
+ <SCM-Timestamp>${timestamp}</SCM-Timestamp>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
</plugins>
</build>
@@ -304,3 +350,4 @@
+
Added:
root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/VersionBean.java
===================================================================
---
root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/VersionBean.java
(rev 0)
+++
root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/VersionBean.java 2010-07-30
12:29:04 UTC (rev 18291)
@@ -0,0 +1,109 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.bean;
+
+import java.io.InputStream;
+import java.util.Properties;
+import javax.annotation.PostConstruct;
+import javax.faces.bean.ApplicationScoped;
+import javax.faces.bean.ManagedBean;
+
+import org.richfaces.log.RichfacesLogger;
+import org.slf4j.Logger;
+
+/**
+ * Vendor and version information for project Metamer.
+ *
+ * @author asmirnov(a)exadel.com, <a
href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+@ManagedBean(name = "metamer")
+@ApplicationScoped
+public final class VersionBean {
+
+ private static final Logger LOGGER = RichfacesLogger.APPLICATION.getLogger();
+ private String implementationVendor;
+ private String implementationVersion;
+ private String implementationTitle;
+ private String scmRevision;
+ private String scmTimestamp;
+ private String fullVersion;
+
+ /**
+ * Initializes the managed bean.
+ */
+ @PostConstruct
+ public void init() {
+ Properties properties = new Properties();
+ try {
+ InputStream inStream =
getClass().getClassLoader().getResourceAsStream("version.properties");
+ properties.load(inStream);
+ } catch (Exception e) {
+ LOGGER.warn("Unable to load version.properties using
PomVersion.class.getClassLoader().getResourceAsStream(...)", e);
+ }
+
+ implementationTitle = properties.getProperty("Implementation-Title");
+ implementationVendor =
properties.getProperty("Implementation-Vendor");
+ implementationVersion =
properties.getProperty("Implementation-Version");
+ scmRevision = properties.getProperty("SCM-Revision");
+ scmTimestamp = properties.getProperty("SCM-Timestamp");
+ }
+
+ public String getVendor() {
+ return implementationVendor;
+ }
+
+ public String getTitle() {
+ return implementationTitle;
+ }
+
+ public String getRevision() {
+ return scmRevision;
+ }
+
+ public String getTimestamp() {
+ return scmTimestamp;
+ }
+
+ public String getVersion() {
+ return implementationVersion;
+ }
+
+ public String getFullVersion() {
+ if (fullVersion != null) {
+ return fullVersion;
+ }
+
+ if (implementationVersion == null) {
+ implementationVersion = "Metamer: RichFaces Testing Application, version
unknown";
+ return implementationVersion;
+ }
+
+ fullVersion = implementationTitle + " by " + implementationVendor +
", version " + implementationVersion + " SVN r. " + scmRevision;
+ return fullVersion;
+ }
+
+ @Override
+ public String toString() {
+ return getVersion();
+ }
+}
Added: root/tests/metamer/trunk/application/src/main/resources/version.properties
===================================================================
--- root/tests/metamer/trunk/application/src/main/resources/version.properties
(rev 0)
+++ root/tests/metamer/trunk/application/src/main/resources/version.properties 2010-07-30
12:29:04 UTC (rev 18291)
@@ -0,0 +1,6 @@
+Implementation-Title=${project.name}
+Implementation-Version=${project.version}
+Implementation-Vendor-Id=${groupId}
+Implementation-Vendor=${project.organization.name}
+SCM-Revision=${buildNumber}
+SCM-Timestamp=${timestamp}
Modified: root/tests/metamer/trunk/application/src/main/webapp/index.xhtml
===================================================================
--- root/tests/metamer/trunk/application/src/main/webapp/index.xhtml 2010-07-30 12:10:15
UTC (rev 18290)
+++ root/tests/metamer/trunk/application/src/main/webapp/index.xhtml 2010-07-30 12:29:04
UTC (rev 18291)
@@ -61,6 +61,9 @@
<hr style="width: 900px; margin-left: 0px;"/>
#{a4j.version}
+ <br/>
+ #{metamer.fullVersion}
+
</h:form>
</h:body>
</html>
\ No newline at end of file
Modified: root/tests/metamer/trunk/application/src/main/webapp/templates/list.xhtml
===================================================================
--- root/tests/metamer/trunk/application/src/main/webapp/templates/list.xhtml 2010-07-30
12:10:15 UTC (rev 18290)
+++ root/tests/metamer/trunk/application/src/main/webapp/templates/list.xhtml 2010-07-30
12:29:04 UTC (rev 18291)
@@ -49,5 +49,7 @@
<hr style="width: 900px; margin-left: 0px;"/>
#{a4j.version}
+ <br/>
+ #{metamer.fullVersion}
</h:body>
</html>
Modified: root/tests/metamer/trunk/application/src/main/webapp/templates/template.xhtml
===================================================================
---
root/tests/metamer/trunk/application/src/main/webapp/templates/template.xhtml 2010-07-30
12:10:15 UTC (rev 18290)
+++
root/tests/metamer/trunk/application/src/main/webapp/templates/template.xhtml 2010-07-30
12:29:04 UTC (rev 18291)
@@ -53,10 +53,14 @@
<a4j:log id="a4jLog" height="300px"
rendered="#{richBean.log}" />
</h:panelGroup>
- <div class="footer"><ui:insert
name="footer">
+ <div class="footer">
+ <ui:insert name="footer">
<hr />
#{a4j.version}
- </ui:insert></div>
+ <br/>
+ #{metamer.fullVersion}
+ </ui:insert>
+ </div>
</h:form>
</h:body>