KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > continuent > sequoia > common > jmx > mbeans > DatabaseBackendMBean


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

22
23 package org.continuent.sequoia.common.jmx.mbeans;
24
25 import java.util.List JavaDoc;
26
27 /**
28  * MBeanInterface to the DatabaseBackend
29  *
30  * @author <a HREF="mailto:Nicolas.Modrzyk@inrialpes.fr">Nicolas Modrzyk </a>
31  * @version 1.0
32  */

33 public interface DatabaseBackendMBean
34 {
35   /**
36    * Tests if this backend is enabled (active and synchronized).
37    *
38    * @return <code>true</code> if this backend is enabled
39    * @throws Exception if an error occurs
40    */

41   boolean isInitialized() throws Exception JavaDoc;
42
43   /**
44    * Tests if this backend is read enabled (active and synchronized).
45    *
46    * @return <code>true</code> if this backend is enabled.
47    */

48   boolean isReadEnabled();
49
50   /**
51    * Tests if this backend is write enabled (active and synchronized).
52    *
53    * @return <code>true</code> if this backend is enabled.
54    */

55   boolean isWriteEnabled();
56
57   /**
58    * Is the backend completely disabled ? This usually means it has a known
59    * state with a checkpoint associated to it.
60    *
61    * @return <code>true</code> if the backend is disabled
62    */

63   boolean isDisabled();
64
65   /**
66    * Enables the database backend for reads. This method should only be called
67    * when the backend is synchronized with the others.
68    */

69   void enableRead();
70
71   /**
72    * Enables the database backend for writes. This method should only be called
73    * when the backend is synchronized with the others.
74    */

75   void enableWrite();
76
77   /**
78    * Disables the database backend for reads. This does not affect write ability
79    */

80   void disableRead();
81
82   /**
83    * Disables the database backend for writes. This does not affect read ability
84    * although the backend will not be coherent anymore as soon as a write as
85    * occured. This should be used in conjunction with a checkpoint to recover
86    * missing writes.
87    */

88   void disableWrite();
89
90   /**
91    * Sets the database backend state to disable. This state is just an
92    * indication and it has no semantic effect. It is up to the request manager
93    * (especially the load balancer) to ensure that no more requests are sent to
94    * this backend.
95    */

96   void disable();
97
98   /**
99    * Returns the SQL statement to use to check the connection validity.
100    *
101    * @return a <code>String</code> containing a SQL statement
102    */

103   String JavaDoc getConnectionTestStatement();
104
105   /**
106    * Returns the database native JDBC driver class name.
107    *
108    * @return the driver class name
109    */

110   String JavaDoc getDriverClassName();
111
112   /**
113    * Returns the backend logical name.
114    *
115    * @return the backend logical name
116    */

117   String JavaDoc getName();
118
119   /**
120    * Returns a description of the state of the backend
121    *
122    * @see org.continuent.sequoia.common.jmx.notifications.SequoiaNotificationList
123    * @return a string description of the state. Can be enabled, disabled,
124    * recovering, backuping ...
125    */

126   String JavaDoc getState();
127
128   /**
129    * Return the integer value corresponding to the state of the backend. The
130    * values are defined in <code>BackendState</code>
131    *
132    * @return <tt>int</tt> value
133    * @see org.continuent.sequoia.common.jmx.management.BackendState
134    */

135   int getStateValue();
136
137   /**
138    * Returns the list of pending requests for this backend.
139    *
140    * @param count number of requests to retrieve, if 0, return all.
141    * @param fromFirst count the request from first if true, or from last if
142    * false
143    * @param clone should clone the pending request if true, block it if false
144    * @return <code>List</code> of <code>String</code> description of each
145    * request.
146    */

147   List JavaDoc getPendingRequestsDescription(int count, boolean fromFirst, boolean clone);
148
149   /**
150    * Returns the list of active transactions for this backend.
151    *
152    * @return <code>List</code> of <code>Long</code>, corresponding to
153    * active transaction identifier.
154    */

155   List JavaDoc getActiveTransactions();
156
157   /**
158    * Gets the names of the tables. <b>NOTE</b>: The returned array will contain
159    * only one entry per actual table prefixed by the schema name + "."
160    *
161    * @return the names as an array of <code>Strings</code>, or an empty array
162    * if no tables were found
163    */

164   String JavaDoc[] getTablesNames();
165
166   /**
167    * Gets the names of the columns.
168    *
169    * @param tableName fully qualified name of the table (with
170    * <code><schema>.</code> prefix)
171    * @return an array containing the columns names, or null if tableName is not
172    * a valid table name.
173    */

174   String JavaDoc[] getColumnsNames(String JavaDoc tableName);
175
176   /**
177    * Gets a description of the given table locks.
178    *
179    * @param tableName fully qualified name of the table (with
180    * <code><schema>.</code> prefix)
181    * @return a (localized) string containing either "No locks" or "Locked by
182    * <tid>"
183    */

184   String JavaDoc getLockInfo(String JavaDoc tableName);
185
186   /**
187    * Lists all stored procedures in this schema. <b>Note:</b> There is an issue
188    * with stored procedures with same name (but different parameters): one will
189    * appear with 0 parameters, the 2nd with the total parameters from the 2
190    * stored proc. See SEQUOIA-296 for more info
191    *
192    * @return An array of Strings containing all stored procedure names (one
193    * array entry per procedure)
194    */

195   String JavaDoc[] getStoredProceduresNames();
196
197   /**
198    * Returns the JDBC URL used to access the database.
199    *
200    * @return a JDBC URL
201    */

202   String JavaDoc getURL();
203
204   /**
205    * Returns the driver path.
206    *
207    * @return the driver path
208    */

209   String JavaDoc getDriverPath();
210
211   /**
212    * Returns the lastKnownCheckpoint value.
213    *
214    * @return Returns the lastKnownCheckpoint.
215    */

216   String JavaDoc getLastKnownCheckpoint();
217
218   /**
219    * Is the backend accessible ?
220    *
221    * @return <tt>true</tt> if a jdbc connection is still possible from the
222    * controller, <tt>false</tt> if connectionTestStatement failed
223    */

224   boolean isJDBCConnected();
225
226   /**
227    * Return a string description of the backend in xml format. This does not
228    * include the schema description if the dynamic precision is not set to
229    * static.
230    *
231    * @return an xml formatted string
232    */

233   String JavaDoc getXml();
234 }
Popular Tags