|
|
Choosing A Webhost: |
CVS update of sequoia/src/org/continuent/sequoia (8 files): msg#00092db.sequoia.cvs
Date: Wednesday, October 18, 2006 @ 16:33:24 Author: emmanuel Path: /cvsroot/sequoia/sequoia/src/org/continuent/sequoia Added: console/text/commands/dbadmin/RenameDump.java (1.1) Modified: common/i18n/console-messages.properties (1.32 -> 1.33) common/i18n/messages.properties (1.45 -> 1.46) common/jmx/mbeans/VirtualDatabaseMBean.java (1.14 -> 1.15) console/text/console.ini (1.14 -> 1.15) controller/recoverylog/RecoveryLog.java (1.114 -> 1.115) controller/virtualdatabase/VirtualDatabase.java (1.131 -> 1.132) controller/virtualdatabase/management/VirtualDatabase.java (1.13 -> 1.14) Implemented 'rename dump' command as described in SEQUOIA-817 ------------------------------------------------------------+ common/i18n/console-messages.properties | 6 common/i18n/messages.properties | 4 common/jmx/mbeans/VirtualDatabaseMBean.java | 11 + console/text/commands/dbadmin/RenameDump.java | 113 +++++++++++ console/text/console.ini | 1 controller/recoverylog/RecoveryLog.java | 15 + controller/virtualdatabase/VirtualDatabase.java | 27 ++ controller/virtualdatabase/management/VirtualDatabase.java | 26 ++ 8 files changed, 202 insertions(+), 1 deletion(-) Index: sequoia/src/org/continuent/sequoia/common/i18n/console-messages.properties diff -u sequoia/src/org/continuent/sequoia/common/i18n/console-messages.properties:1.32 sequoia/src/org/continuent/sequoia/common/i18n/console-messages.properties:1.33 --- sequoia/src/org/continuent/sequoia/common/i18n/console-messages.properties:1.32 Wed Oct 18 16:31:57 2006 +++ sequoia/src/org/continuent/sequoia/common/i18n/console-messages.properties Wed Oct 18 16:33:23 2006 @@ -151,6 +151,12 @@ admin.command.remove.dump.parameters=<dump name> [keepfile] admin.command.remove.dump.done=Done +admin.command.rename.dump.path.description=Rename an existing dump +admin.command.rename.dump.path.parameters=<old dump name> <new dump name> +admin.command.rename.dump.path.echo=Renaming dump {0} to {1}... +admin.command.rename.dump.path.done=Done. + + admin.command.reset.sql.stats.description=Reset SQL monitoring statistics admin.command.show.backend.params=<backend name | *> Index: sequoia/src/org/continuent/sequoia/common/i18n/messages.properties diff -u sequoia/src/org/continuent/sequoia/common/i18n/messages.properties:1.45 sequoia/src/org/continuent/sequoia/common/i18n/messages.properties:1.46 --- sequoia/src/org/continuent/sequoia/common/i18n/messages.properties:1.45 Fri Oct 13 15:37:54 2006 +++ sequoia/src/org/continuent/sequoia/common/i18n/messages.properties Wed Oct 18 16:33:24 2006 @@ -191,6 +191,10 @@ virtualdatabase.delete.dump.failed=Virtual database {0} failed to delete dump {1} (because of : {2}) virtualdatabase.delete.dump.success=Virtual database {0} has successfully deleted dump {1} +virtualdatabase.renaming.dump=Virtual database {0} is renaming dump {1} to {2} +virtualdatabase.rename.dump.failed=Virtual database {0} failed to rename dump {1} to {2} (because of : {3}) +virtualdatabase.rename.dump.success=Virtual database {0} has successfully renamed dump {1} to {2} + virtualdatabase.deleting.log.upToCheckpoint=Virtual database {0} log deleting (purged) up to checkpoint {1} virtualdatabase.delete.log.upToCheckpoint.failed=Failed to delete virtual database {0} log up to checkpoint {1} (because of : {2}) virtualdatabase.delete.log.upToCheckpoint.success=Virtual database {0} log has been successfully deleted (purged) up to checkpoint {0} Index: sequoia/src/org/continuent/sequoia/common/jmx/mbeans/VirtualDatabaseMBean.java diff -u sequoia/src/org/continuent/sequoia/common/jmx/mbeans/VirtualDatabaseMBean.java:1.14 sequoia/src/org/continuent/sequoia/common/jmx/mbeans/VirtualDatabaseMBean.java:1.15 --- sequoia/src/org/continuent/sequoia/common/jmx/mbeans/VirtualDatabaseMBean.java:1.14 Thu Sep 21 16:10:54 2006 +++ sequoia/src/org/continuent/sequoia/common/jmx/mbeans/VirtualDatabaseMBean.java Wed Oct 18 16:33:23 2006 @@ -277,6 +277,17 @@ throws VirtualDatabaseException; /** + * Rename an existing dump. + * + * @param oldDumpName old name of the dump + * @param newDumpName new name of the dump + * @throws VirtualDatabaseException if the old dump does not exist or the new + * dump name already exists + */ + void renameDump(String oldDumpName, String newDumpName) + throws VirtualDatabaseException; + + /** * Restore a dump on a specific backend. The proper Backuper is retrieved * automatically according to the dump format stored in the recovery log dump * table. Index: sequoia/src/org/continuent/sequoia/console/text/commands/dbadmin/RenameDump.java diff -u /dev/null sequoia/src/org/continuent/sequoia/console/text/commands/dbadmin/RenameDump.java:1.1 --- /dev/null Wed Oct 18 16:33:24 2006 +++ sequoia/src/org/continuent/sequoia/console/text/commands/dbadmin/RenameDump.java Wed Oct 18 16:33:23 2006 @@ -0,0 +1,113 @@ +/** + * Sequoia: Database clustering technology. + * Copyright (C) 2002-2004 French National Institute For Research In Computer + * Science And Control (INRIA). + * Contact: sequoia-NAAfj4rwCWAYtQj7fl1lsA@xxxxxxxxxxxxxxxx + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Initial developer(s): Emmanuel Cecchet. + * Contributor(s): ______________________. + */ + +package org.continuent.sequoia.console.text.commands.dbadmin; + +import java.util.StringTokenizer; + +import org.continuent.sequoia.common.i18n.ConsoleTranslate; +import org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean; +import org.continuent.sequoia.console.text.module.VirtualDatabaseAdmin; + +/** + * This class defines a "rename dump" admin command. + * + * @author <a href="mailto:emmanuel.cecchet-NAAfj4rwCWC8rjiVs5Nzzw@xxxxxxxxxxxxxxxx">Emmanuel Cecchet</a> + */ +public class RenameDump extends AbstractAdminCommand +{ + + /** + * Create a "rename dump" command. + * + * @param module the command is attached to + */ + public RenameDump(VirtualDatabaseAdmin module) + { + super(module); + } + + /** + * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#parse(java.lang.String) + */ + public void parse(String commandText) throws Exception + { + String oldDumpName = null; + String newDumpName = null; + StringTokenizer st = new StringTokenizer(commandText.trim()); + + if (st.countTokens() != 2) + { + console.printError(getUsage()); + return; + } + try + { + oldDumpName = st.nextToken(); + newDumpName = st.nextToken(); + if (oldDumpName == null || newDumpName == null) + { + console.printError(getUsage()); + return; + } + + console.printInfo(ConsoleTranslate.get( + "admin.command.rename.dump.path.echo", //$NON-NLS-1$ + new String[]{oldDumpName, newDumpName})); + VirtualDatabaseMBean vdjc = jmxClient.getVirtualDatabaseProxy(dbName, + user, password); + vdjc.renameDump(oldDumpName, newDumpName); + console.printInfo(ConsoleTranslate.get( + "admin.command.rename.dump.path.done", //$NON-NLS-1$ + new String[]{oldDumpName, newDumpName})); + } + catch (Exception e) + { + console.printError( + "Problem while renaming dump (" + e.getMessage() + ")", e); + } + } + + /** + * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#getCommandName() + */ + public String getCommandName() + { + return "rename dump"; //$NON-NLS-1$ + } + + /** + * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#getCommandDescription() + */ + public String getCommandDescription() + { + return ConsoleTranslate.get("admin.command.rename.dump.path.description"); //$NON-NLS-1$ + } + + /** + * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#getCommandParameters() + */ + public String getCommandParameters() + { + return ConsoleTranslate.get("admin.command.rename.dump.path.parameters"); //$NON-NLS-1$ + } +} Index: sequoia/src/org/continuent/sequoia/console/text/console.ini diff -u sequoia/src/org/continuent/sequoia/console/text/console.ini:1.14 sequoia/src/org/continuent/sequoia/console/text/console.ini:1.15 --- sequoia/src/org/continuent/sequoia/console/text/console.ini:1.14 Thu Sep 21 16:10:54 2006 +++ sequoia/src/org/continuent/sequoia/console/text/console.ini Wed Oct 18 16:33:23 2006 @@ -17,6 +17,7 @@ org.continuent.sequoia.console.text.commands.dbadmin.ListBackends,\ org.continuent.sequoia.console.text.commands.dbadmin.PurgeLogUpToDump,\ org.continuent.sequoia.console.text.commands.dbadmin.RemoveDump,\ + org.continuent.sequoia.console.text.commands.dbadmin.RenameDump,\ org.continuent.sequoia.console.text.commands.dbadmin.ResetSqlStats,\ org.continuent.sequoia.console.text.commands.dbadmin.Restore,\ org.continuent.sequoia.console.text.commands.dbadmin.ShowBackend,\ Index: sequoia/src/org/continuent/sequoia/controller/recoverylog/RecoveryLog.java diff -u sequoia/src/org/continuent/sequoia/controller/recoverylog/RecoveryLog.java:1.114 sequoia/src/org/continuent/sequoia/controller/recoverylog/RecoveryLog.java:1.115 --- sequoia/src/org/continuent/sequoia/controller/recoverylog/RecoveryLog.java:1.114 Mon Oct 9 11:34:55 2006 +++ sequoia/src/org/continuent/sequoia/controller/recoverylog/RecoveryLog.java Wed Oct 18 16:33:23 2006 @@ -2720,7 +2720,20 @@ } /** - * Update the path name for a given checkpoint. + * Rename a dump. + * + * @param dumpName the old dump name + * @param newDumpName the new dump name to set + * @throws SQLException if a recovery log database access error occurs + */ + public void updateDumpName(String dumpName, String newDumpName) + throws SQLException + { + updateDumpTableColumn(dumpName, "dump_name", newDumpName); + } + + /** + * Update the path name for a given dump. * * @param dumpName the dump name * @param newPath the new path to set Index: sequoia/src/org/continuent/sequoia/controller/virtualdatabase/VirtualDatabase.java diff -u sequoia/src/org/continuent/sequoia/controller/virtualdatabase/VirtualDatabase.java:1.131 sequoia/src/org/continuent/sequoia/controller/virtualdatabase/VirtualDatabase.java:1.132 --- sequoia/src/org/continuent/sequoia/controller/virtualdatabase/VirtualDatabase.java:1.131 Thu Oct 12 15:52:20 2006 +++ sequoia/src/org/continuent/sequoia/controller/virtualdatabase/VirtualDatabase.java Wed Oct 18 16:33:24 2006 @@ -2582,6 +2582,33 @@ } /** + * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#renameDump(java.lang.String, + * java.lang.String) + */ + public void renameDump(String oldDumpName, String newDumpName) + throws VirtualDatabaseException + { + try + { + RecoveryLog recoveryLog = requestManager.getRecoveryLog(); + if (recoveryLog == null) + throw new VirtualDatabaseException("No recovery log"); // TODO I18N + + if (isDumpNameAvailable(oldDumpName)) + throw new VirtualDatabaseException(oldDumpName + " does not exist"); + + if (!isDumpNameAvailable(newDumpName)) + throw new VirtualDatabaseException(newDumpName + " already exists"); + + recoveryLog.updateDumpName(oldDumpName, newDumpName); + } + catch (SQLException e) + { + throw new VirtualDatabaseException(e); + } + } + + /** * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#restoreDumpOnBackend(String, * String, String, String, ArrayList) */ Index: sequoia/src/org/continuent/sequoia/controller/virtualdatabase/management/VirtualDatabase.java diff -u sequoia/src/org/continuent/sequoia/controller/virtualdatabase/management/VirtualDatabase.java:1.13 sequoia/src/org/continuent/sequoia/controller/virtualdatabase/management/VirtualDatabase.java:1.14 --- sequoia/src/org/continuent/sequoia/controller/virtualdatabase/management/VirtualDatabase.java:1.13 Thu Sep 21 16:29:24 2006 +++ sequoia/src/org/continuent/sequoia/controller/virtualdatabase/management/VirtualDatabase.java Wed Oct 18 16:33:24 2006 @@ -460,6 +460,32 @@ } /** + * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#renameDump(java.lang.String, + * java.lang.String) + */ + public void renameDump(String oldDumpName, String newDumpName) + throws VirtualDatabaseException + { + try + { + endUserLogger.info(Translate + .get("virtualdatabase.renaming.dump", new String[]{ + this.getVirtualDatabaseName(), oldDumpName, newDumpName})); + managedVirtualDatabase.renameDump(oldDumpName, newDumpName); + endUserLogger.info(Translate + .get("virtualdatabase.rename.dump.success", new String[]{ + this.getVirtualDatabaseName(), oldDumpName, newDumpName})); + } + catch (VirtualDatabaseException e) + { + endUserLogger.error(Translate.get("virtualdatabase.rename.dump.failed", + new String[]{this.getVirtualDatabaseName(), oldDumpName, newDumpName, + e.getMessage()})); + throw e; + } + } + + /** * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#restoreDumpOnBackend(java.lang.String, * java.lang.String, java.lang.String, java.lang.String, * java.util.ArrayList)
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | CVS update of sequoia/src/org/continuent/sequoia/common/i18n (1 file), olivier-Tt5JLJuBijYiZlD9aYmxOGD2FQJk+8+b |
|---|---|
| Next by Date: | CVS update of BRANCH_sequoia-2_10 sequoia/src/org/continuent/sequoia/common/i18n (1 file), olivier-Tt5JLJuBijYiZlD9aYmxOGD2FQJk+8+b |
| Previous by Thread: | CVS update of sequoia/src/org/continuent/sequoia/controller/authentication (1 file), emmanuel-Tt5JLJuBijYiZlD9aYmxOGD2FQJk+8+b |
| Next by Thread: | CVS update of BRANCH_sequoia-2_10 sequoia/src/org/continuent/sequoia/common/i18n (1 file), olivier-Tt5JLJuBijYiZlD9aYmxOGD2FQJk+8+b |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |