1 64 65 package com.jcorporate.expresso.core.misc; 66 67 import org.apache.log4j.Logger; 68 69 70 public class SysEventHub { 71 public static SysEventHubImpl myImpl = null; 72 private static Logger log = Logger.getLogger(SysEventHub.class); 73 74 private static SysEventHubImpl getImpl() { 75 if (myImpl == null) { 76 String className = ConfigManager.getClassHandler("sysEventHub"); 77 78 if (className == null || className.length() < 0) { 79 log.warn("Unable to get 'sysEventHub' class handler. Using default"); 80 className = "com.jcorporate.expresso.core.misc.DefaultSysEventHubImpl"; 81 } else { 82 try { 83 myImpl = (SysEventHubImpl) Class.forName(className).newInstance(); 84 } catch (Exception e) { 85 log.error("Error loading sys event hub " + className, e); 86 } 87 } 88 } 89 90 return myImpl; 91 } 92 93 public static void addListener(SysEventListener listener, 94 String newTriggeringClass, String newCode) { 95 getImpl().addListener(listener, newTriggeringClass, newCode); 96 } 97 98 99 public static void trigger(SysEvent theEvent) { 100 getImpl().trigger(theEvent); 101 } 102 103 public static void removeListener(SysEventListener listener, 104 String newTriggeringClass, 105 String newCode) { 106 getImpl().removeListener(listener, newTriggeringClass, newCode); 107 } 108 109 } | Popular Tags |