1 package org.abstracthorizon.extend.server.support; 2 3 import java.io.FileWriter; 4 import java.io.IOException; 5 import java.io.PrintWriter; 6 import java.util.Map; 7 8 import org.abstracthorizon.extend.server.deployment.DeploymentManager; 9 import org.abstracthorizon.extend.server.deployment.Module; 10 import org.abstracthorizon.extend.server.deployment.ModuleId; 11 12 public class Dump { 13 14 15 public static void outputCore(DeploymentManager manager) { 16 try { 17 FileWriter out = new FileWriter("extend-core.out"); 18 try { 19 PrintWriter p = new PrintWriter(out); 20 outputCore(p, manager); 21 } finally { 22 out.close(); 23 } 24 } catch (IOException e) { 25 e.printStackTrace(); 26 } 27 } 28 29 30 public static void outputCore(PrintWriter p, DeploymentManager manager) { 31 if (manager != null) { 32 p.println("Deployed modules hash:"); 33 Map<ModuleId, Module> deployedModules = manager.getDeployedModules(); 34 for (ModuleId key : deployedModules.keySet()) { 35 Module m = deployedModules.get(key); 36 p.println(" " + key.toString() + " -> " + m.getWorkingLocation() + "(" + System.identityHashCode(m) + ")"); 37 } 38 p.println(); 39 p.println("Modules:"); 40 for (Module m : deployedModules.values()) { 41 p.println(" " + m.getModuleId() + "(" + System.identityHashCode(m) + ")"); 42 p.println(" Depends on: "); 43 for (Module d : m.getDependsOn()) { 44 p.println(" " + d.getModuleId() + "(" + System.identityHashCode(d) + ")"); 45 } 46 p.println(" Depend on this: "); 47 for (Module d : m.getDependOnThis()) { 48 p.println(" " + d.getModuleId() + "(" + System.identityHashCode(d) + ")"); 49 } 50 } 51 } else { 52 p.println("No manager defined yet!"); 53 } 54 p.flush(); 55 } 56 }