Package javax.management.modelmbean

Examples of javax.management.modelmbean.ModelMBeanOperationInfo


   * @return the <code>ModelMBeanOperationInfo</code>
   */
  protected ModelMBeanOperationInfo createModelMBeanOperationInfo(Method method, String name, String beanKey) {
    MBeanParameterInfo[] params = getOperationParameters(method, beanKey);
    if (params.length == 0) {
      return new ModelMBeanOperationInfo(getOperationDescription(method, beanKey), method);
    }
    else {
      return new ModelMBeanOperationInfo(name,
        getOperationDescription(method, beanKey),
        getOperationParameters(method, beanKey),
        method.getReturnType().getName(),
        MBeanOperationInfo.UNKNOWN);
    }
View Full Code Here


                                                    paramTypes[i], paramDescs[i]);
            }
        }
   
        operations.put(name,
                        new ModelMBeanOperationInfo(name,
                                                    description,
                                                    params,
                                                    rtype,
                                                    MBeanOperationInfo.ACTION,
                                                    desc));
View Full Code Here

      for (Iterator i = beanMethods.values().iterator(); i.hasNext();)
      {
         Method method = (Method)i.next();

         // Create the metadata
         ModelMBeanOperationInfo mmoi = new ModelMBeanOperationInfo("Javabean introspected method", method);

         // Complete the descriptor
         Descriptor desc = mmoi.getDescriptor();
         String role = (String)roles.get(method);
         desc.setField(JavaBeanModelMBeanBuilder.ROLE, role != null ? role : "operation");
         mmoi.setDescriptor(desc);

         // Finally add the metadata
         mmois.add(mmoi);
      }
   }
View Full Code Here

            // add missing attribute descriptors, this is needed to have attributes accessible
            Descriptor desc = mbeanAttribute.getDescriptor();
            if (info.getGetter() != null) {
                desc.setField("getMethod", info.getGetter().getName());
                // attribute must also be added as mbean operation
                ModelMBeanOperationInfo mbeanOperation = new ModelMBeanOperationInfo(info.getKey(), info.getGetter());
                mBeanOperations.add(mbeanOperation);
            }
            if (info.getSetter() != null) {
                desc.setField("setMethod", info.getSetter().getName());
                // attribute must also be added as mbean operation
                ModelMBeanOperationInfo mbeanOperation = new ModelMBeanOperationInfo(info.getKey(), info.getSetter());
                mBeanOperations.add(mbeanOperation);
            }
            mbeanAttribute.setDescriptor(desc);

            mBeanAttributes.add(mbeanAttribute);
View Full Code Here

        }
    }

    private void extractMbeanOperations(Object managedBean, Set<ManagedOperationInfo> operations, Set<ModelMBeanOperationInfo> mBeanOperations) {
        for (ManagedOperationInfo info : operations) {
            ModelMBeanOperationInfo mbean = new ModelMBeanOperationInfo(info.getDescription(), info.getOperation());
            mBeanOperations.add(mbean);
            LOG.trace("Assembled operation: {}", mbean);
        }
    }
View Full Code Here

   
    @Test
    public void testAttributeHasCorrespondingOperations() throws Exception {
        ModelMBeanInfo info = getMBeanInfoFromAssembler();

        ModelMBeanOperationInfo myOperation = info.getOperation("myOperation");
        assertNotNull("get operation should not be null", myOperation);
        assertEquals("Incorrect myOperation return type", "long", myOperation.getReturnType());
               
        ModelMBeanOperationInfo add = info.getOperation("add");               
        assertNotNull("set operation should not be null", add);
        assertEquals("Incorrect add method description", "Add Two Numbers Together", add.getDescription());
               
    }
View Full Code Here

                                                    paramTypes[i], paramDescs[i]);
            }
        }
   
        operations.put(name,
                        new ModelMBeanOperationInfo(name,
                                                    description,
                                                    params,
                                                    rtype,
                                                    MBeanOperationInfo.ACTION,
                                                    desc));
View Full Code Here

                true, false, false));
    }
   
    @Override
    protected void addExtraOperations(List<ModelMBeanOperationInfo> operations) {
        operations.add(new ModelMBeanOperationInfo(
                "addFilterFirst", "addFilterFirst", new MBeanParameterInfo[] {
                        new MBeanParameterInfo(
                                "name", String.class.getName(), "the new filter name"),
                        new MBeanParameterInfo(
                                "filter", ObjectName.class.getName(), "the ObjectName reference to the filter")
                }, void.class.getName(), ModelMBeanOperationInfo.ACTION));

        operations.add(new ModelMBeanOperationInfo(
                "addFilterLast", "addFilterLast", new MBeanParameterInfo[] {
                        new MBeanParameterInfo(
                                "name", String.class.getName(), "the new filter name"),
                        new MBeanParameterInfo(
                                "filter", ObjectName.class.getName(), "the ObjectName reference to the filter")
                }, void.class.getName(), ModelMBeanOperationInfo.ACTION));

        operations.add(new ModelMBeanOperationInfo(
                "addFilterBefore", "addFilterBefore", new MBeanParameterInfo[] {
                        new MBeanParameterInfo(
                                "baseName", String.class.getName(), "the next filter name"),
                        new MBeanParameterInfo(
                                "name", String.class.getName(), "the new filter name"),
                        new MBeanParameterInfo(
                                "filter", ObjectName.class.getName(), "the ObjectName reference to the filter")
                }, void.class.getName(), ModelMBeanOperationInfo.ACTION));

        operations.add(new ModelMBeanOperationInfo(
                "addFilterAfter", "addFilterAfter", new MBeanParameterInfo[] {
                        new MBeanParameterInfo(
                                "baseName", String.class.getName(), "the previous filter name"),
                        new MBeanParameterInfo(
                                "name", String.class.getName(), "the new filter name"),
                        new MBeanParameterInfo(
                                "filter", ObjectName.class.getName(), "the ObjectName reference to the filter")
                }, void.class.getName(), ModelMBeanOperationInfo.ACTION));
       
        operations.add(new ModelMBeanOperationInfo(
                "removeFilter", "removeFilter", new MBeanParameterInfo[] {
                        new MBeanParameterInfo(
                                "name", String.class.getName(), "the name of the filter to be removed"),
                }, void.class.getName(), ModelMBeanOperationInfo.ACTION));
    }
View Full Code Here

        return super.invoke0(name, params, signature);
    }

    @Override
    protected void addExtraOperations(List<ModelMBeanOperationInfo> operations) {
        operations.add(new ModelMBeanOperationInfo(
                "findSessions", "findSessions",
                new MBeanParameterInfo[] {
                        new MBeanParameterInfo(
                                "ognlQuery", String.class.getName(), "a boolean OGNL expression")
                }, Set.class.getName(), ModelMBeanOperationInfo.INFO));
        operations.add(new ModelMBeanOperationInfo(
                "findAndRegisterSessions", "findAndRegisterSessions",
                new MBeanParameterInfo[] {
                        new MBeanParameterInfo(
                                "ognlQuery", String.class.getName(), "a boolean OGNL expression")
                }, Set.class.getName(), ModelMBeanOperationInfo.ACTION_INFO));
        operations.add(new ModelMBeanOperationInfo(
                "findAndProcessSessions", "findAndProcessSessions",
                new MBeanParameterInfo[] {
                        new MBeanParameterInfo(
                                "ognlQuery", String.class.getName(), "a boolean OGNL expression"),
                        new MBeanParameterInfo(
View Full Code Here

        addAttributes(attributes, source);
        addExtraAttributes(attributes);
       
        addOperations(operations, source);
        addExtraOperations(operations);
        operations.add(new ModelMBeanOperationInfo(
                "unregisterMBean", "unregisterMBean",
                new MBeanParameterInfo[0], void.class.getName(),
                ModelMBeanOperationInfo.ACTION));

        return new ModelMBeanInfoSupport(
View Full Code Here

TOP

Related Classes of javax.management.modelmbean.ModelMBeanOperationInfo

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.