incubator-kato-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From monte...@apache.org
Subject svn commit: r883384 [41/47] - in /incubator/kato/trunk/org.apache.kato: ./ kato.anttasks/src/main/java/org/apache/kato/anttasks/ kato.anttasks/src/main/java/org/apache/kato/anttasks/sitebuilder/ kato.anttasks/src/main/java/org/apache/kato/anttasks/tck/...
Date Mon, 23 Nov 2009 15:54:15 GMT
Modified: incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/QuitCommand.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/QuitCommand.java?rev=883384&r1=883383&r2=883384&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/QuitCommand.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/QuitCommand.java Mon Nov 23 15:53:48 2009
@@ -1,43 +1,43 @@
-/*******************************************************************************
- * 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.
- ******************************************************************************/
-package org.apache.kato.katoview.commands;
-
-import java.util.HashMap;
-import java.util.Stack;
-
-import javax.tools.diagnostics.image.Image;
-
-import org.apache.kato.katoview.Output;
-
-
-public class QuitCommand extends Command {
-	
-	public QuitCommand(Output o){
-		super(o, "quit", "exits the core file viewing tool",
-				"parameters: none\n\n" +
-				"exits the core file viewing tool; any log files that are " +
-				"currently open will be closed prior to exit\n"
-		);
-		child_commands = null;
-	}
-	
-	public void doCommand(Stack args, Image loadedImage, HashMap properties){
-		if (!args.isEmpty())
-		{
-			out.error("\"quit\" does not take any parameters");
-			return;
-		}
-		properties.put("quit", "on");
-	}
-}
+/*******************************************************************************
+ * 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.
+ ******************************************************************************/
+package org.apache.kato.katoview.commands;
+
+import java.util.HashMap;
+import java.util.Stack;
+
+import javax.tools.diagnostics.image.Image;
+
+import org.apache.kato.katoview.Output;
+
+
+public class QuitCommand extends Command {
+	
+	public QuitCommand(Output o){
+		super(o, "quit", "exits the core file viewing tool",
+				"parameters: none\n\n" +
+				"exits the core file viewing tool; any log files that are " +
+				"currently open will be closed prior to exit\n"
+		);
+		child_commands = null;
+	}
+	
+	public void doCommand(Stack args, Image loadedImage, HashMap properties){
+		if (!args.isEmpty())
+		{
+			out.error("\"quit\" does not take any parameters");
+			return;
+		}
+		properties.put("quit", "on");
+	}
+}

Propchange: incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/QuitCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/RootCommand.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/RootCommand.java?rev=883384&r1=883383&r2=883384&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/RootCommand.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/RootCommand.java Mon Nov 23 15:53:48 2009
@@ -1,159 +1,159 @@
-/*******************************************************************************
- * 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.
- ******************************************************************************/
-package org.apache.kato.katoview.commands;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Stack;
-import java.util.Vector;
-
-import javax.tools.diagnostics.image.Image;
-
-import org.apache.kato.katoview.Output;
-
-
-public class RootCommand extends Command{
-
-	public RootCommand(Output o){
-		super(o, "", "", "");
-		
-		child_commands = new Vector();
-		child_commands.add(new InfoCommand(o));
-		child_commands.add(new HexdumpCommand(o));
-		child_commands.add(new HeapdumpCommand(o));
-		child_commands.add(new PlusCommand(o));
-		child_commands.add(new MinusCommand(o));
-		child_commands.add(new FindCommand(o));
-		child_commands.add(new DeadlockCommand(o));
-		child_commands.add(new TomcatCommand(o));
-		child_commands.add(new XPathCommand(o));
-		child_commands.add(new SetCommand(o));
-		child_commands.add(new ShowCommand(o));		
-		child_commands.add(new WhatisCommand(o));
-		child_commands.add(new CdCommand(o));
-		child_commands.add(new PwdCommand(o));
-		child_commands.add(new FindNextCommand(o));
-		child_commands.add(new FindPtrCommand(o));
-		child_commands.add(new HelpCommand(o, this));
-		child_commands.add(new XCommand(o));
-		child_commands.add(new ExitCommand(o));
-		child_commands.add(new QuitCommand(o));
-	}
-	
-	public void printHelp(String indent, int descOffset, Stack currArgs, Stack prevArgs)
-	{
-		if (currArgs.isEmpty())
-		{
-			// out of arguments; we should get our children to print their
-			//  short descriptions
-			out.print("\n");
-			Iterator itCommand = child_commands.iterator();
-			while (itCommand.hasNext())
-			{
-				Command command = (Command)itCommand.next();
-				
-				command.printHelp(indent, descOffset, null, prevArgs);
-			}
-			out.print("\n");
-			return;
-		}
-		
-		// ASSERT: !currArgs.isEmpty()
-		//  we've still got arguments left so we should keep on processing
-		String arg = (String)currArgs.pop();
-
-		// first, we need to process the "x/" command
-		if (arg.equals("x"))
-		{
-			if (!currArgs.isEmpty())
-			{
-				out.error("\"x\" command does not have any sub-commands; try \"x/\"");
-				return;
-			}
-			currArgs.push("x/");
-		}
-		else if (arg.startsWith("x/"))
-		{
-			String xSuffix = arg.substring(2);
-			if (!xSuffix.equals(""))
-			{
-				currArgs.push(xSuffix);
-			}
-			currArgs.push("x/");
-		}
-		else
-		{
-			currArgs.push(arg);
-		}
-		
-		arg = (String)currArgs.pop();
-		
-		// ASSERT: !currArgs.isEmpty() && null != child_commands
-		//  we've still got arguments left and we're an internal node in the command tree;
-		//  thus, we'll pass on the job to the next command down
-		Iterator itCommand = child_commands.iterator();
-		boolean found = false;
-		Command currCommand = null;
-		while (itCommand.hasNext() && !found)
-		{
-			currCommand = (Command)itCommand.next();
-			if (currCommand.getName().equals(arg))
-				found = true;
-		}
-		
-		if (found)
-		{
-			prevArgs.push(arg);
-			currCommand.printHelp(indent, descOffset, currArgs, prevArgs);
-		}
-		else
-		{
-			out.error("\"" + arg + "\" is not a command");
-			return;
-		}
-	}
-	
-	public void doCommand(Stack args, Image loadedImage, HashMap properties)
-	{
-		String nextCommand = null;
-		
-		if (!args.isEmpty())
-		{
-			nextCommand = (String)args.pop();
-		}
-		else
-		{
-			out.error("specified command requires additional subcommand");
-			return;
-		}
-		nextCommand = nextCommand.toLowerCase();
-		
-		if (nextCommand.equals("x"))
-		{
-			args.push(null);	// signifies empty set of parameters for "x" command
-			args.push("x/");
-		}
-		else if (nextCommand.startsWith("x/"))
-		{
-			args.push(nextCommand.substring(2));	// push parameters for "x" command
-			args.push("x/");
-		}
-		else
-		{
-			args.push(nextCommand);
-		}
-		super.doCommand(args, loadedImage, properties);
-	}
-}
-
+/*******************************************************************************
+ * 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.
+ ******************************************************************************/
+package org.apache.kato.katoview.commands;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Stack;
+import java.util.Vector;
+
+import javax.tools.diagnostics.image.Image;
+
+import org.apache.kato.katoview.Output;
+
+
+public class RootCommand extends Command{
+
+	public RootCommand(Output o){
+		super(o, "", "", "");
+		
+		child_commands = new Vector();
+		child_commands.add(new InfoCommand(o));
+		child_commands.add(new HexdumpCommand(o));
+		child_commands.add(new HeapdumpCommand(o));
+		child_commands.add(new PlusCommand(o));
+		child_commands.add(new MinusCommand(o));
+		child_commands.add(new FindCommand(o));
+		child_commands.add(new DeadlockCommand(o));
+		child_commands.add(new TomcatCommand(o));
+		child_commands.add(new XPathCommand(o));
+		child_commands.add(new SetCommand(o));
+		child_commands.add(new ShowCommand(o));		
+		child_commands.add(new WhatisCommand(o));
+		child_commands.add(new CdCommand(o));
+		child_commands.add(new PwdCommand(o));
+		child_commands.add(new FindNextCommand(o));
+		child_commands.add(new FindPtrCommand(o));
+		child_commands.add(new HelpCommand(o, this));
+		child_commands.add(new XCommand(o));
+		child_commands.add(new ExitCommand(o));
+		child_commands.add(new QuitCommand(o));
+	}
+	
+	public void printHelp(String indent, int descOffset, Stack currArgs, Stack prevArgs)
+	{
+		if (currArgs.isEmpty())
+		{
+			// out of arguments; we should get our children to print their
+			//  short descriptions
+			out.print("\n");
+			Iterator itCommand = child_commands.iterator();
+			while (itCommand.hasNext())
+			{
+				Command command = (Command)itCommand.next();
+				
+				command.printHelp(indent, descOffset, null, prevArgs);
+			}
+			out.print("\n");
+			return;
+		}
+		
+		// ASSERT: !currArgs.isEmpty()
+		//  we've still got arguments left so we should keep on processing
+		String arg = (String)currArgs.pop();
+
+		// first, we need to process the "x/" command
+		if (arg.equals("x"))
+		{
+			if (!currArgs.isEmpty())
+			{
+				out.error("\"x\" command does not have any sub-commands; try \"x/\"");
+				return;
+			}
+			currArgs.push("x/");
+		}
+		else if (arg.startsWith("x/"))
+		{
+			String xSuffix = arg.substring(2);
+			if (!xSuffix.equals(""))
+			{
+				currArgs.push(xSuffix);
+			}
+			currArgs.push("x/");
+		}
+		else
+		{
+			currArgs.push(arg);
+		}
+		
+		arg = (String)currArgs.pop();
+		
+		// ASSERT: !currArgs.isEmpty() && null != child_commands
+		//  we've still got arguments left and we're an internal node in the command tree;
+		//  thus, we'll pass on the job to the next command down
+		Iterator itCommand = child_commands.iterator();
+		boolean found = false;
+		Command currCommand = null;
+		while (itCommand.hasNext() && !found)
+		{
+			currCommand = (Command)itCommand.next();
+			if (currCommand.getName().equals(arg))
+				found = true;
+		}
+		
+		if (found)
+		{
+			prevArgs.push(arg);
+			currCommand.printHelp(indent, descOffset, currArgs, prevArgs);
+		}
+		else
+		{
+			out.error("\"" + arg + "\" is not a command");
+			return;
+		}
+	}
+	
+	public void doCommand(Stack args, Image loadedImage, HashMap properties)
+	{
+		String nextCommand = null;
+		
+		if (!args.isEmpty())
+		{
+			nextCommand = (String)args.pop();
+		}
+		else
+		{
+			out.error("specified command requires additional subcommand");
+			return;
+		}
+		nextCommand = nextCommand.toLowerCase();
+		
+		if (nextCommand.equals("x"))
+		{
+			args.push(null);	// signifies empty set of parameters for "x" command
+			args.push("x/");
+		}
+		else if (nextCommand.startsWith("x/"))
+		{
+			args.push(nextCommand.substring(2));	// push parameters for "x" command
+			args.push("x/");
+		}
+		else
+		{
+			args.push(nextCommand);
+		}
+		super.doCommand(args, loadedImage, properties);
+	}
+}
+

Propchange: incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/RootCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/SetCommand.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/SetCommand.java?rev=883384&r1=883383&r2=883384&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/SetCommand.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/SetCommand.java Mon Nov 23 15:53:48 2009
@@ -1,33 +1,33 @@
-/*******************************************************************************
- * 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.
- ******************************************************************************/
-package org.apache.kato.katoview.commands;
-
-import java.util.Vector;
-
-import org.apache.kato.katoview.Output;
-import org.apache.kato.katoview.commands.setcommands.SetHeapdumpCommand;
-import org.apache.kato.katoview.commands.setcommands.SetLoggingCommand;
-
-
-public class SetCommand extends Command {
-
-	public SetCommand(Output o){
-		super(o, "set", "", "");
-		
-		child_commands = new Vector();
-		child_commands.add(new SetLoggingCommand(o));
-		child_commands.add(new SetHeapdumpCommand(o));
-	}
-
-}
+/*******************************************************************************
+ * 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.
+ ******************************************************************************/
+package org.apache.kato.katoview.commands;
+
+import java.util.Vector;
+
+import org.apache.kato.katoview.Output;
+import org.apache.kato.katoview.commands.setcommands.SetHeapdumpCommand;
+import org.apache.kato.katoview.commands.setcommands.SetLoggingCommand;
+
+
+public class SetCommand extends Command {
+
+	public SetCommand(Output o){
+		super(o, "set", "", "");
+		
+		child_commands = new Vector();
+		child_commands.add(new SetLoggingCommand(o));
+		child_commands.add(new SetHeapdumpCommand(o));
+	}
+
+}

Propchange: incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/SetCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/ShowCommand.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/ShowCommand.java?rev=883384&r1=883383&r2=883384&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/ShowCommand.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/ShowCommand.java Mon Nov 23 15:53:48 2009
@@ -1,33 +1,33 @@
-/*******************************************************************************
- * 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.
- ******************************************************************************/
-package org.apache.kato.katoview.commands;
-
-import java.util.Vector;
-
-import org.apache.kato.katoview.Output;
-import org.apache.kato.katoview.commands.showcommands.ShowHeapdumpCommand;
-import org.apache.kato.katoview.commands.showcommands.ShowLoggingCommand;
-
-
-public class ShowCommand extends Command {
-
-	public ShowCommand(Output o){
-		super(o, "show", "", "");
-		
-		child_commands = new Vector();
-		child_commands.add(new ShowLoggingCommand(o));
-		child_commands.add(new ShowHeapdumpCommand(o));
-	}
-
-}
+/*******************************************************************************
+ * 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.
+ ******************************************************************************/
+package org.apache.kato.katoview.commands;
+
+import java.util.Vector;
+
+import org.apache.kato.katoview.Output;
+import org.apache.kato.katoview.commands.showcommands.ShowHeapdumpCommand;
+import org.apache.kato.katoview.commands.showcommands.ShowLoggingCommand;
+
+
+public class ShowCommand extends Command {
+
+	public ShowCommand(Output o){
+		super(o, "show", "", "");
+		
+		child_commands = new Vector();
+		child_commands.add(new ShowLoggingCommand(o));
+		child_commands.add(new ShowHeapdumpCommand(o));
+	}
+
+}

Propchange: incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/ShowCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/TomcatCommand.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/TomcatCommand.java?rev=883384&r1=883383&r2=883384&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/TomcatCommand.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/TomcatCommand.java Mon Nov 23 15:53:48 2009
@@ -1,42 +1,42 @@
-/*******************************************************************************
- * 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.
- ******************************************************************************/
-package org.apache.kato.katoview.commands;
-
-import java.util.Vector;
-
-import org.apache.kato.katoview.Output;
-import org.apache.kato.katoview.commands.tomcat.TomcatJSPCommand;
-import org.apache.kato.katoview.commands.tomcat.TomcatThreadPoolsCommand;
-import org.apache.kato.katoview.commands.tomcat.TomcatVersionCommand;
-
-/**
- * Provides commands for querying a Tomcat 5.5 server.
- * 
- *
- */
-public class TomcatCommand extends Command {
-	private static final String COMMAND_NAME="tomcat";
-	private static final String DESCRIPTION="Tomcat support commands";
-	private static final String LONG_DESCRIPTION="Tomcat support commands";
-	
-	protected TomcatCommand(Output o) {
-		super(o, COMMAND_NAME, DESCRIPTION, LONG_DESCRIPTION);
-		child_commands = new Vector();
-		child_commands.add(new TomcatVersionCommand(o));
-		child_commands.add(new TomcatThreadPoolsCommand(o));
-		child_commands.add(new TomcatJSPCommand(o));
-
-	}
-	
-}
+/*******************************************************************************
+ * 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.
+ ******************************************************************************/
+package org.apache.kato.katoview.commands;
+
+import java.util.Vector;
+
+import org.apache.kato.katoview.Output;
+import org.apache.kato.katoview.commands.tomcat.TomcatJSPCommand;
+import org.apache.kato.katoview.commands.tomcat.TomcatThreadPoolsCommand;
+import org.apache.kato.katoview.commands.tomcat.TomcatVersionCommand;
+
+/**
+ * Provides commands for querying a Tomcat 5.5 server.
+ * 
+ *
+ */
+public class TomcatCommand extends Command {
+	private static final String COMMAND_NAME="tomcat";
+	private static final String DESCRIPTION="Tomcat support commands";
+	private static final String LONG_DESCRIPTION="Tomcat support commands";
+	
+	protected TomcatCommand(Output o) {
+		super(o, COMMAND_NAME, DESCRIPTION, LONG_DESCRIPTION);
+		child_commands = new Vector();
+		child_commands.add(new TomcatVersionCommand(o));
+		child_commands.add(new TomcatThreadPoolsCommand(o));
+		child_commands.add(new TomcatJSPCommand(o));
+
+	}
+	
+}

Propchange: incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/TomcatCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/WhatisCommand.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/WhatisCommand.java?rev=883384&r1=883383&r2=883384&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/WhatisCommand.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/WhatisCommand.java Mon Nov 23 15:53:48 2009
@@ -1,262 +1,262 @@
-/*******************************************************************************
- * 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.
- ******************************************************************************/
-package org.apache.kato.katoview.commands;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Stack;
-
-import javax.tools.diagnostics.image.CorruptDataException;
-import javax.tools.diagnostics.image.DataUnavailable;
-import javax.tools.diagnostics.image.Image;
-import javax.tools.diagnostics.image.ImageSection;
-import javax.tools.diagnostics.runtime.ManagedRuntime;
-import javax.tools.diagnostics.runtime.java.JavaClass;
-import javax.tools.diagnostics.runtime.java.JavaHeap;
-import javax.tools.diagnostics.runtime.java.JavaMethod;
-import javax.tools.diagnostics.runtime.java.JavaObject;
-import javax.tools.diagnostics.runtime.java.JavaRuntime;
-
-import org.apache.kato.katoview.Output;
-import org.apache.kato.katoview.commands.helpers.Utils;
-
-
-public class WhatisCommand extends Command {
-
-	public WhatisCommand(Output o){
-		super(o, "whatis", "gives information about what is stored at the given memory address",
-				"parameters: <hex_address>\n\n" +
-				"the whatis command examines the memory location at <hex_address> and tries to find out more information about this address " +
-				"- for example whether it is within an object in a heap or within the byte codes associated with a class method."
-				);
-		child_commands = null;
-	}
-	
-	public void doCommand(Stack args, Image loadedImage, HashMap systemProperties){
-		if(0 == args.size()){
-			out.error("missing address argument");
-			return;
-		}
-		String address = (String)args.pop();
-		Long lAddressInDecimal = Utils.longFromString(address);
-		if (null == lAddressInDecimal){
-			out.error("cannot convert \"" + address + "\" to numeric value"); 
-			return;
-		}
-		long addressInDecimal = lAddressInDecimal.longValue();
-		
-		findInImage(loadedImage, addressInDecimal);
-		
-		out.print("\n");
-	}
-	
-	private void findInImage(Image loadedImage, long address)
-	{
-		ManagedRuntime mr;
-		Iterator itRuntime = Utils.getRuntimes(loadedImage);
-		int count = 1;
-
-		out.print("\n");
-		while (itRuntime.hasNext()) {
-			mr = (ManagedRuntime)itRuntime.next();
-			if (mr instanceof JavaRuntime)
-			{
-				out.print("\truntime #" + count + "\n");
-				
-				findInRuntime((JavaRuntime)mr, address);
-			}
-			count++;
-		}
-	}
-	
-	private void findInRuntime(JavaRuntime jr, long address)
-	{
-		JavaHeap jh;
-		Iterator itHeap = jr.getHeaps().iterator();
-		int count = 1;
-		
-		while (itHeap.hasNext()) {
-			jh = (JavaHeap)itHeap.next();
-			
-			out.print("\t  heap #" + count + " - name: ");
-			out.print(jh.getName() + "\n");
-			
-			findInHeap(jh, address);
-			count++;
-		}
-	}
-	
-	private void findInHeap(JavaHeap jh, long address)
-	{
-		//TODO: checkWithinValidMemRange(sb, ...);
-		
-		if (isWithinImageSections(jh.getSections().iterator(), null, false, address)){
-			//if it's start or within the range of an object
-			if (!isStartOfObj(jh.getObjects().iterator(), address)){
-				if (!isWithinObjectRange(jh.getObjects().iterator(), address)){
-					out.print("\t\t0x" + Long.toHexString(address) + " is orphaned on the heap.\n");
-				}
-			}
-		}
-		else{
-			out.print("\t\t0x" + Long.toHexString(address) + " is not within this heap.\n");
-			//TODO : function to indicate 16 or 32 bit 
-			long bound = 12; //bounds default to 16 for 32 bit system.
-			checkClassInRange(jh.getObjects().iterator(), bound, address);
-		}
-		
-		checkMethodInRange(jh.getObjects().iterator(), address);
-	}
-	
-	
-	
-	private void checkMethodInRange(Iterator objects, long address){
-		while(objects.hasNext()){
-			JavaObject jObject = (JavaObject)objects.next();
-			JavaClass jClass;
-			try{
-				jClass = jObject.getJavaClass();
-			}catch(CorruptDataException cde){
-				//go to the next iteration
-				continue;
-			}
-			Iterator methods = jClass.getDeclaredMethods().iterator();
-			while(methods.hasNext()){
-				JavaMethod jMethod = (JavaMethod)methods.next();
-				Iterator bytecodeSections = jMethod.getBytecodeSections().iterator();
-				Iterator compiledSections = jMethod.getCompiledSections().iterator();
-				isWithinImageSections(bytecodeSections, jMethod, false, address);
-				isWithinImageSections(compiledSections, jMethod, true, address);
-			}
-		}
-	}
-
-/*	TODO: need to implement some output for this method and use it
-	private void checkMonitorInRange(Iterator monitors){
-		while(monitors.hasNext()){
-			JavaMonitor jMonitor = (JavaMonitor)monitors.next();
-			//TODO: need API for retrieving monitor ID (address)
-			//sb.append("\n" + "monitor object id: " + jMonitor.getObject().getID().getAddress());
-		}
-	}
-*/
-	
-	private void checkClassInRange(Iterator objects, long bound, long address){
-		long startAddress, endAddress ;
-		while(objects.hasNext()){
-			JavaObject jObject = (JavaObject)objects.next();
-			JavaClass jClass;
-			String className;
-			try{
-				jClass = jObject.getJavaClass();
-				className = jClass.getName();
-			}catch(CorruptDataException cde){
-				//TODO exception handling
-				continue;
-			}
-			startAddress = jClass.getID().getAddress();
-			endAddress = startAddress + bound;
-			if(address == startAddress){
-				out.print("0x" + Long.toHexString(address) +
-						" is the address of the java/lang/Class object for " + className);
-				return;
-			}
-			if (isWithinRange(startAddress, endAddress, address)){
-				out.print("0x" + Long.toHexString(address) 
-						+ " is within the java/lang/Class object for " + className);
-				return;
-			}
-		}
-	}
-	
-	private boolean isWithinObjectRange(Iterator objects, long address){
-		long startAddress, endAddress ;
-		String className;
-		while(objects.hasNext()){
-			JavaObject jObject = (JavaObject)objects.next();
-			try{
-				className = jObject.getJavaClass().getName();
-				startAddress = jObject.getID().getAddress();
-				endAddress = startAddress + jObject.getSize();
-			}catch(CorruptDataException cde){
-				//TODO exception handling
-				continue;
-			}
-			if (isWithinRange(startAddress, endAddress, address)){
-				out.print("\t\t0x" + Long.toHexString(address) + " is within an object on the heap:\n" + 
-						"\t\t\toffset " + (address - startAddress) + " within "+ className +
-						" instance @ 0x" + Long.toHexString(startAddress) + "\n");
-				return true;
-			}
-		}
-		return false;
-	}
-	
-	private boolean isWithinRange(long startAddress, long endAddress, long address){
-		return (address <= endAddress && address > startAddress);
-	}
-	
-	private boolean isStartOfObj(Iterator objects, long address){
-		String className;
-		while(objects.hasNext()){
-			JavaObject jObject = (JavaObject)objects.next();
-			if (address == jObject.getID().getAddress()){
-				try{
-					className = jObject.getJavaClass().getName();
-				}catch(CorruptDataException cde){
-					className = "N/A (CorruptDataException occurred)";
-				}
-				out.print("0x" + Long.toHexString(address) + " is start of an object of type " + className);
-				return true;
-			}
-		}
-		return false;
-	}
-	
-	private boolean isWithinImageSections(Iterator heapImageSections, Object memType,
-	  boolean isMethodCompiled, long address)
-	{
-		while (heapImageSections.hasNext()){
-			ImageSection imageSection = (ImageSection)heapImageSections.next();
-			long baseAddress = imageSection.getBaseAddress().getAddress();
-			long size = imageSection.getSize();
-			long endAddress = baseAddress + size;
-			
-			if (address <= endAddress  && address >= baseAddress) {
-				if (null == memType) {
-					out.print("\t\t0x" + Long.toHexString(address) + " is within heap segment: " +  
-							Long.toHexString(baseAddress) + " -- " + Long.toHexString(endAddress) + "\n");
-					return true;
-				}
-				if (memType instanceof JavaMethod) {
-					String methodName = "N/A", methodSig = "N/A", className = "N/A";
-					try{
-						methodName = ((JavaMethod)memType).getName();
-						methodSig = ((JavaMethod)memType).getSignature();
-						className = ((JavaMethod)memType).getDeclaringClass().getName();
-					}catch(CorruptDataException cde){				
-					}catch(DataUnavailable du){
-					}
-					String codeType = isMethodCompiled ? "compiled code" : "byte code";
-					out.print("0x" + Long.toHexString(address) + " is within the " + codeType + " range: " +  
-							Long.toHexString(baseAddress) + " -- " + Long.toHexString(endAddress) + "\n\t" +  "...of method " +
-							methodName + " with signature " + methodSig + "\n\t" + 
-							"...in class " + className + "\n");
-					return true;
-				}
-			}
-		}
-		return false;
-	}
-}
+/*******************************************************************************
+ * 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.
+ ******************************************************************************/
+package org.apache.kato.katoview.commands;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Stack;
+
+import javax.tools.diagnostics.image.CorruptDataException;
+import javax.tools.diagnostics.image.DataUnavailable;
+import javax.tools.diagnostics.image.Image;
+import javax.tools.diagnostics.image.ImageSection;
+import javax.tools.diagnostics.runtime.ManagedRuntime;
+import javax.tools.diagnostics.runtime.java.JavaClass;
+import javax.tools.diagnostics.runtime.java.JavaHeap;
+import javax.tools.diagnostics.runtime.java.JavaMethod;
+import javax.tools.diagnostics.runtime.java.JavaObject;
+import javax.tools.diagnostics.runtime.java.JavaRuntime;
+
+import org.apache.kato.katoview.Output;
+import org.apache.kato.katoview.commands.helpers.Utils;
+
+
+public class WhatisCommand extends Command {
+
+	public WhatisCommand(Output o){
+		super(o, "whatis", "gives information about what is stored at the given memory address",
+				"parameters: <hex_address>\n\n" +
+				"the whatis command examines the memory location at <hex_address> and tries to find out more information about this address " +
+				"- for example whether it is within an object in a heap or within the byte codes associated with a class method."
+				);
+		child_commands = null;
+	}
+	
+	public void doCommand(Stack args, Image loadedImage, HashMap systemProperties){
+		if(0 == args.size()){
+			out.error("missing address argument");
+			return;
+		}
+		String address = (String)args.pop();
+		Long lAddressInDecimal = Utils.longFromString(address);
+		if (null == lAddressInDecimal){
+			out.error("cannot convert \"" + address + "\" to numeric value"); 
+			return;
+		}
+		long addressInDecimal = lAddressInDecimal.longValue();
+		
+		findInImage(loadedImage, addressInDecimal);
+		
+		out.print("\n");
+	}
+	
+	private void findInImage(Image loadedImage, long address)
+	{
+		ManagedRuntime mr;
+		Iterator itRuntime = Utils.getRuntimes(loadedImage);
+		int count = 1;
+
+		out.print("\n");
+		while (itRuntime.hasNext()) {
+			mr = (ManagedRuntime)itRuntime.next();
+			if (mr instanceof JavaRuntime)
+			{
+				out.print("\truntime #" + count + "\n");
+				
+				findInRuntime((JavaRuntime)mr, address);
+			}
+			count++;
+		}
+	}
+	
+	private void findInRuntime(JavaRuntime jr, long address)
+	{
+		JavaHeap jh;
+		Iterator itHeap = jr.getHeaps().iterator();
+		int count = 1;
+		
+		while (itHeap.hasNext()) {
+			jh = (JavaHeap)itHeap.next();
+			
+			out.print("\t  heap #" + count + " - name: ");
+			out.print(jh.getName() + "\n");
+			
+			findInHeap(jh, address);
+			count++;
+		}
+	}
+	
+	private void findInHeap(JavaHeap jh, long address)
+	{
+		//TODO: checkWithinValidMemRange(sb, ...);
+		
+		if (isWithinImageSections(jh.getSections().iterator(), null, false, address)){
+			//if it's start or within the range of an object
+			if (!isStartOfObj(jh.getObjects().iterator(), address)){
+				if (!isWithinObjectRange(jh.getObjects().iterator(), address)){
+					out.print("\t\t0x" + Long.toHexString(address) + " is orphaned on the heap.\n");
+				}
+			}
+		}
+		else{
+			out.print("\t\t0x" + Long.toHexString(address) + " is not within this heap.\n");
+			//TODO : function to indicate 16 or 32 bit 
+			long bound = 12; //bounds default to 16 for 32 bit system.
+			checkClassInRange(jh.getObjects().iterator(), bound, address);
+		}
+		
+		checkMethodInRange(jh.getObjects().iterator(), address);
+	}
+	
+	
+	
+	private void checkMethodInRange(Iterator objects, long address){
+		while(objects.hasNext()){
+			JavaObject jObject = (JavaObject)objects.next();
+			JavaClass jClass;
+			try{
+				jClass = jObject.getJavaClass();
+			}catch(CorruptDataException cde){
+				//go to the next iteration
+				continue;
+			}
+			Iterator methods = jClass.getDeclaredMethods().iterator();
+			while(methods.hasNext()){
+				JavaMethod jMethod = (JavaMethod)methods.next();
+				Iterator bytecodeSections = jMethod.getBytecodeSections().iterator();
+				Iterator compiledSections = jMethod.getCompiledSections().iterator();
+				isWithinImageSections(bytecodeSections, jMethod, false, address);
+				isWithinImageSections(compiledSections, jMethod, true, address);
+			}
+		}
+	}
+
+/*	TODO: need to implement some output for this method and use it
+	private void checkMonitorInRange(Iterator monitors){
+		while(monitors.hasNext()){
+			JavaMonitor jMonitor = (JavaMonitor)monitors.next();
+			//TODO: need API for retrieving monitor ID (address)
+			//sb.append("\n" + "monitor object id: " + jMonitor.getObject().getID().getAddress());
+		}
+	}
+*/
+	
+	private void checkClassInRange(Iterator objects, long bound, long address){
+		long startAddress, endAddress ;
+		while(objects.hasNext()){
+			JavaObject jObject = (JavaObject)objects.next();
+			JavaClass jClass;
+			String className;
+			try{
+				jClass = jObject.getJavaClass();
+				className = jClass.getName();
+			}catch(CorruptDataException cde){
+				//TODO exception handling
+				continue;
+			}
+			startAddress = jClass.getID().getAddress();
+			endAddress = startAddress + bound;
+			if(address == startAddress){
+				out.print("0x" + Long.toHexString(address) +
+						" is the address of the java/lang/Class object for " + className);
+				return;
+			}
+			if (isWithinRange(startAddress, endAddress, address)){
+				out.print("0x" + Long.toHexString(address) 
+						+ " is within the java/lang/Class object for " + className);
+				return;
+			}
+		}
+	}
+	
+	private boolean isWithinObjectRange(Iterator objects, long address){
+		long startAddress, endAddress ;
+		String className;
+		while(objects.hasNext()){
+			JavaObject jObject = (JavaObject)objects.next();
+			try{
+				className = jObject.getJavaClass().getName();
+				startAddress = jObject.getID().getAddress();
+				endAddress = startAddress + jObject.getSize();
+			}catch(CorruptDataException cde){
+				//TODO exception handling
+				continue;
+			}
+			if (isWithinRange(startAddress, endAddress, address)){
+				out.print("\t\t0x" + Long.toHexString(address) + " is within an object on the heap:\n" + 
+						"\t\t\toffset " + (address - startAddress) + " within "+ className +
+						" instance @ 0x" + Long.toHexString(startAddress) + "\n");
+				return true;
+			}
+		}
+		return false;
+	}
+	
+	private boolean isWithinRange(long startAddress, long endAddress, long address){
+		return (address <= endAddress && address > startAddress);
+	}
+	
+	private boolean isStartOfObj(Iterator objects, long address){
+		String className;
+		while(objects.hasNext()){
+			JavaObject jObject = (JavaObject)objects.next();
+			if (address == jObject.getID().getAddress()){
+				try{
+					className = jObject.getJavaClass().getName();
+				}catch(CorruptDataException cde){
+					className = "N/A (CorruptDataException occurred)";
+				}
+				out.print("0x" + Long.toHexString(address) + " is start of an object of type " + className);
+				return true;
+			}
+		}
+		return false;
+	}
+	
+	private boolean isWithinImageSections(Iterator heapImageSections, Object memType,
+	  boolean isMethodCompiled, long address)
+	{
+		while (heapImageSections.hasNext()){
+			ImageSection imageSection = (ImageSection)heapImageSections.next();
+			long baseAddress = imageSection.getBaseAddress().getAddress();
+			long size = imageSection.getSize();
+			long endAddress = baseAddress + size;
+			
+			if (address <= endAddress  && address >= baseAddress) {
+				if (null == memType) {
+					out.print("\t\t0x" + Long.toHexString(address) + " is within heap segment: " +  
+							Long.toHexString(baseAddress) + " -- " + Long.toHexString(endAddress) + "\n");
+					return true;
+				}
+				if (memType instanceof JavaMethod) {
+					String methodName = "N/A", methodSig = "N/A", className = "N/A";
+					try{
+						methodName = ((JavaMethod)memType).getName();
+						methodSig = ((JavaMethod)memType).getSignature();
+						className = ((JavaMethod)memType).getDeclaringClass().getName();
+					}catch(CorruptDataException cde){				
+					}catch(DataUnavailable du){
+					}
+					String codeType = isMethodCompiled ? "compiled code" : "byte code";
+					out.print("0x" + Long.toHexString(address) + " is within the " + codeType + " range: " +  
+							Long.toHexString(baseAddress) + " -- " + Long.toHexString(endAddress) + "\n\t" +  "...of method " +
+							methodName + " with signature " + methodSig + "\n\t" + 
+							"...in class " + className + "\n");
+					return true;
+				}
+			}
+		}
+		return false;
+	}
+}

Propchange: incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/WhatisCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/XCommand.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/XCommand.java?rev=883384&r1=883383&r2=883384&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/XCommand.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/XCommand.java Mon Nov 23 15:53:48 2009
@@ -1,236 +1,236 @@
-/*******************************************************************************
- * 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.
- ******************************************************************************/
-package org.apache.kato.katoview.commands;
-
-import java.util.HashMap;
-import java.util.Stack;
-import java.util.Vector;
-
-import javax.tools.diagnostics.image.Image;
-
-import org.apache.kato.katoview.Output;
-import org.apache.kato.katoview.commands.xcommands.XDCommand;
-import org.apache.kato.katoview.commands.xcommands.XJCommand;
-import org.apache.kato.katoview.commands.xcommands.XKCommand;
-import org.apache.kato.katoview.commands.xcommands.XXCommand;
-
-
-public class XCommand extends Command {
-	
-	public XCommand(Output o){
-		super(o, "x/", "works like \"x/\" in gdb (including use of defaults): passes " +
-				"number of items to display and unit " +
-				"size ('b' for byte, 'h' for halfword, 'w' for word, 'g' for giant " +
-				"word) to sub-command (ie. x/12bd)",
-
-				""
-		);
-		
-		child_commands = new Vector();
-		child_commands.add(new XJCommand(o));
-		child_commands.add(new XDCommand(o));
-		child_commands.add(new XXCommand(o));
-		child_commands.add(new XKCommand(o));
-		
-		// note: do NOT add any of the following:
-		//  - XBCommand
-		//  - XHCommand
-		//  - XWCommand
-		//  - XGCommand
-		
-		// why not?  because 'b', 'h', 'w', and 'g' represent unit sizes and
-		//  the parser won't know whether you mean a unit size or a display format
-		//  if you use any of the above characters for a display format
-	}
-
-	public void doCommand(Stack args, Image loadedImage, HashMap properties)
-	{
-		String arg;
-		
-		if (!args.isEmpty())
-		{
-			arg = (String)args.pop();
-		}
-		else
-		{
-			out.error("\"x/\" command requires additional parameters");
-			return;
-		}
-		
-		int n;
-		Character unitSize;
-		Character displayFormat;
-		
-		if (null == arg || arg.equals(""))
-		{
-			// user didn't specify any parameters; use the defaults
-			n = 1;
-			unitSize = getDefaultUnitSize(properties);
-			displayFormat = getDefaultDisplayFormat(properties);
-		}
-		else
-		{
-			n = 0;
-			int i;
-			for (i = 0; i < arg.length() && Character.isDigit(arg.charAt(i)); i++)
-			{
-				n *= 10;
-				n += Character.getNumericValue(arg.charAt(i)); 
-			}
-		
-			if (0 == n)
-				n = 1;
-			
-			displayFormat = null;
-			unitSize = null;
-			
-			if (i < arg.length())
-			{
-				char currChar = arg.charAt(i);
-				switch (currChar)
-				{
-				case 'b':
-				case 'h':
-				case 'w':
-				case 'g':
-					unitSize = new Character(currChar);
-					break;
-				default:
-					displayFormat = new Character(currChar);
-					break;
-				}
-				i++;
-			}
-			
-			if (i < arg.length())
-			{
-				char currChar = arg.charAt(i);
-				switch (currChar)
-				{
-				case 'b':
-				case 'h':
-				case 'w':
-				case 'g':
-					if (null == unitSize)
-					{
-						unitSize = new Character(currChar);
-					}
-					else
-					{
-						out.error("first letter after \"x/\" was a unit size character; " +
-								"second letter (if specified) must be a display " +
-								"format letter but it was also a unit size character");
-						return;
-					}
-					break;
-				default:
-					if (null == displayFormat)
-					{
-						displayFormat = new Character(currChar);
-					}
-					else
-					{
-						out.error("first letter after \"x/\" was a display format character; " +
-								"second letter (if specified) must be a unit size " +
-								"letter but it was also a display format character");
-						return;
-					}
-					break;
-				}
-				i++;
-			}
-			
-			if (arg.length() != i)
-			{
-				out.error("too many letters after \"x/\"; the \"x/\" command accepts at " +
-						"most two letters, a display format character and a unit " +
-						"size character");
-				return;
-			}
-			
-			// we now have all the necessary information to put on the stack (except
-			//  for the unspecified parameters that assume use of defaults) so let's
-			//  get the required default values and push some parameters back on to
-			//  the argument stack
-			
-			if (null == unitSize) {
-				unitSize = getDefaultUnitSize(properties);
-			} else {
-				setDefaultUnitSize(properties, unitSize);
-			}
-			
-			if (null == displayFormat) {
-				displayFormat = getDefaultDisplayFormat(properties);
-			} else {
-				setDefaultDisplayFormat(properties, displayFormat);
-			}
-		}
-		
-		Integer nUnitSize = null;
-		char cUnitSize = unitSize.charValue();
-		
-		switch (cUnitSize)
-		{
-		case 'b':
-			nUnitSize = new Integer(1);
-			break;
-		case 'h':
-			nUnitSize = new Integer(2);
-			break;
-		case 'w':
-			nUnitSize = new Integer(4);
-			break;
-		case 'g':
-			nUnitSize = new Integer(8);
-			break;
-		}
-		
-		// we can pretty much guarantee that nUnitSize is not null here because
-		//  unitSize has to be one of the above 4 characters if it isn't null
-		
-		args.push(nUnitSize);	// add the unit size to the stack
-		args.push(new Integer(n));	// add the number of units to print to the stack
-		args.push(displayFormat.toString());	// add the display format as a String
-		
-		super.doCommand(args, loadedImage, properties);
-	}
-	
-	private Character getDefaultUnitSize(HashMap properties)
-	{
-		Character defaultUnitSize = (Character)properties.get("x_default_unit_size");
-		if (null == defaultUnitSize)
-			return new Character('w');
-		else
-			return defaultUnitSize;
-	}
-	
-	private Character getDefaultDisplayFormat(HashMap properties)
-	{
-		Character defaultDisplayFormat = (Character)properties.get("x_default_display_format");
-		if (null == defaultDisplayFormat)
-			return new Character('x');
-		else
-			return defaultDisplayFormat;
-	}
-	
-	private void setDefaultUnitSize(HashMap properties, Character defaultUnitSize)
-	{
-		properties.put("x_default_unit_size", defaultUnitSize);
-	}
-	
-	private void setDefaultDisplayFormat(HashMap properties, Character defaultDisplayFormat)
-	{
-		properties.put("x_default_display_format", defaultDisplayFormat);
-	}
-}
+/*******************************************************************************
+ * 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.
+ ******************************************************************************/
+package org.apache.kato.katoview.commands;
+
+import java.util.HashMap;
+import java.util.Stack;
+import java.util.Vector;
+
+import javax.tools.diagnostics.image.Image;
+
+import org.apache.kato.katoview.Output;
+import org.apache.kato.katoview.commands.xcommands.XDCommand;
+import org.apache.kato.katoview.commands.xcommands.XJCommand;
+import org.apache.kato.katoview.commands.xcommands.XKCommand;
+import org.apache.kato.katoview.commands.xcommands.XXCommand;
+
+
+public class XCommand extends Command {
+	
+	public XCommand(Output o){
+		super(o, "x/", "works like \"x/\" in gdb (including use of defaults): passes " +
+				"number of items to display and unit " +
+				"size ('b' for byte, 'h' for halfword, 'w' for word, 'g' for giant " +
+				"word) to sub-command (ie. x/12bd)",
+
+				""
+		);
+		
+		child_commands = new Vector();
+		child_commands.add(new XJCommand(o));
+		child_commands.add(new XDCommand(o));
+		child_commands.add(new XXCommand(o));
+		child_commands.add(new XKCommand(o));
+		
+		// note: do NOT add any of the following:
+		//  - XBCommand
+		//  - XHCommand
+		//  - XWCommand
+		//  - XGCommand
+		
+		// why not?  because 'b', 'h', 'w', and 'g' represent unit sizes and
+		//  the parser won't know whether you mean a unit size or a display format
+		//  if you use any of the above characters for a display format
+	}
+
+	public void doCommand(Stack args, Image loadedImage, HashMap properties)
+	{
+		String arg;
+		
+		if (!args.isEmpty())
+		{
+			arg = (String)args.pop();
+		}
+		else
+		{
+			out.error("\"x/\" command requires additional parameters");
+			return;
+		}
+		
+		int n;
+		Character unitSize;
+		Character displayFormat;
+		
+		if (null == arg || arg.equals(""))
+		{
+			// user didn't specify any parameters; use the defaults
+			n = 1;
+			unitSize = getDefaultUnitSize(properties);
+			displayFormat = getDefaultDisplayFormat(properties);
+		}
+		else
+		{
+			n = 0;
+			int i;
+			for (i = 0; i < arg.length() && Character.isDigit(arg.charAt(i)); i++)
+			{
+				n *= 10;
+				n += Character.getNumericValue(arg.charAt(i)); 
+			}
+		
+			if (0 == n)
+				n = 1;
+			
+			displayFormat = null;
+			unitSize = null;
+			
+			if (i < arg.length())
+			{
+				char currChar = arg.charAt(i);
+				switch (currChar)
+				{
+				case 'b':
+				case 'h':
+				case 'w':
+				case 'g':
+					unitSize = new Character(currChar);
+					break;
+				default:
+					displayFormat = new Character(currChar);
+					break;
+				}
+				i++;
+			}
+			
+			if (i < arg.length())
+			{
+				char currChar = arg.charAt(i);
+				switch (currChar)
+				{
+				case 'b':
+				case 'h':
+				case 'w':
+				case 'g':
+					if (null == unitSize)
+					{
+						unitSize = new Character(currChar);
+					}
+					else
+					{
+						out.error("first letter after \"x/\" was a unit size character; " +
+								"second letter (if specified) must be a display " +
+								"format letter but it was also a unit size character");
+						return;
+					}
+					break;
+				default:
+					if (null == displayFormat)
+					{
+						displayFormat = new Character(currChar);
+					}
+					else
+					{
+						out.error("first letter after \"x/\" was a display format character; " +
+								"second letter (if specified) must be a unit size " +
+								"letter but it was also a display format character");
+						return;
+					}
+					break;
+				}
+				i++;
+			}
+			
+			if (arg.length() != i)
+			{
+				out.error("too many letters after \"x/\"; the \"x/\" command accepts at " +
+						"most two letters, a display format character and a unit " +
+						"size character");
+				return;
+			}
+			
+			// we now have all the necessary information to put on the stack (except
+			//  for the unspecified parameters that assume use of defaults) so let's
+			//  get the required default values and push some parameters back on to
+			//  the argument stack
+			
+			if (null == unitSize) {
+				unitSize = getDefaultUnitSize(properties);
+			} else {
+				setDefaultUnitSize(properties, unitSize);
+			}
+			
+			if (null == displayFormat) {
+				displayFormat = getDefaultDisplayFormat(properties);
+			} else {
+				setDefaultDisplayFormat(properties, displayFormat);
+			}
+		}
+		
+		Integer nUnitSize = null;
+		char cUnitSize = unitSize.charValue();
+		
+		switch (cUnitSize)
+		{
+		case 'b':
+			nUnitSize = new Integer(1);
+			break;
+		case 'h':
+			nUnitSize = new Integer(2);
+			break;
+		case 'w':
+			nUnitSize = new Integer(4);
+			break;
+		case 'g':
+			nUnitSize = new Integer(8);
+			break;
+		}
+		
+		// we can pretty much guarantee that nUnitSize is not null here because
+		//  unitSize has to be one of the above 4 characters if it isn't null
+		
+		args.push(nUnitSize);	// add the unit size to the stack
+		args.push(new Integer(n));	// add the number of units to print to the stack
+		args.push(displayFormat.toString());	// add the display format as a String
+		
+		super.doCommand(args, loadedImage, properties);
+	}
+	
+	private Character getDefaultUnitSize(HashMap properties)
+	{
+		Character defaultUnitSize = (Character)properties.get("x_default_unit_size");
+		if (null == defaultUnitSize)
+			return new Character('w');
+		else
+			return defaultUnitSize;
+	}
+	
+	private Character getDefaultDisplayFormat(HashMap properties)
+	{
+		Character defaultDisplayFormat = (Character)properties.get("x_default_display_format");
+		if (null == defaultDisplayFormat)
+			return new Character('x');
+		else
+			return defaultDisplayFormat;
+	}
+	
+	private void setDefaultUnitSize(HashMap properties, Character defaultUnitSize)
+	{
+		properties.put("x_default_unit_size", defaultUnitSize);
+	}
+	
+	private void setDefaultDisplayFormat(HashMap properties, Character defaultDisplayFormat)
+	{
+		properties.put("x_default_display_format", defaultDisplayFormat);
+	}
+}

Propchange: incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/XCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/XPathCommand.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/XPathCommand.java?rev=883384&r1=883383&r2=883384&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/XPathCommand.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/XPathCommand.java Mon Nov 23 15:53:48 2009
@@ -1,135 +1,135 @@
-/*******************************************************************************
- * 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.
- ******************************************************************************/
-package org.apache.kato.katoview.commands;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Stack;
-
-import javax.tools.diagnostics.image.Image;
-import javax.tools.diagnostics.image.ImageAddressSpace;
-import javax.tools.diagnostics.image.ImageProcess;
-import javax.tools.diagnostics.runtime.java.JavaRuntime;
-
-import org.apache.commons.jxpath.JXPathContext;
-import org.apache.kato.katoview.Output;
-
-/**
- * Provides access to Kato API using JXPath
- * 
- *
- */
-public class XPathCommand extends Command {
-	private static final String COMMAND_NAME="xpath";
-	private static final String DESCRIPTION="JXPath API support";
-	private static final String LONG_DESCRIPTION=
-		"\"xpath\" command\n"+
-		"parameters, space separated:\n"+
-		"\t[runtime] <xpath query>\n\n"+
-		"The xpath commands executes a JXPath query against the Kato api.\n"+
-		"By default, this is from the Image object, with the runtime option\n"+
-		"the query is executed against the JavaRuntime object.\n\n"+
-		"This example prints out the names of all java threads:\n"+
-		"\txpath addressSpaces/currentProcess/runtimes/threads/name\n\n"+
-		"Results are prefix with an index e.g. 1:\thello\n\n"
-		;
-	
-	protected XPathCommand(Output o) {
-		super(o, COMMAND_NAME, DESCRIPTION, LONG_DESCRIPTION);
-		child_commands = null;
-
-	}
-	
-	public void doCommand(Stack args, Image loadedImage, HashMap properties) {
-		String path = "";				
-		
-		JavaRuntime runtime=null;
-		
-		if (args.size() == 0 || args.size() > 2) {
-			out.println(LONG_DESCRIPTION);
-			return;
-		} else if (args.size() == 1) {
-			path = (String) args.get(0);
-			
-		} else if (args.size() == 2) {
-			if (args.get(1).equals("runtime")) {
-				JavaRuntime rt=getJavaRuntime(loadedImage);
-				if(rt==null) {
-					out.println("Unable to locate Java Runtime");
-					return;
-					
-				}
-				runtime=rt;
-				path = (String) args.get(0);
-			} else {
-				out.println(LONG_DESCRIPTION);
-				return;
-			}
-		}
-		
-		
-		JXPathContext context =null;
-		if(runtime!=null) {
-			context = JXPathContext.newContext(runtime);
-		}
-		else {
-			context=JXPathContext.newContext(loadedImage);
-		}
-		
-		Iterator values = context.iterate(path);
-
-		int count=1;
-		while (values.hasNext()) {
-			Object value = values.next();
-			if(value==null) {
-				out.println(count+":\tnull");
-			}
-			else if (value instanceof String) {
-				out.println(count+":\t"+"\""+((String) value)+"\"");		
-			} else if (value instanceof Number) {
-				out.println(count+":\t"+value.toString());
-			} else if (value instanceof Character) {
-				out.println(count+":\t"+"'"+((Character)value).charValue()+"'");
-			} else {
-				out.println(count+":\t"+value.toString());
-			}
-			count++;
-		}
-	}
-
-	/**
-	 * retrieves first javaruntime from image
-	 * 
-	 * @param loadedImage
-	 * 
-	 * @return
-	 */
-	private JavaRuntime getJavaRuntime(Image loadedImage) {
-		
-		for(Object space:loadedImage.getAddressSpaces()) {
-			if(space instanceof  ImageAddressSpace ) {
-				ImageAddressSpace addr=(ImageAddressSpace) space;
-				ImageProcess process=addr.getCurrentProcess();
-				if(process!=null) {
-					for(Object rt:process.getRuntimes()) {
-						if(rt instanceof JavaRuntime) return (JavaRuntime) rt;
-					}
-				}
-				
-			}
-		}
-		return null;
-	}
-
-}
+/*******************************************************************************
+ * 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.
+ ******************************************************************************/
+package org.apache.kato.katoview.commands;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Stack;
+
+import javax.tools.diagnostics.image.Image;
+import javax.tools.diagnostics.image.ImageAddressSpace;
+import javax.tools.diagnostics.image.ImageProcess;
+import javax.tools.diagnostics.runtime.java.JavaRuntime;
+
+import org.apache.commons.jxpath.JXPathContext;
+import org.apache.kato.katoview.Output;
+
+/**
+ * Provides access to Kato API using JXPath
+ * 
+ *
+ */
+public class XPathCommand extends Command {
+	private static final String COMMAND_NAME="xpath";
+	private static final String DESCRIPTION="JXPath API support";
+	private static final String LONG_DESCRIPTION=
+		"\"xpath\" command\n"+
+		"parameters, space separated:\n"+
+		"\t[runtime] <xpath query>\n\n"+
+		"The xpath commands executes a JXPath query against the Kato api.\n"+
+		"By default, this is from the Image object, with the runtime option\n"+
+		"the query is executed against the JavaRuntime object.\n\n"+
+		"This example prints out the names of all java threads:\n"+
+		"\txpath addressSpaces/currentProcess/runtimes/threads/name\n\n"+
+		"Results are prefix with an index e.g. 1:\thello\n\n"
+		;
+	
+	protected XPathCommand(Output o) {
+		super(o, COMMAND_NAME, DESCRIPTION, LONG_DESCRIPTION);
+		child_commands = null;
+
+	}
+	
+	public void doCommand(Stack args, Image loadedImage, HashMap properties) {
+		String path = "";				
+		
+		JavaRuntime runtime=null;
+		
+		if (args.size() == 0 || args.size() > 2) {
+			out.println(LONG_DESCRIPTION);
+			return;
+		} else if (args.size() == 1) {
+			path = (String) args.get(0);
+			
+		} else if (args.size() == 2) {
+			if (args.get(1).equals("runtime")) {
+				JavaRuntime rt=getJavaRuntime(loadedImage);
+				if(rt==null) {
+					out.println("Unable to locate Java Runtime");
+					return;
+					
+				}
+				runtime=rt;
+				path = (String) args.get(0);
+			} else {
+				out.println(LONG_DESCRIPTION);
+				return;
+			}
+		}
+		
+		
+		JXPathContext context =null;
+		if(runtime!=null) {
+			context = JXPathContext.newContext(runtime);
+		}
+		else {
+			context=JXPathContext.newContext(loadedImage);
+		}
+		
+		Iterator values = context.iterate(path);
+
+		int count=1;
+		while (values.hasNext()) {
+			Object value = values.next();
+			if(value==null) {
+				out.println(count+":\tnull");
+			}
+			else if (value instanceof String) {
+				out.println(count+":\t"+"\""+((String) value)+"\"");		
+			} else if (value instanceof Number) {
+				out.println(count+":\t"+value.toString());
+			} else if (value instanceof Character) {
+				out.println(count+":\t"+"'"+((Character)value).charValue()+"'");
+			} else {
+				out.println(count+":\t"+value.toString());
+			}
+			count++;
+		}
+	}
+
+	/**
+	 * retrieves first javaruntime from image
+	 * 
+	 * @param loadedImage
+	 * 
+	 * @return
+	 */
+	private JavaRuntime getJavaRuntime(Image loadedImage) {
+		
+		for(Object space:loadedImage.getAddressSpaces()) {
+			if(space instanceof  ImageAddressSpace ) {
+				ImageAddressSpace addr=(ImageAddressSpace) space;
+				ImageProcess process=addr.getCurrentProcess();
+				if(process!=null) {
+					for(Object rt:process.getRuntimes()) {
+						if(rt instanceof JavaRuntime) return (JavaRuntime) rt;
+					}
+				}
+				
+			}
+		}
+		return null;
+	}
+
+}

Propchange: incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/XPathCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message