1 24 package com.scalagent.kjoram.admin; 25 26 import java.util.Hashtable ; 27 import java.util.Vector ; 28 29 33 public abstract class AdministeredObject 34 { 35 41 protected static Hashtable instancesTable = new Hashtable (); 42 43 44 protected String id; 45 46 47 52 protected AdministeredObject(String id) 53 { 54 this.id = this.getClass().getName() + ":" + id; 55 56 instancesTable.put(this.id, this); 58 } 59 60 63 protected AdministeredObject() 64 {} 65 66 67 public static Object getInstance(String name) 68 { 69 if (name == null) 70 return null; 71 return instancesTable.get(name); 72 } 73 74 public void setId(String id) { 75 this.id = id; 76 } 77 78 public String getId() { 79 return id; 80 } 81 82 public void addInstanceTable(String key, Object value) { 83 instancesTable.put(key,value); 84 } 85 86 90 public Hashtable code() { 91 Hashtable h = new Hashtable (); 92 String className = this.getClass().getName(); 93 String end = className.substring( 94 className.lastIndexOf((int)'.'), 95 className.length()); 96 97 if (className.startsWith("com.scalagent.kjoram.admin")) { 98 className = "org.objectweb.joram.client.jms.admin"; 99 } else if (className.startsWith("com.scalagent.kjoram.excepts")) { 100 className = "org.objectweb.joram.shared.excepts"; 101 } else if (className.startsWith("com.scalagent.kjoram.jms")) { 102 className = "org.objectweb.joram.shared.client"; 103 } else if (className.startsWith("com.scalagent.kjoram.ksoap")) { 104 className = "org.objectweb.joram.client.jms.ksoap"; 105 } else if (className.startsWith("com.scalagent.kjoram.messages")) { 106 className = "org.objectweb.joram.shared.messages"; 107 } else if (className.startsWith("com.scalagent.kjoram")) { 108 className = "org.objectweb.joram.client.jms"; 109 } 110 className = className + end; 111 h.put("className",className); 112 return h; 113 } 114 } 115 | Popular Tags |