KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > continuent > sequoia > common > jmx > management > BackendState


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.jmx.management;
25
26 import org.continuent.sequoia.common.i18n.Translate;
27
28 /**
29  * This describes the different backend states
30  *
31  * @author <a HREF="mailto:Nicolas.Modrzyk@inrialpes.fr">Nicolas Modrzyk </a>
32  * @author <a HREF="mailto:emmanuel.cecchet@emicnetworks.com">Emmanuel Cecchet
33  * </a>
34  * @version 1.0
35  */

36 public final class BackendState
37 {
38   /**
39    * The backend can execute read requests, but not write requests
40    */

41   public static final int READ_ENABLED_WRITE_DISABLED = 0;
42
43   /**
44    * The backend can execute read and write requests
45    */

46   public static final int READ_ENABLED_WRITE_ENABLED = 1;
47
48   /**
49    * The backend can execute write requests but not read requests
50    */

51   public static final int READ_DISABLED_WRITE_ENABLED = 2;
52
53   /**
54    * The backend cannot execute any requests
55    */

56   public static final int DISABLED = 3;
57
58   /**
59    * The backend is loading data from a dump file
60    */

61   public static final int RESTORING = 4;
62
63   /**
64    * The backend is set for disabled. It is finishing to execute open
65    * transactions and waits for persistent connections to close
66    */

67   public static final int DISABLING = 5;
68
69   /**
70    * The backend is in a restore process. The content of a backup file is being
71    * copied onto the backen
72    */

73   public static final int BACKUPING = 6;
74
75   /**
76    * Unknown backend state. This is used when the state of the backend cannot be
77    * determined properly. This is the state the backend is set to after a
78    * backup, restore or recovery failure.
79    */

80   public static final int UNKNOWN = -1;
81
82   /**
83    * Replaying request from the recovery log
84    */

85   public static final int REPLAYING = 7;
86
87   /**
88    * Return a description which can be displayed to the user corresponding to
89    * one of the backend states.
90    *
91    * @param state a int representing a backend state
92    * @return a String representing the state of the backend which can be
93    * displayed to the user
94    */

95   public static String JavaDoc description(int state)
96   {
97     switch (state)
98     {
99       case READ_ENABLED_WRITE_DISABLED :
100         return Translate.get("BackendState.readEnabledWriteDisabled"); //$NON-NLS-1$
101
case READ_ENABLED_WRITE_ENABLED :
102         return Translate.get("BackendState.readEnabledWriteEnabled"); //$NON-NLS-1$
103
case READ_DISABLED_WRITE_ENABLED :
104         return Translate.get("BackendState.readDisabledWriteEnabled"); //$NON-NLS-1$
105
case DISABLED :
106         return Translate.get("BackendState.disabled"); //$NON-NLS-1$
107
case RESTORING :
108         return Translate.get("BackendState.restoring"); //$NON-NLS-1$
109
case DISABLING :
110         return Translate.get("BackendState.disabling"); //$NON-NLS-1$
111
case BACKUPING :
112         return Translate.get("BackendState.backingUp"); //$NON-NLS-1$
113
case REPLAYING :
114         return Translate.get("BackendState.replaying"); //$NON-NLS-1$
115
case UNKNOWN :
116       default :
117         return Translate.get("BackendState.unknown"); //$NON-NLS-1$
118
}
119   }
120 }
Popular Tags