Examples of EJB


Examples of com.sun.enterprise.tools.common.dd.ejb.Ejb

        EnterpriseBeans eBeans = sunEjbJar.getEnterpriseBeans();
        Ejb[] ejbs = eBeans.getEjb();
        HashMap wsMap = new HashMap();

        for (int ejbCnt =0; ejbCnt < ejbs.length; ejbCnt++) {
            Ejb ejb = ejbs[ejbCnt];

            // all web service endpoints for this ejb
            WebserviceEndpoint[] webSvcEps = ejb.getWebserviceEndpoint();

            for ( int wsCnt = 0; wsCnt < webSvcEps.length; wsCnt++) {
                WebserviceEndpoint webSvc = webSvcEps[wsCnt];

                boolean isSec = false;
View Full Code Here

Examples of javax.ejb.EJB

      }
      if (injectionPoint.getMember() instanceof Method && ((Method) injectionPoint.getMember()).getParameterTypes().length != 1)
      {
         throw new IllegalArgumentException("Injection point represents a method which doesn't follow JavaBean conventions (must have exactly one parameter) " + injectionPoint);
      }
      EJB annotation = injectionPoint.getAnnotated().getAnnotation(EJB.class);
      // Get properties from the annotation
      String beanName = annotation.beanName();
      String beanInterface = annotation.beanInterface().getName();

      // Supply beanInterface from reflection if not explicitly-defined
      if (beanInterface == null || beanInterface.equals(Object.class.getName()))
      {
         if (injectionPoint.getMember() instanceof Field && injectionPoint.getType() instanceof Class<?>)
View Full Code Here

Examples of javax.ejb.EJB

         for (EJB ejb : ejbs)
         {
            handleClassAnnotation(ejb, clazz, container);
         }
      }
      EJB ejbref = container.getAnnotation(EJB.class, clazz);
      if (ejbref != null) handleClassAnnotation(ejbref, clazz, container);
   }
View Full Code Here

Examples of javax.ejb.EJB

         ejbRefDependency(ejb.mappedName(), ejb.beanName(), container, ejb.beanInterface(), "@EJB", encName);
   }

   public void handleMethodAnnotations(Method method, InjectionContainer container, Map<AccessibleObject, Injector> injectors)
   {
      EJB ref = container.getAnnotation(EJB.class, method);
      if (ref != null)
      {
         if (!method.getName().startsWith("set"))
            throw new RuntimeException("@EJB can only be used with a set method: " + method);
         String encName = getEncName(ref, method);
         if (!container.getEncInjectors().containsKey(encName))
         {
            ejbRefEncInjector(ref.mappedName(), encName, method.getName().substring(0), method.getParameterTypes()[0], ref.beanName(), "@EJB", container);
           
            if (isIgnoreDependency(container, ref))
               log.debug("IGNORING <ejb-ref> DEPENDENCY: " + encName);
            else
               ejbRefDependency(ref.mappedName(), ref.beanName(), container, method.getParameterTypes()[0], "@EJB", encName);
         }

         super.handleMethodAnnotations(method, container, injectors);
      }
   }
View Full Code Here

Examples of javax.ejb.EJB

      }
   }

   public void handleFieldAnnotations(Field field, InjectionContainer container, Map<AccessibleObject, Injector> injectors)
   {
      EJB ref = container.getAnnotation(EJB.class, field);
      if (ref != null)
      {
         String encName = getEncName(ref, field);
         if (!container.getEncInjectors().containsKey(encName))
         {
            String mappedName = null;
            if(ref.mappedName().length() > 0)
               mappedName = ref.mappedName();
           
            if(mappedName == null)
            {
               EndpointInfo info = null;
               String link = null;
              
               if(ref.beanName().length() > 0)
                  link = ref.beanName();
              
               if(link != null)
                  info = resolver.getEndpointInfo(link, EndpointType.EJB, vfsContext);
               if(info == null)
                  info = resolver.getEndpointInfo(field.getType(), EndpointType.EJB, vfsContext);
               if(info == null)
                  throw new IllegalStateException("No mapped-name for field: "+field+", "+ref);

               ContainerDependencyMetaData cdmd = endpoints.get(info.getComponentKey());
               if(cdmd == null)
                  throw new IllegalStateException("Failed to resolve ContainerDependencyMetaData for info: "+info+", "+ref);
                mappedName = cdmd.getContainerName();
            }
           
            if (isIgnoreDependency(container, ref))
               log.debug("IGNORING <ejb-ref> DEPENDENCY: " + encName);
            else
            {
               ejbRefDependency(mappedName, ref.beanName(), container, field.getType(), "@EJB", encName);
            }
            ejbRefEncInjector(mappedName, encName, field.getName(), field.getType(), ref.beanName(), "@EJB", container);
         }
         super.handleFieldAnnotations(field, container, injectors);
      }
   }
View Full Code Here

Examples of javax.ejb.EJB

    * @return JNDI name of referenced EJB object
    */
   @Override
   protected String resolveField(final Field field)
   {
      final EJB ejbAnnotation = field.getAnnotation(EJB.class);
      final Class<?> type = field.getType();
      final EjbReference reference = this.getEjbReference(ejbAnnotation, type);

      return this.delegate.resolveEjb(this.unit, reference);
   }
View Full Code Here

Examples of javax.ejb.EJB

    * @return JNDI name of referenced EJB object
    */
   @Override
   protected String resolveMethod(final Method method)
   {
      final EJB ejbAnnotation = method.getAnnotation(EJB.class);
      final Class<?> type = method.getParameterTypes()[0];
      final EjbReference reference = this.getEjbReference(ejbAnnotation, type);

      return this.delegate.resolveEjb(this.unit, reference);
   }
View Full Code Here

Examples of javax.ejb.EJB

        List<Method> methodsWithEJB = classFinder.findAnnotatedMethods(EJB.class);
        List<Field> fieldsWithEJB = classFinder.findAnnotatedFields(EJB.class);

        // Class-level annotation
        for (Class cls : classesWithEJB) {
            EJB ejb = (EJB) cls.getAnnotation(EJB.class);
            if (ejb != null) {
                addEJB(annotatedApp, ejb, cls, null, null);
            }
        }

        // Method-level annotation
        for (Method method : methodsWithEJB) {
            EJB ejb = (EJB) method.getAnnotation(EJB.class);
            if (ejb != null) {
                addEJB(annotatedApp, ejb, null, method, null);
            }
        }

        // Field-level annotation
        for (Field field : fieldsWithEJB) {
            EJB ejb = (EJB) field.getAnnotation(EJB.class);
            if (ejb != null) {
                addEJB(annotatedApp, ejb, null, null, field);
            }
        }
View Full Code Here

Examples of javax.ejb.EJB

                if (fields[i].isAnnotationPresent(Resource.class)) {
                    Resource annotation = (Resource) fields[i].getAnnotation(Resource.class);
                    lookupFieldResource(context, instance, fields[i], annotation.name());
                }
                if (fields[i].isAnnotationPresent(EJB.class)) {
                    EJB annotation = (EJB) fields[i].getAnnotation(EJB.class);
                    lookupFieldResource(context, instance, fields[i], annotation.name());
                }
                if (fields[i].isAnnotationPresent(WebServiceRef.class)) {
                    WebServiceRef annotation =
                        (WebServiceRef) fields[i].getAnnotation(WebServiceRef.class);
                    lookupFieldResource(context, instance, fields[i], annotation.name());
                }
                if (fields[i].isAnnotationPresent(PersistenceContext.class)) {
                    PersistenceContext annotation =
                        (PersistenceContext) fields[i].getAnnotation(PersistenceContext.class);
                    lookupFieldResource(context, instance, fields[i], annotation.name());
                }
                if (fields[i].isAnnotationPresent(PersistenceUnit.class)) {
                    PersistenceUnit annotation =
                        (PersistenceUnit) fields[i].getAnnotation(PersistenceUnit.class);
                    lookupFieldResource(context, instance, fields[i], annotation.name());
                }
            }
           
            // Initialize methods annotations
            Method[] methods = instance.getClass().getDeclaredMethods();
            for (int i = 0; i < methods.length; i++) {
                if (methods[i].isAnnotationPresent(Resource.class)) {
                    Resource annotation = (Resource) methods[i].getAnnotation(Resource.class);
                    lookupMethodResource(context, instance, methods[i], annotation.name());
                }
                if (methods[i].isAnnotationPresent(EJB.class)) {
                    EJB annotation = (EJB) methods[i].getAnnotation(EJB.class);
                    lookupMethodResource(context, instance, methods[i], annotation.name());
                }
                if (methods[i].isAnnotationPresent(WebServiceRef.class)) {
                    WebServiceRef annotation =
                        (WebServiceRef) methods[i].getAnnotation(WebServiceRef.class);
                    lookupMethodResource(context, instance, methods[i], annotation.name());
                }
                if (methods[i].isAnnotationPresent(PersistenceContext.class)) {
                    PersistenceContext annotation =
                        (PersistenceContext) methods[i].getAnnotation(PersistenceContext.class);
                    lookupMethodResource(context, instance, methods[i], annotation.name());
                }
                if (methods[i].isAnnotationPresent(PersistenceUnit.class)) {
                    PersistenceUnit annotation =
                        (PersistenceUnit) methods[i].getAnnotation(PersistenceUnit.class);
                    lookupMethodResource(context, instance, methods[i], annotation.name());
                }
            }
           
            clazz = clazz.getSuperclass();
        }
View Full Code Here

Examples of javax.ejb.EJB

            for (Class<?> clazz : classFinder.findAnnotatedClasses(EJBs.class)) {
                EJBs ejbs = clazz.getAnnotation(EJBs.class);
                ejbList.addAll(asList(ejbs.value()));
            }
            for (Class<?> clazz : classFinder.findAnnotatedClasses(EJB.class)) {
                EJB e = clazz.getAnnotation(EJB.class);
                ejbList.add(e);
            }

            for (EJB ejb : ejbList) {
                buildEjbRef(consumer, ejb, null);
            }

            for (Field field : classFinder.findAnnotatedFields(EJB.class)) {
                EJB ejb = field.getAnnotation(EJB.class);

                Member member = new FieldMember(field);

                buildEjbRef(consumer, ejb, member);
            }

            for (Method method : classFinder.findAnnotatedMethods(EJB.class)) {
                EJB ejb = method.getAnnotation(EJB.class);

                Member member = new MethodMember(method);

                buildEjbRef(consumer, ejb, member);
            }
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.