incubator-kato-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spo...@apache.org
Subject svn commit: r893357 - in /incubator/kato/trunk/org.apache.kato/kato.api.vm/src/main/java/javax/tools/diagnostics/vm: DumpDescriptor.java DumpFactory.java spi/delegates/JavaDumpDelegate.java
Date Wed, 23 Dec 2009 00:02:17 GMT
Author: spoole
Date: Wed Dec 23 00:02:17 2009
New Revision: 893357

URL: http://svn.apache.org/viewvc?rev=893357&view=rev
Log:
added a copy mechanism for the dump descriptor and made the dummy dump delegate be more useful

Modified:
    incubator/kato/trunk/org.apache.kato/kato.api.vm/src/main/java/javax/tools/diagnostics/vm/DumpDescriptor.java
    incubator/kato/trunk/org.apache.kato/kato.api.vm/src/main/java/javax/tools/diagnostics/vm/DumpFactory.java
    incubator/kato/trunk/org.apache.kato/kato.api.vm/src/main/java/javax/tools/diagnostics/vm/spi/delegates/JavaDumpDelegate.java

Modified: incubator/kato/trunk/org.apache.kato/kato.api.vm/src/main/java/javax/tools/diagnostics/vm/DumpDescriptor.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.api.vm/src/main/java/javax/tools/diagnostics/vm/DumpDescriptor.java?rev=893357&r1=893356&r2=893357&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.api.vm/src/main/java/javax/tools/diagnostics/vm/DumpDescriptor.java
(original)
+++ incubator/kato/trunk/org.apache.kato/kato.api.vm/src/main/java/javax/tools/diagnostics/vm/DumpDescriptor.java
Wed Dec 23 00:02:17 2009
@@ -24,7 +24,7 @@
  *               change
  * 
  */
-public class DumpDescriptor {
+public class DumpDescriptor implements Cloneable {
 	
 	private boolean recordClassLoaders=false;
 	private boolean recordClasses=false;
@@ -61,5 +61,30 @@
 	public boolean recordClassesRequired() {
 		return recordClasses;
 	}
+
+
+	/**
+	 * Returns a copy of this descriptor.
+	 * 
+	 * @return new copy.
+	 */
+	public DumpDescriptor copy() { 
+		 
+		try {
+			return (DumpDescriptor) clone();
+		} catch (CloneNotSupportedException e) {
+			
+			e.printStackTrace();
+		}
+		return null;
+	
+	}
+
+
+	@Override
+	protected Object clone() throws CloneNotSupportedException {
+		
+		return super.clone();
+	}
 	
 }

Modified: incubator/kato/trunk/org.apache.kato/kato.api.vm/src/main/java/javax/tools/diagnostics/vm/DumpFactory.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.api.vm/src/main/java/javax/tools/diagnostics/vm/DumpFactory.java?rev=893357&r1=893356&r2=893357&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.api.vm/src/main/java/javax/tools/diagnostics/vm/DumpFactory.java
(original)
+++ incubator/kato/trunk/org.apache.kato/kato.api.vm/src/main/java/javax/tools/diagnostics/vm/DumpFactory.java
Wed Dec 23 00:02:17 2009
@@ -109,9 +109,7 @@
 		if(defaultDumpFactory==null) {
 			DumpFactory d=new DumpFactory();
 			d.loadStandardInitiators();
-			if(d.availableInitiators.isEmpty()) {
-				d.addInitiator(new JavaDumpDelegate());
-			}
+			
 			
 			defaultDumpFactory=d;
 		}
@@ -146,8 +144,7 @@
 			
 		}
 		
-		
-		
+		addInitiator(new JavaDumpDelegate());
 	}
 	/**
 	 * Add a dump initiator to the available choices for this dump factory.

Modified: incubator/kato/trunk/org.apache.kato/kato.api.vm/src/main/java/javax/tools/diagnostics/vm/spi/delegates/JavaDumpDelegate.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.api.vm/src/main/java/javax/tools/diagnostics/vm/spi/delegates/JavaDumpDelegate.java?rev=893357&r1=893356&r2=893357&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.api.vm/src/main/java/javax/tools/diagnostics/vm/spi/delegates/JavaDumpDelegate.java
(original)
+++ incubator/kato/trunk/org.apache.kato/kato.api.vm/src/main/java/javax/tools/diagnostics/vm/spi/delegates/JavaDumpDelegate.java
Wed Dec 23 00:02:17 2009
@@ -29,10 +29,12 @@
 	 * @see javax.tools.diagnostics.vm.DumpInitiatorDelegate#dump()
 	 */
 
-	private boolean createDump() throws IOException {
+	private boolean createDump(DumpDescriptor copy) throws IOException {
 
 		File dumpFile=new File("dump.kato");
-		return dumpFile.createNewFile();
+		XMLDumpWriter writer=new XMLDumpWriter();
+		writer.write(dumpFile);
+		return true;
 	
 		
 	}
@@ -47,18 +49,20 @@
 			
 			@Override
 			public boolean dump() throws IOException {
-				return createDump();
+				return createDump(new DumpDescriptor());
 			}
 		};
 	}
 
 	@Override
 	public DumpHandle createDumpHandle(DumpDescriptor descriptor) {
+		final DumpDescriptor copy=(DumpDescriptor) descriptor.copy();
+		
 		return new DumpHandle() {
 			
 			@Override
 			public boolean dump() throws IOException {
-				return createDump();
+				return createDump(copy);
 			}
 		};
 	}



Mime
View raw message