KickJava   Java API By Example, From Geeks To Geeks.

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


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): Emmanuel Cecchet.
21  * Contributor(s): Mathieu Peltier.
22  */

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

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

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

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

64   List JavaDoc getVirtualDatabaseNames();
65
66   //
67
// Controller operations
68
//
69

70   /**
71    * Adds a driver jar file sent in its binary form in the drivers directory of
72    * the controller.
73    *
74    * @param bytes the data in a byte array
75    * @throws Exception if fails
76    */

77   void addDriver(byte[] bytes) throws Exception JavaDoc;
78
79   /**
80    * Save current configuration of the controller to a default file location.
81    *
82    * @return status message
83    * @throws Exception if fails
84    * @see #getXml()
85    */

86   String JavaDoc saveConfiguration() throws Exception JavaDoc;
87
88   /**
89    * Shuts the controller down. The controller can not been shut down if all its
90    * hosted virtual database have not been shut down before
91    *
92    * @throws ControllerException if all the virtual database have not been shut
93    * down or if an error occurs
94    */

95   void shutdown() throws ControllerException;
96
97   //
98
// Controller information
99
//
100

101   /**
102    * Get the controller socket backlog size.
103    *
104    * @return the backlog size
105    */

106   int getBacklogSize();
107
108   // TODO rename it to getName()
109
/**
110    * Gets the controller name.
111    *
112    * @return a <code>String</code> value containing the controller name.
113    */

114   String JavaDoc getControllerName();
115
116   /**
117    * Gets the JMX name of the controller.
118    *
119    * @return a <code>String</code> value containing the jmx name of the
120    * controller
121    */

122   String JavaDoc getJmxName();
123
124   /**
125    * Return this controller JDBC port number
126    *
127    * @return an <code>int</code> containing the port code number
128    */

129   int getPortNumber();
130
131   // FIXME rename to getVersion()
132
/**
133    * Gets the controller version.
134    *
135    * @return a <code>String</code> value containing the version number
136    * @throws RemoteException if an error occurs
137    */

138   String JavaDoc getVersionNumber() throws RemoteException JavaDoc;
139
140   /**
141    * Return the xml version of the controller.xml file without doc type
142    * declaration, just data. The content is formatted using the controller xsl
143    * stylesheet.
144    *
145    * @return controller xml data
146    */

147   String JavaDoc getXml();
148
149   /**
150    * Is the controller shutting down ?
151    *
152    * @return <tt>true</tt> if the controller is no more accepting connection
153    */

154   boolean isShuttingDown();
155
156   /**
157    * Set the controller socket backlog size.
158    *
159    * @param size backlog size
160    */

161   void setBacklogSize(int size);
162
163   //
164
// Logging system
165
//
166

167   /**
168    * Refreshs the logging system configuration by re-reading the
169    * <code>log4j.properties</code> file.
170    *
171    * @exception ControllerException if the <code>log4j.properties</code> file
172    * cannot be found in classpath
173    */

174   void refreshLogConfiguration() throws ControllerException;
175
176   // TODO rename to setLoggingConfiguration(String) to make it
177
// a JMX attribute
178
/**
179    * Update the log4j configuration file with the given content Also call
180    * <code>refreshLogConfiguration</code> method
181    *
182    * @param newConfiguration the content of the new log4j configuration
183    * @throws IOException if cannot access the log4j file
184    * @throws ControllerException if could not refresh the logs
185    */

186   void updateLogConfigurationFile(String JavaDoc newConfiguration) throws IOException JavaDoc,
187       ControllerException;
188
189   // TODO rename to getLoggingConfiguration() to make it
190
// a JMX attribute
191
/**
192    * Retrieve the content of the log4j configuration file
193    *
194    * @return <code>String</code>
195    * @throws IOException if IO problems
196    */

197   String JavaDoc viewLogConfigurationFile() throws IOException JavaDoc;
198
199 }
Popular Tags