krysalis-update/src/java/org/krysalis/depot/common/util/debug Dumpable.java,1.1,1.2 DebugUtils.java,1.1,1.2
Nick Chalko <[email protected]> Wed, 08 Dec 2004 09:11:51 +0000
| Newsgroups | gmane.comp.krysalis.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/common/util/debug
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26470/src/java/org/krysalis/depot/common/util/debug
Modified Files:
Dumpable.java DebugUtils.java
Log Message:
format
Index: Dumpable.java
===================================================================
RCS file: /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/common/util/debug/Dumpable.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Dumpable.java 8 Dec 2004 09:06:27 -0000 1.1
--- Dumpable.java 8 Dec 2004 09:11:48 -0000 1.2
***************
*** 21,24 ****
--- 21,25 ----
/**
* TODO: what is this class for ?
+ *
* @author $Author$
* @version $Revision$
***************
*** 26,29 ****
*/
public interface Dumpable {
! void dump(PrintWriter out, int depth, boolean verbose);
}
--- 27,30 ----
*/
public interface Dumpable {
! void dump(PrintWriter out, int depth, boolean verbose);
}
Index: DebugUtils.java
===================================================================
RCS file: /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/common/util/debug/DebugUtils.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** DebugUtils.java 8 Dec 2004 09:06:27 -0000 1.1
--- DebugUtils.java 8 Dec 2004 09:11:49 -0000 1.2
***************
*** 40,60 ****
public static void enableXercesParser() {
// SAX ...
! System.setProperty(
! "org.xml.sax.driver",
! "org.apache.xerces.parsers.SAXParser");
// DOM...
! //:TODO:
! //javax.xml.parsers.DocumentBuilderFactory
}
public static void enableCommonsLogging() {
! System.setProperty(
! "org.apache.commons.logging.Log",
! "org.apache.commons.logging.impl.SimpleLog");
! System.setProperty(
! "org.apache.commons.logging.simplelog.showdatetime",
! "true");
}
--- 40,57 ----
public static void enableXercesParser() {
// SAX ...
! System.setProperty("org.xml.sax.driver",
! "org.apache.xerces.parsers.SAXParser");
// DOM...
! // :TODO:
! // javax.xml.parsers.DocumentBuilderFactory
}
public static void enableCommonsLogging() {
! System.setProperty("org.apache.commons.logging.Log",
! "org.apache.commons.logging.impl.SimpleLog");
! System.setProperty("org.apache.commons.logging.simplelog.showdatetime",
! "true");
}
***************
*** 64,73 ****
System.setProperty(
! "org.apache.commons.logging.simplelog.log.httpclient.wire",
! "debug");
! System.setProperty(
! "org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient",
! "debug");
}
--- 61,71 ----
System.setProperty(
! "org.apache.commons.logging.simplelog.log.httpclient.wire",
! "debug");
! System
! .setProperty(
! "org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient",
! "debug");
}
***************
*** 136,144 ****
}
! public static String getDump(
! int depth,
! String title,
! Dumpable d,
! boolean verbose) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw, true);
--- 134,139 ----
}
! public static String getDump(int depth, String title, Dumpable d,
! boolean verbose) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw, true);
***************
*** 167,179 ****
printSeparator(SystemUtils.getSystemOut(), 0);
}
public static void printSeparator(PrintWriter out, int depth) {
out.print(DebugUtils.getIndent(depth));
! out.println(
! "--------------------------------------------------------------");
}
! // public static void dump(Dumpable d) {
! // dump(System.out, 0, d, l_verbose);
! // }
public static void dump(Object d) {
dump(SystemUtils.getSystemOut(), d);
--- 162,175 ----
printSeparator(SystemUtils.getSystemOut(), 0);
}
+
public static void printSeparator(PrintWriter out, int depth) {
out.print(DebugUtils.getIndent(depth));
! out
! .println("--------------------------------------------------------------");
}
! // public static void dump(Dumpable d) {
! // dump(System.out, 0, d, l_verbose);
! // }
public static void dump(Object d) {
dump(SystemUtils.getSystemOut(), d);
***************
*** 184,201 ****
}
! public static void dump(
! PrintStream out,
! int depth,
! Dumpable d,
! boolean verbose) {
dump(new PrintWriter(out, true), depth, d, verbose);
}
! public static void dump(
! PrintStream out,
! int depth,
! String title,
! boolean verbose,
! Dumpable d) {
dump(new PrintWriter(out, true), depth, title, verbose, d);
}
--- 180,190 ----
}
! public static void dump(PrintStream out, int depth, Dumpable d,
! boolean verbose) {
dump(new PrintWriter(out, true), depth, d, verbose);
}
! public static void dump(PrintStream out, int depth, String title,
! boolean verbose, Dumpable d) {
dump(new PrintWriter(out, true), depth, title, verbose, d);
}
***************
*** 209,226 ****
}
! public static void dump(
! PrintWriter out,
! int depth,
! boolean verbose,
! Object o) {
dump(out, depth, null, verbose, o);
}
! public static void dump(
! PrintWriter out,
! int depth,
! String title,
! boolean verbose,
! Object o) {
final String indent = DebugUtils.getIndent(depth);
--- 198,208 ----
}
! public static void dump(PrintWriter out, int depth, boolean verbose,
! Object o) {
dump(out, depth, null, verbose, o);
}
! public static void dump(PrintWriter out, int depth, String title,
! boolean verbose, Object o) {
final String indent = DebugUtils.getIndent(depth);
***************
*** 233,238 ****
out.print(indent);
out.println("Null Object");
! }
! else if (o instanceof Dumpable) {
if (null != title) {
out.print(indent);
--- 215,219 ----
out.print(indent);
out.println("Null Object");
! } else if (o instanceof Dumpable) {
if (null != title) {
out.print(indent);
***************
*** 240,245 ****
}
dump(out, depth, (Dumpable) o, verbose);
! }
! else if (o instanceof Map)
dumpMap(out, depth, title, verbose, ((Map) o));
else if (o instanceof List)
--- 221,225 ----
}
dump(out, depth, (Dumpable) o, verbose);
! } else if (o instanceof Map)
dumpMap(out, depth, title, verbose, ((Map) o));
else if (o instanceof List)
***************
*** 258,264 ****
}
! // public static void dump(PrintWriter out, Dumpable d) {
! // dump(out, 0, d, l_verbose);
! // }
public static void dump(PrintWriter out, Dumpable d, boolean verbose) {
--- 238,244 ----
}
! // public static void dump(PrintWriter out, Dumpable d) {
! // dump(out, 0, d, l_verbose);
! // }
public static void dump(PrintWriter out, Dumpable d, boolean verbose) {
***************
*** 274,282 ****
}
! public static void dump(
! PrintWriter out,
! int depth,
! Dumpable d,
! boolean verbose) {
if (null != d)
d.dump(out, depth, verbose);
--- 254,259 ----
}
! public static void dump(PrintWriter out, int depth, Dumpable d,
! boolean verbose) {
if (null != d)
d.dump(out, depth, verbose);
***************
*** 286,295 ****
}
! public static void dump(
! PrintWriter out,
! int depth,
! String title,
! boolean verbose,
! Dumpable d) {
final String indent = DebugUtils.getIndent(depth);
--- 263,268 ----
}
! public static void dump(PrintWriter out, int depth, String title,
! boolean verbose, Dumpable d) {
final String indent = DebugUtils.getIndent(depth);
***************
*** 306,327 ****
}
! // public static void dumpList(PrintWriter out, int depth, List list) {
! // dumpList(out, depth, null, l_verbose, list);
! // }
! public static void dumpList(
! PrintWriter out,
! int depth,
! boolean verbose,
! List list) {
dumpList(out, depth, null, verbose, list);
}
! public static void dumpList(
! PrintWriter out,
! int depth,
! String title,
! boolean verbose,
! List list) {
String indent = DebugUtils.getIndent(depth);
String indent1 = DebugUtils.getIndent(depth + 1);
--- 279,293 ----
}
! // public static void dumpList(PrintWriter out, int depth, List list) {
! // dumpList(out, depth, null, l_verbose, list);
! // }
! public static void dumpList(PrintWriter out, int depth, boolean verbose,
! List list) {
dumpList(out, depth, null, verbose, list);
}
! public static void dumpList(PrintWriter out, int depth, String title,
! boolean verbose, List list) {
String indent = DebugUtils.getIndent(depth);
String indent1 = DebugUtils.getIndent(depth + 1);
***************
*** 330,335 ****
out.print(indent);
out.println(title);
! }
! else {
out.print(indent);
out.println("List Type: " + SystemUtils.getShortName(list));
--- 296,300 ----
out.print(indent);
out.println(title);
! } else {
out.print(indent);
out.println("List Type: " + SystemUtils.getShortName(list));
***************
*** 348,353 ****
out.print(", class: ");
out.println(entry.getClass().getName());
! }
! else
out.print(" ");
--- 313,317 ----
out.print(", class: ");
out.println(entry.getClass().getName());
! } else
out.print(" ");
***************
*** 355,368 ****
// Separator for entries
! //if (i.hasNext() && verbose)
! // DebugUtils.printSeparator(out,depth);
}
! }
! else {
out.print(indent);
out.println("Empty List.");
}
! }
! else {
out.print(indent);
out.println("No List.");
--- 319,330 ----
// Separator for entries
! // if (i.hasNext() && verbose)
! // DebugUtils.printSeparator(out,depth);
}
! } else {
out.print(indent);
out.println("Empty List.");
}
! } else {
out.print(indent);
out.println("No List.");
***************
*** 370,387 ****
}
! public static void dumpMap(
! PrintWriter out,
! int depth,
! boolean verbose,
! Map map) {
dumpMap(out, depth, null, verbose, map);
}
! public static void dumpMap(
! PrintWriter out,
! int depth,
! String title,
! boolean verbose,
! Map map) {
String indent = DebugUtils.getIndent(depth);
String indent1 = DebugUtils.getIndent(depth + 1);
--- 332,342 ----
}
! public static void dumpMap(PrintWriter out, int depth, boolean verbose,
! Map map) {
dumpMap(out, depth, null, verbose, map);
}
! public static void dumpMap(PrintWriter out, int depth, String title,
! boolean verbose, Map map) {
String indent = DebugUtils.getIndent(depth);
String indent1 = DebugUtils.getIndent(depth + 1);
***************
*** 390,395 ****
out.print(indent);
out.println(title);
! }
! else {
out.print(indent);
out.println("Map Type: " + SystemUtils.getShortName(map));
--- 345,349 ----
out.print(indent);
out.println(title);
! } else {
out.print(indent);
out.println("Map Type: " + SystemUtils.getShortName(map));
***************
*** 408,413 ****
out.print(", class: ");
out.println(entry.getClass().getName());
! }
! else
out.print(" ");
--- 362,366 ----
out.print(", class: ");
out.println(entry.getClass().getName());
! } else
out.print(" ");
***************
*** 415,428 ****
// Separator for entries
! //if (i.hasNext() && verbose)
! // DebugUtils.printSeparator(out,depth);
}
! }
! else {
out.print(indent);
out.println("Empty Map.");
}
! }
! else {
out.print(indent);
out.println("No Map.");
--- 368,379 ----
// Separator for entries
! // if (i.hasNext() && verbose)
! // DebugUtils.printSeparator(out,depth);
}
! } else {
out.print(indent);
out.println("Empty Map.");
}
! } else {
out.print(indent);
out.println("No Map.");
***************
*** 432,442 ****
public static void logMemoryInformation() {
logMemoryInformation(null);
!
}
!
! public static void logMemoryInformation(String context) {
!
Triple info = SystemUtils.getMemoryInformation();
!
StringBuffer minfo = new StringBuffer();
--- 383,393 ----
public static void logMemoryInformation() {
logMemoryInformation(null);
!
}
!
! public static void logMemoryInformation(String context) {
!
Triple info = SystemUtils.getMemoryInformation();
!
StringBuffer minfo = new StringBuffer();
***************
*** 449,454 ****
minfo.append(info.getThird());
minfo.append(".");
!
! if (null != context ){
minfo.append(" @ ");
minfo.append(context);
--- 400,405 ----
minfo.append(info.getThird());
minfo.append(".");
!
! if (null != context) {
minfo.append(" @ ");
minfo.append(context);
***************
*** 457,461 ****
String message = minfo.toString();
Logger.getLogger().info(message);
! System.out.println(message);
}
}
--- 408,412 ----
String message = minfo.toString();
Logger.getLogger().info(message);
! System.out.println(message);
}
}
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/