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 [46/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/setcommands/SetLoggingCommand.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/setcommands/SetLoggingCommand.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/setcommands/SetLoggingCommand.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/setcommands/SetLoggingCommand.java Mon Nov 23 15:53:48 2009
@@ -1,308 +1,308 @@
-/*******************************************************************************
- * 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.setcommands;
-
-import java.util.HashMap;
-import java.util.Stack;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-
-import javax.tools.diagnostics.image.Image;
-
-import org.apache.kato.katoview.FileOutputChannel;
-import org.apache.kato.katoview.Output;
-import org.apache.kato.katoview.commands.Command;
-import org.apache.kato.katoview.commands.helpers.Utils;
-
-
-public class SetLoggingCommand extends Command {
-
-	public SetLoggingCommand(Output o){
-		super(o, "logging", "configures several logging-related parameters, " +
-				"starts/stops logging",
-				
-				"parameters: [on|off], file <filename>, overwrite [on|off], " +
-				"redirect [on|off]\n\n" +
-				"- [on|off] - turns logging on or off (default: off)\n" +
-				"- file <filename> - sets the file to log to; this will be relative " +
-				"to the directory returned by the \"pwd\" command unless an " +
-				"absolute path is specified; if the file is set while logging is on, " +
-				"the change will take effect the next time logging is started " +
-				"(default: <not set>)\n" +
-				"- overwrite [on|off] - turns overwriting of the specified log file " +
-				"on or off (off means that the log file will be appended to); if " +
-				"this is on, the log file will be cleared every time \"set logging " +
-				"on\" is run (default: off)\n" +
-				"- redirect [on|off] - turns redirecting to file on or off (on means " +
-				"that non-error output goes only to the log file (not the console) " +
-				"when logging is on, off means that non-error output goes to both " +
-				"the console and the log file); redirection must be turned off " +
-				"logging can be turned off (default: off)\n"
-		);
-		child_commands = null;
-	}
-	
-	public void doCommand(Stack args, Image loadedImage, HashMap properties){
-		if (args.isEmpty())
-		{
-			out.error("\"set logging\" requires at least one parameter");
-			return;
-		}
-
-		String arg1 = (String)args.pop();
-		if (arg1.equals("on"))
-		{
-			if (!args.isEmpty())
-			{
-				out.error("\"set logging on\" does not take any additional parameters");
-				return;
-			}
-			
-			String logging = (String)properties.get("set_logging");
-			if (null != logging && logging.equals("on"))
-			{
-				out.error("logging is already turned on");
-				return;
-			}
-			
-			String filename = (String)properties.get("set_logging_file");
-			if (null == filename)
-			{
-				out.error("log file not yet set; set log file with \"set logging file <filename>\"");
-				return;
-			}
-			
-			File logfile = Utils.absPath(properties, filename);
-			String filepath = logfile.getPath();
-			FileWriter f;
-			try {
-				f = new FileWriter(logfile, appendToFile(properties));
-			} catch (IOException e) {
-				f = null;
-				out.error("IOException encountered while opening file \"" + filepath +
-						"\"; make sure the file can be written to");
-				return;
-			}
-
-			out.addChannel(new FileOutputChannel(f), true);
-			properties.put("set_logging", "on");
-			properties.put("current_logging_file", filepath);
-			
-			out.print("\n");
-			out.print("\tlogging turned on; outputting to \"" + filepath + "\"");
-			out.print("\n\n");
-		}
-		else if (arg1.equals("off"))
-		{
-			if (!args.isEmpty())
-			{
-				out.error("\"set logging off\" does not take any additional parameters");
-				return;
-			}
-
-			String redirect = (String)properties.get("set_logging_redirect");
-			if (null != redirect && redirect.equals("on"))
-			{
-				out.error("cannot turn off logging when redirecting to only a file is " +
-						"turned on; turn off redirecting to only a file and try again");
-				return;
-			}
-
-			String logging = (String)properties.get("set_logging");
-			if (null == logging || logging.equals("off"))
-			{
-				out.error("logging is already turned off");
-				return;
-			}
-			
-			properties.put("set_logging", "off");
-			
-			out.print("\n");
-			out.print("\tlogging turned off; was logging to \"" +
-					(String)properties.get("current_logging_file") + "\"");
-			out.print("\n\n");
-			
-			out.removeFileChannel();
-			properties.put("current_logging_file", null);
-		}
-		else if (arg1.equals("file"))
-		{
-			if (args.isEmpty())
-			{
-				out.error("\"set logging file\" requires a filename parameter");
-				return;
-			}
-
-			String filename = (String)args.pop();
-			
-			if (!args.isEmpty())
-			{
-				out.error("\"set logging file\" takes exactly one parameter");
-				return;
-			}
-			
-			String oldFile = (String)properties.put("set_logging_file", filename);
-			
-			out.print("\n");
-			if (null == oldFile) {
-				out.print("\tlog file set to \"" + filename + "\"");
-			} else {
-				out.print("\tlog file changed from \"" + oldFile + "\" to \"" + filename + "\"");
-			}
-			out.print("\n\n");
-		}
-		else if (arg1.equals("overwrite"))
-		{
-			if (args.isEmpty())
-			{
-				out.error("\"set logging overwrite\" requires on/off parameter");
-				return;
-			}
-
-			String param = (String)args.pop();
-			
-			if (!args.isEmpty())
-			{
-				out.error("\"set logging overwrite\" takes exactly one parameter");
-				return;
-			}
-			
-			if (param.equals("on"))
-			{
-				String oldParam;
-				oldParam = (String)properties.put("set_logging_overwrite", "on");
-				
-				if (null == oldParam || oldParam.equals("off"))
-				{
-					out.print("\n");
-					out.print("\toverwriting of log file option changed from \"off\" to \"on\"");
-					out.print("\n\n");
-				}
-				else
-				{
-					out.print("\n");
-					out.print("\toverwriting of log file option not changed (already \"on\")");
-					out.print("\n\n");
-				}
-			}
-			else if (param.equals("off"))
-			{
-				String oldParam;
-				oldParam = (String)properties.put("set_logging_overwrite", "off");
-				
-				if (null == oldParam || oldParam.equals("off"))
-				{
-					out.print("\n");
-					out.print("\toverwriting of log file option not changed (already \"off\")");
-					out.print("\n\n");
-				}
-				else
-				{
-					out.print("\n");
-					out.print("\toverwriting of log file option changed from \"on\" to \"off\"");
-					out.print("\n\n");
-				}
-			}
-			else
-			{
-				out.error("parameter for \"set logging overwrite\" must be \"on\" or \"off\"");
-				return;
-			}
-		}
-		else if (arg1.equals("redirect"))
-		{
-			if (args.isEmpty())
-			{
-				out.error("\"set logging redirect\" requires on/off parameter");
-				return;
-			}
-
-			String param = (String)args.pop();
-			
-			if (!args.isEmpty())
-			{
-				out.error("\"set logging redirect\" takes exactly one parameter");
-				return;
-			}
-
-			if (param.equals("on"))
-			{
-				String logging = (String)properties.get("set_logging");
-				if (null == logging || logging.equals("off"))
-				{
-					out.error("cannot redirect to only a file because logging is off; " +
-							"turn logging on and try again");
-					return;
-				}
-				
-				String oldParam;
-				oldParam = (String)properties.put("set_logging_redirect", "on");
-				
-				if (null == oldParam || oldParam.equals("off"))
-				{
-					out.print("\n");
-					out.print("\tredirecting to file only option changed from \"off\" to \"on\"");
-					out.print("\n\n");
-					out.setConsoleNoPrint(true);
-				}
-				else
-				{
-					out.print("\n");
-					out.print("\tredirecting to file only option not changed (already \"on\")");
-					out.print("\n\n");
-				}
-			}
-			else if (param.equals("off"))
-			{
-				String oldParam;
-				oldParam = (String)properties.put("set_logging_redirect", "off");
-				
-				if (null == oldParam || oldParam.equals("off"))
-				{
-					out.print("\n");
-					out.print("\tredirecting to file only option not changed (already \"off\")");
-					out.print("\n\n");
-				}
-				else
-				{
-					out.setConsoleNoPrint(false);
-					out.print("\n");
-					out.print("\tredirecting to file only option changed from \"on\" to \"off\"");
-					out.print("\n\n");
-				}
-			}
-			else
-			{
-				out.error("parameter for \"set logging redirect\" must be \"on\" or \"off\"");
-				return;
-			}
-		}
-		else
-		{
-			out.error("\"" + arg1 + "\" is not a valid parameter for the \"set logging\" command");
-			return;
-		}
-	}
-	
-	private boolean appendToFile(HashMap properties)
-	{
-		String append = (String)properties.get("set_logging_overwrite");
-		if (append == null || !append.equals("on"))
-			return true;
-		else
-			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.setcommands;
+
+import java.util.HashMap;
+import java.util.Stack;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+
+import javax.tools.diagnostics.image.Image;
+
+import org.apache.kato.katoview.FileOutputChannel;
+import org.apache.kato.katoview.Output;
+import org.apache.kato.katoview.commands.Command;
+import org.apache.kato.katoview.commands.helpers.Utils;
+
+
+public class SetLoggingCommand extends Command {
+
+	public SetLoggingCommand(Output o){
+		super(o, "logging", "configures several logging-related parameters, " +
+				"starts/stops logging",
+				
+				"parameters: [on|off], file <filename>, overwrite [on|off], " +
+				"redirect [on|off]\n\n" +
+				"- [on|off] - turns logging on or off (default: off)\n" +
+				"- file <filename> - sets the file to log to; this will be relative " +
+				"to the directory returned by the \"pwd\" command unless an " +
+				"absolute path is specified; if the file is set while logging is on, " +
+				"the change will take effect the next time logging is started " +
+				"(default: <not set>)\n" +
+				"- overwrite [on|off] - turns overwriting of the specified log file " +
+				"on or off (off means that the log file will be appended to); if " +
+				"this is on, the log file will be cleared every time \"set logging " +
+				"on\" is run (default: off)\n" +
+				"- redirect [on|off] - turns redirecting to file on or off (on means " +
+				"that non-error output goes only to the log file (not the console) " +
+				"when logging is on, off means that non-error output goes to both " +
+				"the console and the log file); redirection must be turned off " +
+				"logging can be turned off (default: off)\n"
+		);
+		child_commands = null;
+	}
+	
+	public void doCommand(Stack args, Image loadedImage, HashMap properties){
+		if (args.isEmpty())
+		{
+			out.error("\"set logging\" requires at least one parameter");
+			return;
+		}
+
+		String arg1 = (String)args.pop();
+		if (arg1.equals("on"))
+		{
+			if (!args.isEmpty())
+			{
+				out.error("\"set logging on\" does not take any additional parameters");
+				return;
+			}
+			
+			String logging = (String)properties.get("set_logging");
+			if (null != logging && logging.equals("on"))
+			{
+				out.error("logging is already turned on");
+				return;
+			}
+			
+			String filename = (String)properties.get("set_logging_file");
+			if (null == filename)
+			{
+				out.error("log file not yet set; set log file with \"set logging file <filename>\"");
+				return;
+			}
+			
+			File logfile = Utils.absPath(properties, filename);
+			String filepath = logfile.getPath();
+			FileWriter f;
+			try {
+				f = new FileWriter(logfile, appendToFile(properties));
+			} catch (IOException e) {
+				f = null;
+				out.error("IOException encountered while opening file \"" + filepath +
+						"\"; make sure the file can be written to");
+				return;
+			}
+
+			out.addChannel(new FileOutputChannel(f), true);
+			properties.put("set_logging", "on");
+			properties.put("current_logging_file", filepath);
+			
+			out.print("\n");
+			out.print("\tlogging turned on; outputting to \"" + filepath + "\"");
+			out.print("\n\n");
+		}
+		else if (arg1.equals("off"))
+		{
+			if (!args.isEmpty())
+			{
+				out.error("\"set logging off\" does not take any additional parameters");
+				return;
+			}
+
+			String redirect = (String)properties.get("set_logging_redirect");
+			if (null != redirect && redirect.equals("on"))
+			{
+				out.error("cannot turn off logging when redirecting to only a file is " +
+						"turned on; turn off redirecting to only a file and try again");
+				return;
+			}
+
+			String logging = (String)properties.get("set_logging");
+			if (null == logging || logging.equals("off"))
+			{
+				out.error("logging is already turned off");
+				return;
+			}
+			
+			properties.put("set_logging", "off");
+			
+			out.print("\n");
+			out.print("\tlogging turned off; was logging to \"" +
+					(String)properties.get("current_logging_file") + "\"");
+			out.print("\n\n");
+			
+			out.removeFileChannel();
+			properties.put("current_logging_file", null);
+		}
+		else if (arg1.equals("file"))
+		{
+			if (args.isEmpty())
+			{
+				out.error("\"set logging file\" requires a filename parameter");
+				return;
+			}
+
+			String filename = (String)args.pop();
+			
+			if (!args.isEmpty())
+			{
+				out.error("\"set logging file\" takes exactly one parameter");
+				return;
+			}
+			
+			String oldFile = (String)properties.put("set_logging_file", filename);
+			
+			out.print("\n");
+			if (null == oldFile) {
+				out.print("\tlog file set to \"" + filename + "\"");
+			} else {
+				out.print("\tlog file changed from \"" + oldFile + "\" to \"" + filename + "\"");
+			}
+			out.print("\n\n");
+		}
+		else if (arg1.equals("overwrite"))
+		{
+			if (args.isEmpty())
+			{
+				out.error("\"set logging overwrite\" requires on/off parameter");
+				return;
+			}
+
+			String param = (String)args.pop();
+			
+			if (!args.isEmpty())
+			{
+				out.error("\"set logging overwrite\" takes exactly one parameter");
+				return;
+			}
+			
+			if (param.equals("on"))
+			{
+				String oldParam;
+				oldParam = (String)properties.put("set_logging_overwrite", "on");
+				
+				if (null == oldParam || oldParam.equals("off"))
+				{
+					out.print("\n");
+					out.print("\toverwriting of log file option changed from \"off\" to \"on\"");
+					out.print("\n\n");
+				}
+				else
+				{
+					out.print("\n");
+					out.print("\toverwriting of log file option not changed (already \"on\")");
+					out.print("\n\n");
+				}
+			}
+			else if (param.equals("off"))
+			{
+				String oldParam;
+				oldParam = (String)properties.put("set_logging_overwrite", "off");
+				
+				if (null == oldParam || oldParam.equals("off"))
+				{
+					out.print("\n");
+					out.print("\toverwriting of log file option not changed (already \"off\")");
+					out.print("\n\n");
+				}
+				else
+				{
+					out.print("\n");
+					out.print("\toverwriting of log file option changed from \"on\" to \"off\"");
+					out.print("\n\n");
+				}
+			}
+			else
+			{
+				out.error("parameter for \"set logging overwrite\" must be \"on\" or \"off\"");
+				return;
+			}
+		}
+		else if (arg1.equals("redirect"))
+		{
+			if (args.isEmpty())
+			{
+				out.error("\"set logging redirect\" requires on/off parameter");
+				return;
+			}
+
+			String param = (String)args.pop();
+			
+			if (!args.isEmpty())
+			{
+				out.error("\"set logging redirect\" takes exactly one parameter");
+				return;
+			}
+
+			if (param.equals("on"))
+			{
+				String logging = (String)properties.get("set_logging");
+				if (null == logging || logging.equals("off"))
+				{
+					out.error("cannot redirect to only a file because logging is off; " +
+							"turn logging on and try again");
+					return;
+				}
+				
+				String oldParam;
+				oldParam = (String)properties.put("set_logging_redirect", "on");
+				
+				if (null == oldParam || oldParam.equals("off"))
+				{
+					out.print("\n");
+					out.print("\tredirecting to file only option changed from \"off\" to \"on\"");
+					out.print("\n\n");
+					out.setConsoleNoPrint(true);
+				}
+				else
+				{
+					out.print("\n");
+					out.print("\tredirecting to file only option not changed (already \"on\")");
+					out.print("\n\n");
+				}
+			}
+			else if (param.equals("off"))
+			{
+				String oldParam;
+				oldParam = (String)properties.put("set_logging_redirect", "off");
+				
+				if (null == oldParam || oldParam.equals("off"))
+				{
+					out.print("\n");
+					out.print("\tredirecting to file only option not changed (already \"off\")");
+					out.print("\n\n");
+				}
+				else
+				{
+					out.setConsoleNoPrint(false);
+					out.print("\n");
+					out.print("\tredirecting to file only option changed from \"on\" to \"off\"");
+					out.print("\n\n");
+				}
+			}
+			else
+			{
+				out.error("parameter for \"set logging redirect\" must be \"on\" or \"off\"");
+				return;
+			}
+		}
+		else
+		{
+			out.error("\"" + arg1 + "\" is not a valid parameter for the \"set logging\" command");
+			return;
+		}
+	}
+	
+	private boolean appendToFile(HashMap properties)
+	{
+		String append = (String)properties.get("set_logging_overwrite");
+		if (append == null || !append.equals("on"))
+			return true;
+		else
+			return false;
+	}
+
+}

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

Modified: incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/showcommands/ShowHeapdumpCommand.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/showcommands/ShowHeapdumpCommand.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/showcommands/ShowHeapdumpCommand.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/showcommands/ShowHeapdumpCommand.java Mon Nov 23 15:53:48 2009
@@ -1,54 +1,54 @@
-/*******************************************************************************
- * 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.showcommands;
-
-import java.util.HashMap;
-import java.util.Stack;
-
-import javax.tools.diagnostics.image.Image;
-
-import org.apache.kato.katoview.Output;
-import org.apache.kato.katoview.commands.Command;
-import org.apache.kato.katoview.heapdump.HeapDumpSettings;
-
-
-public class ShowHeapdumpCommand extends Command
-{
-	public static final String COMMAND_NAME = "heapdump";
-	public static final String COMMAND_DESCRIPTION = "displays heapdump settings";
-	public static final String LONG_DESCRIPTION = "Parameters:none\n\n"
-		+ "Prints heapdump format and file name.\n"
-		+ "Use \"set heapdump\" to change settings\n";
-
-	public ShowHeapdumpCommand(Output o) {
-		super(o,COMMAND_NAME,COMMAND_DESCRIPTION,LONG_DESCRIPTION);
-	}
-
-	public void doCommand(Stack args, Image loadedImage, HashMap properties)
-	{
-		if(! args.isEmpty()) {
-			out.error("\"show heapdump\" does not take any parameters.");
-			return;
-		}
-		
-		out.print("Heapdump Settings:\n\n");
-		
-		out.print("\tFormat: " + (HeapDumpSettings.areHeapDumpsPHD(properties) ? "PHD" : "Classic (TXT)") + "\n");
-		out.print("\tFile Name: " + HeapDumpSettings.getFileName(properties) + "\n");
-		out.print("\tMultiple heaps will be written to " 
-				+ (HeapDumpSettings.multipleHeapsInMultipleFiles(properties) ? "multiple files":"a single file") 
-				+ "\n");
-	}
-	
-}
+/*******************************************************************************
+ * 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.showcommands;
+
+import java.util.HashMap;
+import java.util.Stack;
+
+import javax.tools.diagnostics.image.Image;
+
+import org.apache.kato.katoview.Output;
+import org.apache.kato.katoview.commands.Command;
+import org.apache.kato.katoview.heapdump.HeapDumpSettings;
+
+
+public class ShowHeapdumpCommand extends Command
+{
+	public static final String COMMAND_NAME = "heapdump";
+	public static final String COMMAND_DESCRIPTION = "displays heapdump settings";
+	public static final String LONG_DESCRIPTION = "Parameters:none\n\n"
+		+ "Prints heapdump format and file name.\n"
+		+ "Use \"set heapdump\" to change settings\n";
+
+	public ShowHeapdumpCommand(Output o) {
+		super(o,COMMAND_NAME,COMMAND_DESCRIPTION,LONG_DESCRIPTION);
+	}
+
+	public void doCommand(Stack args, Image loadedImage, HashMap properties)
+	{
+		if(! args.isEmpty()) {
+			out.error("\"show heapdump\" does not take any parameters.");
+			return;
+		}
+		
+		out.print("Heapdump Settings:\n\n");
+		
+		out.print("\tFormat: " + (HeapDumpSettings.areHeapDumpsPHD(properties) ? "PHD" : "Classic (TXT)") + "\n");
+		out.print("\tFile Name: " + HeapDumpSettings.getFileName(properties) + "\n");
+		out.print("\tMultiple heaps will be written to " 
+				+ (HeapDumpSettings.multipleHeapsInMultipleFiles(properties) ? "multiple files":"a single file") 
+				+ "\n");
+	}
+	
+}

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

Modified: incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/showcommands/ShowLoggingCommand.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/showcommands/ShowLoggingCommand.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/showcommands/ShowLoggingCommand.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/showcommands/ShowLoggingCommand.java Mon Nov 23 15:53:48 2009
@@ -1,87 +1,87 @@
-/*******************************************************************************
- * 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.showcommands;
-
-import java.util.HashMap;
-import java.util.Stack;
-
-import javax.tools.diagnostics.image.Image;
-
-import org.apache.kato.katoview.Output;
-import org.apache.kato.katoview.commands.Command;
-
-
-public class ShowLoggingCommand extends Command {
-
-	public ShowLoggingCommand(Output o){
-		super(o, "logging", "displays the current values of logging settings",
-				"parameters: none\n\n" +
-				"outputs following values, which are generally set by the \"set " +
-				 "logging\" command:\n" +
-				" set_logging = [on|off]\n" +
-				" set_logging_file = <filename>\n" +
-				" set_logging_overwrite = [on|off]\n" +
-				" set_logging_redirect = [on|off]\n" +
-				" current_logging_file = <filename> - file that is currently being " +
-				 "logged to; could be different than set_logging_file if that value " +
-				 "was changed after logging was started"
-				);
-		child_commands = null;
-	}
-	
-	public void doCommand(Stack args, Image loadedImage, HashMap properties){
-		if (!args.isEmpty())
-		{
-			out.error("\"show logging\" does not take any parameters");
-			return;
-		}
-		
-		String fileVal = (String)properties.get("set_logging_file");
-		if (null == fileVal)
-			fileVal = "<not set>";
-		else
-			fileVal = "\"" + fileVal + "\"";
-		
-		String currentFileVal = (String)properties.get("current_logging_file");
-		if (null == currentFileVal)
-			currentFileVal = "<not currently logging>";
-		else
-			currentFileVal = "\"" + currentFileVal + "\"";
-
-		out.print("\n");
-		printKeyVal(properties, "set_logging");
-		out.println("\t" + "set_logging_file" + " = " + fileVal);
-		printKeyVal(properties, "set_logging_overwrite");
-		printKeyVal(properties, "set_logging_redirect");
-		out.print("\n");
-		out.println("\t" + "current_logging_file" + " = " + currentFileVal);
-			
-		out.print("\n");
-	}
-	
-	private void printKeyVal(HashMap properties, String key)
-	{
-		out.println("\t" + key + " = " + getVal(properties, key));
-	}
-	
-	private String getVal(HashMap properties, String key)
-	{
-		String val = (String)properties.get(key);
-
-		if (null == val)
-			return "off";
-		else
-			return val;
-	}
-}
+/*******************************************************************************
+ * 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.showcommands;
+
+import java.util.HashMap;
+import java.util.Stack;
+
+import javax.tools.diagnostics.image.Image;
+
+import org.apache.kato.katoview.Output;
+import org.apache.kato.katoview.commands.Command;
+
+
+public class ShowLoggingCommand extends Command {
+
+	public ShowLoggingCommand(Output o){
+		super(o, "logging", "displays the current values of logging settings",
+				"parameters: none\n\n" +
+				"outputs following values, which are generally set by the \"set " +
+				 "logging\" command:\n" +
+				" set_logging = [on|off]\n" +
+				" set_logging_file = <filename>\n" +
+				" set_logging_overwrite = [on|off]\n" +
+				" set_logging_redirect = [on|off]\n" +
+				" current_logging_file = <filename> - file that is currently being " +
+				 "logged to; could be different than set_logging_file if that value " +
+				 "was changed after logging was started"
+				);
+		child_commands = null;
+	}
+	
+	public void doCommand(Stack args, Image loadedImage, HashMap properties){
+		if (!args.isEmpty())
+		{
+			out.error("\"show logging\" does not take any parameters");
+			return;
+		}
+		
+		String fileVal = (String)properties.get("set_logging_file");
+		if (null == fileVal)
+			fileVal = "<not set>";
+		else
+			fileVal = "\"" + fileVal + "\"";
+		
+		String currentFileVal = (String)properties.get("current_logging_file");
+		if (null == currentFileVal)
+			currentFileVal = "<not currently logging>";
+		else
+			currentFileVal = "\"" + currentFileVal + "\"";
+
+		out.print("\n");
+		printKeyVal(properties, "set_logging");
+		out.println("\t" + "set_logging_file" + " = " + fileVal);
+		printKeyVal(properties, "set_logging_overwrite");
+		printKeyVal(properties, "set_logging_redirect");
+		out.print("\n");
+		out.println("\t" + "current_logging_file" + " = " + currentFileVal);
+			
+		out.print("\n");
+	}
+	
+	private void printKeyVal(HashMap properties, String key)
+	{
+		out.println("\t" + key + " = " + getVal(properties, key));
+	}
+	
+	private String getVal(HashMap properties, String key)
+	{
+		String val = (String)properties.get(key);
+
+		if (null == val)
+			return "off";
+		else
+			return val;
+	}
+}

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

Modified: incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/tomcat/TomcatJSPCommand.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/tomcat/TomcatJSPCommand.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/tomcat/TomcatJSPCommand.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/tomcat/TomcatJSPCommand.java Mon Nov 23 15:53:48 2009
@@ -1,120 +1,120 @@
-/*******************************************************************************
- * 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.tomcat;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Stack;
-
-import javax.tools.diagnostics.image.CorruptData;
-import javax.tools.diagnostics.image.Image;
-import javax.tools.diagnostics.image.DiagnosticException;
-import javax.tools.diagnostics.runtime.java.JavaClass;
-import javax.tools.diagnostics.runtime.java.JavaLocation;
-import javax.tools.diagnostics.runtime.java.JavaObject;
-import javax.tools.diagnostics.runtime.java.JavaRuntime;
-import javax.tools.diagnostics.runtime.java.JavaStackFrame;
-import javax.tools.diagnostics.runtime.java.JavaThread;
-
-import org.apache.kato.katoview.Output;
-import org.apache.kato.katoview.commands.Command;
-import org.apache.kato.katoview.commands.helpers.JavaRuntimeVisitor;
-import org.apache.kato.katoview.commands.helpers.KatoSearch;
-
-/**
- * Retrieves the version of Tomcat in the dump, or displays an error.
- *
- */
-public class TomcatJSPCommand extends Command {
-	private static final String SHORT_DESCRIPTION = "Shows JSPS";
-	private static final String COMMAND_NAME = "jsp";
-	private static final String LONG_DESCRIPTION = "Reports tomcat's thread pool state.";
-	
-	// Look for this class.
-	private static final String JSP_CLASS="org/apache/jasper/runtime/HttpJspBase"; 
-
-	
-	public TomcatJSPCommand(Output o) {
-		super(o, COMMAND_NAME, SHORT_DESCRIPTION, LONG_DESCRIPTION);
-		
-		child_commands = null;
-	}
-
-	public void doCommand(Stack args, Image loadedImage, HashMap properties) {
-		try {
-			KatoSearch.visitRuntimes(loadedImage, new PrintJSP());
-		} catch (DiagnosticException e) {
-			e.printStackTrace();
-		}
-	}
-
-	/**
-	 * A visitor for finding the correct class and then return
-	 *
-	 */
-	private class PrintJSP implements JavaRuntimeVisitor {
-		boolean found = false;
-		JavaRuntime runtime;
-		
-		public void visit(JavaRuntime runtime) throws DiagnosticException {
-			found = false;
-			this.runtime = runtime;
-			List<JavaClass> jsps = KatoSearch.findClasses(runtime, JSP_CLASS);
-			
-			for (JavaClass jsp : jsps) {
-				// Avoid the JSP superclass itself.
-				if (JSP_CLASS.equals(jsp.getName())) {
-					continue;
-				}
-					
-				found = true;
-				out.println("Found JSP:  "+ jsp.getName() + ", instances: ");
-				
-				List<JavaObject> instances = KatoSearch.findInstances(runtime, jsp);
-				
-				for (JavaObject instance : instances) {
-					out.println("\t0x"+Long.toHexString(instance.getID().getAddress()));
-				}
-				out.println("\nJavaThread: ");
-				
-				List<JavaThread> threads = KatoSearch.findClassInThreads(runtime, jsp);
-				
-				for (JavaThread thread : threads) {					 
-					out.println("\tJava stack trace for thread `" + thread.getName() + "'");
-					out.println("\t=========================================================\n");
-					
-					for (Object nextFrame : thread.getStackFrames()) {
-						if (nextFrame instanceof CorruptData) {
-							continue;
-						}
-						
-						JavaLocation location = ((JavaStackFrame) nextFrame).getLocation();
-						
-						if (location != null) {
-							out.println("\t"+location);
-						}
-					}
-					out.println("");
-				}
-				out.println("");
-			}
-			
-			if (found == false) {
-				out.println("Couldn't find any JSPs");				
-			}
-		}
-
-		
-	}
+/*******************************************************************************
+ * 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.tomcat;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Stack;
+
+import javax.tools.diagnostics.image.CorruptData;
+import javax.tools.diagnostics.image.Image;
+import javax.tools.diagnostics.image.DiagnosticException;
+import javax.tools.diagnostics.runtime.java.JavaClass;
+import javax.tools.diagnostics.runtime.java.JavaLocation;
+import javax.tools.diagnostics.runtime.java.JavaObject;
+import javax.tools.diagnostics.runtime.java.JavaRuntime;
+import javax.tools.diagnostics.runtime.java.JavaStackFrame;
+import javax.tools.diagnostics.runtime.java.JavaThread;
+
+import org.apache.kato.katoview.Output;
+import org.apache.kato.katoview.commands.Command;
+import org.apache.kato.katoview.commands.helpers.JavaRuntimeVisitor;
+import org.apache.kato.katoview.commands.helpers.KatoSearch;
+
+/**
+ * Retrieves the version of Tomcat in the dump, or displays an error.
+ *
+ */
+public class TomcatJSPCommand extends Command {
+	private static final String SHORT_DESCRIPTION = "Shows JSPS";
+	private static final String COMMAND_NAME = "jsp";
+	private static final String LONG_DESCRIPTION = "Reports tomcat's thread pool state.";
+	
+	// Look for this class.
+	private static final String JSP_CLASS="org/apache/jasper/runtime/HttpJspBase"; 
+
+	
+	public TomcatJSPCommand(Output o) {
+		super(o, COMMAND_NAME, SHORT_DESCRIPTION, LONG_DESCRIPTION);
+		
+		child_commands = null;
+	}
+
+	public void doCommand(Stack args, Image loadedImage, HashMap properties) {
+		try {
+			KatoSearch.visitRuntimes(loadedImage, new PrintJSP());
+		} catch (DiagnosticException e) {
+			e.printStackTrace();
+		}
+	}
+
+	/**
+	 * A visitor for finding the correct class and then return
+	 *
+	 */
+	private class PrintJSP implements JavaRuntimeVisitor {
+		boolean found = false;
+		JavaRuntime runtime;
+		
+		public void visit(JavaRuntime runtime) throws DiagnosticException {
+			found = false;
+			this.runtime = runtime;
+			List<JavaClass> jsps = KatoSearch.findClasses(runtime, JSP_CLASS);
+			
+			for (JavaClass jsp : jsps) {
+				// Avoid the JSP superclass itself.
+				if (JSP_CLASS.equals(jsp.getName())) {
+					continue;
+				}
+					
+				found = true;
+				out.println("Found JSP:  "+ jsp.getName() + ", instances: ");
+				
+				List<JavaObject> instances = KatoSearch.findInstances(runtime, jsp);
+				
+				for (JavaObject instance : instances) {
+					out.println("\t0x"+Long.toHexString(instance.getID().getAddress()));
+				}
+				out.println("\nJavaThread: ");
+				
+				List<JavaThread> threads = KatoSearch.findClassInThreads(runtime, jsp);
+				
+				for (JavaThread thread : threads) {					 
+					out.println("\tJava stack trace for thread `" + thread.getName() + "'");
+					out.println("\t=========================================================\n");
+					
+					for (Object nextFrame : thread.getStackFrames()) {
+						if (nextFrame instanceof CorruptData) {
+							continue;
+						}
+						
+						JavaLocation location = ((JavaStackFrame) nextFrame).getLocation();
+						
+						if (location != null) {
+							out.println("\t"+location);
+						}
+					}
+					out.println("");
+				}
+				out.println("");
+			}
+			
+			if (found == false) {
+				out.println("Couldn't find any JSPs");				
+			}
+		}
+
+		
+	}
 }
\ No newline at end of file

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

Modified: incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/tomcat/TomcatThreadPoolsCommand.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/tomcat/TomcatThreadPoolsCommand.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/tomcat/TomcatThreadPoolsCommand.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/tomcat/TomcatThreadPoolsCommand.java Mon Nov 23 15:53:48 2009
@@ -1,109 +1,109 @@
-/*******************************************************************************
- * 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.tomcat;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Stack;
-
-import javax.tools.diagnostics.image.Image;
-import javax.tools.diagnostics.image.DiagnosticException;
-import javax.tools.diagnostics.runtime.java.JavaClass;
-import javax.tools.diagnostics.runtime.java.JavaField;
-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.Command;
-import org.apache.kato.katoview.commands.helpers.JavaClassVisitor;
-import org.apache.kato.katoview.commands.helpers.JavaRuntimeVisitor;
-import org.apache.kato.katoview.commands.helpers.KatoSearch;
-
-/**
- * Retrieves the version of Tomcat in the dump, or displays an error.
- *
- */
-public class TomcatThreadPoolsCommand extends Command {
-	private static final String SHORT_DESCRIPTION = "Shows thread pool state";
-	private static final String COMMAND_NAME = "pools";
-	private static final String LONG_DESCRIPTION = "Reports tomcat's thread pool state.";
-	
-	// Look for this class.
-	private static final String THREAD_POOL_CLASS="org/apache/tomcat/util/threads/ThreadPool"; 
-	private static final String POOL_NAME = "name",
-								CURRENT_BUSY = "currentThreadsBusy",
-								CURRENT_COUNT = "currentThreadCount";
-	
-	public TomcatThreadPoolsCommand(Output o) {
-		super(o, COMMAND_NAME, SHORT_DESCRIPTION, LONG_DESCRIPTION);
-		
-		child_commands = null;
-	}
-
-	public void doCommand(Stack args, Image loadedImage, HashMap properties) {
-		try {
-			KatoSearch.visitRuntimes(loadedImage, new PrintVersion());
-		} catch (DiagnosticException e) {
-			e.printStackTrace();
-		}
-	}
-
-	/**
-	 * A visitor for finding the correct class and then return
-	 *
-	 */
-	private class PrintVersion implements JavaRuntimeVisitor, JavaClassVisitor {
-		boolean found = false;
-		JavaRuntime runtime;
-		
-		public void visit(JavaRuntime runtime) throws DiagnosticException {
-			found = false;
-			this.runtime = runtime;
-			KatoSearch.visitClasses(runtime, this);
-			
-			if (found == false) {
-				out.println("ERROR: Couldn't find a Tomcat server");				
-			}
-		}
-
-		public boolean visit(JavaClass clazz) throws DiagnosticException {
-			if (clazz.getName().equals(THREAD_POOL_CLASS)) {
-				found = true;
-				JavaField nameField = KatoSearch.getField(clazz, POOL_NAME);
-				JavaField busyField = KatoSearch.getField(clazz, CURRENT_BUSY);
-				JavaField countField = KatoSearch.getField(clazz, CURRENT_COUNT);
-				
-				
-				List<JavaObject> instances = KatoSearch.findInstances(runtime, clazz);
-				if (instances.size() >0) {
-					out.println("Found thread pools");
-					for (JavaObject obj : instances) {
-						try {
-							out.println("Pool name:" + nameField.getString(obj)+", threads: "
-									+ countField.getInt(obj) +
-									", busy: " + busyField.getInt(obj));
-						
-						}catch (DiagnosticException e) {
-							e.printStackTrace();
-						}
-					}
-				}
-				
-				return false; // Stop searching through classes.
-			}
-			return true;
-		}
-		
-	}
+/*******************************************************************************
+ * 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.tomcat;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Stack;
+
+import javax.tools.diagnostics.image.Image;
+import javax.tools.diagnostics.image.DiagnosticException;
+import javax.tools.diagnostics.runtime.java.JavaClass;
+import javax.tools.diagnostics.runtime.java.JavaField;
+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.Command;
+import org.apache.kato.katoview.commands.helpers.JavaClassVisitor;
+import org.apache.kato.katoview.commands.helpers.JavaRuntimeVisitor;
+import org.apache.kato.katoview.commands.helpers.KatoSearch;
+
+/**
+ * Retrieves the version of Tomcat in the dump, or displays an error.
+ *
+ */
+public class TomcatThreadPoolsCommand extends Command {
+	private static final String SHORT_DESCRIPTION = "Shows thread pool state";
+	private static final String COMMAND_NAME = "pools";
+	private static final String LONG_DESCRIPTION = "Reports tomcat's thread pool state.";
+	
+	// Look for this class.
+	private static final String THREAD_POOL_CLASS="org/apache/tomcat/util/threads/ThreadPool"; 
+	private static final String POOL_NAME = "name",
+								CURRENT_BUSY = "currentThreadsBusy",
+								CURRENT_COUNT = "currentThreadCount";
+	
+	public TomcatThreadPoolsCommand(Output o) {
+		super(o, COMMAND_NAME, SHORT_DESCRIPTION, LONG_DESCRIPTION);
+		
+		child_commands = null;
+	}
+
+	public void doCommand(Stack args, Image loadedImage, HashMap properties) {
+		try {
+			KatoSearch.visitRuntimes(loadedImage, new PrintVersion());
+		} catch (DiagnosticException e) {
+			e.printStackTrace();
+		}
+	}
+
+	/**
+	 * A visitor for finding the correct class and then return
+	 *
+	 */
+	private class PrintVersion implements JavaRuntimeVisitor, JavaClassVisitor {
+		boolean found = false;
+		JavaRuntime runtime;
+		
+		public void visit(JavaRuntime runtime) throws DiagnosticException {
+			found = false;
+			this.runtime = runtime;
+			KatoSearch.visitClasses(runtime, this);
+			
+			if (found == false) {
+				out.println("ERROR: Couldn't find a Tomcat server");				
+			}
+		}
+
+		public boolean visit(JavaClass clazz) throws DiagnosticException {
+			if (clazz.getName().equals(THREAD_POOL_CLASS)) {
+				found = true;
+				JavaField nameField = KatoSearch.getField(clazz, POOL_NAME);
+				JavaField busyField = KatoSearch.getField(clazz, CURRENT_BUSY);
+				JavaField countField = KatoSearch.getField(clazz, CURRENT_COUNT);
+				
+				
+				List<JavaObject> instances = KatoSearch.findInstances(runtime, clazz);
+				if (instances.size() >0) {
+					out.println("Found thread pools");
+					for (JavaObject obj : instances) {
+						try {
+							out.println("Pool name:" + nameField.getString(obj)+", threads: "
+									+ countField.getInt(obj) +
+									", busy: " + busyField.getInt(obj));
+						
+						}catch (DiagnosticException e) {
+							e.printStackTrace();
+						}
+					}
+				}
+				
+				return false; // Stop searching through classes.
+			}
+			return true;
+		}
+		
+	}
 }
\ No newline at end of file

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

Modified: incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/tomcat/TomcatVersionCommand.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/tomcat/TomcatVersionCommand.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/tomcat/TomcatVersionCommand.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/tomcat/TomcatVersionCommand.java Mon Nov 23 15:53:48 2009
@@ -1,101 +1,101 @@
-/*******************************************************************************
- * 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.tomcat;
-
-import java.util.HashMap;
-import java.util.Stack;
-
-import javax.tools.diagnostics.image.Image;
-import javax.tools.diagnostics.image.DiagnosticException;
-import javax.tools.diagnostics.runtime.java.JavaClass;
-import javax.tools.diagnostics.runtime.java.JavaField;
-import javax.tools.diagnostics.runtime.java.JavaRuntime;
-
-import org.apache.kato.katoview.Output;
-import org.apache.kato.katoview.commands.Command;
-import org.apache.kato.katoview.commands.helpers.JavaClassVisitor;
-import org.apache.kato.katoview.commands.helpers.JavaRuntimeVisitor;
-import org.apache.kato.katoview.commands.helpers.KatoSearch;
-
-/**
- * Retrieves the version of Tomcat in the dump, or displays an error.
- *
- */
-public class TomcatVersionCommand extends Command {
-	private static final String SHORT_DESCRIPTION = "Returns version of Tomcat in the dump.";
-	private static final String COMMAND_NAME = "version";
-	private static final String LONG_DESCRIPTION = "Looks for Tomcat within the dump and reports the version.";
-	
-	// Look for this class.
-	private static final String SERVER_INFO_CLASS="org/apache/catalina/util/ServerInfo"; 
-	private static final String SERVER_NUMBER = "serverNumber",
-								SERVER_BUILT = "serverBuilt",
-								SERVER_INFO = "serverInfo";
-	
-	public TomcatVersionCommand(Output o) {
-		super(o, COMMAND_NAME, SHORT_DESCRIPTION, LONG_DESCRIPTION);
-		
-		child_commands = null;
-	}
-
-	public void doCommand(Stack args, Image loadedImage, HashMap properties) {
-		try {
-			KatoSearch.visitRuntimes(loadedImage, new PrintVersion());
-		} catch (DiagnosticException e) {
-			e.printStackTrace();
-		}
-	}
-
-	/**
-	 * A visitor for finding the correct class and then return
-	 *
-	 */
-	private class PrintVersion implements JavaRuntimeVisitor, JavaClassVisitor {
-		boolean found = false;
-		
-		public void visit(JavaRuntime runtime) throws DiagnosticException {
-			found = false;
-			KatoSearch.visitClasses(runtime, this);
-			
-			if (found == false) {
-				out.println("ERROR: Couldn't find a Tomcat server");				
-			}
-		}
-
-		public boolean visit(JavaClass clazz) throws DiagnosticException {
-			if (clazz.getName().equals(SERVER_INFO_CLASS)) {
-				JavaField serverNumberField = KatoSearch.getField(clazz, SERVER_NUMBER);
-				JavaField serverBuiltField = KatoSearch.getField(clazz, SERVER_BUILT);
-				JavaField serverInfoField = KatoSearch.getField(clazz, SERVER_INFO);
-				
-				
-				out.println("Found Tomcat server: ");
-				if (serverInfoField != null) {
-					out.println("\tInfo: "+serverInfoField.getString(null));						
-				}
-				if (serverBuiltField != null) {
-					out.println("\tBuilt: "+serverBuiltField.getString(null));						
-				}
-				if (serverNumberField != null) {
-					out.println("\tNumber: "+serverNumberField.getString(null));						
-				}
-				found = true; // indicate we found a server.
-				
-				return false; // Stop searching through classes.
-			}
-			return true;
-		}
-		
-	}
+/*******************************************************************************
+ * 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.tomcat;
+
+import java.util.HashMap;
+import java.util.Stack;
+
+import javax.tools.diagnostics.image.Image;
+import javax.tools.diagnostics.image.DiagnosticException;
+import javax.tools.diagnostics.runtime.java.JavaClass;
+import javax.tools.diagnostics.runtime.java.JavaField;
+import javax.tools.diagnostics.runtime.java.JavaRuntime;
+
+import org.apache.kato.katoview.Output;
+import org.apache.kato.katoview.commands.Command;
+import org.apache.kato.katoview.commands.helpers.JavaClassVisitor;
+import org.apache.kato.katoview.commands.helpers.JavaRuntimeVisitor;
+import org.apache.kato.katoview.commands.helpers.KatoSearch;
+
+/**
+ * Retrieves the version of Tomcat in the dump, or displays an error.
+ *
+ */
+public class TomcatVersionCommand extends Command {
+	private static final String SHORT_DESCRIPTION = "Returns version of Tomcat in the dump.";
+	private static final String COMMAND_NAME = "version";
+	private static final String LONG_DESCRIPTION = "Looks for Tomcat within the dump and reports the version.";
+	
+	// Look for this class.
+	private static final String SERVER_INFO_CLASS="org/apache/catalina/util/ServerInfo"; 
+	private static final String SERVER_NUMBER = "serverNumber",
+								SERVER_BUILT = "serverBuilt",
+								SERVER_INFO = "serverInfo";
+	
+	public TomcatVersionCommand(Output o) {
+		super(o, COMMAND_NAME, SHORT_DESCRIPTION, LONG_DESCRIPTION);
+		
+		child_commands = null;
+	}
+
+	public void doCommand(Stack args, Image loadedImage, HashMap properties) {
+		try {
+			KatoSearch.visitRuntimes(loadedImage, new PrintVersion());
+		} catch (DiagnosticException e) {
+			e.printStackTrace();
+		}
+	}
+
+	/**
+	 * A visitor for finding the correct class and then return
+	 *
+	 */
+	private class PrintVersion implements JavaRuntimeVisitor, JavaClassVisitor {
+		boolean found = false;
+		
+		public void visit(JavaRuntime runtime) throws DiagnosticException {
+			found = false;
+			KatoSearch.visitClasses(runtime, this);
+			
+			if (found == false) {
+				out.println("ERROR: Couldn't find a Tomcat server");				
+			}
+		}
+
+		public boolean visit(JavaClass clazz) throws DiagnosticException {
+			if (clazz.getName().equals(SERVER_INFO_CLASS)) {
+				JavaField serverNumberField = KatoSearch.getField(clazz, SERVER_NUMBER);
+				JavaField serverBuiltField = KatoSearch.getField(clazz, SERVER_BUILT);
+				JavaField serverInfoField = KatoSearch.getField(clazz, SERVER_INFO);
+				
+				
+				out.println("Found Tomcat server: ");
+				if (serverInfoField != null) {
+					out.println("\tInfo: "+serverInfoField.getString(null));						
+				}
+				if (serverBuiltField != null) {
+					out.println("\tBuilt: "+serverBuiltField.getString(null));						
+				}
+				if (serverNumberField != null) {
+					out.println("\tNumber: "+serverNumberField.getString(null));						
+				}
+				found = true; // indicate we found a server.
+				
+				return false; // Stop searching through classes.
+			}
+			return true;
+		}
+		
+	}
 }
\ No newline at end of file

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

Modified: incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/xcommands/XDCommand.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/xcommands/XDCommand.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/xcommands/XDCommand.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/xcommands/XDCommand.java Mon Nov 23 15:53:48 2009
@@ -1,146 +1,146 @@
-/*******************************************************************************
- * 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.xcommands;
-
-import java.util.HashMap;
-import java.util.Stack;
-import java.util.Iterator;
-
-import javax.tools.diagnostics.image.CorruptDataException;
-import javax.tools.diagnostics.image.Image;
-import javax.tools.diagnostics.image.ImageAddressSpace;
-import javax.tools.diagnostics.image.ImagePointer;
-import javax.tools.diagnostics.image.MemoryAccessException;
-
-import org.apache.kato.katoview.Output;
-import org.apache.kato.katoview.commands.Command;
-import org.apache.kato.katoview.commands.helpers.Utils;
-
-
-public class XDCommand extends Command {
-
-	public XDCommand(Output o){
-		super(o, "d", "displays the integer at the specified address",
-				"parameters: 0x<addr>\n\n" +
-				"Displays the integer at the specified address, adjusted for the " +
-				"endianness of the architecture this dump file is from.\n\n" +
-				"Note: This command uses the number of items and unit size passed to " +
-				"it by the \"x/\" command.\n"
-		);
-		child_commands = null;
-	}
-	
-	public void doCommand(Stack args, Image loadedImage, HashMap properties)
-	{
-		int numUnits = ((Integer)args.pop()).intValue();
-		int unitSize = ((Integer)args.pop()).intValue();
-		
-		if (args.isEmpty())
-		{
-			out.error("\"x/d\" command takes exactly one parameter");
-			return;
-		}
-
-		String param = (String)args.pop();
-		if (!args.isEmpty())
-		{
-			out.error("\"x/d\" only takes one parameter");
-			return;
-		}
-		Long address;
-		
-		address = Utils.longFromStringWithPrefix(param);
-		if (null == address)
-		{
-			out.error("invalid hex address specified; address must be specified as "
-					+ "\"0x<hex_address>\"");
-			return;
-		}
-
-		out.print("\n");
-		
-		for (int index = 0; index < numUnits; index++)
-		{
-			boolean found = false;
-			Iterator itImageAddressSpace = loadedImage.getAddressSpaces().iterator();
-			long currAddr = address.longValue() + (index * unitSize);
-			
-			out.print("\t");
-			out.print(Utils.toHex(currAddr));
-			out.print(": ");
-			
-			while (itImageAddressSpace.hasNext() && !found)
-			{
-				ImageAddressSpace ias = (ImageAddressSpace)itImageAddressSpace.next();
-				ImagePointer ip = ias.getPointer(currAddr);
-				
-				byte b = 0;
-				short s = 0;
-				int i = 0;
-				long l = 0;
-				try {
-					switch (unitSize)
-					{
-					case 1:
-						b = ip.getByteAt(0);
-						break;
-					case 2:
-						s = ip.getShortAt(0);
-						break;
-					case 4:
-						i = ip.getIntAt(0);
-						break;
-					case 8:
-						l = ip.getLongAt(0);
-						break;
-					}
-					
-					found = true;
-				} catch (CorruptDataException e) {
-					found = false;
-				} catch (MemoryAccessException e) {
-					found = false;
-				}
-
-				if (found)
-				{
-					switch (unitSize)
-					{
-					case 1:
-						out.print(Byte.toString(b));
-						break;
-					case 2:
-						out.print(Short.toString(s));
-						break;
-					case 4:
-						out.print(Integer.toString(i));
-						break;
-					case 8:
-						out.print(Long.toString(l));
-						break;
-					}
-				}
-			}
-			
-			if (!found)
-			{
-				out.print("<address not found in any address space>");
-			}
-			out.print("\n");
-		}
-		
-		out.print("\n");
-	}
-	
-}
+/*******************************************************************************
+ * 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.xcommands;
+
+import java.util.HashMap;
+import java.util.Stack;
+import java.util.Iterator;
+
+import javax.tools.diagnostics.image.CorruptDataException;
+import javax.tools.diagnostics.image.Image;
+import javax.tools.diagnostics.image.ImageAddressSpace;
+import javax.tools.diagnostics.image.ImagePointer;
+import javax.tools.diagnostics.image.MemoryAccessException;
+
+import org.apache.kato.katoview.Output;
+import org.apache.kato.katoview.commands.Command;
+import org.apache.kato.katoview.commands.helpers.Utils;
+
+
+public class XDCommand extends Command {
+
+	public XDCommand(Output o){
+		super(o, "d", "displays the integer at the specified address",
+				"parameters: 0x<addr>\n\n" +
+				"Displays the integer at the specified address, adjusted for the " +
+				"endianness of the architecture this dump file is from.\n\n" +
+				"Note: This command uses the number of items and unit size passed to " +
+				"it by the \"x/\" command.\n"
+		);
+		child_commands = null;
+	}
+	
+	public void doCommand(Stack args, Image loadedImage, HashMap properties)
+	{
+		int numUnits = ((Integer)args.pop()).intValue();
+		int unitSize = ((Integer)args.pop()).intValue();
+		
+		if (args.isEmpty())
+		{
+			out.error("\"x/d\" command takes exactly one parameter");
+			return;
+		}
+
+		String param = (String)args.pop();
+		if (!args.isEmpty())
+		{
+			out.error("\"x/d\" only takes one parameter");
+			return;
+		}
+		Long address;
+		
+		address = Utils.longFromStringWithPrefix(param);
+		if (null == address)
+		{
+			out.error("invalid hex address specified; address must be specified as "
+					+ "\"0x<hex_address>\"");
+			return;
+		}
+
+		out.print("\n");
+		
+		for (int index = 0; index < numUnits; index++)
+		{
+			boolean found = false;
+			Iterator itImageAddressSpace = loadedImage.getAddressSpaces().iterator();
+			long currAddr = address.longValue() + (index * unitSize);
+			
+			out.print("\t");
+			out.print(Utils.toHex(currAddr));
+			out.print(": ");
+			
+			while (itImageAddressSpace.hasNext() && !found)
+			{
+				ImageAddressSpace ias = (ImageAddressSpace)itImageAddressSpace.next();
+				ImagePointer ip = ias.getPointer(currAddr);
+				
+				byte b = 0;
+				short s = 0;
+				int i = 0;
+				long l = 0;
+				try {
+					switch (unitSize)
+					{
+					case 1:
+						b = ip.getByteAt(0);
+						break;
+					case 2:
+						s = ip.getShortAt(0);
+						break;
+					case 4:
+						i = ip.getIntAt(0);
+						break;
+					case 8:
+						l = ip.getLongAt(0);
+						break;
+					}
+					
+					found = true;
+				} catch (CorruptDataException e) {
+					found = false;
+				} catch (MemoryAccessException e) {
+					found = false;
+				}
+
+				if (found)
+				{
+					switch (unitSize)
+					{
+					case 1:
+						out.print(Byte.toString(b));
+						break;
+					case 2:
+						out.print(Short.toString(s));
+						break;
+					case 4:
+						out.print(Integer.toString(i));
+						break;
+					case 8:
+						out.print(Long.toString(l));
+						break;
+					}
+				}
+			}
+			
+			if (!found)
+			{
+				out.print("<address not found in any address space>");
+			}
+			out.print("\n");
+		}
+		
+		out.print("\n");
+	}
+	
+}

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

Modified: incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/xcommands/XJCommand.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/xcommands/XJCommand.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/xcommands/XJCommand.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/xcommands/XJCommand.java Mon Nov 23 15:53:48 2009
@@ -1,308 +1,308 @@
-/*******************************************************************************
- * 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.xcommands;
-
-import java.util.HashMap;
-import java.util.Stack;
-import java.util.Iterator;
-
-import javax.tools.diagnostics.image.CorruptDataException;
-import javax.tools.diagnostics.image.Image;
-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.JavaObject;
-import javax.tools.diagnostics.runtime.java.JavaRuntime;
-
-import org.apache.kato.katoview.Output;
-import org.apache.kato.katoview.commands.Command;
-import org.apache.kato.katoview.commands.helpers.ClassOutput;
-import org.apache.kato.katoview.commands.helpers.Exceptions;
-import org.apache.kato.katoview.commands.helpers.Utils;
-
-
-public class XJCommand extends Command {
-
-	public XJCommand(Output o){
-		super(o, "j", "displays information about a particular object or all " +
-				"objects of a class",
-				
-				"parameters: 0x<object_addr>, <class_name>\n\n" +
-				"If given class name, all static fields with their values will be " +
-				"printed, followed by all objects of that class with their fields " +
-				"and values.\n\n" +
-				"If given an object address (in hex), static fields for that object's " +
-				"class will not be printed; the other fields and values of that object " +
-				"will be printed along with its address.\n\n" +
-				"Note: this command ignores the number of items and unit size passed " +
-				"to it by the \"x/\" command.\n"
-		);
-		child_commands = null;
-	}
-	
-	public void doCommand(Stack args, Image loadedImage, HashMap properties)
-	{
-		args.pop();	// pop and discard number of units to display
-		args.pop();	// pop and discard unit size
-		
-		boolean supers = false;
-		
-		if (args.isEmpty())
-		{
-			out.error("\"x/j\" command requires one or two parameters");
-			return;
-		}
-		else
-		{
-			String param = (String)args.pop();
-			Long objAddress;
-			String objName;
-			
-			objAddress = Utils.longFromStringWithPrefix(param);
-			if (null == objAddress)
-			{
-				objName = param;
-				
-				if (!args.isEmpty())
-				{
-					String option = (String)args.pop();
-					if (option.equals("super"))
-					{
-						supers = true;
-					}
-					else if (option.equals("nosuper"))
-					{
-						supers = false;
-					}
-					else
-					{
-						out.error("second parameter for \"x/j\" must be \"super\" or" +
-								" \"nosuper\"");
-						return;
-					}
-				}
-			}
-			else
-			{
-				objName = null;
-			}
-			
-			if (!args.isEmpty())
-			{
-				out.error("\"x/j\" takes at most one parameter if address is specified" +
-						" or two parameters if class name is specified");
-				return;
-			}
-			
-			printRuntimeObjects(loadedImage, objAddress, objName, out, supers);
-		}
-	}
-	
-	private void printRuntimeObjects(Image loadedImage, Long objAddress, String objName,
-			Output out, boolean supers)
-	{
-		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 + " - version: ");
-				try {
-					out.print(mr.getVersion());
-				} catch (CorruptDataException e) {
-					out.print(Exceptions.getCorruptDataExceptionString());
-				}
-				out.print("\n");
-				
-				printHeapObjects((JavaRuntime)mr, objAddress, objName, out, supers);
-			}
-			count++;
-		}
-	}
-	
-	private void printHeapObjects(JavaRuntime jr, Long objAddress, String objName,
-			Output out, boolean supers)
-	{
-		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());
-			out.print("\n\n");
-			
-			printObjects(jh, objAddress, objName, out, supers, jr);
-			count++;
-		}
-	}
-	
-	private void printObjects(JavaHeap jh, Long objAddress, String objName, Output out,
-			boolean supers, JavaRuntime jr)
-	{
-		JavaObject jo;
-		Iterator itObject = jh.getObjects().iterator();
-		boolean found = false;
-
-		if (objName != null)
-		{
-			JavaClass objClass = Utils.getClassGivenName(objName, jr, out);
-			
-			// if we couldn't find a class of that name, return; the passed in class name could
-			//  still be an array type or it might not exist
-			if (null == objClass)
-			{
-				out.print("\t  could not find class with name \"" + objName + "\"\n\n");
-				return;
-			}
-			
-			ClassOutput.printStaticFields(objClass, out);
-			
-			while (itObject.hasNext())
-			{
-				jo = (JavaObject)itObject.next();
-
-
-				String className;
-				String hierarchy = "";
-				JavaClass jc;
-
-				try {
-					jc = jo.getJavaClass();
-				} catch (CorruptDataException e) {
-					out.print("\t  <error getting class while traversing objects: ");
-					out.print(Exceptions.getCorruptDataExceptionString());
-					out.print(">\n");
-					jc = null;
-				}
-
-				boolean foundSuperclass = false;
-				while (jc != null && !foundSuperclass)
-				{
-					try {
-						className = jc.getName();
-					} catch (CorruptDataException e) {
-						out.print("\t  <error getting class name while traversing objects: ");
-						out.print(Exceptions.getCorruptDataExceptionString());
-						out.print(">\n");
-						jc = null;
-						continue;
-					}
-						
-					if (hierarchy.equals(""))
-						hierarchy = className;
-					else
-						hierarchy = className + " => " + hierarchy;
-
-					if (className.equals(objName))
-					{
-						found = true;
-						foundSuperclass = true;
-						out.print("\t  ");
-						out.print(hierarchy);
-						out.print(" @ ");
-						out.print(Utils.toHex(jo.getID().getAddress()));
-						out.print("\n");
-						
-						ClassOutput.printFields(jo, jc, jr, out);
-					}
-					else
-					{
-						if (supers)
-						{
-							try {
-								jc = jc.getSuperclass();
-							} catch (CorruptDataException e) {
-								out.print("\t  <error getting superclass while traversing objects: ");
-								out.print(Exceptions.getCorruptDataExceptionString());
-								out.print(">\n");
-								jc = null;
-							}
-						}
-						else
-						{
-							jc = null;
-						}
-					}
-				}
-			}
-		}
-		else // objAddress != null
-		{
-			boolean done = false;
-			while (itObject.hasNext() && !done)
-			{
-				jo = (JavaObject)itObject.next();
-
-
-				if (jo.getID().getAddress() == objAddress.longValue())
-				{
-					JavaClass jc;
-					
-					found = true;
-					out.print("\t  ");
-					try {
-						jc = jo.getJavaClass();
-					} catch (CorruptDataException e) {
-						out.print("\t  <error getting class while traversing objects: ");
-						out.print(Exceptions.getCorruptDataExceptionString());
-						out.print(">");
-						jc = null;
-					}
-					
-					if (null != jc)
-					{
-						try {
-							out.print(jc.getName());
-						} catch (CorruptDataException e) {
-							out.print("\t  <error getting class name while traversing objects: ");
-							out.print(Exceptions.getCorruptDataExceptionString());
-							out.print(">");
-						}
-						out.print(" @ ");
-						out.print(Utils.toHex(objAddress.longValue()));
-						out.print("\n");
-						
-						ClassOutput.printFields(jo, jc, jr, out);
-					
-						done = true;	// assumes only one object can exist at a specific memory address
-					}
-				}
-			}
-		}
-		
-		if (!found)
-		{
-			if (objName != null)
-			{
-				out.print("\t  <no object of class \"");
-				out.print(objName);
-				out.print("\" exists>\n\n");
-			}
-			else // objAddress != null
-			{
-				out.print("\t  <no object found at address ");
-				out.print(Utils.toHex(objAddress.longValue()));
-				out.print(">\n\n");
-			}
-		}
-	}
-
-}
+/*******************************************************************************
+ * 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.xcommands;
+
+import java.util.HashMap;
+import java.util.Stack;
+import java.util.Iterator;
+
+import javax.tools.diagnostics.image.CorruptDataException;
+import javax.tools.diagnostics.image.Image;
+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.JavaObject;
+import javax.tools.diagnostics.runtime.java.JavaRuntime;
+
+import org.apache.kato.katoview.Output;
+import org.apache.kato.katoview.commands.Command;
+import org.apache.kato.katoview.commands.helpers.ClassOutput;
+import org.apache.kato.katoview.commands.helpers.Exceptions;
+import org.apache.kato.katoview.commands.helpers.Utils;
+
+
+public class XJCommand extends Command {
+
+	public XJCommand(Output o){
+		super(o, "j", "displays information about a particular object or all " +
+				"objects of a class",
+				
+				"parameters: 0x<object_addr>, <class_name>\n\n" +
+				"If given class name, all static fields with their values will be " +
+				"printed, followed by all objects of that class with their fields " +
+				"and values.\n\n" +
+				"If given an object address (in hex), static fields for that object's " +
+				"class will not be printed; the other fields and values of that object " +
+				"will be printed along with its address.\n\n" +
+				"Note: this command ignores the number of items and unit size passed " +
+				"to it by the \"x/\" command.\n"
+		);
+		child_commands = null;
+	}
+	
+	public void doCommand(Stack args, Image loadedImage, HashMap properties)
+	{
+		args.pop();	// pop and discard number of units to display
+		args.pop();	// pop and discard unit size
+		
+		boolean supers = false;
+		
+		if (args.isEmpty())
+		{
+			out.error("\"x/j\" command requires one or two parameters");
+			return;
+		}
+		else
+		{
+			String param = (String)args.pop();
+			Long objAddress;
+			String objName;
+			
+			objAddress = Utils.longFromStringWithPrefix(param);
+			if (null == objAddress)
+			{
+				objName = param;
+				
+				if (!args.isEmpty())
+				{
+					String option = (String)args.pop();
+					if (option.equals("super"))
+					{
+						supers = true;
+					}
+					else if (option.equals("nosuper"))
+					{
+						supers = false;
+					}
+					else
+					{
+						out.error("second parameter for \"x/j\" must be \"super\" or" +
+								" \"nosuper\"");
+						return;
+					}
+				}
+			}
+			else
+			{
+				objName = null;
+			}
+			
+			if (!args.isEmpty())
+			{
+				out.error("\"x/j\" takes at most one parameter if address is specified" +
+						" or two parameters if class name is specified");
+				return;
+			}
+			
+			printRuntimeObjects(loadedImage, objAddress, objName, out, supers);
+		}
+	}
+	
+	private void printRuntimeObjects(Image loadedImage, Long objAddress, String objName,
+			Output out, boolean supers)
+	{
+		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 + " - version: ");
+				try {
+					out.print(mr.getVersion());
+				} catch (CorruptDataException e) {
+					out.print(Exceptions.getCorruptDataExceptionString());
+				}
+				out.print("\n");
+				
+				printHeapObjects((JavaRuntime)mr, objAddress, objName, out, supers);
+			}
+			count++;
+		}
+	}
+	
+	private void printHeapObjects(JavaRuntime jr, Long objAddress, String objName,
+			Output out, boolean supers)
+	{
+		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());
+			out.print("\n\n");
+			
+			printObjects(jh, objAddress, objName, out, supers, jr);
+			count++;
+		}
+	}
+	
+	private void printObjects(JavaHeap jh, Long objAddress, String objName, Output out,
+			boolean supers, JavaRuntime jr)
+	{
+		JavaObject jo;
+		Iterator itObject = jh.getObjects().iterator();
+		boolean found = false;
+
+		if (objName != null)
+		{
+			JavaClass objClass = Utils.getClassGivenName(objName, jr, out);
+			
+			// if we couldn't find a class of that name, return; the passed in class name could
+			//  still be an array type or it might not exist
+			if (null == objClass)
+			{
+				out.print("\t  could not find class with name \"" + objName + "\"\n\n");
+				return;
+			}
+			
+			ClassOutput.printStaticFields(objClass, out);
+			
+			while (itObject.hasNext())
+			{
+				jo = (JavaObject)itObject.next();
+
+
+				String className;
+				String hierarchy = "";
+				JavaClass jc;
+
+				try {
+					jc = jo.getJavaClass();
+				} catch (CorruptDataException e) {
+					out.print("\t  <error getting class while traversing objects: ");
+					out.print(Exceptions.getCorruptDataExceptionString());
+					out.print(">\n");
+					jc = null;
+				}
+
+				boolean foundSuperclass = false;
+				while (jc != null && !foundSuperclass)
+				{
+					try {
+						className = jc.getName();
+					} catch (CorruptDataException e) {
+						out.print("\t  <error getting class name while traversing objects: ");
+						out.print(Exceptions.getCorruptDataExceptionString());
+						out.print(">\n");
+						jc = null;
+						continue;
+					}
+						
+					if (hierarchy.equals(""))
+						hierarchy = className;
+					else
+						hierarchy = className + " => " + hierarchy;
+
+					if (className.equals(objName))
+					{
+						found = true;
+						foundSuperclass = true;
+						out.print("\t  ");
+						out.print(hierarchy);
+						out.print(" @ ");
+						out.print(Utils.toHex(jo.getID().getAddress()));
+						out.print("\n");
+						
+						ClassOutput.printFields(jo, jc, jr, out);
+					}
+					else
+					{
+						if (supers)
+						{
+							try {
+								jc = jc.getSuperclass();
+							} catch (CorruptDataException e) {
+								out.print("\t  <error getting superclass while traversing objects: ");
+								out.print(Exceptions.getCorruptDataExceptionString());
+								out.print(">\n");
+								jc = null;
+							}
+						}
+						else
+						{
+							jc = null;
+						}
+					}
+				}
+			}
+		}
+		else // objAddress != null
+		{
+			boolean done = false;
+			while (itObject.hasNext() && !done)
+			{
+				jo = (JavaObject)itObject.next();
+
+
+				if (jo.getID().getAddress() == objAddress.longValue())
+				{
+					JavaClass jc;
+					
+					found = true;
+					out.print("\t  ");
+					try {
+						jc = jo.getJavaClass();
+					} catch (CorruptDataException e) {
+						out.print("\t  <error getting class while traversing objects: ");
+						out.print(Exceptions.getCorruptDataExceptionString());
+						out.print(">");
+						jc = null;
+					}
+					
+					if (null != jc)
+					{
+						try {
+							out.print(jc.getName());
+						} catch (CorruptDataException e) {
+							out.print("\t  <error getting class name while traversing objects: ");
+							out.print(Exceptions.getCorruptDataExceptionString());
+							out.print(">");
+						}
+						out.print(" @ ");
+						out.print(Utils.toHex(objAddress.longValue()));
+						out.print("\n");
+						
+						ClassOutput.printFields(jo, jc, jr, out);
+					
+						done = true;	// assumes only one object can exist at a specific memory address
+					}
+				}
+			}
+		}
+		
+		if (!found)
+		{
+			if (objName != null)
+			{
+				out.print("\t  <no object of class \"");
+				out.print(objName);
+				out.print("\" exists>\n\n");
+			}
+			else // objAddress != null
+			{
+				out.print("\t  <no object found at address ");
+				out.print(Utils.toHex(objAddress.longValue()));
+				out.print(">\n\n");
+			}
+		}
+	}
+
+}

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



Mime
View raw message