Main Page | Packages | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

org.objectweb.cjdbc.console.text.commands.dbadmin.ShowBackendState Class Reference

Inheritance diagram for org.objectweb.cjdbc.console.text.commands.dbadmin.ShowBackendState:

Inheritance graph
[legend]
Collaboration diagram for org.objectweb.cjdbc.console.text.commands.dbadmin.ShowBackendState:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ShowBackendState (VirtualDatabaseAdmin module)
void parse (String commandText) throws Exception
String getCommandName ()
String getCommandDescription ()
String getCommandParameters ()

Detailed Description

This class defines a ShowBackendState

Author:
Nicolas Modrzyk
Version:
1.0

Definition at line 40 of file ShowBackendState.java.


Constructor & Destructor Documentation

org.objectweb.cjdbc.console.text.commands.dbadmin.ShowBackendState.ShowBackendState VirtualDatabaseAdmin  module  ) 
 

Creates a new ShowBackendState object

Parameters:
module the calling module

Definition at line 48 of file ShowBackendState.java.

00049   {
00050     super(module);
00051   }


Member Function Documentation

String org.objectweb.cjdbc.console.text.commands.dbadmin.ShowBackendState.getCommandDescription  )  [virtual]
 

See also:
org.objectweb.cjdbc.console.text.commands.ConsoleCommand.getCommandDescription()

Implements org.objectweb.cjdbc.console.text.commands.ConsoleCommand.

Definition at line 136 of file ShowBackendState.java.

00137   {
00138     return ConsoleTranslate.get("admin.command.showbackend.state");
00139   }

String org.objectweb.cjdbc.console.text.commands.dbadmin.ShowBackendState.getCommandName  )  [virtual]
 

See also:
org.objectweb.cjdbc.console.text.commands.ConsoleCommand.getCommandName()

Implements org.objectweb.cjdbc.console.text.commands.ConsoleCommand.

Definition at line 128 of file ShowBackendState.java.

00129   {
00130     return "showbackend";
00131   }

String org.objectweb.cjdbc.console.text.commands.dbadmin.ShowBackendState.getCommandParameters  ) 
 

See also:
org.objectweb.cjdbc.console.text.commands.ConsoleCommand.getCommandParameters()

Reimplemented from org.objectweb.cjdbc.console.text.commands.ConsoleCommand.

Definition at line 144 of file ShowBackendState.java.

00145   {
00146     return "<backendName> [<count>] [<fromFirst>] [<clone>]";
00147   }

void org.objectweb.cjdbc.console.text.commands.dbadmin.ShowBackendState.parse String  commandText  )  throws Exception [virtual]
 

See also:
org.objectweb.cjdbc.console.text.commands.ConsoleCommand.parse(java.lang.String)

Implements org.objectweb.cjdbc.console.text.commands.ConsoleCommand.

Definition at line 56 of file ShowBackendState.java.

References org.objectweb.cjdbc.common.jmx.mbeans.VirtualDatabaseMBean.getAllBackendNames(), org.objectweb.cjdbc.console.jmx.RmiJmxClient.getVirtualDatabaseProxy(), org.objectweb.cjdbc.console.text.Console.printError(), and org.objectweb.cjdbc.console.text.Console.println().

00057   {
00058     if (commandText == null || commandText.trim().equals(""))
00059     {
00060       console.printError(ConsoleTranslate
00061           .get("admin.command.showbackend.state.no.input"));
00062       return;
00063     }
00064     StringTokenizer st = new StringTokenizer(commandText);
00065 
00066     String backendName = st.nextToken();
00067 
00068     if (!jmxClient.getVirtualDatabaseProxy(dbName, user, password)
00069         .getAllBackendNames().contains(backendName))
00070       console.printError(ConsoleTranslate.get(
00071           "admin.command.showbackend.state.invalid.backend", backendName));
00072 
00073     int count = 0;
00074     if (st.hasMoreTokens())
00075     {
00076       try
00077       {
00078         count = Integer.parseInt(st.nextToken());
00079       }
00080       catch (NumberFormatException e)
00081       {
00082       }
00083     }
00084     boolean fromFirst = true;
00085     if (st.hasMoreTokens())
00086       fromFirst = Boolean.valueOf(st.nextToken()).booleanValue();
00087     boolean clone = false;
00088     if (st.hasMoreTokens())
00089       clone = Boolean.valueOf(st.nextToken()).booleanValue();
00090 
00091     console.println(ConsoleTranslate.get(
00092         "admin.command.showbackend.state.echo", new Object[]{backendName,
00093             String.valueOf(count), String.valueOf(fromFirst),
00094             String.valueOf(clone)}));
00095     DatabaseBackendMBean db = jmxClient.getDatabaseBackendProxy(dbName,
00096         backendName, user, password);
00097 
00098     ArrayList list = db.getActiveTransactions();
00099     console.printInfo(ConsoleTranslate
00100         .get("admin.command.showbackend.state.state"));
00101     console.println(db.getState());
00102     console.printInfo(ConsoleTranslate
00103         .get("admin.command.showbackend.state.active.transactions"));
00104     for (int i = 0; i < list.size(); i++)
00105     {
00106       if (i != 0)
00107         console.print(",");
00108       console.print(list.get(i).toString());
00109     }
00110     console.println();
00111     console.printInfo(ConsoleTranslate
00112         .get("admin.command.showbackend.state.pending.requests"));
00113     try
00114     {
00115       list = db.getPendingRequestsDescription(count, fromFirst, clone);
00116       for (int i = 0; i < list.size(); i++)
00117         console.println((String) list.get(i));
00118     }
00119     catch (Exception e)
00120     {
00121       e.printStackTrace();
00122     }
00123   }


The documentation for this class was generated from the following file:
Generated on Mon Apr 11 22:03:01 2005 for C-JDBC by  doxygen 1.3.9.1