Examples of ManagedOperation


Examples of br.gov.frameworkdemoiselle.annotation.ManagedOperation

    // Para cada metodo verifica se ele está anotado com ManagedOperation e cria um MBeanOperationInfo para ele.
    Method[] methodList = type.getMethods();
    if (methodList != null) {
      for (Method method : methodList) {
        ManagedOperation opAnnotation = method.getAnnotation(ManagedOperation.class);

        if (opAnnotation != null) {
          // Lemos as informações sobre o método e criamos uma instância
          // de MethodDetail para representar este método como uma
          // operação.

          Class<?>[] parameterTypes = method.getParameterTypes();
          Annotation[][] parameterAnnotations = method.getParameterAnnotations();
          ParameterDetail[] parameterDetails = new ParameterDetail[parameterTypes.length];
          OperationType operationType = opAnnotation.type();

          for (int i = 0; i < parameterTypes.length; i++) {
            OperationParameter paramAnnotation = null;
            for (Annotation annotation : parameterAnnotations[i]) {
              if (annotation.annotationType() == OperationParameter.class) {
                paramAnnotation = (OperationParameter) annotation;
                break;
              }
            }

            String name = paramAnnotation != null ? paramAnnotation.name() : ("arg" + i);
            String description = paramAnnotation != null ? paramAnnotation.description() : null;

            parameterDetails[i] = new ParameterDetail(parameterTypes[i], name, description);
          }

          // Com todas as informações, criamos nossa instância de MethodDetail e
          // acrescentamos na lista de todas as operações.
          MethodDetail detail = new MethodDetail(method, opAnnotation.description(), operationType, parameterDetails);
          operationMethods.put(method.getName(), detail);
        }
      }
    }
  }
View Full Code Here

Examples of com.ecyrd.simplejmx.ManagedOperation

            if( a != null )
            {
                createNewAttribute( m, a );
            }
           
            ManagedOperation mm = m.getAnnotation( ManagedOperation.class );
           
            if( mm != null ) createNewMethod( m, mm );
        }
    }
View Full Code Here

Examples of org.activiti.management.jmx.annotations.ManagedOperation

        attributes.put(key, info);
        continue;
      }

      // operations
      ManagedOperation mo = method.getAnnotation(ManagedOperation.class);
      if (mo != null) {
        String desc = mo.description();
        Method operation = method;
        operations.add(new ManagedOperationInfo(desc, operation));
      }
    }
  }
View Full Code Here

Examples of org.apache.camel.api.management.ManagedOperation

                attributes.put(key, info);
            }

            // operations
            ManagedOperation mo = method.getAnnotation(ManagedOperation.class);
            if (mo != null) {
                String desc = mo.description();
                Method operation = method;
                operations.add(new ManagedOperationInfo(desc, operation));
            }
        }
    }
View Full Code Here

Examples of org.apache.cxf.management.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.eclipse.jetty.util.annotation.ManagedOperation

                            {
                                attributes.add(mai);
                            }
                        }

                        ManagedOperation methodOperationAnnotation = method.getAnnotation(ManagedOperation.class);

                        if (methodOperationAnnotation != null)
                        {
                            if (LOG.isDebugEnabled())
                                LOG.debug("Method Annotation found for: {}", method.getName());
View Full Code Here

Examples of org.gatein.management.api.annotations.ManagedOperation

   }

   public void registerOperation(AbstractManagedResource managedResource)
   {
      final AbstractManagedResource resource = registerOrGetResource(managedResource, method.getAnnotation(Managed.class));
      ManagedOperation mo = method.getAnnotation(ManagedOperation.class);
      String operationName = OperationNames.READ_RESOURCE;
      String desc = "";
      if (mo != null)
      {
         operationName = mo.name();
         desc = mo.description();
      }

      final boolean debug = log.isDebugEnabled();
      if (debug) log.debug("Registering operation " + operationName + " for path " + resource.getPath());
View Full Code Here

Examples of org.glassfish.admin.amx.annotation.ManagedOperation

        for (final Method method : methods) {
            final String methodName = method.getName();

            final ManagedAttribute managedAttr = method.getAnnotation(ManagedAttribute.class);
            final ManagedOperation managedOp = method.getAnnotation(ManagedOperation.class);

            if (managedAttr != null) {
                String attrName = null;
                final int numArgs = method.getParameterTypes().length;
                if (managedOp != null) {
View Full Code Here

Examples of org.glassfish.gmbal.ManagedOperation

      final EvaluatedType rtype = m.returnType();
      final TypeConverter rtc = rtype == null ? null : mom.getTypeConverter(
    rtype);
      final List<EvaluatedType> atypes = m.parameterTypes();
      final List<TypeConverter> atcs = new ArrayList<TypeConverter>();
      final ManagedOperation mo = mom.getAnnotation(m.element(),
    ManagedOperation.class);

      Descriptor modelDescriptor = makeValidDescriptor(
    DescriptorIntrospector.descriptorForElement(mom, m.element()),
    DescriptorType.operation, m.name());

      for (EvaluatedType ltype : atypes) {
    atcs.add(mom.getTypeConverter(ltype));
      }

      if (mom.registrationFineDebug()) {
    mm.info( true, "desc", desc);
    mm.info( true, "rtype", rtype);
    mm.info( true, "rtc", rtc);
    mm.info( true, "atcs", atcs);
    mm.info( true, "atypes", atypes);
    mm.info( true, "descriptor", modelDescriptor);
      }

      final Operation oper = new Operation() {
    public Object evaluate(FacetAccessor target, List<Object> args) {
        mm.enter( mom.runtimeDebug(), "Operation:evaluate", target,
      args);

        Object[] margs = new Object[args.size()];
        Iterator<Object> argsIterator = args.iterator();
        Iterator<TypeConverter> tcIterator = atcs.iterator();
        int ctr = 0;
        while (argsIterator.hasNext() && tcIterator.hasNext()) {
      final Object arg = argsIterator.next();
      final TypeConverter tc = tcIterator.next();
      margs[ctr++] = tc.fromManagedEntity(arg);
        }

        mm.info( mom.runtimeDebug(), "Before invoke: margs=", margs);

        Object result = target.invoke(m.method(), mom.runtimeDebug(),
      margs);

        mm.info( mom.runtimeDebug(), "After invoke: result=", result);

        if (rtc == null) {
      return null;
        } else {
      return rtc.toManagedEntity(result);
        }
    }
      };

      final ParameterNames pna = mom.getAnnotation( m.element(),
                ParameterNames.class);
      mm.info( mom.registrationFineDebug(), "pna", pna);

      if (pna != null && pna.value().length != atcs.size()) {
        throw Exceptions.self.parameterNamesLengthBad();
      }

      final MBeanParameterInfo[] paramInfo =
        new OpenMBeanParameterInfoSupport[atcs.size()];
      int ctr = 0;
      for (TypeConverter tc : atcs) {
        String name = "";
        try {
          name = (pna == null) ? "arg" + ctr : pna.value()[ctr];
          paramInfo[ctr] = new OpenMBeanParameterInfoSupport(
            name, Exceptions.self.noDescriptionAvailable(),
            tc.getManagedType());
          ctr++;
        } catch (IllegalArgumentException ex) {
          Exceptions.self.excInOpenParameterInfo(ex, name, m);
        }
      }

      final ModelMBeanOperationInfo operInfo =
    new ModelMBeanOperationInfo(m.name(),
    desc, paramInfo, rtc.getManagedType().getClassName(),
    mo.impact().ordinal(), modelDescriptor);

      mm.info(mom.registrationFineDebug(), "operInfo", operInfo);

      return new Pair<Operation, ModelMBeanOperationInfo>(oper, operInfo);
  } finally {
View Full Code Here

Examples of org.infinispan.jmx.annotations.ManagedOperation

            methodParameters[i] = new JmxOperationParameter("p" + i, params[i].getName(), null);
         } else {
            methodParameters[i] = new JmxOperationParameter(annot.name(), params[i].getName(), annot.description());
         }
      }
      ManagedOperation mo = m.getAnnotation(ManagedOperation.class);
      operationName = mo.name();
      description = mo != null ? mo.description() : null;
   }
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.