00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 package com.scalagent.kjoram.admin;
00025
00026 import java.util.Hashtable;
00027 import java.util.Vector;
00028
00033 public abstract class AdministeredObject
00034 {
00041 protected static Hashtable instancesTable = new Hashtable();
00042
00044 protected String id;
00045
00046
00052 protected AdministeredObject(String id)
00053 {
00054 this.id = this.getClass().getName() + ":" + id;
00055
00056
00057 instancesTable.put(this.id, this);
00058 }
00059
00063 protected AdministeredObject()
00064 {}
00065
00067 public static Object getInstance(String name)
00068 {
00069 if (name == null)
00070 return null;
00071 return instancesTable.get(name);
00072 }
00073
00074 public void setId(String id) {
00075 this.id = id;
00076 }
00077
00078 public String getId() {
00079 return id;
00080 }
00081
00082 public void addInstanceTable(String key, Object value) {
00083 instancesTable.put(key,value);
00084 }
00085
00090 public Hashtable code() {
00091 Hashtable h = new Hashtable();
00092 String className = this.getClass().getName();
00093 String end = className.substring(
00094 className.lastIndexOf((int)'.'),
00095 className.length());
00096
00097 if (className.startsWith("com.scalagent.kjoram.admin")) {
00098 className = "org.objectweb.joram.client.jms.admin";
00099 } else if (className.startsWith("com.scalagent.kjoram.excepts")) {
00100 className = "org.objectweb.joram.shared.excepts";
00101 } else if (className.startsWith("com.scalagent.kjoram.jms")) {
00102 className = "org.objectweb.joram.shared.client";
00103 } else if (className.startsWith("com.scalagent.kjoram.ksoap")) {
00104 className = "org.objectweb.joram.client.jms.ksoap";
00105 } else if (className.startsWith("com.scalagent.kjoram.messages")) {
00106 className = "org.objectweb.joram.shared.messages";
00107 } else if (className.startsWith("com.scalagent.kjoram")) {
00108 className = "org.objectweb.joram.client.jms";
00109 }
00110 className = className + end;
00111 h.put("className",className);
00112 return h;
00113 }
00114 }