01: /**
02: * Sequoia: Database clustering technology.
03: * Contact: sequoia@continuent.org
04: *
05: * Licensed under the Apache License, Version 2.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: *
17: * Initial developer(s): Damian Arregui
18: * Contributor(s): ______________________.
19: */package org.continuent.sequoia.console.text.commands.dbadmin;
20:
21: import org.continuent.sequoia.common.i18n.ConsoleTranslate;
22: import org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean;
23: import org.continuent.sequoia.console.text.module.VirtualDatabaseAdmin;
24:
25: /**
26: * This class defines an AborTransaction
27: *
28: * @author <a href="mailto:damian.arregui@continuent.com">Damian Arregui </a>
29: * @version 1.0
30: */
31: public class AbortTransaction extends AbstractAdminCommand {
32:
33: /**
34: * Creates a new <code>AbortTransaction</code> object
35: *
36: * @param module the commands is attached to
37: */
38: public AbortTransaction(VirtualDatabaseAdmin module) {
39: super (module);
40: }
41:
42: /**
43: * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#parse(String)
44: */
45: public void parse(String commandText) throws Exception {
46: VirtualDatabaseMBean db = jmxClient.getVirtualDatabaseProxy(
47: dbName, user, password);
48:
49: String tid;
50:
51: tid = commandText.trim();
52:
53: if ("".equals(tid)) //$NON-NLS-1$
54: {
55: console.printError(getUsage());
56: return;
57: }
58:
59: db.abort(Long.parseLong(tid), true, true);
60: console
61: .println(ConsoleTranslate
62: .get(
63: "admin.command.abort.transaction.ok", new Object[] { tid })); //$NON-NLS-1$
64: }
65:
66: /**
67: * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#getCommandName()
68: */
69: public String getCommandName() {
70: return "abort transaction"; //$NON-NLS-1$
71: }
72:
73: /**
74: * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#getCommandDescription()
75: */
76: public String getCommandDescription() {
77: return ConsoleTranslate
78: .get("admin.command.abort.transaction.description"); //$NON-NLS-1$
79: }
80:
81: /**
82: * @see org.continuent.sequoia.console.text.commands.ConsoleCommand#getCommandParameters()
83: */
84: public String getCommandParameters() {
85: return ConsoleTranslate
86: .get("admin.command.abort.transaction.params"); //$NON-NLS-1$
87: }
88: }
|