Examples of MethodMetadata


Examples of org.jboss.metadata.ejb.spec.MethodMetaData

         metaData.setMethods(methods);
      }
      String ejbName = EjbNameThreadLocal.ejbName.get();
      if(ejbName == null)
         ejbName = "*";
      MethodMetaData mmd = ProcessorUtils.createMethod(ejbName, method);
      Descriptions descriptions = ProcessorUtils.getDescription("@DenyAll for: "+method);
      mmd.setDescriptions(descriptions);
      log.trace("add " + mmd);
      methods.add(mmd);
   }
View Full Code Here

Examples of org.jboss.metadata.ejb.spec.MethodMetaData

      Method method = null;
      if(type instanceof Method)
         method = (Method) type;

      String ejbName = EjbNameThreadLocal.ejbName.get();
      MethodMetaData mmd = ProcessorUtils.createMethod(ejbName, method);
      MethodPermissionMetaData perm = new MethodPermissionMetaData();
      MethodsMetaData methods = perm.getMethods();
      if(methods == null)
      {
         methods = new MethodsMetaData();
         perm.setMethods(methods);
      }
      perm.setUnchecked(new EmptyMetaData());
      Descriptions descriptions = ProcessorUtils.getDescription("@PermitAll for: "+type);
      mmd.setDescriptions(descriptions);
      methods.add(mmd);
      metaData.add(perm);
   }
View Full Code Here

Examples of org.jboss.metadata.ejb.spec.MethodMetaData

      ContainerTransactionsMetaData containerTransactions = getContainerTransactions();
      if (containerTransactions == null || containerTransactions.isEmpty())
         return result;

      ContainerTransactionMetaData bestMatchTransaction = null;
      MethodMetaData bestMatch = null;
      for (ContainerTransactionMetaData transaction : containerTransactions)
      {
         MethodMetaData match = transaction.bestMatch(methodName, params, iface, bestMatch);
         if (match != bestMatch)
         {
            bestMatchTransaction = transaction;
            bestMatch = match;
         }
View Full Code Here

Examples of org.jboss.metadata.ejb.spec.MethodMetaData

      Method method = null;
      if(type instanceof Method)
         method = (Method) type;

      String ejbName = EjbNameThreadLocal.ejbName.get();
      MethodMetaData mmd = ProcessorUtils.createMethod(ejbName, method);
      MethodPermissionMetaData perm = new MethodPermissionMetaData();
      MethodsMetaData methods = perm.getMethods();
      if(methods == null)
      {
         methods = new MethodsMetaData();
         perm.setMethods(methods);
      }
      HashSet<String> roles = new HashSet<String>();
      for(String role : allowed.value())
         roles.add(role);
      perm.setRoles(roles);
      Descriptions descriptions = ProcessorUtils.getDescription("@RolesAllowed for: "+type);
      mmd.setDescriptions(descriptions);
      methods.add(mmd);
      metaData.add(perm);
   }
View Full Code Here

Examples of org.logicblaze.lingo.MethodMetadata

     *
     * @param invocation
     * @param requestMessage
     */
    protected void introduceRemoteReferences(LingoInvocation invocation, Message requestMessage) throws JMSException {
        MethodMetadata metadata = invocation.getMetadata();
        Object[] arguments = invocation.getArguments();
        Class[] parameterTypes = invocation.getParameterTypes();
        for (int i = 0; i < parameterTypes.length; i++) {
            if (metadata.isRemoteParameter(i)) {
                arguments[i] = createRemoteProxy(requestMessage, parameterTypes[i], arguments[i]);
            }
        }
    }
View Full Code Here

Examples of org.logicblaze.lingo.MethodMetadata

    public Object invoke(MethodInvocation methodInvocation) throws Throwable {
        if (AopUtils.isToStringMethod(methodInvocation.getMethod())) {
            return "JMS invoker proxy for service URL [" + getServiceUrl() + "]";
        }
        LingoInvocation invocation = (LingoInvocation) createRemoteInvocation(methodInvocation);
        MethodMetadata metadata = invocation.getMetadata();
        replaceRemoteReferences(invocation, metadata);
        try {
            Message requestMessage = marshaller.createRequestMessage(requestor, invocation);
            populateHeaders(requestMessage);
            if (metadata.isOneWay()) {
                requestor.oneWay(destination, requestMessage);
                return null;
            }
            else {
                Message response = requestor.request(destination, requestMessage);
View Full Code Here

Examples of org.logicblaze.lingo.MethodMetadata

    Marshaller marshaller = new XStreamMarshaller();

    public void testMarshall() throws Exception {
        Requestor requestor = createRequestor(getDestinationName());

        LingoInvocation invocation = new LingoInvocation("foo", new Class[0], new Object[0], new MethodMetadata(false));
        Message message = marshaller.createRequestMessage(requestor, invocation);

        assertTrue("Should have created a text message: " + message, message instanceof TextMessage);

        TextMessage textMessage = (TextMessage) message;
View Full Code Here

Examples of org.modeshape.sequencer.javafile.metadata.MethodMetadata

        List<MethodMetadata> methods = typeMetadata.getMethods();
        assertEquals(10, methods.size());

        assertMethodMetadata(methods.get(0), MethodMetadata.Type.CONSTRUCTOR, new String[0], null, "MySource", 0);

        MethodMetadata methodMetadata = methods.get(1);
        assertMethodMetadata(methodMetadata, MethodMetadata.Type.CONSTRUCTOR, new String[] {PUBLIC}, null, "MySource", 2);
        List<FieldMetadata> parameters = methodMetadata.getParameters();
        assertFieldMetadata(parameters.get(0), FieldMetadata.Type.PRIMITIVE, new String[0], "int", new String[] {"i"});
        assertFieldMetadata(parameters.get(1), FieldMetadata.Type.PRIMITIVE, new String[0], "int", new String[] {"j"});

        methodMetadata = methods.get(2);
        assertMethodMetadata(methodMetadata, MethodMetadata.Type.CONSTRUCTOR, new String[] {PUBLIC}, null, "MySource", 3);
        parameters = methodMetadata.getParameters();
        assertFieldMetadata(parameters.get(0), FieldMetadata.Type.PRIMITIVE, new String[0], "int", new String[] {"i"});
        assertFieldMetadata(parameters.get(1), FieldMetadata.Type.PRIMITIVE, new String[0], "int", new String[] {"j"});
        assertFieldMetadata(parameters.get(2), FieldMetadata.Type.SIMPLE, new String[0], "Object", new String[] {"o"});

        assertMethodMetadata(methods.get(3), MethodMetadata.Type.METHOD_TYPE_MEMBER, new String[] {PUBLIC}, "int", "getI", 0);

        methodMetadata = methods.get(4);
        assertMethodMetadata(methodMetadata, MethodMetadata.Type.METHOD_TYPE_MEMBER, new String[] {PUBLIC}, "void", "setI", 1);
        parameters = methodMetadata.getParameters();
        assertFieldMetadata(parameters.get(0), FieldMetadata.Type.PRIMITIVE, new String[0], "int", new String[] {"i"});

        methodMetadata = methods.get(5);
        assertMethodMetadata(methodMetadata, MethodMetadata.Type.METHOD_TYPE_MEMBER, new String[] {PUBLIC}, "void", "setJ", 1);
        parameters = methodMetadata.getParameters();
        assertFieldMetadata(parameters.get(0), FieldMetadata.Type.PRIMITIVE, new String[0], "int", new String[] {"j"});

        methodMetadata = methods.get(6);
        assertMethodMetadata(methodMetadata,
                             MethodMetadata.Type.METHOD_TYPE_MEMBER,
                             new String[] {PUBLIC},
                             "void",
                             "doSomething",
                             3);
        parameters = methodMetadata.getParameters();
        assertFieldMetadata(parameters.get(0), FieldMetadata.Type.PRIMITIVE, new String[0], "int", new String[] {"p1"});
        assertFieldMetadata(parameters.get(1), FieldMetadata.Type.PRIMITIVE, new String[0], "double", new String[] {"p2"});
        assertFieldMetadata(parameters.get(2), FieldMetadata.Type.SIMPLE, new String[0], "Object", new String[] {"o"});

        methodMetadata = methods.get(7);
        assertMethodMetadata(methodMetadata,
                             MethodMetadata.Type.METHOD_TYPE_MEMBER,
                             new String[] {PUBLIC},
                             "void",
                             "doSomething",
                             4);
        parameters = methodMetadata.getParameters();
        assertFieldMetadata(parameters.get(0), FieldMetadata.Type.PRIMITIVE, new String[0], "int", new String[] {"p1"});
        assertFieldMetadata(parameters.get(1), FieldMetadata.Type.PRIMITIVE, new String[0], "double", new String[] {"p2"});
        assertFieldMetadata(parameters.get(2), FieldMetadata.Type.PRIMITIVE, new String[0], "float", new String[] {"p3"});
        assertFieldMetadata(parameters.get(3), FieldMetadata.Type.SIMPLE, new String[0], "Object", new String[] {"o"});

        methodMetadata = methods.get(8);
        assertMethodMetadata(methodMetadata,
                             MethodMetadata.Type.METHOD_TYPE_MEMBER,
                             new String[] {PRIVATE},
                             "double",
                             "doSomething2",
                             2);
        parameters = methodMetadata.getParameters();
        assertFieldMetadata(parameters.get(0), FieldMetadata.Type.ARRAY, new String[0], "Object", new String[] {"oa"});
        assertFieldMetadata(parameters.get(1), FieldMetadata.Type.ARRAY, new String[0], "int", new String[] {"ia"});

        methodMetadata = methods.get(9);
        assertMethodMetadata(methodMetadata,
View Full Code Here

Examples of org.richfaces.view.facelets.MethodMetadata

    static class AjaxPollHandlerMetaRule extends MetaRule {
        public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
            if (meta.isTargetInstanceOf(AbstractPoll.class)) {
                if ("action".equals(name)) {
                    return new MethodMetadata(attribute) {
                        public void applyMetadata(FaceletContext ctx, Object instance) {
                            ((AbstractPoll) instance).setActionExpression(getMethodExpression(ctx));
                        }
                    };
                }
                if ("actionExpression".equals(name)) {
                    return new MethodMetadata(attribute) {
                        public void applyMetadata(FaceletContext ctx, Object instance) {
                            ((AbstractPoll) instance).setActionExpression(getMethodExpression(ctx));
                        }
                    };
                }
                if ("actionListener".equals(name)) {
                    return new MethodMetadata(attribute, ActionEvent.class) {
                        public void applyMetadata(FaceletContext ctx, Object instance) {
                            ActionListener actionListener = new MethodExpressionActionListener(getMethodExpression(ctx));
                            ((AbstractPoll) instance).addActionListener(actionListener);
                        }
                    };
View Full Code Here

Examples of org.springframework.core.type.MethodMetadata

   * Read the given {@link BeanMethod}, registering bean definitions
   * with the BeanDefinitionRegistry based on its contents.
   */
  private void loadBeanDefinitionsForBeanMethod(BeanMethod beanMethod) {
    ConfigurationClass configClass = beanMethod.getConfigurationClass();
    MethodMetadata metadata = beanMethod.getMetadata();

    RootBeanDefinition beanDef = new ConfigurationClassBeanDefinition(configClass);
    beanDef.setResource(configClass.getResource());
    beanDef.setSource(this.sourceExtractor.extractSource(metadata, configClass.getResource()));
    if (metadata.isStatic()) {
      // static @Bean method
      beanDef.setBeanClassName(configClass.getMetadata().getClassName());
      beanDef.setFactoryMethodName(metadata.getMethodName());
    }
    else {
      // instance @Bean method
      beanDef.setFactoryBeanName(configClass.getBeanName());
      beanDef.setUniqueFactoryMethodName(metadata.getMethodName());
    }
    beanDef.setAutowireMode(RootBeanDefinition.AUTOWIRE_CONSTRUCTOR);
    beanDef.setAttribute(RequiredAnnotationBeanPostProcessor.SKIP_REQUIRED_CHECK_ATTRIBUTE, Boolean.TRUE);

    // consider role
    Map<String, Object> roleAttributes = metadata.getAnnotationAttributes(Role.class.getName());
    if (roleAttributes != null) {
      int role = (Integer) roleAttributes.get("value");
      beanDef.setRole(role);
    }

    // consider name and any aliases
    Map<String, Object> beanAttributes = metadata.getAnnotationAttributes(Bean.class.getName());
    List<String> names = new ArrayList<String>(Arrays.asList((String[]) beanAttributes.get("name")));
    String beanName = (names.size() > 0 ? names.remove(0) : beanMethod.getMetadata().getMethodName());
    for (String alias : names) {
      this.registry.registerAlias(beanName, alias);
    }

    // has this already been overridden (e.g. via XML)?
    if (this.registry.containsBeanDefinition(beanName)) {
      BeanDefinition existingBeanDef = registry.getBeanDefinition(beanName);
      // is the existing bean definition one that was created from a configuration class?
      if (!(existingBeanDef instanceof ConfigurationClassBeanDefinition)) {
        // no -> then it's an external override, probably XML
        // overriding is legal, return immediately
        if (logger.isDebugEnabled()) {
          logger.debug(String.format("Skipping loading bean definition for %s: a definition for bean " +
              "'%s' already exists. This is likely due to an override in XML.", beanMethod, beanName));
        }
        return;
      }
    }

    if (metadata.isAnnotated(Primary.class.getName())) {
      beanDef.setPrimary(true);
    }

    // is this bean to be instantiated lazily?
    if (metadata.isAnnotated(Lazy.class.getName())) {
      beanDef.setLazyInit((Boolean) metadata.getAnnotationAttributes(Lazy.class.getName()).get("value"));
    }
    else if (configClass.getMetadata().isAnnotated(Lazy.class.getName())){
      beanDef.setLazyInit((Boolean) configClass.getMetadata().getAnnotationAttributes(Lazy.class.getName()).get("value"));
    }

    if (metadata.isAnnotated(DependsOn.class.getName())) {
      String[] dependsOn = (String[]) metadata.getAnnotationAttributes(DependsOn.class.getName()).get("value");
      if (dependsOn.length > 0) {
        beanDef.setDependsOn(dependsOn);
      }
    }

    Autowire autowire = (Autowire) beanAttributes.get("autowire");
    if (autowire.isAutowire()) {
      beanDef.setAutowireMode(autowire.value());
    }

    String initMethodName = (String) beanAttributes.get("initMethod");
    if (StringUtils.hasText(initMethodName)) {
      beanDef.setInitMethodName(initMethodName);
    }

    String destroyMethodName = (String) beanAttributes.get("destroyMethod");
    if (StringUtils.hasText(destroyMethodName)) {
      beanDef.setDestroyMethodName(destroyMethodName);
    }

    // consider scoping
    ScopedProxyMode proxyMode = ScopedProxyMode.NO;
    Map<String, Object> scopeAttributes = metadata.getAnnotationAttributes(Scope.class.getName());
    if (scopeAttributes != null) {
      beanDef.setScope((String) scopeAttributes.get("value"));
      proxyMode = (ScopedProxyMode) scopeAttributes.get("proxyMode");
      if (proxyMode == ScopedProxyMode.DEFAULT) {
        proxyMode = ScopedProxyMode.NO;
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.