Package org.jboss.metadata.ejb.spec

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


   {
      // Override
      RemoveMethodsMetaData overrideRemoveMethods = new RemoveMethodsMetaData();
      RemoveMethodMetaData overrideRemoveMethod = new RemoveMethodMetaData();
      overrideRemoveMethod.setId("overrideId");
      NamedMethodMetaData overrideNamedMethod = new NamedMethodMetaData();
      overrideNamedMethod.setMethodName("overrideMethodName");
      overrideRemoveMethod.setBeanMethod(overrideNamedMethod);
      overrideRemoveMethods.add(overrideRemoveMethod);

      JBossSessionBeanMetaData override = new JBossSessionBeanMetaData();
      override.setRemoveMethods(overrideRemoveMethods);
      override.setName("overrideName");

      // Original
      RemoveMethodsMetaData originalRemoveMethods = new RemoveMethodsMetaData();
      RemoveMethodMetaData originalRemoveMethod = new RemoveMethodMetaData();
      originalRemoveMethod.setId("originalId");
      originalRemoveMethod.setRetainIfException(true);
      NamedMethodMetaData originalNamedMethod = new NamedMethodMetaData();
      originalNamedMethod.setMethodName("overrideMethodName");
      originalNamedMethod.setId("originalId");
      originalRemoveMethod.setBeanMethod(originalNamedMethod);
      originalRemoveMethods.add(originalRemoveMethod);
     
      JBossSessionBeanMetaData original = new JBossSessionBeanMetaData();
      original.setRemoveMethods(originalRemoveMethods);
     
      // Merged
      JBossSessionBeanMetaData merged = new JBossSessionBeanMetaData();
      merged.merge(override, original);
      RemoveMethodsMetaData removeMethods = merged.getRemoveMethods();
      assertNotNull(removeMethods);
      RemoveMethodMetaData removeMethod = removeMethods.get(0);
      assertNotNull(removeMethod);
      assertEquals("overrideId", removeMethod.getId());
      assertTrue(removeMethod.isRetainIfException());
      NamedMethodMetaData namedMethod = removeMethod.getBeanMethod();
      assertNotNull(namedMethod);
      assertEquals("overrideMethodName", namedMethod.getMethodName());
     
   }
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

        //We loop through twice, as the more more general form with no parameters is applied to all methods with that name
        //while the method that specifies the actual parameters override this
        for (final RemoveMethodMetaData removeMethod : beanMetaData.getRemoveMethods()) {
            if(removeMethod.getBeanMethod().getMethodParams() == null) {
                final NamedMethodMetaData methodData = removeMethod.getBeanMethod();
                final Collection<Method> methods = MethodResolutionUtils.resolveMethods(methodData, componentClass, reflectionIndex);
                for(Method method : methods) {
                    componentConfiguration.addRemoveMethod(MethodIdentifier.getIdentifierForMethod(method), removeMethod.isRetainIfException());
                }
            }
        }
        for (final RemoveMethodMetaData removeMethod : beanMetaData.getRemoveMethods()) {
            if(removeMethod.getBeanMethod().getMethodParams() != null) {
                final NamedMethodMetaData methodData = removeMethod.getBeanMethod();
                final Collection<Method> methods = MethodResolutionUtils.resolveMethods(methodData, componentClass, reflectionIndex);
                for(Method method : methods) {
                    componentConfiguration.addRemoveMethod(MethodIdentifier.getIdentifierForMethod(method), removeMethod.isRetainIfException());
                }
            }
View Full Code Here

      interceptor.setEjbName(ejbName);
      interceptor.setExcludeClassInterceptors(excludeClass != null);
      interceptor.setExcludeDefaultInterceptors(excludeDefaults != null);
      if(method != null)
      {
         NamedMethodMetaData namedMethod = new NamedMethodMetaData();
         namedMethod.setMethodName(method.getName());
         MethodParametersMetaData methodParams = ProcessorUtils.getMethodParameters(method);
         namedMethod.setMethodParams(methodParams);
         interceptor.setMethod(namedMethod);
      }
      InterceptorClassesMetaData classes = new InterceptorClassesMetaData();
      for(Class c : interceptors.value())
      {
View Full Code Here

      RemoveMethodsMetaData removeMethods = sb.getRemoveMethods();
     
      assertNotNull(removeMethods);
      assertEquals(5, removeMethods.size());

      NamedMethodMetaData namedMethod = createNamedMethodMD("remove", "boolean");
      RemoveMethodMetaData removeMethod = getRemoveMethod(removeMethods, namedMethod);
      assertNotNull(removeMethod);
      assertEquals("remove", removeMethod.getBeanMethod().getMethodName());
      assertNotNull(removeMethod.getBeanMethod().getMethodParams());
      assertEquals(1, removeMethod.getBeanMethod().getMethodParams().size());
View Full Code Here

   private NamedMethodMetaData createNamedMethodMD(String methodName, String... params)
   {
      if(methodName == null)
         throw new IllegalArgumentException("null methodName");
     
      NamedMethodMetaData namedMethod = new NamedMethodMetaData();
      namedMethod.setMethodName(methodName);
      if(params != null)
      {
         MethodParametersMetaData methodParams = new MethodParametersMetaData();
         for(String param : params)
            methodParams.add(param);
         namedMethod.setMethodParams(methodParams);
      }
      return namedMethod;
   }
View Full Code Here

            {
               // For the bean
               if(binding.getMethod() == null)
                  continue;
              
               NamedMethodMetaData method = binding.getMethod();
              
               // TODO: this is weird, it should have been caught earlier (invalid xml)
               if(method.getMethodName() == null)
                  continue;
              
               if(method.getMethodName().equals(methodName))
               {
                  MethodParametersMetaData methodParams = method.getMethodParams();
                  if(methodParams == null)
                     add(interceptors, classLoader, binding);
                  else
                  {
                     if(Arrays.equals(methodParams.toArray(), parameterNames))
View Full Code Here

      {
         return null;
      }
      JBossSessionBean31MetaData sessionBean = (JBossSessionBean31MetaData) metaData;
      // create  a named method metadata to represent the method being queried
      NamedMethodMetaData namedMethod = new NamedMethodMetaData();
      namedMethod.setName(method.getName());
      if (method.getParameters() != null)
      {
         MethodParametersMetaData methodParams = new MethodParametersMetaData();
         methodParams.addAll(Arrays.asList(method.getParameters()));
         // set the method params on the named method metadata
         namedMethod.setMethodParams(methodParams);
      }
      ConcurrentMethodsMetaData concurrentMethods = sessionBean.getConcurrentMethods();
      if(concurrentMethods == null)
         return null;
      // get the concurrency method metadata for this named method
View Full Code Here

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

      {
         return null;
      }
      JBossSessionBean31MetaData sessionBean = (JBossSessionBean31MetaData) metaData;
      // create  a named method metadata to represent the method being queried
      NamedMethodMetaData namedMethod = new NamedMethodMetaData();
      namedMethod.setName(method.getName());
      if (method.getParameters() != null)
      {
         MethodParametersMetaData methodParams = new MethodParametersMetaData();
         methodParams.addAll(Arrays.asList(method.getParameters()));
         // set the method params on the named method metadata
         namedMethod.setMethodParams(methodParams);
      }
      ConcurrentMethodsMetaData concurrentMethods = sessionBean.getConcurrentMethods();
      if(concurrentMethods == null)
      {
         // EJB3.1 spec, section 4.8.5.5 specifies special meaning for @Lock annotation
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.