1 23 24 28 29 package com.sun.enterprise.admin.selfmanagement.event; 30 31 import javax.management.NotificationBroadcasterSupport ; 32 import javax.management.NotificationListener ; 33 import javax.management.NotificationFilter ; 34 import javax.management.Notification ; 35 import javax.management.ObjectName ; 36 import javax.management.MalformedObjectNameException ; 37 import com.sun.enterprise.util.i18n.StringManager; 38 import java.util.logging.Logger ; 39 import java.util.logging.Level ; 40 import com.sun.logging.LogDomains; 41 42 43 44 48 public class LifeCycleEvent implements Event { 49 50 private static Logger _logger = LogDomains.getLogger(LogDomains.SELF_MANAGEMENT_LOGGER); 51 private static StringManager sm = StringManager.getManager(LifeCycleEvent.class); 52 53 public LifeCycleEvent(String type, LifeCycleNotificationFilter lfilter, String description) { 54 this.type = type; 55 this.lfilter = lfilter; 56 if (description != null) 57 this.description = description; 58 else 59 this.description = defaultDescription; 60 } 61 62 public ObjectName getObjectName() { 63 return objName; 64 } 65 66 67 public String getType() { 68 return type; 69 } 70 71 public NotificationFilter getNotificationFilter( ){ 72 return lfilter; 73 } 74 75 public String getDescription() { 76 return description; 77 } 78 79 public void destroy() { 80 } 82 83 static ObjectName getLifeCycleImplObjectName() { 84 if (objName != null) 85 return objName; 86 try { 87 objName = new ObjectName ( DOMAIN_NAME,DEFAULT_KEY, "lifecycle"); 88 }catch (MalformedObjectNameException mex) { 89 _logger.log(Level.WARNING,"smgt.internal_error", mex); 90 } 91 return objName; 92 } 93 94 public static boolean isValidType(String type) { 95 if ("*".equals(type) || READY_EVENT.equals(type) || 96 SHUTDOWN_EVENT.equals(type) || TERMINATION_EVENT.equals(type) ) { 97 return true; 98 } 99 return false; 100 } 101 102 private static ObjectName objName = null; 103 private static String defaultDescription = 104 sm.getString("selfmgmt_event.lifecycle_event_description"); 105 private LifeCycleNotificationFilter lfilter = null; 106 private String description = null; 107 private String type = null; 108 109 112 public static final String READY_EVENT = "lifecycle.ready"; 113 114 117 public static final String SHUTDOWN_EVENT = "lifecycle.shutdown"; 118 119 122 public static final String TERMINATION_EVENT = "lifecycle.termination"; 123 124 } 125 | Popular Tags |