Package javax.management

Examples of javax.management.NotCompliantMBeanException


    static MBeanInfo testCompliance(final Class baseClass,
            Class mbeanInterface)
      throws NotCompliantMBeanException {
 
  if (baseClass.isInterface())
      throw new NotCompliantMBeanException(baseClass.getName() +
             " must be a class.");
  // ------------------------------
  // ------------------------------
  if (mbeanInterface == null)
      // No interface specified: look for default MBean interface.
      mbeanInterface = getStandardMBeanInterface(baseClass);
  else if (! mbeanInterface.isAssignableFrom(baseClass)) {
      // specified interface not implemented by given class
      final String msg =
    baseClass.getName() + " does not implement the " +
    mbeanInterface.getName() + " interface";
      throw new NotCompliantMBeanException(msg);
  } else if (! mbeanInterface.isInterface()) {
      // Base class X, but XMBean is not an interface
      final String msg =
    baseClass.getName() + ": " + mbeanInterface.getName() +
    " is not an interface";
      throw new NotCompliantMBeanException(msg);
  }


  if (mbeanInterface == null) {
      // Error: MBean does not implement javax.management.DynamicMBean
      // nor MBean interface
      final String baseClassName = baseClass.getName();
      final String msg =
    baseClassName + " does not implement the " + baseClassName +
    "MBean interface or the DynamicMBean interface";
      throw new NotCompliantMBeanException(msg);
  }
 
  final int mods = mbeanInterface.getModifiers();
  if (!Modifier.isPublic(mods))
      throw new NotCompliantMBeanException(mbeanInterface.getName() +
             " implemented by " +
             baseClass.getName() +
             " must be public");

  return (introspect(baseClass, mbeanInterface));
View Full Code Here


      if (mb.getName().equals(attr.getName())) {
    if ((attr.isReadable() && mb.isReadable()) &&
        (attr.isIs() != mb.isIs())) {
        final String msg =
      "Conflicting getters for attribute " + mb.getName();
        throw new NotCompliantMBeanException(msg);
   
    if (!mb.getType().equals(attr.getType())) {
        if (mb.isWritable() && attr.isWritable()) {
      final String msg =
          "Type mismatch between parameters of set" +
          mb.getName() + " methods";
      throw new NotCompliantMBeanException(msg);
        } else {
      final String msg =
          "Type mismatch between parameters of get or is" +
          mb.getName() + ", set" + mb.getName() + " methods";
      throw new NotCompliantMBeanException(msg);
        }
    }
    if (attr.isReadable() && mb.isReadable()) {
        return false;
    }
View Full Code Here

      }
      catch (Exception ex)
      {
         // any other exception is mapped to NotCompliantMBeanException
         registrationDone = false;
         NotCompliantMBeanException ncex = new NotCompliantMBeanException("Cannot register MBean: " + name);
         ncex.initCause(ex);
         throw ncex;
      }
      catch (Throwable t)
      {
         // Some other error
View Full Code Here

           throws NotCompliantMBeanException
   {
      try
      {
         if (info == null)
            throw new NotCompliantMBeanException("MBeanInfo cannot be null, for: " + name);

         if (info.getClassName() == null)
            throw new NotCompliantMBeanException("Classname returned from MBeanInfo cannot be null, for: " + name);
      }
      catch (NotCompliantMBeanException ncex)
      {
         throw ncex;
      }
      catch (Throwable t)
      {
         NotCompliantMBeanException ncex = new NotCompliantMBeanException("Cannot verify MBeanInfo, for: " + name);
         ncex.initCause(t);
         throw ncex;
      }
   }
View Full Code Here

      }
      catch (ReflectionException refex)
      {
         // Note, the CTS wants a NotCompliantMBeanException for this case
         if (refex.getCause() instanceof InstantiationException)
            throw new NotCompliantMBeanException("Cannot instanciate MBean: " + className);
         else
            throw refex;
      }
   }
View Full Code Here

    */
   private ObjectInstance handleExceptionOnCreate(ReflectionException refex, String className)
           throws NotCompliantMBeanException, ReflectionException
   {
      if (refex.getCause() instanceof InstantiationException)
         throw new NotCompliantMBeanException("Cannot instanciate MBean: " + className);

      throw refex;
   }
View Full Code Here

            // jboss_xmbean_1_0.dtd is the only implemented useful xmbean
            return new JBossXMBean10(mmbClassName, resourceClassName, element, properties).build();
         }
         else
         {
            throw new NotCompliantMBeanException("Unknown xmbean type " + versionString);
         } // end of else

      }
      catch (DocumentException e)
      {
View Full Code Here

      // If there is an ancestor called SuperClass that is an instance of SuperClassMBean
      Class superClass = mbeanClass.getSuperclass();
      if (superClass != null)
         return of(superClass);

      throw new NotCompliantMBeanException("Class does not expose a management interface: " + mbeanClass.getName());
   }
View Full Code Here

   public MXBeanMetaData(Class<?> mbeanClassthrows NotCompliantMBeanException
   {
      this.mbeanClass = mbeanClass;
      this.mbeanInterface = findMXBeanInterface(mbeanClass);
      if (this.mbeanInterface == null)
         throw new NotCompliantMBeanException("Cannot obtain MXBean interface for: " + mbeanClass);
   }
View Full Code Here

      this.mbeanClass = mbeanInstance.getClass();
      this.mbeanInterface = mbeanInterface;
      if (this.mbeanInterface == null)
         this.mbeanInterface = MXBeanMetaData.findMXBeanInterface(mbeanClass);
      if (this.mbeanInterface == null)
         throw new NotCompliantMBeanException("Cannot obtain mxbean interface for: " + mbeanClass);
      if (this.mbeanInterface.isInterface() == false)
         throw new NotCompliantMBeanException("Management interface is not an interface: " + mbeanInterface);
   }
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.