Revision: 5769
http://squirrel-sql.svn.sourceforge.net/squirrel-sql/?rev=5769&view=rev
Author: manningr
Date: 2010-08-08 13:01:36 +0000 (Sun, 08 Aug 2010)
Log Message:
-----------
A slightly altered version of Version.java which uses the maven property ${squirrelsql.version} for short version. With this, it is now no longer necessary to manually set the version as it is done automatically from maven.
Added Paths:
-----------
trunk/mavenize/Version.java
Added: trunk/mavenize/Version.java
===================================================================
--- trunk/mavenize/Version.java (rev 0)
+++ trunk/mavenize/Version.java 2010-08-08 13:01:36 UTC (rev 5769)
@@ -0,0 +1,149 @@
+package net.sourceforge.squirrel_sql.client;
+/*
+ * Copyright (C) 2001-2006 Colin Bell
+ * co...@us...
+ *
+ * This library 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 library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+import net.sourceforge.squirrel_sql.fw.util.StringManager;
+import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
+/**
+ * Application version information.
+ *
+ * @author <A HREF="mailto:co...@us...">Colin Bell</A>
+ */
+public class Version
+{
+ /** Internationalized strings for this class. */
+ private static final StringManager s_stringMgr =
+ StringManagerFactory.getStringManager(Version.class);
+
+ private static final String APP_NAME = s_stringMgr.getString("Version.appname");
+ private static final int MAJOR_VERSION = 3;
+ private static final int MINOR_VERSION = 2;
+ private static final int RELEASE = 0;
+
+ private static final String COPYRIGHT = s_stringMgr.getString("Version.copyright");
+
+ private static final String WEB_SITE = s_stringMgr.getString("Version.website");
+
+ public static String getApplicationName()
+ {
+ return APP_NAME;
+ }
+
+ /**
+ * @return the filtered in value of the version from maven. This property is created in maven by using the
+ * squirrelsql-version-plugin. If this string appears as ${squirrelsql.version} in the filtered version
+ * of this file (target/classes/net/sourceforge/squirrel_sql/client/Version.java) ensure that the
+ * squirrelsql-version-plugin is being bound to the initialize phase, or any phase prior to
+ * process-resources.
+ */
+ public static String getShortVersion()
+ {
+ return "${squirrelsql.version}";
+ }
+
+ public static String getVersion()
+ {
+ StringBuffer buf = new StringBuffer();
+ buf.append(APP_NAME)
+ .append(" Version ")
+ .append(getShortVersion());
+ return buf.toString();
+ }
+
+ /**
+ * Returns a boolean value indicating whether or not this is a snapshot release or a stable release.
+ *
+ * @return true if this is snapshot release; false otherwise. Note: Since snapshot releases replace this
+ * version with Version.java.template, this version should always return false. This makes it possible to
+ * determine what channel to use for updates when SQuirreL is installed for the very first time and no
+ * preference is set. After that the channel can be changed by the user at will.
+ */
+ public static boolean isSnapshotVersion() {
+ return getShortVersion().toLowerCase().startsWith("snapshot");
+ }
+
+ public static String getCopyrightStatement()
+ {
+ return COPYRIGHT;
+ }
+
+ public static String getWebSite()
+ {
+ return WEB_SITE;
+ }
+
+ public static boolean supportsUsedJDK()
+ {
+ String vmVer = System.getProperty("java.vm.version");
+
+ if( vmVer.startsWith("0")
+ || vmVer.startsWith("1.0")
+ || vmVer.startsWith("1.1")
+ || vmVer.startsWith("1.2")
+ || vmVer.startsWith("1.3")
+ || vmVer.startsWith("1.4")
+ || vmVer.startsWith("1.5"))
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+
+ public static String getUnsupportedJDKMessage()
+ {
+ String[] params = new String[]
+ {
+ System.getProperty("java.vm.version"),
+ System.getProperty("java.home")
+ };
+
+ return s_stringMgr.getString("Application.error.unsupportedJDKVersion", params);
+ }
+
+ public static boolean isJDK14()
+ {
+ String vmVer = System.getProperty("java.vm.version");
+
+ if(vmVer.startsWith("1.4"))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public static boolean isJDK16OrAbove()
+ {
+ String vmVer = System.getProperty("java.vm.version").substring(0, 3);
+
+ if(vmVer.compareTo("1.6") >= 0)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|