001: /**
002: * Sequoia: Database clustering technology.
003: * Copyright (C) 2002-2004 French National Institute For Research In Computer
004: * Science And Control (INRIA).
005: * Copyright (C) 2005 AmicoSoft, Inc. dba Emic Networks
006: * Contact: sequoia@continuent.org
007: *
008: * Licensed under the Apache License, Version 2.0 (the "License");
009: * you may not use this file except in compliance with the License.
010: * You may obtain a copy of the License at
011: *
012: * http://www.apache.org/licenses/LICENSE-2.0
013: *
014: * Unless required by applicable law or agreed to in writing, software
015: * distributed under the License is distributed on an "AS IS" BASIS,
016: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: * See the License for the specific language governing permissions and
018: * limitations under the License.
019: *
020: * Initial developer(s): Emmanuel Cecchet.
021: * Contributor(s): Mathieu Peltier.
022: */package org.continuent.sequoia.common.jmx.mbeans;
023:
024: import java.io.IOException;
025: import java.rmi.RemoteException;
026: import java.util.List;
027:
028: import org.continuent.sequoia.common.exceptions.ControllerException;
029:
030: /**
031: * JMX Interface of the Sequoia Controller.
032: *
033: * @author <a href="mailto:Emmanuel.Cecchet@inria.fr">Emmanuel Cecchet </a>
034: * @author <a href="mailto:Mathieu.Peltier@inrialpes.fr">Mathieu Peltier </a>
035: * @version 1.0
036: */
037: public interface ControllerMBean {
038:
039: //
040: // Virtual databases management
041: //
042:
043: /**
044: * Registers one or several virtual databases in the controller. The
045: * description of each Virtual Database must contain the definition of the
046: * backends and components (cache, scheduler, load balancer) to use.
047: * <p>
048: * This function expects the content of an XML file conforming to the Sequoia
049: * DTD to be given as a single <code>String</code> object.
050: *
051: * @param xml XML code to parse
052: * @exception ControllerException if an error occurs while interpreting XML
053: */
054: void addVirtualDatabases(String xml) throws ControllerException;
055:
056: /**
057: * Same as addVirtualDatabases(String xml) above, except that a force option
058: * can be specified to bypass the load-order (last-man-down) check.
059: *
060: * @param xml vdb.xml config data
061: * @param force set to true to bypass the load-order (last-man-down) check.
062: * @exception ControllerException if an error occurs (vdb xml not valid, other...)
063: */
064: void addVirtualDatabases(String xml, boolean force)
065: throws ControllerException;
066:
067: /**
068: * Loads a vdb part and initialize it as the first vdb part. This clears the
069: * recovery log. Similarly to addVirtualDatabases() above, several vdb parts
070: * can be specified at once.
071: *
072: * @param vdbXmlSpec an xml string containing the vdb part specification (s)
073: * @throws ControllerException if there is a problem (vdb xml not valid, not
074: * first in group, ...)
075: */
076: void initializeVirtualDatabases(String vdbXmlSpec)
077: throws ControllerException;
078:
079: /**
080: * Returns the names of currently available virtual databases.
081: *
082: * @return List of <code>String</code> objects.
083: */
084: List getVirtualDatabaseNames();
085:
086: //
087: // Controller operations
088: //
089:
090: /**
091: * Adds a driver jar file sent in its binary form in the drivers directory of
092: * the controller.
093: *
094: * @param bytes the data in a byte array
095: * @throws Exception if fails
096: */
097: void addDriver(byte[] bytes) throws Exception;
098:
099: /**
100: * Save current configuration of the controller to a default file location.
101: *
102: * @return status message
103: * @throws Exception if fails
104: *
105: * @see #getXml()
106: */
107: String saveConfiguration() throws Exception;
108:
109: /**
110: * Shuts the controller down. The controller can not been shut down if all its
111: * hosted virtual database have not been shut down before
112: *
113: * @throws ControllerException if all the virtual database have not been shut
114: * down or if an error occurs
115: */
116: void shutdown() throws ControllerException;
117:
118: //
119: // Controller information
120: //
121:
122: /**
123: * Get the controller socket backlog size.
124: *
125: * @return the backlog size
126: */
127: int getBacklogSize();
128:
129: //TODO rename it to getName()
130: /**
131: * Gets the controller name.
132: *
133: * @return a <code>String</code> value containing the controller name.
134: */
135: String getControllerName();
136:
137: /**
138: * Gets the JMX name of the controller.
139: *
140: * @return a <code>String</code> value containing the jmx name of the
141: * controller
142: */
143: String getJmxName();
144:
145: /**
146: * Return this controller port number
147: *
148: * @return a <code>int</code> containing the port code number
149: */
150: int getPortNumber();
151:
152: //FIXME rename to getVersion()
153: /**
154: * Gets the controller version.
155: *
156: * @return a <code>String</code> value containing the version number
157: * @throws RemoteException if an error occurs
158: */
159: String getVersionNumber() throws RemoteException;
160:
161: /**
162: * Return the xml version of the controller.xml file without doc type
163: * declaration, just data. The content is formatted using the controller xsl
164: * stylesheet.
165: *
166: * @return controller xml data
167: */
168: String getXml();
169:
170: /**
171: * Is the controller shutting down ?
172: *
173: * @return <tt>true</tt> if the controller is no more accepting connection
174: */
175: boolean isShuttingDown();
176:
177: /**
178: * Set the controller socket backlog size.
179: *
180: * @param size backlog size
181: */
182: void setBacklogSize(int size);
183:
184: //
185: // Logging system
186: //
187:
188: /**
189: * Refreshs the logging system configuration by re-reading the
190: * <code>log4j.properties</code> file.
191: *
192: * @exception ControllerException if the <code>log4j.properties</code> file
193: * cannot be found in classpath
194: */
195: void refreshLogConfiguration() throws ControllerException;
196:
197: //TODO rename to setLoggingConfiguration(String) to make it
198: // a JMX attribute
199: /**
200: * Update the log4j configuration file with the given content Also call
201: * <code>refreshLogConfiguration</code> method
202: *
203: * @param newConfiguration the content of the new log4j configuration
204: * @throws IOException if cannot access the log4j file
205: * @throws ControllerException if could not refresh the logs
206: */
207: void updateLogConfigurationFile(String newConfiguration)
208: throws IOException, ControllerException;
209:
210: //TODO rename to getLoggingConfiguration() to make it
211: // a JMX attribute
212: /**
213: * Retrieve the content of the log4j configuration file
214: *
215: * @return <code>String</code>
216: * @throws IOException if IO problems
217: */
218: String viewLogConfigurationFile() throws IOException;
219:
220: }
|