Source Code Cross Referenced for VersionUtil.java in  » Ajax » dwr » org » directwebremoting » util » 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 » Ajax » dwr » org.directwebremoting.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2005 Joe Walker
003:         *
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         *
008:         *     http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:        package org.directwebremoting.util;
017:
018:        import java.io.IOException;
019:        import java.io.InputStream;
020:        import java.util.Properties;
021:
022:        /**
023:         * Interface to the system version info file.
024:         * DWR version numbers are of the form "Version 1.2.3.3128[.beta]", where:
025:         * <ul>
026:         * <li>1 is the major release number. Changes in major version number indicate
027:         * significant enhancements in functionality</li>
028:         * <li>2 is the minor release number. Changes in minor version number indicate
029:         * less significant changes in functionality</li>
030:         * <li>3 is the revision release number. Changes here typically indicate bug
031:         * fixes only</li>
032:         * <li>3128 is the build number. This number increments for each build</li>
033:         * <li>.beta is a release title that is generally only used for non production
034:         * releases to indicate the purpose/quality of the release</li>
035:         * <li>The label is these strings concatenated</li>
036:         * </ul>
037:         * @author Joe Walker [joe at getahead dot ltd dot uk]
038:         */
039:        public class VersionUtil {
040:            /**
041:             * Fish the version number out of the dwr.properties file.
042:             * @return The current version number.
043:             */
044:            public static String getSourceControlInfo() {
045:                loadProperties();
046:                return sccInfo;
047:            }
048:
049:            /**
050:             * Fish the version number out of the dwr.properties file.
051:             * @return The current version number.
052:             * @deprecated Use {@link #getLabel()}
053:             */
054:            @Deprecated
055:            public static String getVersion() {
056:                return getLabel();
057:            }
058:
059:            /**
060:             * @return The major version number of this release
061:             */
062:            public static int getMajor() {
063:                return major;
064:            }
065:
066:            /**
067:             * @return The minor version number of this release
068:             */
069:            public static int getMinor() {
070:                return minor;
071:            }
072:
073:            /**
074:             * @return The revision version number of this release
075:             */
076:            public static int getRevision() {
077:                return revision;
078:            }
079:
080:            /**
081:             * @return The build number of this release
082:             */
083:            public static int getBuild() {
084:                return build;
085:            }
086:
087:            /**
088:             * @return The optional title of this release
089:             */
090:            public static String getTitle() {
091:                loadProperties();
092:                return title;
093:            }
094:
095:            /**
096:             * @return The full version string
097:             */
098:            public static String getLabel() {
099:                loadProperties();
100:                return label;
101:            }
102:
103:            /**
104:             * Load the properties from the internal properties file.
105:             */
106:            private static synchronized void loadProperties() {
107:                if (loaded) {
108:                    return;
109:                }
110:
111:                try {
112:                    InputStream in = VersionUtil.class
113:                            .getResourceAsStream(FILENAME_VERSION);
114:                    Properties props = new Properties();
115:                    props.load(in);
116:
117:                    sccInfo = props.getProperty(KEY_SCC_INFO);
118:                    major = Integer.parseInt(props.getProperty(KEY_MAJOR));
119:                    minor = Integer.parseInt(props.getProperty(KEY_MINOR));
120:                    revision = Integer
121:                            .parseInt(props.getProperty(KEY_REVISION));
122:                    build = Integer.parseInt(props.getProperty(KEY_BUILD));
123:                    title = props.getProperty(KEY_TITLE);
124:
125:                    if (title.length() == 0) {
126:                        label = major + "." + minor + "." + revision;
127:                    } else {
128:                        label = major + "." + minor + "." + revision + "."
129:                                + build + "." + title;
130:                    }
131:
132:                    loaded = true;
133:                } catch (IOException ex) {
134:                    throw new RuntimeException(ex);
135:                }
136:            }
137:
138:            private static boolean loaded = false;
139:
140:            private static final String FILENAME_VERSION = "/dwr-version.properties";
141:
142:            private static final String KEY_MAJOR = "major";
143:            private static int major;
144:
145:            private static final String KEY_MINOR = "minor";
146:            private static int minor;
147:
148:            private static final String KEY_REVISION = "revision";
149:            private static int revision;
150:
151:            private static final String KEY_BUILD = "build";
152:            private static int build;
153:
154:            private static final String KEY_TITLE = "title";
155:            private static String title;
156:
157:            private static String label;
158:
159:            private static final String KEY_SCC_INFO = "scc-info";
160:            private static String sccInfo;
161:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.