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 import static com.sun.appserv.management.event.TraceEventHelper.*; 43 44 45 46 50 public class TraceEvent implements Event { 51 52 private static Logger _logger = LogDomains.getLogger(LogDomains.SELF_MANAGEMENT_LOGGER); 53 private static StringManager sm = StringManager.getManager(TraceEvent.class); 54 55 public TraceEvent(String type, TraceEventNotificationFilter lfilter, String description) { 56 this.type = type; 57 this.lfilter = lfilter; 58 if (description != null) 59 this.description = description; 60 else 61 this.description = defaultDescription; 62 } 63 64 public ObjectName getObjectName() { 65 return objName; 66 } 67 68 69 public String getType() { 70 return type; 71 } 72 73 public NotificationFilter getNotificationFilter( ){ 74 return lfilter; 75 } 76 77 public String getDescription() { 78 return description; 79 } 80 81 public void destroy() { 82 } 84 85 static ObjectName getTraceImplObjectName() { 86 if (objName != null) 87 return objName; 88 try { 89 objName = new ObjectName ( DOMAIN_NAME,DEFAULT_KEY, "trace"); 90 }catch (MalformedObjectNameException mex) { 91 _logger.log(Level.WARNING,"smgt.internal_error", mex); 92 } 93 return objName; 94 } 95 96 public static boolean isValidType(String type) { 97 if ("*".equals(type) || REQUEST_START.equals(type) || 98 REQUEST_END.equals(type) || WEB_COMPONENT_METHOD_ENTRY.equals(type) || 99 WEB_COMPONENT_METHOD_EXIT.equals(type) || EJB_COMPONENT_METHOD_ENTRY.equals(type) || 100 EJB_COMPONENT_METHOD_EXIT.equals(type) ) { 101 return true; 102 } 103 return false; 104 } 105 106 private static ObjectName objName = null; 107 private static String defaultDescription = 108 sm.getString("selfmgmt_event.trace_event_description"); 109 private TraceEventNotificationFilter lfilter = null; 110 private String description = null; 111 private String type = null; 112 113 122 123 124 } 125 | Popular Tags |