Examples of ManagedOperation


Examples of org.jboss.managed.api.ManagedOperation

   }

   public void testTopicOperations() throws Exception
   {
      ManagedComponent component = getManagementView().getComponent("testCreateTopic", TopicType);
      ManagedOperation o = getOperation(component, "listAllSubscriptionsAsHTML", new String[0]);
      MetaValue v = o.invoke(new MetaValue[0]);
      assertNotNull("null operation return value", v);
      log.debug("result" + v);
   }
View Full Code Here

Examples of org.jboss.managed.api.ManagedOperation

      ManagedProperty messageCounter = component.getProperty("messageCounter");
      assertNotNull("messageCounter", messageCounter);

      // Clear any
      Set<ManagedOperation> ops = component.getOperations();
      ManagedOperation removeAllMessages = ManagedOperationMatcher.findOperation(ops, "removeAllMessages");
      assertNotNull("removeAllMessages", removeAllMessages);
      removeAllMessages.invoke();
      assertEquals(SimpleValueSupport.wrap(0), messageCount.getValue());

      // Send a message
      Queue queue = (Queue) getInitialContext().lookup(jndiName);
      assertNotNull(queue);
      QueueConnectionFactory qCf = (QueueConnectionFactory) getInitialContext().lookup("ConnectionFactory");
      QueueConnection c = qCf.createQueueConnection();
      c.start();
      QueueSession s = c.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
      QueueSender sender = s.createSender(queue);
     
      // Message 1
      sender.send(s.createTextMessage("Hey!"));

      SimpleValue messageCount1 = (SimpleValue) messageCount.getValue();
      assertTrue((Integer) (messageCount1).getValue() > 0);
      CompositeValue messageCounterCV = (CompositeValue) messageCounter.getValue();
      log.info(messageCounterCV);
      assertEquals(messageCounterCV.get("messageCount"), messageCount1);

      // Message 2
      sender.send(s.createTextMessage("Message2"));
     
      SimpleValue messageCount2 = (SimpleValue) messageCount.getValue();
      assertTrue(messageCount2.compareTo(messageCount1) > 0);
      messageCounterCV = (CompositeValue) messageCounter.getValue();
      assertEquals(messageCounterCV.get("messageCount"), messageCount2);
     
      //
      ManagedOperation listAllMessages = ManagedOperationMatcher.findOperation(ops, "listAllMessages");
      assertNotNull("listAllMessages", listAllMessages);
      MetaValue msgs = listAllMessages.invoke();
      assertNotNull(msgs);
      log.info("listAllMessages.MV: "+msgs);
      assertTrue("msgs is a CollectionValue", msgs instanceof CollectionValue);
      CollectionValue msgsCV = (CollectionValue) msgs;
      MetaValue[] msgsMVs = msgsCV.getElements();
View Full Code Here

Examples of org.jboss.managed.api.ManagedOperation

   }

   protected ManagedOperation getOperation(ManagedComponent comp, String name, String[] signature)
   {
      assertNotNull(comp);
      ManagedOperation operation = null;
      for(ManagedOperation o : comp.getOperations())
      {
         if(o.getName().equals(name))
         {
            if(Arrays.equals(signature, o.getReflectionSignature()))
View Full Code Here

Examples of org.jgroups.annotations.ManagedOperation

                        }
                    }
                }
            }
            else if (method.isAnnotationPresent(ManagedOperation.class) || isMBeanAnnotationPresentWithExposeAll()){
                ManagedOperation op=method.getAnnotation(ManagedOperation.class);               
                String attName=method.getName();
                if(isSetMethod(method) || isGetMethod(method)) {
                    attName=attName.substring(3);
                }
                else if(isIsMethod(method)) {
                    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));
                    if(log.isDebugEnabled()) {
                        log.debug("@Operation found for method " + method.getName());
                    }
                }               
            }                    
View Full Code Here

Examples of org.jgroups.annotations.ManagedOperation

            if(method.isAnnotationPresent(ManagedAttribute.class) || method.isAnnotationPresent(Property.class)) {
                exposeManagedAttribute(method);
            }
            //or @ManagedOperation
            else if (method.isAnnotationPresent(ManagedOperation.class) || expose_all){
                ManagedOperation op=method.getAnnotation(ManagedOperation.class);
                ops.add(new MBeanOperationInfo(op != null? op.description() : "",method));
            }
        }
    }
View Full Code Here

Examples of org.jgroups.demo.tankwar.jmx.annotations.ManagedOperation

        Class<? extends Object> c=getObject().getClass();
      return c.isAnnotationPresent(MBean.class) && c.getAnnotation(MBean.class).exposeAll();
    }
 
  private void exposeManagedOperation(Method method) {
    ManagedOperation op = method.getAnnotation(ManagedOperation.class);             
        String attName=method.getName();
        if(isSetMethod(method) || isGetMethod(method)) {
            attName=attName.substring(3);
        }
        else if(isIsMethod(method)) {
            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

Examples of org.objectweb.celtix.bus.management.jmx.export.annotation.ManagedOperation

                    }
                }
             
            } else {  
                // add Operation to the ModelMBean
                ManagedOperation mo = getManagedOperation(methods[i]);
               
                if (mo != null) {
                    Class<?>[] types = methods[i].getParameterTypes();                   
                    ManagedOperationParameter[] mop = getManagedOperationParameters(methods[i]);
                    String[] paramTypes = new String[types.length];
                    String[] paramNames = new String[types.length];                   
                    String[] paramDescs = new String[types.length];
                   
                    for (int j = 0; j < types.length; j++) {
                        paramTypes[j] = types[j].getName();                      
                        if (j < mop.length) {
                            paramDescs[j] = mop[j].description();
                            paramNames[j] = mop[j].name();
                        } else {
                            paramDescs[j] = "";
                            paramNames[j] = types[j].getName();
                        }
                    }                   
                    Descriptor operationDescriptor =
                        supporter.buildOperationDescriptor(mo, methods[i].getName());
                    supporter.addModelMBeanMethod(methods[i].getName(),
                                                paramTypes,
                                                paramNames,
                                                paramDescs,
                                                mo.description(),
                                                methods[i].getReturnType().getName(),
                                                operationDescriptor);
                }
            }
           
View Full Code Here

Examples of org.springframework.jmx.export.metadata.ManagedOperation

  public ManagedOperation getManagedOperation(Method method) throws InvalidMetadataException {
    Annotation ann = AnnotationUtils.findAnnotation(method, org.springframework.jmx.export.annotation.ManagedOperation.class);
    if (ann == null) {
      return null;
    }
    ManagedOperation op = new ManagedOperation();
    AnnotationBeanUtils.copyPropertiesToBean(ann, op);
    return op;
  }
View Full Code Here

Examples of org.springframework.jmx.export.metadata.ManagedOperation

        return metric.getDescription();
      }
      return method.getName();
    }
    else {
      ManagedOperation mo = this.attributeSource.getManagedOperation(method);
      if (mo != null && StringUtils.hasText(mo.getDescription())) {
        return mo.getDescription();
      }
      return method.getName();
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.