00001 /** 00002 * C-JDBC: Clustered JDBC. 00003 * Copyright (C) 2005 Emic Networks. 00004 * Contact: c-jdbc@objectweb.org 00005 * 00006 * This library is free software; you can redistribute it and/or modify it 00007 * under the terms of the GNU Lesser General Public License as published by the 00008 * Free Software Foundation; either version 2.1 of the License, or any later 00009 * version. 00010 * 00011 * This library is distributed in the hope that it will be useful, but WITHOUT 00012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 00014 * for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public License 00017 * along with this library; if not, write to the Free Software Foundation, 00018 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 00019 * 00020 * Initial developer(s): Emmanuel Cecchet. 00021 * Contributor(s): ______________________. 00022 */ 00023 00024 package org.objectweb.cjdbc.console.text.commands.dbadmin; 00025 00026 import java.io.File; 00027 00028 import org.objectweb.cjdbc.common.i18n.ConsoleTranslate; 00029 import org.objectweb.cjdbc.common.jmx.mbeans.VirtualDatabaseMBean; 00030 import org.objectweb.cjdbc.console.text.module.VirtualDatabaseAdmin; 00031 00032 /** 00033 * This class defines the command used to display available dumps of a given 00034 * virtual database. 00035 * 00036 * @author <a href="mailto:emmanuel.cecchet@emicnetworks.com">Emmanuel Cecchet 00037 * </a> 00038 * @version 1.0 00039 */ 00040 public class ViewDumpNames extends AbstractAdminCommand 00041 { 00042 00043 /** 00044 * Creates a new <code>ViewDumpNames</code> object 00045 * 00046 * @param module module that owns this commands 00047 */ 00048 public ViewDumpNames(VirtualDatabaseAdmin module) 00049 { 00050 super(module); 00051 } 00052 00053 /** 00054 * @see org.objectweb.cjdbc.console.text.commands.ConsoleCommand#parse(java.lang.String) 00055 */ 00056 public void parse(String commandText) throws Exception 00057 { 00058 console.println(ConsoleTranslate.get("admin.command.view.dumps.echo", 00059 dbName)); 00060 VirtualDatabaseMBean vdjc = jmxClient.getVirtualDatabaseProxy(dbName, user, 00061 password); 00062 File[] files = vdjc.getAvailableDumpFiles(); 00063 for (int i = 0; i < files.length; i++) 00064 console.println("[" + i + "]\t" + files[i].getName()); 00065 } 00066 00067 /** 00068 * @see org.objectweb.cjdbc.console.text.commands.ConsoleCommand#getCommandName() 00069 */ 00070 public String getCommandName() 00071 { 00072 return "viewDumpNames"; 00073 } 00074 00075 /** 00076 * @see org.objectweb.cjdbc.console.text.commands.ConsoleCommand#getCommandDescription() 00077 */ 00078 public String getCommandDescription() 00079 { 00080 return ConsoleTranslate.get("admin.command.view.dumps"); 00081 } 00082 00083 }