1 20 21 package org.xmpp.component; 22 23 38 public class ComponentManagerFactory { 39 40 private static ComponentManager componentManager; 41 42 47 public static synchronized ComponentManager getComponentManager() { 48 if (componentManager != null) { 49 return componentManager; 50 } 51 String className = System.getProperty("whack.componentManagerClass"); 54 if (className != null) { 55 try { 56 Class c = Class.forName(className); 57 componentManager = (ComponentManager)c.newInstance(); 58 return componentManager; 59 } 60 catch (Exception e) { 61 e.printStackTrace(); 62 } 63 } 64 throw new NullPointerException ("No ComponentManager implementation available."); 66 } 67 68 73 public static void setComponentManager(ComponentManager manager) { 74 componentManager = manager; 75 } 76 } 77 | Popular Tags |