Package javax.management

Examples of javax.management.NotCompliantMBeanException


            throw (NotCompliantMBeanException)cause;
        final String classname =
                (notCompliant==null)?"null class":notCompliant.getName();
        final String reason =
                (cause==null)?"Not compliant":cause.getMessage();
        final NotCompliantMBeanException res =
                new NotCompliantMBeanException(classname+": "+reason);
        res.initCause(cause);
        throw res;
    }
View Full Code Here


    private MBeanAnalyzer(Class<?> mbeanInterface,
            MBeanIntrospector<M> introspector)
            throws NotCompliantMBeanException {
        if (!mbeanInterface.isInterface()) {
            throw new NotCompliantMBeanException("Not an interface: " +
                    mbeanInterface.getName());
        }

        try {
            initMaps(mbeanInterface, introspector);
View Full Code Here

                    am = new AttrMethods<M>();
                else {
                    if (am.getter != null) {
                        final String msg = "Attribute " + attrName +
                                " has more than one getter";
                        throw new NotCompliantMBeanException(msg);
                    }
                }
                am.getter = cm;
                attrMap.put(attrName, am);
            } else if (name.startsWith("set") && name.length() > 3
                    && m.getParameterTypes().length == 1 &&
                    m.getReturnType() == void.class) {
                // It's a setter
                attrName = name.substring(3);
                AttrMethods<M> am = attrMap.get(attrName);
                if (am == null)
                    am = new AttrMethods<M>();
                else if (am.setter != null) {
                    final String msg = "Attribute " + attrName +
                            " has more than one setter";
                    throw new NotCompliantMBeanException(msg);
                }
                am.setter = cm;
                attrMap.put(attrName, am);
            } else {
                // It's an operation
                List<M> cms = opMap.get(name);
                if (cms == null)
                    cms = newList();
                cms.add(cm);
                opMap.put(name, cms);
            }
        }
        /* Check that getters and setters are consistent. */
        for (Map.Entry<String, AttrMethods<M>> entry : attrMap.entrySet()) {
            AttrMethods<M> am = entry.getValue();
            if (!introspector.consistent(am.getter, am.setter)) {
                final String msg = "Getter and setter for " + entry.getKey() +
                        " have inconsistent types";
                throw new NotCompliantMBeanException(msg);
            }
        }
    }
View Full Code Here

        implements DynamicMBean2, MBeanRegistration {

    <T> MBeanSupport(T resource, Class<T> mbeanInterface)
            throws NotCompliantMBeanException {
  if (mbeanInterface == null)
      throw new NotCompliantMBeanException("Null MBean interface");
  if (!mbeanInterface.isInstance(resource)) {
      final String msg =
    "Resource class " + resource.getClass().getName() +
    " is not an instance of " + mbeanInterface.getName();
      throw new NotCompliantMBeanException(msg);
  }
  this.resource = resource;
        MBeanIntrospector introspector = getMBeanIntrospector();
        this.perInterface = introspector.getPerInterface(mbeanInterface);
  this.mbeanInfo = introspector.getMBeanInfo(resource, perInterface);
View Full Code Here

    Class targetClass = AopUtils.getTargetClass(bean);
    if (targetClass != bean.getClass()) {
      Class ifc = JmxUtils.getMXBeanInterface(targetClass);
      if (ifc != null) {
        if (!(ifc.isInstance(bean))) {
          throw new NotCompliantMBeanException("Managed bean [" + bean +
              "] has a target class with an MXBean interface but does not expose it in the proxy");
        }
        return new StandardMBean(bean, ifc, true);
      }
      else {
        ifc = JmxUtils.getMBeanInterface(targetClass);
        if (ifc != null) {
          if (!(ifc.isInstance(bean))) {
            throw new NotCompliantMBeanException("Managed bean [" + bean +
                "] has a target class with an MBean interface but does not expose it in the proxy");
          }
          return new StandardMBean(bean, ifc);
        }
      }
View Full Code Here

    Class targetClass = AopUtils.getTargetClass(bean);
    if (targetClass != bean.getClass()) {
      Class ifc = JmxUtils.getMXBeanInterface(targetClass);
      if (ifc != null) {
        if (!(ifc.isInstance(bean))) {
          throw new NotCompliantMBeanException("Managed bean [" + bean +
              "] has a target class with an MXBean interface but does not expose it in the proxy");
        }
        return new StandardMBean(bean, ifc, true);
      }
      else {
        ifc = JmxUtils.getMBeanInterface(targetClass);
        if (ifc != null) {
          if (!(ifc.isInstance(bean))) {
            throw new NotCompliantMBeanException("Managed bean [" + bean +
                "] has a target class with an MBean interface but does not expose it in the proxy");
          }
          return new StandardMBean(bean, ifc);
        }
      }
View Full Code Here

    Class targetClass = AopUtils.getTargetClass(bean);
    if (targetClass != bean.getClass()) {
      Class ifc = JmxUtils.getMXBeanInterface(targetClass);
      if (ifc != null) {
        if (!(ifc.isInstance(bean))) {
          throw new NotCompliantMBeanException("Managed bean [" + bean +
              "] has a target class with an MXBean interface but does not exposed it in the proxy");
        }
        return new StandardMBean(bean, ifc, true);
      }
      else {
        ifc = JmxUtils.getMBeanInterface(targetClass);
        if (ifc != null) {
          if (!(ifc.isInstance(bean))) {
            throw new NotCompliantMBeanException("Managed bean [" + bean +
                "] has a target class with an MXBean interface but does not exposed it in the proxy");
          }
          return new StandardMBean(bean, ifc);
        }
      }
View Full Code Here

                {
                    info = new MBeanAttributeInfo( attlist[i], description, getter, setter );
                }
                catch (IntrospectionException e)
                {
                    throw new NotCompliantMBeanException( e.getMessage() );
                }

                attributes[i] = info;
            }
        }

        //
        //  Create operations.
        //
        String[] oplist = getMethodNames();
        MBeanOperationInfo[] operations = new MBeanOperationInfo[oplist.length];

        Method[] methods = getClass().getMethods();

        for( int i = 0; i < oplist.length; i++ )
        {
            Method method = null;

            for( int m = 0; m < methods.length; m++ )
            {
                if( methods[m].getName().equals( oplist[i] ) )
                {
                    method = methods[m];
                }
            }

            if( method == null )
            {
                throw new NotCompliantMBeanException("Class declares method "+oplist[i]+", yet does not implement it!");
            }

            MBeanOperationInfo info = new MBeanOperationInfo( method.getName(), method );

            operations[i] = info;
View Full Code Here

    private void checkCompliance() throws NotCompliantMBeanException
    {
        if (!(mIsStandard || mIsDynamic) || // (A U B)' = A' ^ B'
            (mIsStandard && mIsDynamic))
        {
            throw new NotCompliantMBeanException();
        }
    }
View Full Code Here

        implements DynamicMBean2, MBeanRegistration {

    <T> MBeanSupport(T resource, Class<T> mbeanInterfaceType)
            throws NotCompliantMBeanException {
        if (mbeanInterfaceType == null)
            throw new NotCompliantMBeanException("Null MBean interface");
        if (!mbeanInterfaceType.isInstance(resource)) {
            final String msg =
                "Resource class " + resource.getClass().getName() +
                " is not an instance of " + mbeanInterfaceType.getName();
            throw new NotCompliantMBeanException(msg);
        }
        this.resource = resource;
        MBeanIntrospector<M> introspector = getMBeanIntrospector();
        this.perInterface = introspector.getPerInterface(mbeanInterfaceType);
        this.mbeanInfo = introspector.getMBeanInfo(resource, perInterface);
View Full Code Here

TOP

Related Classes of javax.management.NotCompliantMBeanException

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.