1 25 26 package org.objectweb.easybeans.jsr77; 27 28 import javax.management.InstanceNotFoundException ; 29 import javax.management.MBeanException ; 30 import javax.management.RuntimeOperationsException ; 31 import javax.management.modelmbean.InvalidTargetObjectTypeException ; 32 33 import org.apache.commons.modeler.BaseModelMBean; 34 import org.objectweb.easybeans.log.JLog; 35 import org.objectweb.easybeans.log.JLogFactory; 36 37 42 public class J2EEManagedObjectMBean<T> extends BaseModelMBean { 43 44 47 private static JLog logger = JLogFactory.getLog(J2EEManagedObjectMBean.class); 48 49 52 private static final boolean IS_EVENT_PROVIDER = false; 53 54 57 private static final boolean IS_STATISTICS_PROVIDER = false; 58 59 62 private static final boolean IS_STATE_MANAGEABLE = false; 63 64 68 public J2EEManagedObjectMBean() throws MBeanException { 69 super(); 70 } 71 72 73 76 @SuppressWarnings ("unchecked") 77 protected T getManagedComponent() { 78 T deployer = null; 79 try { 80 deployer = (T) getManagedResource(); 81 } catch (InstanceNotFoundException e) { 82 throw new IllegalStateException ("Cannot get the managed resource of the MBean", e); 83 } catch (RuntimeOperationsException e) { 84 throw new IllegalStateException ("Cannot get the managed resource of the MBean", e); 85 } catch (MBeanException e) { 86 throw new IllegalStateException ("Cannot get the managed resource of the MBean", e); 87 } catch (InvalidTargetObjectTypeException e) { 88 throw new IllegalStateException ("Cannot get the managed resource of the MBean", e); 89 } 90 return deployer; 91 } 92 93 96 public boolean isStateManageable() { 97 return IS_STATE_MANAGEABLE; 98 } 99 100 103 public boolean isStatisticsProvider() { 104 return IS_STATISTICS_PROVIDER; 105 } 106 107 110 public boolean isEventProvider() { 111 return IS_EVENT_PROVIDER; 112 } 113 114 117 protected static final JLog getLogger() { 118 return logger; 119 } 120 121 } 122 123 | Popular Tags |