Java Code Examples for javax.management.Attribute#getName()
The following examples show how to use
javax.management.Attribute#getName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JmxMBeanServer.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * Clone attribute. */ private Attribute cloneAttribute(Attribute attribute) { if (attribute != null) { if (!attribute.getClass().equals(Attribute.class)) { return new Attribute(attribute.getName(), attribute.getValue()); } } return attribute; }
Example 2
Source File: MBeanExceptionTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public void setAttribute(Attribute attr) throws MBeanException { String attrName = attr.getName(); if (attrName.equals("UncheckedException")) throw theUncheckedException; else throw new AssertionError(); }
Example 3
Source File: MBeanSupport.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public final void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException { final String name = attribute.getName(); final Object value = attribute.getValue(); perInterface.setAttribute(resource, name, value, getCookie()); }
Example 4
Source File: MBeanSupport.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public final void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException { final String name = attribute.getName(); final Object value = attribute.getValue(); perInterface.setAttribute(resource, name, value, getCookie()); }
Example 5
Source File: MBeanServerDelegateImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * This method always fail since all MBeanServerDelegateMBean attributes * are read-only. * * @param attribute The identification of the attribute to * be set and the value it is to be set to. * * @exception AttributeNotFoundException */ public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException { // Now we will always fail: // Either because the attribute is null or because it is not // accessible (or does not exist). // final String attname = (attribute==null?null:attribute.getName()); if (attname == null) { final RuntimeException r = new IllegalArgumentException("Attribute name cannot be null"); throw new RuntimeOperationsException(r, "Exception occurred trying to invoke the setter on the MBean"); } // This is a hack: we call getAttribute in order to generate an // AttributeNotFoundException if the attribute does not exist. // Object val = getAttribute(attname); // If we reach this point, we know that the requested attribute // exists. However, since all attributes are read-only, we throw // an AttributeNotFoundException. // throw new AttributeNotFoundException(attname + " not accessible"); }
Example 6
Source File: OldMBeanServerTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException { String name = attribute.getName(); AttrMethods am = attrMap.get(name); if (am == null || am.setter == null) throw new AttributeNotFoundException(name); invokeMethod(am.setter, attribute.getValue()); }
Example 7
Source File: MBeanSupport.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public final void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException { final String name = attribute.getName(); final Object value = attribute.getValue(); perInterface.setAttribute(resource, name, value, getCookie()); }
Example 8
Source File: MBeanSupport.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public final void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException { final String name = attribute.getName(); final Object value = attribute.getValue(); perInterface.setAttribute(resource, name, value, getCookie()); }
Example 9
Source File: MBeanServerDelegateImpl.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * This method always fail since all MBeanServerDelegateMBean attributes * are read-only. * * @param attribute The identification of the attribute to * be set and the value it is to be set to. * * @exception AttributeNotFoundException */ public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException { // Now we will always fail: // Either because the attribute is null or because it is not // accessible (or does not exist). // final String attname = (attribute==null?null:attribute.getName()); if (attname == null) { final RuntimeException r = new IllegalArgumentException("Attribute name cannot be null"); throw new RuntimeOperationsException(r, "Exception occurred trying to invoke the setter on the MBean"); } // This is a hack: we call getAttribute in order to generate an // AttributeNotFoundException if the attribute does not exist. // Object val = getAttribute(attname); // If we reach this point, we know that the requested attribute // exists. However, since all attributes are read-only, we throw // an AttributeNotFoundException. // throw new AttributeNotFoundException(attname + " not accessible"); }
Example 10
Source File: MBeanServerDelegateImpl.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * This method always fail since all MBeanServerDelegateMBean attributes * are read-only. * * @param attribute The identification of the attribute to * be set and the value it is to be set to. * * @exception AttributeNotFoundException */ public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException { // Now we will always fail: // Either because the attribute is null or because it is not // accessible (or does not exist). // final String attname = (attribute==null?null:attribute.getName()); if (attname == null) { final RuntimeException r = new IllegalArgumentException("Attribute name cannot be null"); throw new RuntimeOperationsException(r, "Exception occurred trying to invoke the setter on the MBean"); } // This is a hack: we call getAttribute in order to generate an // AttributeNotFoundException if the attribute does not exist. // Object val = getAttribute(attname); // If we reach this point, we know that the requested attribute // exists. However, since all attributes are read-only, we throw // an AttributeNotFoundException. // throw new AttributeNotFoundException(attname + " not accessible"); }
Example 11
Source File: MBeanSupport.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
public final void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException { final String name = attribute.getName(); final Object value = attribute.getValue(); perInterface.setAttribute(resource, name, value, getCookie()); }
Example 12
Source File: JmxMBeanServer.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** * Clone attribute. */ private Attribute cloneAttribute(Attribute attribute) { if (attribute != null) { if (!attribute.getClass().equals(Attribute.class)) { return new Attribute(attribute.getName(), attribute.getValue()); } } return attribute; }
Example 13
Source File: JmxMBeanServer.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Clone attribute. */ private Attribute cloneAttribute(Attribute attribute) { if (attribute != null) { if (!attribute.getClass().equals(Attribute.class)) { return new Attribute(attribute.getName(), attribute.getValue()); } } return attribute; }
Example 14
Source File: MBeanServerDelegateImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * This method always fail since all MBeanServerDelegateMBean attributes * are read-only. * * @param attribute The identification of the attribute to * be set and the value it is to be set to. * * @exception AttributeNotFoundException */ public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException { // Now we will always fail: // Either because the attribute is null or because it is not // accessible (or does not exist). // final String attname = (attribute==null?null:attribute.getName()); if (attname == null) { final RuntimeException r = new IllegalArgumentException("Attribute name cannot be null"); throw new RuntimeOperationsException(r, "Exception occurred trying to invoke the setter on the MBean"); } // This is a hack: we call getAttribute in order to generate an // AttributeNotFoundException if the attribute does not exist. // Object val = getAttribute(attname); // If we reach this point, we know that the requested attribute // exists. However, since all attributes are read-only, we throw // an AttributeNotFoundException. // throw new AttributeNotFoundException(attname + " not accessible"); }
Example 15
Source File: MBeanExceptionTest.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public void setAttribute(Attribute attr) throws MBeanException { String attrName = attr.getName(); if (attrName.equals("UncheckedException")) throw theUncheckedException; else throw new AssertionError(); }
Example 16
Source File: RequiredModelMBean.java From jdk1.8-source-analysis with Apache License 2.0 | 4 votes |
public void sendAttributeChangeNotification(Attribute inOldVal, Attribute inNewVal) throws MBeanException, RuntimeOperationsException { final String mth = "sendAttributeChangeNotification(Attribute, Attribute)"; if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { MODELMBEAN_LOGGER.logp(Level.FINER, RequiredModelMBean.class.getName(),mth, "Entry"); } // do we really want to do this? if ((inOldVal == null) || (inNewVal == null)) throw new RuntimeOperationsException(new IllegalArgumentException("Attribute object must not be null"), "Exception occurred trying to send " + "attribute change notification of a ModelMBean"); if (!(inOldVal.getName().equals(inNewVal.getName()))) throw new RuntimeOperationsException(new IllegalArgumentException("Attribute names are not the same"), "Exception occurred trying to send " + "attribute change notification of a ModelMBean"); Object newVal = inNewVal.getValue(); Object oldVal = inOldVal.getValue(); String className = "unknown"; if (newVal != null) className = newVal.getClass().getName(); if (oldVal != null) className = oldVal.getClass().getName(); AttributeChangeNotification myNtfyObj = new AttributeChangeNotification(this, 1, ((new Date()).getTime()), "AttributeChangeDetected", inOldVal.getName(), className, inOldVal.getValue(), inNewVal.getValue()); sendAttributeChangeNotification(myNtfyObj); if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { MODELMBEAN_LOGGER.logp(Level.FINER, RequiredModelMBean.class.getName(),mth, "Exit"); } }
Example 17
Source File: RequiredModelMBean.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
public void sendAttributeChangeNotification(Attribute inOldVal, Attribute inNewVal) throws MBeanException, RuntimeOperationsException { final String mth = "sendAttributeChangeNotification(Attribute, Attribute)"; if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { MODELMBEAN_LOGGER.logp(Level.FINER, RequiredModelMBean.class.getName(),mth, "Entry"); } // do we really want to do this? if ((inOldVal == null) || (inNewVal == null)) throw new RuntimeOperationsException(new IllegalArgumentException("Attribute object must not be null"), "Exception occurred trying to send " + "attribute change notification of a ModelMBean"); if (!(inOldVal.getName().equals(inNewVal.getName()))) throw new RuntimeOperationsException(new IllegalArgumentException("Attribute names are not the same"), "Exception occurred trying to send " + "attribute change notification of a ModelMBean"); Object newVal = inNewVal.getValue(); Object oldVal = inOldVal.getValue(); String className = "unknown"; if (newVal != null) className = newVal.getClass().getName(); if (oldVal != null) className = oldVal.getClass().getName(); AttributeChangeNotification myNtfyObj = new AttributeChangeNotification(this, 1, ((new Date()).getTime()), "AttributeChangeDetected", inOldVal.getName(), className, inOldVal.getValue(), inNewVal.getValue()); sendAttributeChangeNotification(myNtfyObj); if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { MODELMBEAN_LOGGER.logp(Level.FINER, RequiredModelMBean.class.getName(),mth, "Exit"); } }
Example 18
Source File: RequiredModelMBean.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public void sendAttributeChangeNotification(Attribute inOldVal, Attribute inNewVal) throws MBeanException, RuntimeOperationsException { final String mth = "sendAttributeChangeNotification(Attribute, Attribute)"; if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { MODELMBEAN_LOGGER.logp(Level.FINER, RequiredModelMBean.class.getName(),mth, "Entry"); } // do we really want to do this? if ((inOldVal == null) || (inNewVal == null)) throw new RuntimeOperationsException(new IllegalArgumentException("Attribute object must not be null"), "Exception occurred trying to send " + "attribute change notification of a ModelMBean"); if (!(inOldVal.getName().equals(inNewVal.getName()))) throw new RuntimeOperationsException(new IllegalArgumentException("Attribute names are not the same"), "Exception occurred trying to send " + "attribute change notification of a ModelMBean"); Object newVal = inNewVal.getValue(); Object oldVal = inOldVal.getValue(); String className = "unknown"; if (newVal != null) className = newVal.getClass().getName(); if (oldVal != null) className = oldVal.getClass().getName(); AttributeChangeNotification myNtfyObj = new AttributeChangeNotification(this, 1, ((new Date()).getTime()), "AttributeChangeDetected", inOldVal.getName(), className, inOldVal.getValue(), inNewVal.getValue()); sendAttributeChangeNotification(myNtfyObj); if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { MODELMBEAN_LOGGER.logp(Level.FINER, RequiredModelMBean.class.getName(),mth, "Exit"); } }
Example 19
Source File: ContextResourceMBean.java From Tomcat8-Source-Read with MIT License | 4 votes |
/** * Set the value of a specific attribute of this MBean. * * @param attribute The identification of the attribute to be set * and the new value * * @exception AttributeNotFoundException if this attribute is not * supported by this MBean * @exception MBeanException if the initializer of an object * throws an exception * @exception ReflectionException if a Java reflection exception * occurs when invoking the getter */ @Override public void setAttribute(Attribute attribute) throws AttributeNotFoundException, MBeanException, ReflectionException { // Validate the input parameters if (attribute == null) { throw new RuntimeOperationsException( new IllegalArgumentException("Attribute is null"), "Attribute is null"); } String name = attribute.getName(); Object value = attribute.getValue(); if (name == null) { throw new RuntimeOperationsException( new IllegalArgumentException("Attribute name is null"), "Attribute name is null"); } ContextResource cr = doGetManagedResource(); if ("auth".equals(name)) { cr.setAuth((String)value); } else if ("description".equals(name)) { cr.setDescription((String)value); } else if ("name".equals(name)) { cr.setName((String)value); } else if ("scope".equals(name)) { cr.setScope((String)value); } else if ("type".equals(name)) { cr.setType((String)value); } else { cr.setProperty(name, "" + value); } // cannot use side-effects. It's removed and added back each time // there is a modification in a resource. NamingResources nr = cr.getNamingResources(); nr.removeResource(cr.getName()); nr.addResource(cr); }
Example 20
Source File: RequiredModelMBean.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public void sendAttributeChangeNotification(Attribute inOldVal, Attribute inNewVal) throws MBeanException, RuntimeOperationsException { final String mth = "sendAttributeChangeNotification(Attribute, Attribute)"; if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { MODELMBEAN_LOGGER.logp(Level.FINER, RequiredModelMBean.class.getName(),mth, "Entry"); } // do we really want to do this? if ((inOldVal == null) || (inNewVal == null)) throw new RuntimeOperationsException(new IllegalArgumentException("Attribute object must not be null"), "Exception occurred trying to send " + "attribute change notification of a ModelMBean"); if (!(inOldVal.getName().equals(inNewVal.getName()))) throw new RuntimeOperationsException(new IllegalArgumentException("Attribute names are not the same"), "Exception occurred trying to send " + "attribute change notification of a ModelMBean"); Object newVal = inNewVal.getValue(); Object oldVal = inOldVal.getValue(); String className = "unknown"; if (newVal != null) className = newVal.getClass().getName(); if (oldVal != null) className = oldVal.getClass().getName(); AttributeChangeNotification myNtfyObj = new AttributeChangeNotification(this, 1, ((new Date()).getTime()), "AttributeChangeDetected", inOldVal.getName(), className, inOldVal.getValue(), inNewVal.getValue()); sendAttributeChangeNotification(myNtfyObj); if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { MODELMBEAN_LOGGER.logp(Level.FINER, RequiredModelMBean.class.getName(),mth, "Exit"); } }