Package javax.management

Examples of javax.management.MBeanOperationInfo


                                                                         ReflectionException {
      if (log.isDebugEnabled()) {
         log.debugf("Invoke method called on %s", name);
      }

      MBeanOperationInfo opInfo = null;
      for (IspnMBeanOperationInfo op : opInfos) {
         if (op.getOperationName().equals(name)) {
            opInfo = op;
            break;
         }
      }

      if (opInfo == null) {
         final String msg = "Operation " + name + " not amongst operations in " + opInfos;
         throw new MBeanException(new ServiceNotFoundException(msg), msg);
      }

      // Argument type transformation according to signatures
      for (int i = 0; i < sig.length; i++) {
         // arguments are taken from RHQ like java.lang.String but we need some fields to be numbers
         if (args[i] != null) {
            if (log.isDebugEnabled())
               log.debugf("Argument value before transformation: %s and its class: %s. " +
                                "For method.invoke we need it to be class: %s", args[i], args[i].getClass(), sig[i]);
            if (sig[i].equals(int.class.getCanonicalName()) || sig[i].equals(Integer.class.getCanonicalName())) {
               if ((args[i].getClass() != Integer.class) && (args[i].getClass() != int.class))
                  args[i] = Integer.parseInt((String) args[i]);
            }
            if (sig[i].equals(Long.class.getCanonicalName()) || sig[i].equals(long.class.getCanonicalName())) {
               if ((args[i].getClass() != Long.class) && (args[i].getClass() != long.class))
                  args[i] = Long.parseLong((String) args[i]);
            }
         }
      }

      try {
         Class<?>[] classes = new Class[sig.length];
         for (int i = 0; i < classes.length; i++) {
            classes[i] = ReflectionUtil.getClassForName(sig[i], null);
         }
         Method method = getObject().getClass().getMethod(opInfo.getName(), classes);
         return method.invoke(getObject(), args);
      } catch (Exception e) {
         throw new MBeanException(new Exception(getRootCause(e)));
      }
   }
View Full Code Here


        MetricsUtil.LOG.error("unknown metrics type: " + o.getClass().getName());
      }

      if (needsMinMaxResetOperation) {
        operationsInfo = new MBeanOperationInfo[] {
            new MBeanOperationInfo(RESET_ALL_MIN_MAX_OP, "Reset (zero) All Min Max",
                    null, "void", MBeanOperationInfo.ACTION) };
      }
    }
    MBeanAttributeInfo[] attrArray = new MBeanAttributeInfo[attributesInfo.size()];
    mbeanInfo =  new MBeanInfo(this.getClass().getName(), mbeanDescription,
View Full Code Here

      }
      catch(Exception e)
      {
      }
      MBeanOperationInfo[] opInfo = {
         new MBeanOperationInfo("Access the LoginConfiguration", getConfiguration)
      };
      MBeanInfo info = new MBeanInfo(c.getName(), "Default JAAS LoginConfig",
         attrInfo, ctorInfo, opInfo, null);
      return info;
   }
View Full Code Here

       
        if (managedMethod != null)
        {
          Description description = method.getAnnotation(Description.class);
         
          operationList.add(new MBeanOperationInfo((description != null) ? description.value() : null, method));
        }
      }
     
      Description description = beanClass.getAnnotation(Description.class);
     
View Full Code Here

            new MBeanAttributeInfo[attrs.length];
        for (int i = 0; i < attrs.length; i++)
            attributes[i] = attrs[i].createAttributeInfo();

        OperationInfo opers[] = getOperations();
        MBeanOperationInfo operations[] =
            new MBeanOperationInfo[opers.length];
        for (int i = 0; i < opers.length; i++)
            operations[i] = opers[i].createOperationInfo();

View Full Code Here

                       info.getMBeanAttributeInfo().isReadable(), info.getMBeanAttributeInfo().isWritable(),
                       info.getMBeanAttributeInfo().isIs(), info.getMBeanAttributeInfo().getType());
      }

      // And operations
      MBeanOperationInfo op;
      opInfos = new MBeanOperationInfo[mBeanMetadata.getOperationMetadata().size()];
      i = 0;
      for (JmxOperationMetadata operation : mBeanMetadata.getOperationMetadata()) {
         op = toJmxInfo(operation);
         opInfos[i++] = op;
         if (trace) log.tracef("Operation %s %s", op.getReturnType(), op.getName());
      }
   }
View Full Code Here

                                                        attributeMetadata.getDescription(), true, attributeMetadata.isWritable(),
                                                        attributeMetadata.isIs(), getter, setter, this);
   }

   private MBeanOperationInfo toJmxInfo(JmxOperationMetadata operationMetadata) throws ClassNotFoundException {
      return new MBeanOperationInfo(operationMetadata.getDescription(),
                                    ReflectionUtil.findMethod(objectClass,
                                                              operationMetadata.getMethodName(),
                                                              getParameterArray(operationMetadata.getMethodParameters())));
   }
View Full Code Here

                                                                         ReflectionException {
      if (log.isDebugEnabled()) {
         log.debugf("Invoke method called on %s", name);
      }

      MBeanOperationInfo opInfo = null;
      for (MBeanOperationInfo op : opInfos) {
         if (op.getName().equals(name)) {
            opInfo = op;
            break;
         }
View Full Code Here

                       info.getMBeanAttributeInfo().isReadable(), info.getMBeanAttributeInfo().isWritable(),
                       info.getMBeanAttributeInfo().isIs(), info.getMBeanAttributeInfo().getType());
      }

      // And operations
      MBeanOperationInfo op;
      opInfos = new MBeanOperationInfo[mBeanMetadata.getOperationMetadata().size()];
      i = 0;
      for (JmxOperationMetadata operation : mBeanMetadata.getOperationMetadata()) {
         op = toJmxInfo(operation);
         opInfos[i++] = op;
         if (trace) log.tracef("Operation %s %s", op.getReturnType(), op.getName());
      }
   }
View Full Code Here

                                                        attributeMetadata.getDescription(), true, attributeMetadata.isWritable(),
                                                        attributeMetadata.isIs(), getter, setter, this);
   }

   private MBeanOperationInfo toJmxInfo(JmxOperationMetadata operationMetadata) throws ClassNotFoundException {
      return new MBeanOperationInfo(operationMetadata.getDescription(),
                                    ReflectionUtil.findMethod(objectClass,
                                                              operationMetadata.getMethodName(),
                                                              getParameterArray(operationMetadata.getMethodParameters())));
   }
View Full Code Here

TOP

Related Classes of javax.management.MBeanOperationInfo

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.