Source Code Cross Referenced for Version.java in  » Portal » uPortal_rel-2-6-1-GA » org » jasig » portal » 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 » Portal » uPortal_rel 2 6 1 GA » org.jasig.portal 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* Copyright 2004 2006 The JA-SIG Collaborative.  All rights reserved.
002:         *  See license distributed with this file and
003:         *  available online at http://www.uportal.org/license.html
004:         */
005:
006:        package org.jasig.portal;
007:
008:        import org.apache.commons.logging.Log;
009:        import org.apache.commons.logging.LogFactory;
010:        import org.jasig.portal.security.IPermission;
011:        import org.jasig.portal.tools.versioning.VersionsManager;
012:
013:        /**
014:         * Contains version information about the current release.
015:         * This implementation uses static fields and static initializers to pre-compute
016:         * once the return values for all String-returning methods so as to avoid
017:         * String concatenation induced object churn at runtime.  This adds a moderate
018:         * amount of code complexity in exchange for non-impactful memory utilization
019:         * behaviors in the case where this class is invoked in a tight loop, as when
020:         * it is called on every portal render informing the theme transform.
021:         *
022:         * This class is deprecated so these heroics are likely misapplied.  Use
023:         * VersionManager instead.
024:         *
025:         * @author Ken Weiner, kweiner@unicon.net
026:         * @author Bernie Durfee, bernard.durfee@suny.edu
027:         * @version $Revision: 36790 $
028:         * @deprecated use VersionManager with fname UP_FRAMEWORK instead.
029:         */
030:        public class Version {
031:
032:            private static final Log LOG = LogFactory
033:                    .getLog(org.jasig.portal.Version.class);
034:
035:            private static String product = "uPortal";
036:
037:            private static org.jasig.portal.tools.versioning.Version uPVersion = null;
038:
039:            private static String majorVersion = "unknown";
040:
041:            private static String minorVersion = "unknown";
042:
043:            private static String microVersion = "unknown";
044:
045:            private static String releaseTag = "unknown";
046:
047:            private static String dottedTriple = "unknown";
048:
049:            private static String productAndVersion = "unknown";
050:
051:            static {
052:                // try blocks in static initializer to ensure that this class will statically
053:                // initialize and report unknown versions rather than failing to initialize at all.
054:
055:                try {
056:                    uPVersion = VersionsManager.getInstance().getVersion(
057:                            IPermission.PORTAL_FRAMEWORK);
058:
059:                    try {
060:                        majorVersion = Integer.toString(uPVersion.getMajor());
061:                    } catch (Exception e) {
062:                        LOG.error("Error computing major version of uPortal.",
063:                                e);
064:                    }
065:
066:                    try {
067:                        minorVersion = Integer.toString(uPVersion.getMinor());
068:                    } catch (Exception e) {
069:                        LOG.error("Error computing minor version of uPortal.",
070:                                e);
071:                    }
072:
073:                    try {
074:                        microVersion = Integer.toString(uPVersion.getMicro());
075:                    } catch (Exception e) {
076:                        LOG.error("Error computing micro version of uPortal.",
077:                                e);
078:                    }
079:
080:                    releaseTag = "rel-" + majorVersion + "-" + minorVersion
081:                            + "-" + microVersion;
082:
083:                    try {
084:                        dottedTriple = uPVersion.dottedTriple();
085:                    } catch (Exception e) {
086:                        LOG
087:                                .error(
088:                                        "Error computing dotted triple representation of uPortal version.",
089:                                        e);
090:                    }
091:
092:                    productAndVersion = product + " " + dottedTriple;
093:
094:                } catch (Exception e) {
095:                    // if getting the version from VersionsManager fails,
096:                    // populating the dependent String static fields of this class will
097:                    // also fail, so this static initializer doesn't bother trying in that case
098:                    LOG.error("Error getting version of "
099:                            + IPermission.PORTAL_FRAMEWORK
100:                            + " from VersionsManager.", e);
101:                }
102:
103:            }
104:
105:            /**
106:             * Returns the product name.
107:             * For example, this would return <code>uPortal</code> for uPortal 2.3.4.
108:             * If the product name is unknown this method returns the String "unknown".
109:             * @return the product name
110:             */
111:            public static String getProduct() {
112:                return product;
113:            }
114:
115:            /**
116:             * Returns the major version.
117:             * For example, this would return <code>2</code> for uPortal 2.3.4.
118:             * If the product major version is unknown this method returns the String "unknown".
119:             * @return the major version
120:             */
121:            public static String getMajor() {
122:                return majorVersion;
123:            }
124:
125:            /**
126:             * Returns the minor version.
127:             * For example, this would return <code>3</code> for uPortal 2.3.4.
128:             * If the product minor version is unknown this method returns the String "unknown".
129:             * @return the minor version
130:             */
131:            public static String getMinor() {
132:                return minorVersion;
133:            }
134:
135:            /**
136:             * Returns the patch version.
137:             * For example, this would return <code>4</code> for uPortal 2.3.4.
138:             * This method may return an empty String.
139:             * If the product patch version is unknown this method returns the String "unknown".
140:             * @return the patch version
141:             */
142:            public static String getPatch() {
143:                return microVersion;
144:            }
145:
146:            /**
147:             * Previously, returned the security version.
148:             * For example, this would return <code>1</code> for uPortal 2.3.4.1.
149:             * Now, this method always returns the String "unknown".  Security
150:             * version number is not supported by VersionsManager, upon which
151:             * uPortal has standardized since the inception of this class.  This class
152:             * is deprecated and will be removed in a future uPortal release.
153:             * @return "unknown"
154:             */
155:            public static String getSecurity() {
156:                return "unknown";
157:            }
158:
159:            /**
160:             * Previously, returned any extra string used to construct this version.
161:             * For example, this would return <code>+</code> for uPortal 2.3.4+.
162:             * A plus sign is used to denote that the code is between releases,
163:             * the head of a branch in CVS.
164:             * Now, this method always returns the String "unkown".   Extra information
165:             * beyond dotted triple version number is not supported by
166:             * VersionsManager, upon which
167:             * uPortal has standardized since the inception of this class.  This class
168:             * is deprecated and will be removed in a future uPortal release.
169:             * @return "unknown"
170:             */
171:            public static String getExtra() {
172:                return "unknown";
173:            }
174:
175:            /**
176:             * Returns the release tag in the CVS repository
177:             * corresponding to the current code.
178:             * For example, <code>rel-2-3-4</code>.
179:             * If the product release tag is unknown this method returns the String "unknown".
180:             * @return the release tag matching the running code
181:             */
182:            public static String getReleaseTag() {
183:                return releaseTag;
184:            }
185:
186:            /**
187:             * Returns the version of the current code.
188:             * For example, <code>2.3.4</code>.
189:             * If the product version is unknown this method returns the String "unknown".
190:             * @return the current version of the running code
191:             */
192:            public static String getVersion() {
193:                return dottedTriple;
194:            }
195:
196:            /**
197:             * Returns a display-friendly string representing the
198:             * current product and version.
199:             * For example, <code>uPortal 2.3.4</code>.
200:             * If the version is unknown this method returns the String "unknown".
201:             * @return a verison string suitable for display
202:             */
203:            public static String getProductAndVersion() {
204:                return productAndVersion;
205:            }
206:
207:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.