/**
* Sequoia: Database clustering technology.
* Copyright (C) 2002-2004 French National Institute For Research In Computer
* Science And Control (INRIA).
* Contact: sequoia@continuent.org
*
* 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): Nicolas Modrzyk.
* 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 transferBackend
*
* @author <a href="mailto:Nicolas.Modrzyk@inrialpes.fr">Nicolas Modrzyk </a>
* @version 1.0
*/
public class TransferBackend extends AbstractAdminCommand
{
/**
* Creates a new <code>transferBackend</code> object
*
* @param module the command is attached to
*/
public TransferBackend(VirtualDatabaseAdmin module)
{
super(module);
}
/**
* @see org.continuent.sequoia.console.text.commands.ConsoleCommand#parse(java.lang.String)
*/
public void parse(String commandText) throws Exception
{
String controller = null;
String backendName = null;
StringTokenizer st = new StringTokenizer(commandText.trim());
if (st == null || st.countTokens() != 2)
{
console.printError(getUsage());
return;
}
backendName = st.nextToken();
controller = st.nextToken();
console.printInfo(ConsoleTranslate.get("admin.command.transfer.echo", //$NON-NLS-1$
new String[]{backendName, controller}));
VirtualDatabaseMBean vjdc = jmxClient.getVirtualDatabaseProxy(dbName, user,
password);
vjdc.transferBackend(backendName, controller);
}
/**
* @see org.continuent.sequoia.console.text.commands.ConsoleCommand#getCommandName()
*/
public String getCommandName()
{
return "transfer backend"; //$NON-NLS-1$
}
/**
* @see org.continuent.sequoia.console.text.commands.ConsoleCommand#getCommandDescription()
*/
public String getCommandDescription()
{
return ConsoleTranslate.get("admin.command.transfer.description"); //$NON-NLS-1$
}
/**
* @see org.continuent.sequoia.console.text.commands.ConsoleCommand#getCommandParameters()
*/
public String getCommandParameters()
{
return ConsoleTranslate.get("admin.command.transfer.params"); //$NON-NLS-1$
}
}
|