Print

Print


Commit in lcsim on MAIN
pom.xml+40-41.45 -> 1.46
src/org/lcsim/LCSimVersion.java+128added 1.1
resources/org/lcsim/application.properties+10added 1.1
src/org/lcsim/job/JobControlManager.java+6-41.12 -> 1.13
+184-8
2 added + 2 modified, total 4 files
JM: add support for lcsim version info

lcsim
pom.xml 1.45 -> 1.46
diff -u -r1.45 -r1.46
--- pom.xml	30 Oct 2008 07:12:52 -0000	1.45
+++ pom.xml	30 Oct 2008 22:55:36 -0000	1.46
@@ -4,9 +4,9 @@
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
     <modelVersion>4.0.0</modelVersion>
     <artifactId>lcsim</artifactId>
-    <name>org DOT lcsim</name>
+    <name>org.lcsim</name>
     <version>1.3-SNAPSHOT</version>
-    <description>org.lcsim</description>
+    <description>A Java-based reconstruction and analysis system for ILC detectors.</description>
     <scm>
         <connection>scm:cvs:pserver:anonymous:@cvs.freehep.org:/cvs/lcd:lcsim</connection>
         <developerConnection>scm:cvs:pserver:${scm.username}:@cvs.freehep.org:/cvs/lcd:lcsim</developerConnection>
@@ -50,15 +50,30 @@
     </distributionManagement>
     <build>
         <defaultGoal>install</defaultGoal>
+        <filters>
+            <filter>${basedir}/target/filter.properties</filter>
+        </filters>
         <resources>
             <resource>
-                <directory>src</directory>
+                <directory>src/org/lcsim/plugin/web/examples/</directory>
                 <includes>
-                    <include>org/lcsim/plugin/web/examples/</include>
+                    <include>**/*.*</include>
                 </includes>
+                <filtering>false</filtering>
             </resource>
             <resource>
                 <directory>resources</directory>
+                <filtering>true</filtering>
+                <includes>
+                    <include>**/*.properties</include>
+                </includes>
+            </resource>
+            <resource>
+                <directory>resources</directory>
+                <filtering>false</filtering>
+                <excludes>
+                    <exclude>**/*.properties</exclude>
+                </excludes>
             </resource>
         </resources>
         <plugins>
@@ -138,6 +153,27 @@
                     </execution> 
                 </executions>
             </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-antrun-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <phase>generate-resources</phase>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                        <configuration>
+                            <tasks>                      
+                                <mkdir dir="${project.build.directory}"/>
+                                <tstamp>
+                                    <format property="last.updated" pattern="yyyy-MM-dd kk:mm:ss z"/> 
+                                </tstamp>
+                                <echo file="${basedir}/target/filter.properties" message="build.date=${last.updated}"/>
+                            </tasks>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>            
         </plugins>
     </build>
     <dependencies>

lcsim/src/org/lcsim
LCSimVersion.java added at 1.1
diff -N LCSimVersion.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ LCSimVersion.java	30 Oct 2008 22:55:36 -0000	1.1
@@ -0,0 +1,128 @@
+package org.lcsim;
+
+import java.io.IOException;
+import java.io.PrintStream;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Properties;
+
+/**
+ * This class provides version information about the lcsim jar,
+ * mostly derived from various maven properties.
+ *  
+ * @author jeremym
+ * @version $Id: LCSimVersion.java,v 1.1 2008/10/30 22:55:36 jeremy Exp $
+ */
+public class LCSimVersion
+{
+	Properties prop = new Properties();
+	
+	String name;
+	String version;
+	String artifactId;
+	String user;
+	String arch;
+	String javaspec;
+	String javac;	
+	String description;
+	String osname;
+	String osversion;
+	Date date;
+	private static final String url = "/org/lcsim/application.properties"; 
+	
+	public LCSimVersion()
+	{
+		try 
+		{
+			prop.load(getClass().getResourceAsStream(url));
+		}
+		catch (IOException x)
+		{
+			throw new RuntimeException("Failed to load " + url + "!  Maybe you built the lcsim jar using maven 1?");
+		}
+		name = prop.getProperty("application.name");
+		version = prop.getProperty("application.version");
+		description = prop.getProperty("application.description");
+		artifactId = prop.getProperty("application.artifactId");
+		user = prop.getProperty("build.user");
+		arch = prop.getProperty("os.arch");		
+		osname = prop.getProperty("os.name");
+		osversion = prop.getProperty("os.version");
+		javaspec = prop.getProperty("java.specification.version");
+		
+		try {
+			date = (new SimpleDateFormat("yyyy-MM-dd kk:mm:ss z")).parse(prop.getProperty("build.date"));
+		}
+		catch (ParseException x)
+		{
+			throw new RuntimeException(x);
+		}
+	}
+	
+	public void printOut(PrintStream ps)
+	{
+		ps.println("---- " + getName() + " version ----");
+		ps.println("application.artifactId: " + getArtifactId());
+		ps.println("application.name: " + getName());
+		ps.println("application.version: " + getVersion());
+		ps.println("application.description: " + getDescription());
+		ps.println("build.user: " + getUser());
+		ps.println("build.date: " + getDate());
+		ps.println("java.version: " + getJavaVersion());
+		ps.println("os.arch: " + getArch());
+		ps.println("os.name: " + getOsName());
+		ps.println("os.version: " + getOsVersion());		
+		ps.println("---- end " + getName() + " version ----");
+	}
+	
+	public String getOsName()
+	{
+		return osname;
+	}
+	
+	public String getOsVersion()
+	{
+		return osversion;
+	}
+	
+	public String getDescription()
+	{
+		return description;
+	}
+	
+	public String getArtifactId()
+	{
+		return artifactId;
+	}
+	
+	public Date getDate()
+	{
+		return date;
+	}
+	
+	public String getUser()
+	{
+		return user;
+	}
+	
+	public String getJavaVersion()
+	{
+		return javaspec;
+	}	
+	
+	public String getArch()
+	{
+		return arch;
+	}
+	
+	public String getVersion()
+	{
+		return version;
+	}
+	
+	public String getName()
+	{
+		return name;
+	}	
+}
\ No newline at end of file

lcsim/resources/org/lcsim
application.properties added at 1.1
diff -N application.properties
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ application.properties	30 Oct 2008 22:55:36 -0000	1.1
@@ -0,0 +1,10 @@
+application.artifactId=${pom.artifactId}
+application.name=${pom.name}
+application.version=${pom.version}
+application.description=${pom.description}
+build.user=${user.name}
+build.date=${build.date}
+os.arch=${os.arch}
+os.name=${os.name}
+os.version=${os.version}
+java.specification.version=${java.specification.version}
\ No newline at end of file

lcsim/src/org/lcsim/job
JobControlManager.java 1.12 -> 1.13
diff -u -r1.12 -r1.13
--- JobControlManager.java	27 Oct 2008 17:58:21 -0000	1.12
+++ JobControlManager.java	30 Oct 2008 22:55:36 -0000	1.13
@@ -5,7 +5,6 @@
 
 import java.beans.BeanInfo;
 import java.beans.MethodDescriptor;
-import java.beans.PropertyDescriptor;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
@@ -13,7 +12,6 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.PrintStream;
-import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
 import java.net.URL;
 import java.util.ArrayList;
@@ -29,6 +27,7 @@
 import org.jdom.Document;
 import org.jdom.Element;
 import org.jdom.input.SAXBuilder;
+import org.lcsim.LCSimVersion;
 import org.lcsim.util.Driver;
 import org.lcsim.util.cache.FileCache;
 import org.lcsim.util.loop.LCIOEventSource;
@@ -182,7 +181,7 @@
 	 * @param doc
 	 */
 	private void setup(Document doc)
-	{
+	{		
 		// Clear data structures if a previous job was run.
 		clear();
 
@@ -218,6 +217,10 @@
 					throw new RuntimeException(x);
 				}
 			}
+			
+			// Print the lcsim version info to the log (always).
+			(new LCSimVersion()).printOut(logStream);			
+			logStream.println();
 
 			// Print hello world message to appear at top of log.
 			if (verbose)
@@ -336,7 +339,6 @@
 		// Print user's classpath entries.
 		if (printUserClassPath)
 		{
-			logStream.println();
 			logStream.println("-- Extra Classpath URLs --");
 			for (URL url : loader.getURLs())
 			{
CVSspam 0.2.8