Package javax.management

Examples of javax.management.AttributeNotFoundException


    private void checkIsIsAttribute(String name) throws
    AttributeNotFoundException {
        MBeanAttributeInfo attrInfo = getAttributeInfo(name);

  if (attrInfo == null)  {
      throw new AttributeNotFoundException("The attribute "
      + name
      + " is not a valid attribute for MBean"
      + getMBeanName());
  }

  if (!attrInfo.isIs())  {
      throw new AttributeNotFoundException("The attribute "
      + name
      + " is not an isIs attribute for MBean"
      + getMBeanName());
  }
    }
View Full Code Here


    /* ------------------------------------------------------------ */
    public Object getAttribute(String name) throws AttributeNotFoundException, MBeanException, ReflectionException
    {
        Method getter = (Method) _getters.get(name);
        if (getter == null)
            throw new AttributeNotFoundException(name);
        try
        {
            Object o = _managed;
            if (getter.getDeclaringClass().isInstance(this))
                o = this; // mbean method

            // get the attribute
            Object r=getter.invoke(o, (java.lang.Object[]) null);

            // convert to ObjectName if need be.
            if (r!=null && _convert.contains(name))
            {
                if (r.getClass().isArray())
                {
                    ObjectName[] on = new ObjectName[Array.getLength(r)];
                    for (int i=0;i<on.length;i++)
                        on[i]=_mbeanContainer.findMBean(Array.get(r, i));
                    r=on;
                }
                else
                {
                    ObjectName mbean = _mbeanContainer.findMBean(r);
                    if (mbean==null)
                        return null;
                    r=mbean;
                }
            }
            return r;
        }
        catch (IllegalAccessException e)
        {
            Log.warn(Log.EXCEPTION, e);
            throw new AttributeNotFoundException(e.toString());
        }
        catch (InvocationTargetException e)
        {
            Log.warn(Log.EXCEPTION, e);
            throw new ReflectionException((Exception) e.getTargetException());
View Full Code Here

        if (Log.isDebugEnabled())
            Log.debug("setAttribute " + _managed + ":" +attr.getName() + "=" + attr.getValue());
        Method setter = (Method) _setters.get(attr.getName());
        if (setter == null)
            throw new AttributeNotFoundException(attr.getName());
        try
        {
            Object o = _managed;
            if (setter.getDeclaringClass().isInstance(this))
                o = this;

            // get the value
            Object value = attr.getValue();

            // convert from ObjectName if need be
            if (value!=null && _convert.contains(attr.getName()))
            {
                if (value.getClass().isArray())
                {
                    Class t=setter.getParameterTypes()[0].getComponentType();
                    Object na = Array.newInstance(t,Array.getLength(value));
                    for (int i=Array.getLength(value);i-->0;)
                        Array.set(na, i, _mbeanContainer.findBean((ObjectName)Array.get(value, i)));
                    value=na;
                }
                else
                    value=_mbeanContainer.findBean((ObjectName)value);
            }

            // do the setting
            setter.invoke(o, new Object[]{ value });
        }
        catch (IllegalAccessException e)
        {
            Log.warn(Log.EXCEPTION, e);
            throw new AttributeNotFoundException(e.toString());
        }
        catch (InvocationTargetException e)
        {
            Log.warn(Log.EXCEPTION, e);
            throw new ReflectionException((Exception) e.getTargetException());
View Full Code Here

    public Object getAttribute(ObjectName name, String attribute) throws MBeanException, AttributeNotFoundException, InstanceNotFoundException, ReflectionException {
        AbstractName abstractName = toAbstractName(name);
        try {
            return kernel.getAttribute(abstractName, attribute);
        } catch (NoSuchAttributeException e) {
            throw (AttributeNotFoundException)new AttributeNotFoundException(attribute).initCause(e);
        } catch (GBeanNotFoundException e) {
            throw (InstanceNotFoundException)new InstanceNotFoundException(name.getCanonicalName()).initCause(e);
        } catch (InternalKernelException e) {
            throw new MBeanException(unwrapInternalKernelException(e));
        } catch (Exception e) {
View Full Code Here

        String attributeName = attribute.getName();
        Object attributeValue = attribute.getValue();
        try {
            kernel.setAttribute(abstractName, attributeName, attributeValue);
        } catch (NoSuchAttributeException e) {
            throw (AttributeNotFoundException)new AttributeNotFoundException(attributeName).initCause(e);
        } catch (GBeanNotFoundException e) {
            throw (InstanceNotFoundException)new InstanceNotFoundException(name.getCanonicalName()).initCause(e);
        } catch (InternalKernelException e) {
            throw new MBeanException(unwrapInternalKernelException(e));
        } catch (Exception e) {
View Full Code Here

    public Object getAttribute(String attributeName) throws ReflectionException, AttributeNotFoundException {
        try {
            return kernel.getAttribute(abstractName, attributeName);
        } catch (NoSuchAttributeException e) {
            throw (AttributeNotFoundException)new AttributeNotFoundException(attributeName).initCause(e);
        } catch (Exception e) {
            throw new ReflectionException(e);
        }
    }
View Full Code Here

        String attributeName = attribute.getName();
        Object attributeValue = attribute.getValue();
        try {
            kernel.setAttribute(abstractName, attributeName, attributeValue);
        } catch (NoSuchAttributeException e) {
            throw (AttributeNotFoundException)new AttributeNotFoundException(attributeName).initCause(e);
        } catch (Exception e) {
            throw new ReflectionException(e);
        }
    }
View Full Code Here

  @Override
  public Object getAttribute(Object o, String attribute)
      throws AttributeNotFoundException, MBeanException,
      ReflectionException {
    Method method = getGetter(attribute);
    if (method == null) throw new AttributeNotFoundException(attribute + "@" + name);
    try {
      return method.invoke(o, new Object[0]);
    } catch (Exception e) {
      throw new ReflectionException(e,attribute + "@" + name);
    }
View Full Code Here

  public void setAttribute(Object o,Attribute attribute)
      throws AttributeNotFoundException, InvalidAttributeValueException,
      MBeanException, ReflectionException {
   
    Method method = getSetter(attribute.getName());
    if (method == null) throw new AttributeNotFoundException(attribute + "@" + name);
    try {
      method.invoke(o, new Object[] { attribute.getValue() } );
    } catch (Exception e) {
      throw new ReflectionException(e,attribute + "@" + name);
    }
View Full Code Here

                                                      "Error retrieving globals list " + e.getMessage() );
            }
        } else if ( attributeName.equals( ATTR_PACKAGES ) ) {
            return getPackages();
        }
        throw new AttributeNotFoundException( "Cannot find " + attributeName + " attribute " );
    }
View Full Code Here

TOP

Related Classes of javax.management.AttributeNotFoundException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.