Package javax.management

Examples of javax.management.MBeanOperationInfo


            attName=attName.substring(2);
        }
        //expose unless we already exposed matching attribute field
        boolean isAlreadyExposed=atts.containsKey(attName);
        if(!isAlreadyExposed) {
            ops.add(new MBeanOperationInfo(op != null? op.description() : "", method));
        }
    }
View Full Code Here


            Iterator < MethodField[] > iterator = m_configMap.getMethods()
                .iterator();
            while (iterator.hasNext()) {
                MethodField[] method = iterator.next();
                for (int i = 0; i < method.length; i++) {
                    lOperations.add(new MBeanOperationInfo(method[i].getName(),
                        method[i].getDescription(), method[i].getParams(),
                        method[i].getReturnType(), MBeanOperationInfo.UNKNOWN));
                }
                dOperations = lOperations
                    .toArray(new MBeanOperationInfo[lOperations.size()]);
View Full Code Here

               Class param = params[k];
               String paramName = description == null ? null : description.getOperationParameterName(method, k);
               String paramDescr = description == null ? null : description.getOperationParameterDescription(method, k);
               paramsInfo[k] = new MBeanParameterInfo(paramName, param.getName(), paramDescr);
            }
            MBeanOperationInfo info = new MBeanOperationInfo(method.getName(), descr, paramsInfo, method.getReturnType().getName(), MBeanOperationInfo.UNKNOWN);
            operations.add(info);
         }
      }

      return (MBeanOperationInfo[])operations.toArray(new MBeanOperationInfo[operations.size()]);
View Full Code Here

   private final MethodTernaryTree operations = new MethodTernaryTree();
   private final MethodTernaryTree methods = new MethodTernaryTree();

   public Object invoke(MBeanMetaData metadata, String method, String[] params, Object[] args) throws MBeanException, ReflectionException
   {
      MBeanOperationInfo oper = getStandardOperationInfo(metadata, method, params);
      if (oper != null)
      {
         try
         {
            return invokeImpl(metadata, method, params, args);
View Full Code Here

      return null;
   }

   private MBeanOperationInfo getStandardOperationInfo(MBeanMetaData metadata, String method, String[] signature)
   {
      MBeanOperationInfo oper = null;

      synchronized (operations)
      {
         oper = (MBeanOperationInfo)operations.get(method, signature);
      }

      if (oper != null) return oper;

      // The MBeanOperationInfo is not in the cache, look it up
      MBeanInfo info = metadata.info;
      MBeanOperationInfo[] opers = info.getOperations();
      if (opers != null)
      {
         for (int i = 0; i < opers.length; ++i)
         {
            oper = opers[i];
            String name = oper.getName();
            if (method.equals(name))
            {
               // Same method name, check number of parameters
               MBeanParameterInfo[] params = oper.getSignature();
               if (signature.length == params.length)
               {
                  boolean match = true;
                  for (int j = 0; j < params.length; ++j)
                  {
View Full Code Here

        if (mBeanInfo == null) {
            throw new IllegalArgumentException("MBean with name " + callBean + " is not found");
        }

        // Find operation
        MBeanOperationInfo mBeanOperationInfo = findMBeanOperation(mBeanInfo, definition.getMethod());
        if (mBeanOperationInfo == null) {
            throw new IllegalArgumentException("Operation [" + callMethod + "] is not found for bean " + callBean);
        }

        // Get arguments type
        MBeanParameterInfo[] mBeanParameterInfos = mBeanOperationInfo.getSignature();

        int realCount = (mBeanParameterInfos != null) ? mBeanParameterInfos.length : 0;
        int haveCount = (callParameters != null) ? callParameters.size() : 0;

        if (realCount != haveCount) {
            throw new IllegalArgumentException("Method " + callMethod + " of bean " + callBean +
                " has " + realCount + " arguments but there are " + haveCount + " values specified");
        }

        // Compose parameters
        Object[] parameterArray = null;
        String[] signatureArray = null;

        if ((callParameters != null) && (mBeanParameterInfos != null) && (realCount > 0)) {
            parameterArray = new Object[realCount];
            signatureArray = new String[realCount];

            SimpleTypeConverter typeConverter = new SimpleTypeConverter();

            for (int i = 0; i < realCount; i++) {
                String value = callParameters.get(i);

                String requiredType = mBeanParameterInfos[i].getType();
                Class<?> requiredClass = ClassUtils.forName(requiredType, this.getClass().getClassLoader());

                parameterArray[i] = typeConverter.convertIfNecessary(value, requiredClass);
                signatureArray[i] = requiredType;
            }
        }

        // Make call
        Object resultObject = mBeanServerConnection.invoke(objectName, mBeanOperationInfo.getName(),
            parameterArray, signatureArray);

        // Convert object to text
        String resultText = String.valueOf(resultObject);
View Full Code Here

        try {
            final MBeanInfo minfo = server.getMBeanInfo(on);
            final MBeanOperationInfo[] methods = minfo.getOperations();

            MBeanOperationInfo operation = null;
            for (int i = 0; i < methods.length; i++) {
                if (methods[i].getName().equals(name)) {
                    operation = methods[i];
                    break;
                }
            }

            if (operation == null) {
                streamManager.writeErr("can't find operation '" + name + "'");
                return;
            }

            final Object[] passedArgs = new Object[args.length];
            final String[] passedArgTypes = new String[args.length];
            for (int i = 0; i < passedArgs.length; i++) {
                final String expected = operation.getSignature()[i].getType();
                if (!String.class.getName().equals(expected)) {
                    passedArgs[i] = PropertyEditors.getValue(expected, args[i], Thread.currentThread().getContextClassLoader());
                } else {
                    passedArgs[i] = args[i];
                }
View Full Code Here

            for (Iterator piterator = gparameters.iterator(); piterator.hasNext();) {
                String type = (String) piterator.next();
                parameters[p] = new MBeanParameterInfo("parameter" + p, type, "no description available");
                p++;
            }
            operations[o] = new MBeanOperationInfo(gOperationInfo.getName(), "no description available", parameters, "java.lang.Object", MBeanOperationInfo.UNKNOWN);
            o++;
        }

        MBeanNotificationInfo[] notifications = new MBeanNotificationInfo[1];
        notifications[0] = new MBeanNotificationInfo(NotificationType.TYPES, "javax.management.Notification", "J2EE Notifications");
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

            for (int i = 0; i < descs.length; i++)
                System.out.println("  Descriptor=" + descs[i]);
            MBeanNotificationInfo notifs[] = info.getNotifications();
            for (int i = 0; i < notifs.length; i++)
                System.out.println("  Notification=" + notifs[i]);
            MBeanOperationInfo opers[] = info.getOperations();
            for (int i = 0; i < opers.length; i++)
                System.out.println("  Operation=" + opers[i]);

        } catch (MBeanException t) {
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.