Revert ""
[openafs-wiki.git] / JavaAdminAPI / VersionInfo.java
1 /*
2  * @(#)VersionInfo.java 1.0 6/29/2001
3  *
4  * Copyright (c) 2001 International Business Machines Corp.
5  * All rights reserved.
6  *
7  * This software has been released under the terms of the IBM Public
8  * License.  For details, see the LICENSE file in the top-level source
9  * directory or online at http://www.openafs.org/dl/license10.html
10  * 
11  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
12  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
13  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
14  * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR
15  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
16  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
17  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
18  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
19  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
20  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
21  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22  */
23
24 package org.openafs.jafs;
25
26 import java.util.Date;
27
28 /**
29  * Class providing static methods for retrieving version information specific to
30  * the JNI library.
31  * <BR><BR>
32  *
33  * <!--Example of how to use class-->
34  * The following is a simple example of how to use the
35  * <code>VersionInfo</code> class.
36  * <PRE>
37  * import org.openafs.jafs.VersionInfo;
38  * ...
39  * public class ...
40  * {
41  *   ...
42  *   public static void main(String[] args) throws Exception
43  *   {
44  *     System.out.println("Attributes of the jafs native library:");
45  *     System.out.println("\tDescription:\t" + VersionInfo.getDescription());
46  *     System.out.println("\tCompile Date:\t" + VersionInfo.getCompileDate());
47  *     System.out.println("\tVersion Number:\t" + VersionInfo.getBuildNumber());
48  *   }
49  *   ...
50  * }
51  * </PRE>
52  *
53  */
54 public final class VersionInfo
55 {
56   /*-------------------------------------------------------------------------*/
57
58   // No constructors, this is strictly a static class
59
60   /*-------------------------------------------------------------------------*/
61
62
63   ///////////////// accessors ///////////////////////
64
65   /**
66    * Returns the date, in the form of a {@link java.util.Date} object,
67    * representing the compile-time of the native library.
68    *
69    * @see java.util.Date
70    * @exception Exception   If an error occurs in the native code
71    */
72   public static final Date getBuildDate() throws Exception
73   {
74     return new Date(getBuildTime());
75   }
76
77   /**
78    * Returns the version, in the form of "<version number>.<build number>",
79    * representing the full version and build revision of the native library.
80    *
81    * @see #getVersion()
82    * @see #getBuildNumber()
83    * @exception Exception   If an error occurs in the native code
84    */
85   public static final String getFullVersion() throws Exception
86   {
87     return getVersion() + "." + getBuildNumber();
88   }
89
90   /////////////// native methods ////////////////////
91
92   /**
93    * Returns the date, in the form of a long value of milliseconds since 
94    * "epoch", representing the compile-time of the native library.
95    *
96    * @see #getBuildTime
97    * @exception Exception   If an error occurs in the native code
98    */
99   protected static final native long getBuildTime() throws Exception;
100
101   /**
102    * Returns the compile-time description of the native library.
103    *
104    * @exception Exception  If an error occurs in the native code
105    */
106   public static final native String getDescription() throws Exception;
107
108   /**
109    * Returns the build number of the native library.
110    *
111    * @exception Exception  If an error occurs in the native code
112    */
113   public static final native int getBuildNumber() throws Exception;
114
115   /**
116    * Returns the version number of the native library.
117    *
118    * @exception Exception  If an error occurs in the native code
119    */
120   public static final native String getVersion() throws Exception;
121
122   /**
123    * Returns the description of the platform that built the native library.
124    *
125    * @exception Exception  If an error occurs in the native code
126    */
127   public static final native String getBuildPlatform() throws Exception;
128 }