KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > cjdbc > common > jmx > mbeans > ControllerMBean


1 /**
2  * C-JDBC: Clustered JDBC.
3  * Copyright (C) 2002-2005 French National Institute For Research In Computer
4  * Science And Control (INRIA).
5  * Contact: c-jdbc@objectweb.org
6  *
7  * This library is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License as published by the
9  * Free Software Foundation; either version 2.1 of the License, or any later
10  * version.
11  *
12  * This library is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
15  * for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this library; if not, write to the Free Software Foundation,
19  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
20  *
21  * Initial developer(s): Emmanuel Cecchet.
22  * Contributor(s): Mathieu Peltier.
23  */

24
25 package org.objectweb.cjdbc.common.jmx.mbeans;
26
27 import java.io.IOException JavaDoc;
28 import java.rmi.RemoteException JavaDoc;
29 import java.util.ArrayList JavaDoc;
30
31 import org.objectweb.cjdbc.common.exceptions.ControllerException;
32
33 /**
34  * JMX Interface of the C-JDBC Controller.
35  *
36  * @author <a HREF="mailto:Emmanuel.Cecchet@inria.fr">Emmanuel Cecchet </a>
37  * @author <a HREF="mailto:Mathieu.Peltier@inrialpes.fr">Mathieu Peltier </a>
38  * @version 1.0
39  */

40 public interface ControllerMBean
41 {
42
43   //
44
// Virtual databases management
45
//
46

47   /**
48    * Registers one or several virtual databases in the controller. The
49    * description of each Virtual Database must contain the definition of the
50    * backends and components (cache, scheduler, load balancer) to use.
51    * <p>
52    * This function expects the content of an XML file conforming to the C-JDBC
53    * DTD to be given as a single <code>String</code> object.
54    *
55    * @param xml XML code to parse
56    * @exception ControllerException if an error occurs while interpreting XML
57    */

58   void addVirtualDatabases(String JavaDoc xml) throws ControllerException;
59
60   /**
61    * Returns the names of currently available virtual databases.
62    *
63    * @return ArrayList of <code>String</code> objects.
64    */

65   ArrayList JavaDoc getVirtualDatabaseNames();
66
67   /**
68    * Tests if a <code>VirtualDatabase</code> of a given name exists in this
69    * controller.
70    *
71    * @param name the virtual database name
72    * @return <code>true</code> if the virtual database exists
73    */

74   boolean hasVirtualDatabase(String JavaDoc name);
75
76   /**
77    * Prevent the controller from accessing a virtual database thereafter
78    *
79    * @param virtualname the virtual database name to remove
80    * @return description message
81    * @throws Exception if fails
82    */

83   String JavaDoc removeVirtualDatabase(String JavaDoc virtualname) throws Exception JavaDoc;
84
85   //
86
// Controller operations
87
//
88

89   /**
90    * Adds a driver jar file sent in its binary form in the drivers directory of
91    * the controller.
92    *
93    * @param bytes the data in a byte array
94    * @throws Exception if fails
95    */

96   void addDriver(byte[] bytes) throws Exception JavaDoc;
97
98   /**
99    * Generate a log report on the controller now
100    *
101    * @return the content of the logreport
102    * @throws Exception if fails
103    */

104   String JavaDoc generateLogReport() throws Exception JavaDoc;
105
106   /**
107    * Generate a report on the controller now
108    *
109    * @return the content of the report
110    * @throws Exception if fails
111    */

112   String JavaDoc generateReport() throws Exception JavaDoc;
113
114   /**
115    * Get the configuration of the logging now.
116    *
117    * @return a <code>String</code> representing the logging configuration
118    * @throws Exception if the logging configuration can not be returned
119    */

120   String JavaDoc getLoggingConfiguration() throws Exception JavaDoc;
121   
122   /**
123    * Save current configuration of the controller to a default file location.
124    *
125    * @return status message
126    * @throws Exception if fails
127    */

128   String JavaDoc saveConfiguration() throws Exception JavaDoc;
129
130   /**
131    * Turns the controller down by using default shutdown level
132    *
133    * @param level Smart,Fast or Immediate.
134    * @throws ControllerException if unknown level or other error occurs.
135    */

136   void shutdown(int level) throws ControllerException;
137
138   //
139
// Controller information
140
//
141

142   /**
143    * Get the controller socket backlog size.
144    *
145    * @return the backlog size
146    */

147   int getBacklogSize();
148
149   /**
150    * Gets the controller name.
151    *
152    * @return a <code>String</code> value containing the controller name.
153    */

154   String JavaDoc getControllerName();
155
156   /**
157    * Gets the JMX name of the controller.
158    *
159    * @return a <code>String</code> value containing the jmx name of the
160    * controller
161    */

162   String JavaDoc getJmxName();
163
164   /**
165    * Return this controller port number
166    *
167    * @return a <code>int</code> containing the port code number
168    */

169   int getPortNumber();
170
171   /**
172    * Gets the controller version.
173    *
174    * @return a <code>String</code> value containing the version number
175    * @throws RemoteException if an error occurs
176    */

177   String JavaDoc getVersionNumber() throws RemoteException JavaDoc;
178
179   /**
180    * Return the xml version of the controller.xml file without doc type
181    * declaration, just data. The content is formatted using the controller xsl
182    * stylesheet.
183    *
184    * @return controller xml data
185    */

186   String JavaDoc getXml();
187
188   /**
189    * Is the controller shutting down ?
190    *
191    * @return <tt>true</tt> if the controller is no more accepting connection
192    */

193   boolean isShuttingDown();
194
195   /**
196    * Set the controller socket backlog size.
197    *
198    * @param size backlog size
199    */

200   void setBacklogSize(int size);
201
202   //
203
// Logging system
204
//
205

206   /**
207    * Refreshs the logging system configuration by re-reading the
208    * <code>log4j.properties</code> file.
209    *
210    * @exception ControllerException if the <code>log4j.properties</code> file
211    * cannot be found in classpath
212    */

213   void refreshLogConfiguration() throws ControllerException;
214
215   /**
216    * Update the log4j configuration file with the given content Also call
217    * <code>refreshLogConfiguration</code> method
218    *
219    * @param newConfiguration the content of the new log4j configuration
220    * @throws IOException if cannot access the log4j file
221    * @throws ControllerException if could not refresh the logs
222    */

223   void updateLogConfigurationFile(String JavaDoc newConfiguration) throws IOException JavaDoc,
224       ControllerException;
225
226   /**
227    * Retrieve the content of the log4j configuration file
228    *
229    * @return <code>String</code>
230    * @throws IOException if IO problems
231    */

232   String JavaDoc viewLogConfigurationFile() throws IOException JavaDoc;
233
234 }
Popular Tags