KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > continuent > sequoia > common > util > Constants


1 /**
2  * Sequoia: Database clustering technology.
3  * Copyright (C) 2002-2004 French National Institute For Research In Computer
4  * Science And Control (INRIA).
5  * Copyright (C) 2005 AmicoSoft, Inc. dba Emic Networks
6  * Contact: sequoia@continuent.org
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  * Initial developer(s): Nicolas Modrzyk.
21  * Contributor(s): Emmanuel Cecchet.
22  */

23
24 package org.continuent.sequoia.common.util;
25
26 import java.io.IOException JavaDoc;
27 import java.util.Properties JavaDoc;
28
29 /**
30  * Constants that are common to the console, driver and controller modules
31  *
32  * @author <a HREF="mailto:Nicolas.Modrzyk@inrialpes.fr">Nicolas Modrzyk </a>
33  * @author <a HREF="mailto:Emmanuel.Cecchet@inria.fr">Emmanuel Cecchet </a>
34  */

35 public class Constants
36 {
37   static Properties JavaDoc getVersionProperties()
38   {
39     Properties JavaDoc versionProperties = new Properties JavaDoc();
40     try
41     {
42       versionProperties.load(Constants.class
43           .getResourceAsStream("version.properties"));
44     }
45     catch (IOException JavaDoc e)
46     { // error reading ressource
47
}
48     catch (NullPointerException JavaDoc e)
49     { // resource not found (getResourceAsStream() returns null)
50
}
51     return versionProperties;
52   }
53
54   // the following default value "@VERSION@" is patched by build.xml
55
// target 'init-compile'.
56

57   /** Sequoia version. */
58   public static final String JavaDoc VERSION = getVersionProperties().getProperty(
59                                          "sequoia.version", "@VERSION@");
60
61   /**
62    * Sequoia major version
63    *
64    * @return major version
65    */

66   public static final int getMajorVersion()
67   {
68     int ind = VERSION.indexOf('.');
69     if (ind > 0)
70       return Integer.parseInt(VERSION.substring(0, ind));
71     else
72       return 1;
73   }
74
75   /**
76    * Sequoia minor version
77    *
78    * @return minor version
79    */

80   public static final int getMinorVersion()
81   {
82     int ind = VERSION.indexOf('.');
83     if (ind > 0)
84       return Integer.parseInt(VERSION.substring(ind + 1, ind + 2));
85     else
86       return 0;
87   }
88
89   //
90
// Shutdown constants
91
//
92

93   /** Shutdown Mode Wait: Wait for all clients to disconnect */
94   public static final int SHUTDOWN_WAIT = 1;
95
96   /**
97    * Shutdown Mode Safe: Wait for all current transactions to complete before
98    * shutdown
99    */

100   public static final int SHUTDOWN_SAFE = 2;
101
102   /**
103    * Shutdown Mode Force: Does not wait for the end of the current transactions
104    * and kill all connections. Recovery will be needed on restart.
105    */

106   public static final int SHUTDOWN_FORCE = 3;
107
108 }
Popular Tags