00001 /** 00002 * C-JDBC: Clustered JDBC. 00003 * Copyright (C) 2002-2005 French National Institute For Research In Computer 00004 * Science And Control (INRIA). 00005 * Contact: c-jdbc@objectweb.org 00006 * 00007 * This library is free software; you can redistribute it and/or modify it 00008 * under the terms of the GNU Lesser General Public License as published by the 00009 * Free Software Foundation; either version 2.1 of the License, or any later 00010 * version. 00011 * 00012 * This library is distributed in the hope that it will be useful, but WITHOUT 00013 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00014 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 00015 * for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public License 00018 * along with this library; if not, write to the Free Software Foundation, 00019 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 00020 * 00021 * Initial developer(s): Emmanuel Cecchet. 00022 * Contributor(s): Mathieu Peltier. 00023 */ 00024 00025 package org.objectweb.cjdbc.common.jmx.mbeans; 00026 00027 import java.io.IOException; 00028 import java.rmi.RemoteException; 00029 import java.util.ArrayList; 00030 00031 import org.objectweb.cjdbc.common.exceptions.ControllerException; 00032 00033 /** 00034 * JMX Interface of the C-JDBC Controller. 00035 * 00036 * @author <a href="mailto:Emmanuel.Cecchet@inria.fr">Emmanuel Cecchet </a> 00037 * @author <a href="mailto:Mathieu.Peltier@inrialpes.fr">Mathieu Peltier </a> 00038 * @version 1.0 00039 */ 00040 public interface ControllerMBean 00041 { 00042 00043 // 00044 // Virtual databases management 00045 // 00046 00047 /** 00048 * Registers one or several virtual databases in the controller. The 00049 * description of each Virtual Database must contain the definition of the 00050 * backends and components (cache, scheduler, load balancer) to use. 00051 * <p> 00052 * This function expects the content of an XML file conforming to the C-JDBC 00053 * DTD to be given as a single <code>String</code> object. 00054 * 00055 * @param xml XML code to parse 00056 * @exception ControllerException if an error occurs while interpreting XML 00057 */ 00058 void addVirtualDatabases(String xml) throws ControllerException; 00059 00060 /** 00061 * Returns the names of currently available virtual databases. 00062 * 00063 * @return ArrayList of <code>String</code> objects. 00064 */ 00065 public ArrayList getVirtualDatabaseNames(); 00066 00067 /** 00068 * Tests if a <code>VirtualDatabase</code> of a given name exists in this 00069 * controller. 00070 * 00071 * @param name the virtual database name 00072 * @return <code>true</code> if the virtual database exists 00073 */ 00074 boolean hasVirtualDatabase(String name); 00075 00076 /** 00077 * Prevent the controller from accessing a virtual database thereafter 00078 * 00079 * @param virtualname the virtual database name to remove 00080 * @return description message 00081 * @throws Exception if fails 00082 */ 00083 String removeVirtualDatabase(String virtualname) throws Exception; 00084 00085 // 00086 // Controller operations 00087 // 00088 00089 /** 00090 * Adds a driver jar file sent in its binary form in the drivers directory of 00091 * the controller. 00092 * 00093 * @param bytes the data in a byte array 00094 * @throws Exception if fails 00095 */ 00096 void addDriver(byte[] bytes) throws Exception; 00097 00098 /** 00099 * Generate a log report on the controller now 00100 * 00101 * @return the content of the logreport 00102 * @throws Exception if fails 00103 */ 00104 String generateLogReport() throws Exception; 00105 00106 /** 00107 * Generate a report on the controller now 00108 * 00109 * @return the content of the report 00110 * @throws Exception if fails 00111 */ 00112 String generateReport() throws Exception; 00113 00114 /** 00115 * Reads a XML configuration file. 00116 * 00117 * @param filename XML configuration file name 00118 * @return a diagnostic message 00119 * @throws Exception if an error occurs 00120 */ 00121 String loadXml(String filename) throws Exception; 00122 00123 /** 00124 * Save current configuration of the controller to a default file location. 00125 * 00126 * @return status message 00127 * @throws Exception if fails 00128 */ 00129 String saveConfiguration() throws Exception; 00130 00131 /** 00132 * Turns the controller down by using default shutdown level 00133 * 00134 * @param level Smart,Fast or Immediate. 00135 * @throws ControllerException if unknown level or other error occurs. 00136 */ 00137 void shutdown(int level) throws ControllerException; 00138 00139 // 00140 // Controller information 00141 // 00142 00143 /** 00144 * Get the controller socket backlog size. 00145 * 00146 * @return the backlog size 00147 */ 00148 int getBacklogSize(); 00149 00150 /** 00151 * Gets the controller name. 00152 * 00153 * @return a <code>String</code> value containing the controller name. 00154 */ 00155 String getControllerName(); 00156 00157 /** 00158 * Gets the JMX name of the controller. 00159 * 00160 * @return a <code>String</code> value containing the jmx name of the 00161 * controller 00162 */ 00163 String getJmxName(); 00164 00165 /** 00166 * Return this controller port number 00167 * 00168 * @return a <code>int</code> containing the port code number 00169 */ 00170 int getPortNumber(); 00171 00172 /** 00173 * Gets the controller version. 00174 * 00175 * @return a <code>String</code> value containing the version number 00176 * @throws RemoteException if an error occurs 00177 */ 00178 String getVersionNumber() throws RemoteException; 00179 00180 /** 00181 * Return the xml version of the controller.xml file without doc type 00182 * declaration, just data. The content is formatted using the controller xsl 00183 * stylesheet. 00184 * 00185 * @return controller xml data 00186 */ 00187 String getXml(); 00188 00189 /** 00190 * Is the controller shutting down ? 00191 * 00192 * @return <tt>true</tt> if the controller is no more accepting connection 00193 */ 00194 boolean isShuttingDown(); 00195 00196 /** 00197 * Set the controller socket backlog size. 00198 * 00199 * @param size backlog size 00200 */ 00201 void setBacklogSize(int size); 00202 00203 // 00204 // Logging system 00205 // 00206 00207 /** 00208 * Refreshs the logging system configuration by re-reading the 00209 * <code>log4j.properties</code> file. 00210 * 00211 * @exception ControllerException if the <code>log4j.properties</code> file 00212 * cannot be found in classpath 00213 */ 00214 void refreshLogConfiguration() throws ControllerException; 00215 00216 /** 00217 * Update the log4j configuration file with the given content Also call 00218 * <code>refreshLogConfiguration</code> method 00219 * 00220 * @param newConfiguration the content of the new log4j configuration 00221 * @throws IOException if cannot access the log4j file 00222 * @throws ControllerException if could not refresh the logs 00223 */ 00224 void updateLogConfigurationFile(String newConfiguration) throws IOException, 00225 ControllerException; 00226 00227 /** 00228 * Retrieve the content of the log4j configuration file 00229 * 00230 * @return <code>String</code> 00231 * @throws IOException if IO problems 00232 */ 00233 String viewLogConfigurationFile() throws IOException; 00234 00235 }