User: user57
Date: 01/08/31 21:11:59
Modified: src/main/org/jboss Main.java Version.java
Log:
o re-enabled usage of Version & changed back to using Calader to avoid
deprecated warnings.
Revision Changes Path
1.45 +21 -12 jboss/src/main/org/jboss/Main.java
Index: Main.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/Main.java,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- Main.java 2001/08/30 04:28:42 1.44
+++ Main.java 2001/09/01 04:11:59 1.45
@@ -20,6 +20,7 @@
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Set;
+import java.util.Calendar;
import java.security.AccessController;
import java.security.PrivilegedAction;
@@ -40,7 +41,7 @@
*
* @see <related>
* @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>.
-* @version $Revision: 1.44 $
+* @version $Revision: 1.45 $
*
* <p><b> Revisions:</b>
* <p><b> 20010830 marcf: </b>
@@ -52,10 +53,12 @@
*/
public class Main
{
- // Constants -----------------------------------------------------
-
- String versionIdentifier = "pre-3.0 [RABBIT-HOLE]";
- // Attributes ----------------------------------------------------
+ // Constants -----------------------------------------------------
+
+ /** The version & build information holder. */
+ private Version version = Version.getInstance();
+
+ // Attributes ----------------------------------------------------
// Static --------------------------------------------------------
public static void main(final String[] args)
@@ -150,7 +153,8 @@
System.setProperty("jboss.system.configurationDirectory",
confDir);
System.setProperty("jboss.system.patchDirectory", patchDir);
System.setProperty("jboss.system.libraryDirectory", libDir);
- System.setProperty("jboss.system.version", versionIdentifier);
+ System.setProperty("jboss.system.version", version.toString());
+ System.setProperty("jboss.system.version.name",
version.getName());
// Give feedback about from where jndi.properties is read
URL jndiLocation =
this.getClass().getResource("/jndi.properties");
@@ -265,11 +269,16 @@
{
e.printStackTrace();
}
-
- // Done
- Date stopTime = new Date();
- Date lapsedTime = new Date(stopTime.getTime()-startTime.getTime());
- System.out.println("JBoss "+versionIdentifier+" Started in
"+lapsedTime.getMinutes()+"m:"+lapsedTime.getSeconds()+"s");
+
+ // Done
+ Date lapsedTime = new Date(new Date().getTime() -
startTime.getTime());
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(lapsedTime);
+
+ System.out.println("JBoss " + version +
+ " [" + version.getName() + "] Started in " +
+ cal.get(Calendar.MINUTE) + "m:" +
+ cal.get(Calendar.SECOND) + "s");
}
@@ -336,4 +345,4 @@
if (System.getProperty("java.security.manager") != null)
System.setSecurityManager((SecurityManager)Class.forName(System.getProperty("java.security.manager")).newInstance());
*/
-}
\ No newline at end of file
+}
1.2 +113 -84 jboss/src/main/org/jboss/Version.java
Index: Version.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/Version.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Version.java 2001/08/28 02:08:18 1.1
+++ Version.java 2001/09/01 04:11:59 1.2
@@ -1,171 +1,164 @@
/*
- * JBoss, the OpenSource EJB server
+ * JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
-
package org.jboss;
+import java.io.IOException;
-import java.util.Properties;
-import java.util.Map;
+import java.io.InputStream;
import java.util.Collections;
+import java.util.Map;
-import java.io.InputStream;
-import java.io.IOException;
+import java.util.Properties;
/**
- * Provides access to JBoss version (and build) properties.
- *
- * @author <a href="mailto:[EMAIL PROTECTED]">Jason Dillon</a>
- * @version $Revision: 1.1 $
+ * Provides access to JBoss version (and build) properties.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Jason Dillon</a>
+ * @version $Revision: 1.2 $
*/
public final class Version
{
- public static final String VERSION_MAJOR = "version.major";
- public static final String VERSION_MINOR = "version.minor";
- public static final String VERSION_REVISION = "version.revision";
- public static final String VERSION_TAG = "version.tag";
- public static final String VERSION_NAME = "version.name";
- public static final String BUILD_NUMBER = "build.number";
- public static final String BUILD_ID = "build.id";
-
- /** The single instance. */
- private static Version instance = null;
+ public final static String VERSION_MAJOR = "version.major";
+ public final static String VERSION_MINOR = "version.minor";
+ public final static String VERSION_REVISION = "version.revision";
+ public final static String VERSION_TAG = "version.tag";
+ public final static String VERSION_NAME = "version.name";
+ public final static String BUILD_NUMBER = "build.number";
+ public final static String BUILD_ID = "build.id";
/**
- * Get the single <tt>Version</tt> instance.
- *
- * @return The single <tt>Version</tt> instance.
+ * The single instance.
*/
- public static Version getInstance() {
- if (instance == null) {
- instance = new Version();
- }
- return instance;
- }
+ private static Version instance = null;
- /** The version properties. */
+ /**
+ * The version properties.
+ */
private Properties props;
- /** Do not allow direct public construction. */
- private Version() {
+ /**
+ * Do not allow direct public construction.
+ */
+ private Version()
+ {
props = loadProperties();
}
/**
- * Load the version properties from a resource.
+ * Get the single <tt>Version</tt> instance.
+ *
+ * @return The single <tt>Version</tt> instance.
*/
- private Properties loadProperties() {
- props = new Properties();
-
- try {
- InputStream in =
- Version.class.getResourceAsStream("/org/jboss/version.properties");
-
- props.load(in);
- in.close();
- }
- catch (IOException e) {
- throw new Error("missing version.properties");
+ public static Version getInstance()
+ {
+ if (instance == null)
+ {
+ instance = new Version();
}
-
- return props;
+ return instance;
}
/**
- * Returns an unmodifiable map of version properties.
+ * Returns an unmodifiable map of version properties.
*
- * @return An unmodifiable map of version properties.
+ * @return An unmodifiable map of version properties.
*/
- public Map getProperties() {
+ public Map getProperties()
+ {
return Collections.unmodifiableMap(props);
}
/**
- * Returns the value for the given property name.
+ * Returns the value for the given property name.
*
- * @param name The name of the property.
- * @return The property value or null if the property is not set.
+ * @param name The name of the property.
+ * @return The property value or null if the property is not set.
*/
- public String getProperty(final String name) {
+ public String getProperty(final String name)
+ {
return props.getProperty(name);
}
- /** Returns a property value as an int. */
- private int getIntProperty(final String name) {
- return Integer.valueOf(props.getProperty(name)).intValue();
- }
-
/**
- * Returns the major number of the version.
+ * Returns the major number of the version.
*
- * @return The major number of the version.
+ * @return The major number of the version.
*/
- public int getMajor() {
+ public int getMajor()
+ {
return getIntProperty(VERSION_MAJOR);
}
/**
- * Returns the minor number of the version.
+ * Returns the minor number of the version.
*
- * @return The minor number of the version.
+ * @return The minor number of the version.
*/
- public int getMinor() {
+ public int getMinor()
+ {
return getIntProperty(VERSION_MINOR);
}
/**
- * Returns the revision number of the version.
+ * Returns the revision number of the version.
*
- * @return The revision number of the version.
+ * @return The revision number of the version.
*/
- public int getRevision() {
+ public int getRevision()
+ {
return getIntProperty(VERSION_REVISION);
}
/**
- * Returns the tag of the version.
+ * Returns the tag of the version.
*
- * @return The tag of the version.
+ * @return The tag of the version.
*/
- public String getTag() {
+ public String getTag()
+ {
return props.getProperty(VERSION_TAG);
}
/**
- * Returns the name number of the version.
+ * Returns the name number of the version.
*
- * @return The name of the version.
+ * @return The name of the version.
*/
- public String getName() {
+ public String getName()
+ {
return props.getProperty(VERSION_NAME);
}
/**
- * Returns the build identifier for this version.
+ * Returns the build identifier for this version.
*
- * @return The build identifier for this version.
+ * @return The build identifier for this version.
*/
- public String getBuildID() {
+ public String getBuildID()
+ {
return props.getProperty(BUILD_ID);
}
/**
- * Returns the build number for this version.
+ * Returns the build number for this version.
*
- * @return The build number for this version.
+ * @return The build number for this version.
*/
- public String getBuildNumber() {
+ public String getBuildNumber()
+ {
return props.getProperty(BUILD_NUMBER);
}
-
+
/**
- * Returns the version information as a string.
+ * Returns the version information as a string.
*
- * @return Basic information as a string.
+ * @return Basic information as a string.
*/
- public String toString() {
+ public String toString()
+ {
StringBuffer buff = new StringBuffer();
buff.append(getMajor()).append(".");
@@ -174,6 +167,42 @@
buff.append("(").append(getBuildID()).append(")");
return buff.toString();
+ }
+
+ /**
+ * Returns a property value as an int.
+ *
+ * @param name Description of Parameter
+ * @return The IntProperty value
+ */
+ private int getIntProperty(final String name)
+ {
+ return Integer.valueOf(props.getProperty(name)).intValue();
+ }
+
+ /**
+ * Load the version properties from a resource.
+ *
+ * @return Description of the Returned Value
+ */
+ private Properties loadProperties()
+ {
+ props = new Properties();
+
+ try
+ {
+ InputStream in =
+ Version.class.getResourceAsStream("/org/jboss/version.properties");
+
+ props.load(in);
+ in.close();
+ }
+ catch (IOException e)
+ {
+ throw new Error("missing version.properties");
+ }
+
+ return props;
}
}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development