1 23 24 77 78 package com.sun.enterprise.admin; 79 80 import javax.management.DynamicMBean ; 82 import javax.management.AttributeList ; 83 import javax.management.MBeanInfo ; 84 import javax.management.Attribute ; 85 import javax.management.AttributeNotFoundException ; 86 import javax.management.MBeanException ; 87 import javax.management.ReflectionException ; 88 import javax.management.InvalidAttributeValueException ; 89 import javax.management.InstanceNotFoundException ; 90 import javax.management.RuntimeOperationsException ; 91 import javax.management.Descriptor ; 92 93 import javax.management.modelmbean.ModelMBeanInfo ; 94 95 96 import java.lang.reflect.Method ; 98 99 import com.sun.enterprise.admin.meta.MBeanMetaConstants; 100 101 import java.util.logging.Logger ; 103 import java.util.logging.Level ; 104 import com.sun.logging.LogDomains; 105 106 import javax.management.NotificationBroadcasterSupport ; 107 import com.sun.enterprise.util.i18n.StringManager; 108 109 115 116 public class BaseAdminMBean extends NotificationBroadcasterSupport implements DynamicMBean 117 { 118 protected ModelMBeanInfo info = null; 119 protected String mbeanType = "unknown"; 120 121 static protected Logger _sLogger = LogDomains.getLogger(LogDomains.ADMIN_LOGGER); 123 protected StringManager _localStrings = null; 124 public BaseAdminMBean() { 125 _localStrings = StringManager.getManager( BaseAdminMBean.class ); 126 } 127 128 public void setModelMBeanInfo(ModelMBeanInfo mbeanInfo) { 129 info = mbeanInfo; 130 try { 132 Descriptor descr = info.getMBeanDescriptor(); 133 mbeanType = (String )descr.getFieldValue(MBeanMetaConstants.NMTYPE_FIELD_NAME); 134 } catch (Exception e) 135 { 136 } 137 } 138 139 public void setManagedResource(Object resource, String type) 140 throws InstanceNotFoundException , 141 MBeanException , RuntimeOperationsException { 142 143 String msg = _localStrings.getString("mbean.baseadmin.setmanagedresource_not_implemented"); 144 throw new UnsupportedOperationException ( msg ); 145 } 146 147 public Object getAttribute(String attributeName) throws 148 AttributeNotFoundException , MBeanException , ReflectionException { 149 String msg = _localStrings.getString("mbean.baseadmin.getattribute_not_implemented"); 150 throw new UnsupportedOperationException ( msg ); 151 } 152 153 public AttributeList getAttributes(String [] attributeNames) { 154 String msg = _localStrings.getString("mbean.baseadmin.getattributes_not_implemented"); 155 throw new UnsupportedOperationException ( msg ); 156 } 157 158 public MBeanInfo getMBeanInfo() { 159 return (MBeanInfo )info; 160 } 161 162 165 167 168 170 181 public Object invoke(String methodName, Object [] methodParams, 182 String [] methodSignature) throws MBeanException , ReflectionException { 183 227 228 throw new java.lang.UnsupportedOperationException ("Not Yet Implemented"); 229 } 230 231 public void setAttribute(Attribute attribute) throws 232 AttributeNotFoundException , InvalidAttributeValueException , 233 MBeanException , ReflectionException { 234 235 String msg = _localStrings.getString("mbean.baseadmin.setattribute_not_implemented" ); 236 throw new UnsupportedOperationException ( msg ); 237 } 238 239 public AttributeList setAttributes(AttributeList parm1) { 240 String msg = _localStrings.getString("mbean.baseadmin.setattributes_not_implemented" ); 241 throw new UnsupportedOperationException ( msg ); 242 } 243 246 protected boolean isDebugEnabled() { 247 return true; 248 } 249 250 protected void debug(String s) { 251 System.out.println(s); 253 } 254 protected void info(String s) { 255 System.out.println(s); 257 } 258 protected void error(String s) { 259 System.out.println(s); 261 } 262 263 } 264 | Popular Tags |