Package org.jboss.metadata.ejb.spec

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


    * @param sessionBean Session bean metadata
    * @return
    */
   private LockType getLockTypeApplicableForAllMethods(JBossSessionBean31MetaData sessionBean)
   {
      NamedMethodMetaData allMethods = new NamedMethodMetaData();
      allMethods.setName("*");
      ConcurrentMethodMetaData concurrentMethod = sessionBean.getConcurrentMethods().get(allMethods);
      if (concurrentMethod == null)
      {
         return null;
      }
View Full Code Here


                        }
                    } else {

                        //method level bindings
                        //first find the right method
                        final NamedMethodMetaData methodData = binding.getMethod();
                        final ClassReflectionIndex<?> classIndex = index.getClassIndex(componentClass);
                        Method resolvedMethod = null;
                        if (methodData.getMethodParams() == null) {
                            final Collection<Method> methods = classIndex.getAllMethods(methodData.getMethodName());
                            if (methods.isEmpty()) {
                                throw EjbLogger.ROOT_LOGGER.failToFindMethodInEjbJarXml(componentClass.getName(), methodData.getMethodName());
                            } else if (methods.size() > 1) {
                                throw EjbLogger.ROOT_LOGGER.multipleMethodReferencedInEjbJarXml(methodData.getMethodName(), componentClass.getName());
                            }
                            resolvedMethod = methods.iterator().next();
                        } else {
                            final Collection<Method> methods = classIndex.getAllMethods(methodData.getMethodName(), methodData.getMethodParams().size());
                            for (final Method method : methods) {
                                boolean match = true;
                                for (int i = 0; i < method.getParameterTypes().length; ++i) {
                                    if (!method.getParameterTypes()[i].getName().equals(methodData.getMethodParams().get(i))) {
                                        match = false;
                                        break;
                                    }
                                }
                                if (match) {
                                    resolvedMethod = method;
                                    break;
                                }
                            }
                            if (resolvedMethod == null) {
                                throw EjbLogger.ROOT_LOGGER.failToFindMethodWithParameterTypes(componentClass.getName(), methodData.getMethodName(), methodData.getMethodParams());
                            }
                        }
                        List<InterceptorBindingMetaData> list = methodInterceptors.get(resolvedMethod);
                        if (list == null) {
                            methodInterceptors.put(resolvedMethod, list = new ArrayList<InterceptorBindingMetaData>());
View Full Code Here

                            }
                        }
                    } else {
                        // Method level bindings
                        // First find the right method
                        final NamedMethodMetaData methodData = binding.getMethod();
                        final ClassReflectionIndex<?> classIndex = index.getClassIndex(componentClass);
                        Method resolvedMethod = null;
                        if (methodData.getMethodParams() == null) {
                            final Collection<Method> methods = classIndex.getAllMethods(methodData.getMethodName());
                            if (methods.isEmpty()) {
                                throw EjbLogger.ROOT_LOGGER.failToFindMethodInEjbJarXml(componentClass.getName(), methodData.getMethodName());
                            } else if (methods.size() > 1) {
                                throw EjbLogger.ROOT_LOGGER.multipleMethodReferencedInEjbJarXml(methodData.getMethodName(), componentClass.getName());
                            }
                            resolvedMethod = methods.iterator().next();
                        } else {
                            final Collection<Method> methods = classIndex.getAllMethods(methodData.getMethodName(), methodData.getMethodParams().size());
                            for (final Method method : methods) {
                                boolean match = true;
                                for (int i = 0; i < method.getParameterTypes().length; ++i) {
                                    if (!method.getParameterTypes()[i].getName().equals(methodData.getMethodParams().get(i))) {
                                        match = false;
                                        break;
                                    }
                                }
                                if (match) {
                                    resolvedMethod = method;
                                    break;
                                }
                            }
                            if (resolvedMethod == null) {
                                throw EjbLogger.ROOT_LOGGER.failToFindMethodWithParameterTypes(componentClass.getName(), methodData.getMethodName(), methodData.getMethodParams());
                            }
                        }
                        List<InterceptorBindingMetaData> methodSpecificInterceptorBindings = methodInterceptors.get(resolvedMethod);
                        if (methodSpecificInterceptorBindings == null) {
                            methodSpecificInterceptorBindings = new ArrayList<InterceptorBindingMetaData>();
View Full Code Here

    }


    private void parseTimeoutMethod(final ITimeoutTarget beanMetaData, final EJBComponentDescription sessionBean, final Class<?> componentClass, final DeploymentReflectionIndex deploymentReflectionIndex) throws DeploymentUnitProcessingException {
        //resolve timeout methods
        final NamedMethodMetaData methodData = beanMetaData.getTimeoutMethod();
        sessionBean.setTimeoutMethod(MethodResolutionUtils.resolveMethod(methodData, componentClass, deploymentReflectionIndex));
    }
View Full Code Here

         InterceptorOrderMetaData methodParamsOrder = null;
         for (InterceptorBindingMetaData binding : orderedBindings)
         {
            if (binding.getEjbName().equals(container.getEjbName()))
            {
               NamedMethodMetaData bindingMethod = binding.getMethod();
               if (bindingMethod != null)
               {
                  if (bindingMethod.getMethodParams() == null)
                  {
                     if (methodNoParamsOrder != null)
                     {
                        throw new RuntimeException("There should only be one interceptor-binding specifying " +
                              "the order of method interceptors: "  + getInterceptorBindingString(binding));
                     }
                     methodNoParamsOrder = binding.getInterceptorOrder();
                  }
                  else
                  {
                     Class<?>[] params = method.getParameterTypes();
                     List<String> methodParams = bindingMethod.getMethodParams();
                     if (methodParams.size() == params.length)
                     {
                        boolean matches = true;
                        for (int i = 0 ; i < params.length ; i++)
                        {
View Full Code Here

      String getInterceptorBindingString(InterceptorBindingMetaData binding)
      {
         StringBuffer buf = new StringBuffer();
        
         buf.append(binding.getEjbName());
         NamedMethodMetaData method = binding.getMethod();
         if(method != null)
         {
            buf.append("." + method.getMethodName());
            MethodParametersMetaData methodParams = method.getMethodParams();
            if (methodParams != null)
            {
               buf.append("(");
               for (int i = 0 ; i < methodParams.size() ; )
               {
View Full Code Here

   {
      if (list != null)
      {
         for (InitMethodMetaData initMethod : list)
         {
            NamedMethodMetaData method = initMethod.getBeanMethod();
            InitImpl annotation = new InitImpl();
            addAnnotations(Init.class, annotation, container, method);
         }
      }
   }
View Full Code Here

   {
      if (list != null)
      {
         for (RemoveMethodMetaData removeMethod : list)
         {
            NamedMethodMetaData method = removeMethod.getBeanMethod();
            RemoveImpl annotation = new RemoveImpl(removeMethod.isRetainIfException());
            addAnnotations(Remove.class, annotation, container, method);
         }
      }
   }
View Full Code Here

   }
  
   private void initializeTimeout()
   {
      JBossSessionBeanMetaData metaData = getMetaData();
      NamedMethodMetaData timeoutMethodMetaData = null;
      if(metaData != null)
         timeoutMethodMetaData = metaData.getTimeoutMethod();
      this.timeout = getTimeoutCallback(timeoutMethodMetaData, getBeanClass());
   }
View Full Code Here

         String info = autoTimerMetaData.getInfo();
         if (info != null && !info.isEmpty())
         {
            timerConfig.setInfo(autoTimerMetaData.getInfo());
         }
         NamedMethodMetaData timeoutMethodMetaData = autoTimerMetaData.getTimeoutMethod();
         // get hold of the timeout method for this auto-timer
         Method timeoutMethod = this.getTimeoutMethod(timeoutMethodMetaData, container.getBeanClass());
         if (timeoutMethod == null)
         {
            StringBuilder methodStringBuilder = new StringBuilder();
            methodStringBuilder.append(timeoutMethodMetaData.getMethodName());
            if (timeoutMethodMetaData.getMethodParams() != null)
            {
               methodStringBuilder.append(Arrays.toString(timeoutMethodMetaData.getMethodParams().toArray()));
            }
            throw new IllegalStateException("Timeout method: " + methodStringBuilder.toString()
                  + " not found for bean class: " + enterpriseBeanMetaData.getEjbClass());
         }
         // finally create/get the auto timer
View Full Code Here

TOP

Related Classes of org.jboss.metadata.ejb.spec.NamedMethodMetaData

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.