Import Upstream version 1.8.5
[hcoop/debian/openafs.git] / src / JAVA / classes / org / openafs / jafs / VersionInfo.java
1 /*
2 * @(#)VersionInfo.java 1.0 05/09/2005
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 /**
27 * Provides version information about the native C library and the JAVA side.
28 *
29 * At least a <<Class.forName("org.openafs.jafs.Token");>> is necessary before using these methods.
30 * Perhaps a redesign would be required because the library initialization occures only in Token.java.
31 */
32 public class VersionInfo
33 {
34 /**
35 * Returns java interface version string
36 * the native library version should be higher
37 */
38 public static String getVersionOfJavaInterface() {return "20050905";}
39
40 /**
41 * Returns the native library version
42 *
43 * @exception AFSException if internal (libjafs, libjafsadmin) versions differ
44 */
45 public static String getVersionOfLibrary() throws AFSException
46 {
47 String ver = getVersionOfLibjafs();
48 if (!ver.equals(getVersionOfLibjafsadm()))
49 throw new AFSException("library versions differ", 0);
50 return ver;
51 }
52
53 /**
54 * Returns build information of the native library.
55 * This information is autogenerated by the openafs make system.
56 * Example: "@(#) OpenAFS 1.3.87 built 2005-09-06 "
57 *
58 * @exception AFSException if internal (libjafs, libjafsadmin) versions differ
59 */
60 public static String getBuildInfo() throws AFSException
61 {
62 String info = getBuildInfoOfLibjafs();
63 if (!info.equals(getBuildInfoOfLibjafsadm()))
64 throw new AFSException("library build info differ", 0);
65 return info;
66 }
67
68 private static native String getVersionOfLibjafs();
69 private static native String getVersionOfLibjafsadm();
70 private static native String getBuildInfoOfLibjafs();
71 private static native String getBuildInfoOfLibjafsadm();
72 }