1 23 24 25 package com.sun.enterprise.admin.mbeans; 26 27 import java.util.Iterator ; 28 import java.util.logging.Level ; 29 import java.util.logging.Logger ; 30 31 import javax.management.MBeanInfo ; 32 import javax.management.MBeanServer ; 33 import javax.management.ObjectName ; 34 import javax.management.Attribute ; 35 import javax.management.AttributeList ; 36 import javax.management.MBeanException ; 37 import javax.management.AttributeNotFoundException ; 38 import javax.management.InvalidAttributeValueException ; 39 import com.sun.enterprise.admin.common.constant.AdminConstants; 40 import com.sun.enterprise.admin.config.BaseConfigMBean; 41 import com.sun.enterprise.admin.common.exception.AFRuntimeException; 42 43 51 public class ModuleMonitoringLevelsMBean extends BaseConfigMBean { 52 53 public static final String CONNECTOR_SERVICE_ATTR_NAME = "connector-service"; 54 public static final String JMS_SERVICE_ATTR_NAME = "jms-service"; 55 public static final String CONNECTOR_CONNPOOL_ATTR_NAME = "connector-connection-pool"; 56 public static final Logger sLogger = Logger.getLogger(AdminConstants.kLoggerName); 57 58 61 public ModuleMonitoringLevelsMBean() { 62 63 } 64 65 public void setAttribute(Attribute attr) { 66 try { 67 super.setAttribute(attr); 68 String attrName = attr.getName(); 69 AttributeList otherAttrs = new AttributeList (); 70 sLogger.log(Level.FINE, "modulemonitoringlevelsmbean.attribute_name", attrName); 71 if(attrName.equals(CONNECTOR_SERVICE_ATTR_NAME)) { 72 73 otherAttrs.add(new Attribute (JMS_SERVICE_ATTR_NAME, attr.getValue())); 74 otherAttrs.add(new Attribute (CONNECTOR_CONNPOOL_ATTR_NAME, attr.getValue())); 75 } 76 else if(attrName.equals(JMS_SERVICE_ATTR_NAME)) 77 { 78 79 otherAttrs.add(new Attribute (CONNECTOR_CONNPOOL_ATTR_NAME, attr.getValue())); 80 otherAttrs.add(new Attribute (CONNECTOR_SERVICE_ATTR_NAME, attr.getValue())); 81 } 82 else if(attrName.equals(CONNECTOR_CONNPOOL_ATTR_NAME)) 83 { 84 85 otherAttrs.add(new Attribute (CONNECTOR_SERVICE_ATTR_NAME, attr.getValue())); 86 otherAttrs.add(new Attribute (JMS_SERVICE_ATTR_NAME, attr.getValue())); 87 } 88 super.setAttributes(otherAttrs); 89 } catch(AFRuntimeException afe) { 90 throw afe; 91 } catch(Exception e) { 92 sLogger.log(Level.WARNING, "modulemonitoringlevelsmbean.set_failed"); 93 sLogger.log(Level.WARNING, e.getLocalizedMessage(), e); 94 } 95 } 96 97 public AttributeList setAttributes(AttributeList attrs) { 98 99 AttributeList attrList = new AttributeList (); 100 Iterator it = attrs.iterator(); 101 Attribute attr = null; 102 while(it.hasNext()) { 103 try { 104 attr = (Attribute )it.next(); 105 setAttribute(attr); 106 } catch(AFRuntimeException afe) { 107 throw afe; 108 } catch(Exception e) { 109 sLogger.log(Level.WARNING, "modulemonitoringlevelsmbean.set_failed"); 110 sLogger.log(Level.WARNING, e.getLocalizedMessage(), e); 111 } 112 attrList.add(attr); 113 } 114 return attrList; 115 } 116 117 } 118 | Popular Tags |