Examples of MethodMetaData


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

    */
   private void addEjb21Annotations(EJBContainer container, boolean isStateful) throws Exception
   {
      if(javax.ejb.SessionBean.class.isAssignableFrom(ejbClass))
      {
         MethodMetaData method = new MethodMetaData();
         method.setEjbName(container.getEjbName());

         Annotation annotation;
         Class<? extends Annotation> annotationClass;
         // EJB3 4.6.2: The class may implement the ejbCreate method(s).
         // EJB3 4.6.4: The method must be declared as public.
         if(hasPublicMethod(ejbClass, "ejbCreate"))
         {
            if(isStateful)
            {
               annotation = new InitImpl();
            }
            else
            {
               annotation = new PostConstructImpl();
            }
            annotationClass = annotation.annotationType();
            method.setMethodName("ejbCreate");
            addAnnotations(annotationClass, annotation, container, method);
         }

         annotation = new PostActivateImpl();
         annotationClass = javax.ejb.PostActivate.class;
         method.setMethodName("ejbActivate");
         addAnnotations(annotationClass, annotation, container, method);

         annotation = new PrePassivateImpl();
         annotationClass = javax.ejb.PrePassivate.class;
         method.setMethodName("ejbPassivate");
         addAnnotations(annotationClass, annotation, container, method);

         annotation = new PreDestroyImpl();
         annotationClass = javax.annotation.PreDestroy.class;
         method.setMethodName("ejbRemove");
         addAnnotations(annotationClass, annotation, container, method);
           
         annotation = new ResourceImpl();
         annotationClass = Resource.class;
         method.setMethodName("setSessionContext");
         // TODO: set param?
         addAnnotations(annotationClass, annotation, container, method);
      }
   }
View Full Code Here

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

         {
            addClassAnnotation(container, annotationClass, annotation);
         }
         else
         {
            MethodMetaData method = new MethodMetaData();
            method.setMethodName(xmlAnnotation.getInjectionTarget().getInjectionTargetName());
            addAnnotations(annotationClass, annotation, container, method);
         }
      }
   }
View Full Code Here

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

      {
         for(ResourceInjectionTargetMetaData ignore : enterpriseBean.getIgnoreDependency().getInjectionTargets())
         {
            IgnoreDependencyImpl annotation = new IgnoreDependencyImpl();

            MethodMetaData method = new MethodMetaData();
            method.setMethodName(ignore.getInjectionTargetName());

            addAnnotations(IgnoreDependency.class, annotation, container, method);
         }
      }
   }
View Full Code Here

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

    */
   private void addEjb21Annotations(EJBContainer container, boolean isStateful) throws Exception
   {
      if(javax.ejb.SessionBean.class.isAssignableFrom(ejbClass))
      {
         MethodMetaData method = new MethodMetaData();
         method.setEjbName(container.getEjbName());

         Annotation annotation;
         Class<? extends Annotation> annotationClass;
         // EJB3 4.6.2: The class may implement the ejbCreate method(s).
         // EJB3 4.6.4: The method must be declared as public.
         if(hasPublicMethod(ejbClass, "ejbCreate"))
         {
            if(isStateful)
            {
               annotation = new InitImpl();
            }
            else
            {
               annotation = new PostConstructImpl();
            }
            annotationClass = annotation.annotationType();
            method.setMethodName("ejbCreate");
            addAnnotations(annotationClass, annotation, container, method);
         }

         annotation = new PostActivateImpl();
         annotationClass = javax.ejb.PostActivate.class;
         method.setMethodName("ejbActivate");
         addAnnotations(annotationClass, annotation, container, method);

         annotation = new PrePassivateImpl();
         annotationClass = javax.ejb.PrePassivate.class;
         method.setMethodName("ejbPassivate");
         addAnnotations(annotationClass, annotation, container, method);

         annotation = new PreDestroyImpl();
         annotationClass = javax.annotation.PreDestroy.class;
         method.setMethodName("ejbRemove");
         addAnnotations(annotationClass, annotation, container, method);
           
         annotation = new ResourceImpl();
         annotationClass = Resource.class;
         method.setMethodName("setSessionContext");
         // TODO: set param?
         addAnnotations(annotationClass, annotation, container, method);
      }
   }
View Full Code Here

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

         {
            addClassAnnotation(container, annotationClass, annotation);
         }
         else
         {
            MethodMetaData method = new MethodMetaData();
            method.setMethodName(xmlAnnotation.getInjectionTarget().getInjectionTargetName());
            addAnnotations(annotationClass, annotation, container, method);
         }
      }
   }
View Full Code Here

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

      {
         for(ResourceInjectionTargetMetaData ignore : enterpriseBean.getIgnoreDependency().getInjectionTargets())
         {
            IgnoreDependencyImpl annotation = new IgnoreDependencyImpl();

            MethodMetaData method = new MethodMetaData();
            method.setMethodName(ignore.getInjectionTargetName());

            addAnnotations(IgnoreDependency.class, annotation, container, method);
         }
      }
   }
View Full Code Here

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

    */
   private void addEjb21Annotations(EJBContainer container, boolean isStateful) throws Exception
   {
      if(javax.ejb.SessionBean.class.isAssignableFrom(ejbClass))
      {
         MethodMetaData method = new MethodMetaData();
         method.setEjbName(container.getEjbName());

         Annotation annotation;
         Class<? extends Annotation> annotationClass;
         // EJB3 4.6.2: The class may implement the ejbCreate method(s).
         // EJB3 4.6.4: The method must be declared as public.
         if(hasPublicMethod(ejbClass, "ejbCreate"))
         {
            if(isStateful)
            {
               annotation = new InitImpl();
            }
            else
            {
               annotation = new PostConstructImpl();
            }
            annotationClass = annotation.annotationType();
            method.setMethodName("ejbCreate");
            addAnnotations(annotationClass, annotation, container, method);
         }

         annotation = new PostActivateImpl();
         annotationClass = javax.ejb.PostActivate.class;
         method.setMethodName("ejbActivate");
         addAnnotations(annotationClass, annotation, container, method);

         annotation = new PrePassivateImpl();
         annotationClass = javax.ejb.PrePassivate.class;
         method.setMethodName("ejbPassivate");
         addAnnotations(annotationClass, annotation, container, method);

         annotation = new PreDestroyImpl();
         annotationClass = javax.annotation.PreDestroy.class;
         method.setMethodName("ejbRemove");
         addAnnotations(annotationClass, annotation, container, method);
           
         annotation = new ResourceImpl();
         annotationClass = Resource.class;
         method.setMethodName("setSessionContext");
         // TODO: set param?
         addAnnotations(annotationClass, annotation, container, method);
      }
   }
View Full Code Here

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

         {
            addClassAnnotation(container, annotationClass, annotation);
         }
         else
         {
            MethodMetaData method = new MethodMetaData();
            method.setMethodName(xmlAnnotation.getInjectionTarget().getInjectionTargetName());
            addAnnotations(annotationClass, annotation, container, method);
         }
      }
   }
View Full Code Here

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

      {
         for(ResourceInjectionTargetMetaData ignore : enterpriseBean.getIgnoreDependency().getInjectionTargets())
         {
            IgnoreDependencyImpl annotation = new IgnoreDependencyImpl();

            MethodMetaData method = new MethodMetaData();
            method.setMethodName(ignore.getInjectionTargetName());

            addAnnotations(IgnoreDependency.class, annotation, container, method);
         }
      }
   }
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);
     
      /*
       * JBMETA-152
       *
       * Check that we haven't already defined permissions for this method
       */
      MethodPermissionsMetaData existingPerms = metaData.getMethodPermissionsByEjbName(ejbName);
      if (existingPerms != null && !existingPerms.isEmpty())
      {
         for (MethodPermissionMetaData existingPerm : existingPerms)
         {
            for (MethodMetaData existingMethod : existingPerm.getMethods())
            {
               // If this method's already been added
               if (existingMethod.getMethodName().equals(mmd.getMethodName())
                     && existingMethod.getMethodParams().equals(mmd.getMethodParams()))
               {
                  // Do nothing
                  return;
               }
            }
         }
      }
     
      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
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.