KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > tanukisoftware > wrapper > WrapperInfo


1 package org.tanukisoftware.wrapper;
2
3 /*
4  * Copyright (c) 1999, 2006 Tanuki Software Inc.
5  *
6  * Permission is hereby granted, free of charge, to any person
7  * obtaining a copy of the Java Service Wrapper and associated
8  * documentation files (the "Software"), to deal in the Software
9  * without restriction, including without limitation the rights
10  * to use, copy, modify, merge, publish, distribute, sub-license,
11  * and/or sell copies of the Software, and to permit persons to
12  * whom the Software is furnished to do so, subject to the
13  * following conditions:
14  *
15  * The above copyright notice and this permission notice shall be
16  * included in all copies or substantial portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21  * NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22  * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25  * OTHER DEALINGS IN THE SOFTWARE.
26  *
27  *
28  * Portions of the Software have been derived from source code
29  * developed by Silver Egg Technology under the following license:
30  *
31  * Copyright (c) 2001 Silver Egg Technology
32  *
33  * Permission is hereby granted, free of charge, to any person
34  * obtaining a copy of this software and associated documentation
35  * files (the "Software"), to deal in the Software without
36  * restriction, including without limitation the rights to use,
37  * copy, modify, merge, publish, distribute, sub-license, and/or
38  * sell copies of the Software, and to permit persons to whom the
39  * Software is furnished to do so, subject to the following
40  * conditions:
41  *
42  * The above copyright notice and this permission notice shall be
43  * included in all copies or substantial portions of the Software.
44  */

45
46 import java.util.Calendar JavaDoc;
47 import java.text.DateFormat JavaDoc;
48 import java.text.SimpleDateFormat JavaDoc;
49 import java.text.ParseException JavaDoc;
50
51 /**
52  * WrapperInfo.java is build as part of the build process and should not be
53  * modified. Any changes to this class should be made to WrapperInfo.java.in
54  *
55  * @author Leif Mortenson <leif@tanukisoftware.com>
56  */

57 final class WrapperInfo
58 {
59     /** Version of the Wrapper. */
60     private static final String JavaDoc m_version = "3.2.3";
61
62     /** Date that the Wrapper was built. */
63     private static final Calendar JavaDoc m_build = Calendar.getInstance();
64     
65     /** Static initializer to create the build calendar from info hardcoded
66      * during the build. */

67     static
68     {
69         Calendar JavaDoc buildDate = Calendar.getInstance();
70         Calendar JavaDoc buildTime = Calendar.getInstance();
71         try
72         {
73             buildDate.setTime( new SimpleDateFormat JavaDoc( "yyyyMMdd" ).parse( "20061017" ) );
74             buildTime.setTime( new SimpleDateFormat JavaDoc( "HHmm" ).parse( "2319" ) );
75             
76             m_build.set( buildDate.get( Calendar.YEAR ),
77                         buildDate.get( Calendar.MONTH ),
78                         buildDate.get( Calendar.DATE ),
79                         buildTime.get( Calendar.HOUR_OF_DAY ),
80                         buildTime.get( Calendar.MINUTE ) );
81
82         }
83         catch ( ParseException JavaDoc e )
84         {
85             System.out.println( "Can not parse build date: " + e.getMessage() );
86         }
87     }
88
89     /**
90      * Returns the version of the Wrapper.
91      *
92      * @return the version of the Wrapper.
93      */

94     static String JavaDoc getVersion()
95     {
96         return m_version;
97     }
98     
99     /**
100      * Returns the time that the Wrapper was built.
101      *
102      * @return The time that the Wrapper was built.
103      */

104     static String JavaDoc getBuildTime()
105     {
106         DateFormat JavaDoc df = new SimpleDateFormat JavaDoc( "HH:mm zz MMM d, yyyy" );
107         return df.format( m_build.getTime() );
108     }
109     
110     /*---------------------------------------------------------------
111      * Constructors
112      *-------------------------------------------------------------*/

113     /**
114      * Can not be instantiated.
115      */

116     private WrapperInfo()
117     {
118     }
119 }
120
121
Popular Tags