[jboss-cvs] JBoss Messaging SVN: r4072 - in trunk/src/main/org/jboss/messaging: core/server/impl and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Apr 17 05:02:51 EDT 2008
Author: ataylor
Date: 2008-04-17 05:02:50 -0400 (Thu, 17 Apr 2008)
New Revision: 4072
Added:
trunk/src/main/org/jboss/messaging/util/VersionLoader.java
Modified:
trunk/src/main/org/jboss/messaging/core/client/impl/ClientConnectionFactoryImpl.java
trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java
trunk/src/main/org/jboss/messaging/core/version/impl/VersionImpl.java
Log:
added version loader
Modified: trunk/src/main/org/jboss/messaging/core/client/impl/ClientConnectionFactoryImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ClientConnectionFactoryImpl.java 2008-04-17 08:45:39 UTC (rev 4071)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/ClientConnectionFactoryImpl.java 2008-04-17 09:02:50 UTC (rev 4072)
@@ -34,6 +34,7 @@
import org.jboss.messaging.core.remoting.impl.wireformat.CreateConnectionResponse;
import org.jboss.messaging.core.version.Version;
import org.jboss.messaging.core.version.impl.VersionImpl;
+import org.jboss.messaging.util.VersionLoader;
/**
@@ -115,7 +116,7 @@
public ClientConnection createConnection(final String username, final String password) throws MessagingException
{
- Version clientVersion = VersionImpl.load();
+ Version clientVersion = VersionLoader.load();
RemotingConnection remotingConnection = null;
try
Modified: trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java 2008-04-17 08:45:39 UTC (rev 4071)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java 2008-04-17 09:02:50 UTC (rev 4072)
@@ -62,6 +62,7 @@
import org.jboss.messaging.core.version.Version;
import org.jboss.messaging.core.version.impl.VersionImpl;
import org.jboss.messaging.core.exception.MessagingException;
+import org.jboss.messaging.util.VersionLoader;
/**
* A Messaging Server
@@ -123,7 +124,7 @@
{
//We need to hard code the version information into a source file
- version = VersionImpl.load();
+ version = VersionLoader.load();
started = false;
}
Modified: trunk/src/main/org/jboss/messaging/core/version/impl/VersionImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/version/impl/VersionImpl.java 2008-04-17 08:45:39 UTC (rev 4071)
+++ trunk/src/main/org/jboss/messaging/core/version/impl/VersionImpl.java 2008-04-17 09:02:50 UTC (rev 4072)
@@ -60,33 +60,6 @@
this.versionSuffix = versionSuffix;
}
- public static Version load()
- {
- Properties versionProps = new Properties();
- InputStream in = VersionImpl.class.getClassLoader().getResourceAsStream("version.properties");
- if (in == null)
- {
- throw new RuntimeException("version.properties is not available");
- }
- try
- {
- versionProps.load(in);
- String versionName = versionProps.getProperty("messaging.version.versionName");
- int majorVersion = Integer.valueOf(versionProps.getProperty("messaging.version.majorVersion"));
- int minorVersion = Integer.valueOf(versionProps.getProperty("messaging.version.minorVersion"));
- int microVersion = Integer.valueOf(versionProps.getProperty("messaging.version.microVersion"));
- int incrementingVersion = Integer.valueOf(versionProps.getProperty("messaging.version.incrementingVersion"));
- String versionSuffix = versionProps.getProperty("messaging.version.versionSuffix");
- return new VersionImpl(versionName, majorVersion, minorVersion, microVersion, incrementingVersion, versionSuffix);
- }
- catch (IOException e)
- {
- //if we get here then the messaging hasnt been built properly and the version.properties is skewed in some way
- throw new RuntimeException("unable to load version.properties", e);
- }
-
- }
-
// Version implementation ------------------------------------------
public String getFullVersion()
Added: trunk/src/main/org/jboss/messaging/util/VersionLoader.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/VersionLoader.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/util/VersionLoader.java 2008-04-17 09:02:50 UTC (rev 4072)
@@ -0,0 +1,64 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.jboss.messaging.util;
+
+import org.jboss.messaging.core.version.Version;
+import org.jboss.messaging.core.version.impl.VersionImpl;
+
+import java.util.Properties;
+import java.io.InputStream;
+import java.io.IOException;
+
+/**
+ * This loads the version info in from a version.properties file.
+ *
+ * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ */
+public class VersionLoader
+{
+ public static Version load()
+ {
+ Properties versionProps = new Properties();
+ InputStream in = VersionImpl.class.getClassLoader().getResourceAsStream("version.properties");
+ if (in == null)
+ {
+ throw new RuntimeException("version.properties is not available");
+ }
+ try
+ {
+ versionProps.load(in);
+ String versionName = versionProps.getProperty("messaging.version.versionName");
+ int majorVersion = Integer.valueOf(versionProps.getProperty("messaging.version.majorVersion"));
+ int minorVersion = Integer.valueOf(versionProps.getProperty("messaging.version.minorVersion"));
+ int microVersion = Integer.valueOf(versionProps.getProperty("messaging.version.microVersion"));
+ int incrementingVersion = Integer.valueOf(versionProps.getProperty("messaging.version.incrementingVersion"));
+ String versionSuffix = versionProps.getProperty("messaging.version.versionSuffix");
+ return new VersionImpl(versionName, majorVersion, minorVersion, microVersion, incrementingVersion, versionSuffix);
+ }
+ catch (IOException e)
+ {
+ //if we get here then the messaging hasnt been built properly and the version.properties is skewed in some way
+ throw new RuntimeException("unable to load version.properties", e);
+ }
+
+ }
+}
More information about the jboss-cvs-commits
mailing list