Source Code Cross Referenced for Release.java in  » Wiki-Engine » JSPWiki » com » ecyrd » jspwiki » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Wiki Engine » JSPWiki » com.ecyrd.jspwiki 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:            JSPWiki - a JSP-based WikiWiki clone.
003:
004:            Copyright (C) 2001-2007 Janne Jalkanen (Janne.Jalkanen@iki.fi)
005:
006:            This program is free software; you can redistribute it and/or modify
007:            it under the terms of the GNU Lesser General Public License as published by
008:            the Free Software Foundation; either version 2.1 of the License, or
009:            (at your option) any later version.
010:
011:            This program is distributed in the hope that it will be useful,
012:            but WITHOUT ANY WARRANTY; without even the implied warranty of
013:            MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014:            GNU Lesser General Public License for more details.
015:
016:            You should have received a copy of the GNU Lesser General Public License
017:            along with this program; if not, write to the Free Software
018:            Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
019:         */
020:
021:        package com.ecyrd.jspwiki;
022:
023:        import org.apache.commons.lang.StringUtils;
024:
025:        /**
026:         *  Contains release and version information.  You may also invoke this
027:         *  class directly, in which case it prints out the version string.  This
028:         *  is a handy way of checking which JSPWiki version you have - just type
029:         *  from a command line:
030:         *  <pre>
031:         *  % java -cp JSPWiki.jar com.ecyrd.jspwiki.Release
032:         *  2.5.38
033:         *  </pre>
034:         *  <p>
035:         *  As a historical curiosity, this is the oldest JSPWiki file.  According
036:         *  to the CVS history, it dates from 6.7.2001, and it really hasn't changed
037:         *  much since.
038:         *  </p>
039:         *  @author Janne Jalkanen
040:         *  @since  1.0
041:         */
042:        public final class Release {
043:            private static final String VERSION_SEPARATORS = ".-";
044:
045:            /**
046:             *  This is the default application name.
047:             */
048:            public static final String APPNAME = "JSPWiki";
049:
050:            /**
051:             *  This should be empty when doing a release - otherwise
052:             *  keep it as "cvs" so that whenever someone checks out the code,
053:             *  they know it is a bleeding-edge version.  Other possible
054:             *  values are "alpha" and "beta" for alpha and beta versions,
055:             *  respectively.
056:             *  <p>
057:             *  If the POSTFIX is empty, it is not added to the version string.
058:             */
059:            private static final String POSTFIX = "";
060:
061:            /** The JSPWiki major version. */
062:            public static final int VERSION = 2;
063:
064:            /** The JSPWiki revision. */
065:            public static final int REVISION = 6;
066:
067:            /** The minor revision.  */
068:            public static final int MINORREVISION = 1;
069:
070:            /** The build number/identifier.  This is a String as opposed to an integer, just
071:             *  so that people can add other identifiers to it.  The build number is incremented
072:             *  every time a committer checks in code, and reset when the a release is made.
073:             *  <p>
074:             *  If you are a person who likes to build his own releases, we recommend that you
075:             *  add your initials to this identifier (e.g. "13-jj", or 49-aj").
076:             *  <p>
077:             *  If the build identifier is empty, it is not added.
078:             */
079:            public static final String BUILD = "";
080:
081:            /**
082:             *  This is the generic version string you should use
083:             *  when printing out the version.  It is of the form "VERSION.REVISION.MINORREVISION[-POSTFIX][-BUILD]".
084:             */
085:            public static final String VERSTR = VERSION + "." + REVISION + "."
086:                    + MINORREVISION
087:                    + ((POSTFIX.length() != 0) ? "-" + POSTFIX : "")
088:                    + ((BUILD.length() != 0 ? "-" + BUILD : ""));
089:
090:            /**
091:             *  Private constructor prevents instantiation.
092:             */
093:            private Release() {
094:            }
095:
096:            /**
097:             *  This method is useful for templates, because hopefully it will
098:             *  not be inlined, and thus any change to version number does not
099:             *  need recompiling the pages.
100:             *
101:             *  @since 2.1.26.
102:             *  @return The version string (e.g. 2.5.23).
103:             */
104:            public static String getVersionString() {
105:                return VERSTR;
106:            }
107:
108:            /**
109:             *  Returns true, if this version of JSPWiki is newer or equal than what is requested.
110:             *  @param version A version parameter string (a.b.c-something). B and C are optional.
111:             *  @return A boolean value describing whether the given version is newer than the current JSPWiki.
112:             *  @since 2.4.57
113:             *  @throws IllegalArgumentException If the version string could not be parsed.
114:             */
115:            public static boolean isNewerOrEqual(String version)
116:                    throws IllegalArgumentException {
117:                if (version == null)
118:                    return true;
119:                String[] versionComponents = StringUtils.split(version,
120:                        VERSION_SEPARATORS);
121:                int reqVersion = versionComponents.length > 0 ? Integer
122:                        .parseInt(versionComponents[0]) : Release.VERSION;
123:                int reqRevision = versionComponents.length > 1 ? Integer
124:                        .parseInt(versionComponents[1]) : Release.REVISION;
125:                int reqMinorRevision = versionComponents.length > 2 ? Integer
126:                        .parseInt(versionComponents[2]) : Release.MINORREVISION;
127:
128:                if (VERSION == reqVersion) {
129:                    if (REVISION == reqRevision) {
130:                        if (MINORREVISION == reqMinorRevision) {
131:                            return true;
132:                        }
133:
134:                        return MINORREVISION > reqMinorRevision;
135:                    }
136:
137:                    return REVISION > reqRevision;
138:                }
139:
140:                return VERSION > reqVersion;
141:            }
142:
143:            /**
144:             *  Returns true, if this version of JSPWiki is older or equal than what is requested.
145:             *  @param version A version parameter string (a.b.c-something)
146:             *  @return A boolean value describing whether the given version is older than the current JSPWiki version
147:             *  @since 2.4.57
148:             *  @throws IllegalArgumentException If the version string could not be parsed.
149:             */
150:            public static boolean isOlderOrEqual(String version)
151:                    throws IllegalArgumentException {
152:                if (version == null)
153:                    return true;
154:
155:                String[] versionComponents = StringUtils.split(version,
156:                        VERSION_SEPARATORS);
157:                int reqVersion = versionComponents.length > 0 ? Integer
158:                        .parseInt(versionComponents[0]) : Release.VERSION;
159:                int reqRevision = versionComponents.length > 1 ? Integer
160:                        .parseInt(versionComponents[1]) : Release.REVISION;
161:                int reqMinorRevision = versionComponents.length > 2 ? Integer
162:                        .parseInt(versionComponents[2]) : Release.MINORREVISION;
163:
164:                if (VERSION == reqVersion) {
165:                    if (REVISION == reqRevision) {
166:                        if (MINORREVISION == reqMinorRevision) {
167:                            return true;
168:                        }
169:
170:                        return MINORREVISION < reqMinorRevision;
171:                    }
172:
173:                    return REVISION < reqRevision;
174:                }
175:
176:                return VERSION < reqVersion;
177:            }
178:
179:            /**
180:             *  Executing this class directly from command line prints out
181:             *  the current version.  It is very useful for things like
182:             *  different command line tools.
183:             *  <P>Example:
184:             *  <PRE>
185:             *  % java com.ecyrd.jspwiki.Release
186:             *  1.9.26-cvs
187:             *  </PRE>
188:             *
189:             *  @param argv The argument string.  This class takes in no arguments.
190:             */
191:            public static void main(String[] argv) {
192:                System.out.println(VERSTR);
193:            }
194:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.