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): Nicolas Modrzyk. 00022 * Contributor(s): Emmanuel Cecchet. 00023 */ 00024 00025 package org.objectweb.cjdbc.common.jmx.mbeans; 00026 00027 import java.sql.SQLException; 00028 import java.util.ArrayList; 00029 00030 import org.objectweb.cjdbc.controller.recoverylog.BackendRecoveryInfo; 00031 00032 /** 00033 * This class defines a AbstractRecoveryLogMBean 00034 * 00035 * @author <a href="mailto:Nicolas.Modrzyk@inrialpes.fr">Nicolas Modrzyk </a> 00036 * @author <a href="mailto:Emmanuel.Cecchet@inria.fr">Emmanuel Cecchet </a> 00037 * @version 1.0 00038 */ 00039 public interface AbstractRecoveryLogMBean 00040 { 00041 /** 00042 * Possibly clean the recovery log after all recovery process are done. 00043 * 00044 * @exception SQLException if an error occurs 00045 */ 00046 void cleanRecoveryLog() throws SQLException; 00047 00048 /** 00049 * Retrieve recovery information on a backend. This includes, the last known 00050 * state of the backend, and the last known checkpoint 00051 * 00052 * @param databaseName the virtual database name 00053 * @param backendName the backend name 00054 * @return <code>BackendRecoveryInfo<code> instance or <code>null</code> if the backend does not exist 00055 * @throws SQLException if cannot proceed 00056 */ 00057 BackendRecoveryInfo getBackendRecoveryInfo(String databaseName, 00058 String backendName) throws SQLException; 00059 00060 /** 00061 * Returns an array of names of all the checkpoint available in the recovery 00062 * log 00063 * 00064 * @return <code>ArrayList</code> of <code>String</code> checkpoint names 00065 * @throws SQLException if fails 00066 */ 00067 ArrayList getCheckpointNames() throws SQLException; 00068 00069 /** 00070 * Get the request id corresponding to a given checkpoint. This is the first 00071 * step in a recovery process. Following steps consist in calling 00072 * recoverNextRequest. 00073 * 00074 * @param checkpointName Name of the checkpoint 00075 * @return int the request identifier corresponding to this checkpoint. 00076 * @exception SQLException if an error occurs 00077 */ 00078 long getCheckpointRequestId(String checkpointName) throws SQLException; 00079 00080 /** 00081 * Returns the recoveringNb value. 00082 * 00083 * @return Returns the recoveringNb. 00084 */ 00085 long getRecoveringNb(); 00086 00087 /** 00088 * Get the id of the last transaction logged in the recovery log. 00089 * 00090 * @return the last transaction id. 00091 * @throws SQLException if an error occurs 00092 */ 00093 long getLastTransactionId() throws SQLException; 00094 00095 /** 00096 * Returns <code>true</code> if at least one backend has started a recover 00097 * process. 00098 * 00099 * @return <code>boolean</code> 00100 */ 00101 boolean isRecovering(); 00102 00103 /** 00104 * Remove a checkpoint from the recovery. This is useful for recovery 00105 * maintenant 00106 * 00107 * @param checkpointName to remove 00108 * @throws SQLException if an error occurs 00109 */ 00110 void removeCheckpoint(String checkpointName) throws SQLException; 00111 00112 /** 00113 * Store the state of the backend in the recovery log 00114 * 00115 * @param databaseName the virtual database name 00116 * @param backendRecoveryInfo the backend recovery information to store 00117 * @throws SQLException if cannot proceed 00118 */ 00119 void storeBackendRecoveryInfo(String databaseName, 00120 BackendRecoveryInfo backendRecoveryInfo) throws SQLException; 00121 00122 /** 00123 * Store a Checkpoint using the current log state. 00124 * 00125 * @param checkpointName Name of the checkpoint 00126 * @exception SQLException if an error occurs 00127 */ 00128 void storeCheckpoint(String checkpointName) throws SQLException; 00129 00130 /** 00131 * Store a Checkpoint using the given request id. 00132 * 00133 * @param checkpointName Name of the checkpoint 00134 * @param requestId request identifier 00135 * @exception SQLException if an error occurs 00136 */ 00137 void storeCheckpoint(String checkpointName, long requestId) 00138 throws SQLException; 00139 00140 }