1 23 24 package com.sun.enterprise.admin.selfmanagement.event; 25 import javax.management.ObjectName ; 26 import javax.management.NotificationFilter ; 27 import javax.management.MalformedObjectNameException ; 28 import com.sun.enterprise.util.i18n.StringManager; 29 import java.util.logging.Logger ; 30 import java.util.logging.Level ; 31 import com.sun.logging.LogDomains; 32 33 34 public class TimerEvent implements Event { 35 private static StringManager sm = StringManager.getManager(TimerEvent.class); 36 private static Logger _logger=LogDomains.getLogger(LogDomains.SELF_MANAGEMENT_LOGGER); 37 TimerEvent(Integer id, NotificationFilter filter, String description) { 38 this.id = id; 39 this.filter = filter; 40 if (description != null) 41 this.description = description; 42 else 43 this.description = defaultDescription; 44 } 45 public ObjectName getObjectName() { 46 return getTimerObjectName(); 47 } 48 public String getType() { 49 return "timer"; 50 } 51 public NotificationFilter getNotificationFilter() { 52 return filter; 53 } 54 public String getDescription() { 55 return description; 56 } 57 public void destroy() { 58 TimerEventFactory.getInstance().removeEvent(id); 59 } 60 static ObjectName getTimerObjectName() { 61 if (objName != null) 62 return objName; 63 try { 64 objName = new ObjectName (DOMAIN_NAME, DEFAULT_KEY,"timer"); 65 return objName; 66 } catch (MalformedObjectNameException ex) { 67 _logger.log(Level.WARNING,"smgt.internal_error", ex); 68 } 69 return null; 70 } 71 72 private static ObjectName objName = null; 73 private NotificationFilter filter = null; 74 private String description = null; 75 private static String defaultDescription = sm.getString("selfmgmt_event.timer_event_description"); 76 private int id; 77 } 78 | Popular Tags |