Package javax.annotation

Examples of javax.annotation.Resource


    public final void visitField(final Field field, final Annotation annotation) {

        assert annotation instanceof Resource : annotation;
       
        Resource res = (Resource)annotation;

        String name = getFieldNameForResource(res, field);
        Class<?> type = getResourceType(res, field);
       
        Object resource = resourceManager.resolveResource(name, type);
View Full Code Here


    public final void visitMethod(final Method method, final Annotation annotation) {
       
        assert annotation instanceof Resource : annotation;

        Resource res = (Resource)annotation;
       
        String resourceName = getResourceName(res, method);
        Class<?> clz = getResourceType(res, method);

        Object resource = resourceManager.resolveResource(resourceName, clz);
View Full Code Here

      for (Resource ref : resources.value())
      {
         handleClassAnnotation(ref, container, clazz);
      }
      }
      Resource res = container.getAnnotation(Resource.class, clazz);
      if (res != null) handleClassAnnotation(res, container, clazz);
   }
View Full Code Here

      }
   }

   public void handleMethodAnnotations(Method method, InjectionContainer container, Map<AccessibleObject, Injector> injectors)
   {
      Resource ref = container.getAnnotation(Resource.class, method);
      if (ref == null) return;

      log.trace("method " + method + " has @Resource");
     
      handlePropertyAnnotation(ref, new MethodBeanProperty(method), container, injectors);
View Full Code Here

      */
   }
  
   public void handleFieldAnnotations(Field field, InjectionContainer container, Map<AccessibleObject, Injector> injectors)
   {
      Resource ref = container.getAnnotation(Resource.class, field);
      if (ref == null) return;

      log.trace("field " + field + " has @Resource");
     
      handlePropertyAnnotation(ref, new FieldBeanProperty(field), container, injectors);
View Full Code Here

         for (Resource ref : resources.value())
         {
            handleClassAnnotation(ref, container, clazz);
         }
      }
      Resource res = container.getAnnotation(Resource.class, clazz);
      if (res != null)
         handleClassAnnotation(res, container, clazz);
   }
View Full Code Here

   }

   public void handleMethodAnnotations(Method method, InjectionContainer container,
         Map<AccessibleObject, Injector> injectors)
   {
      Resource ref = container.getAnnotation(Resource.class, method);
      if (ref == null)
         return;

      log.trace("method " + method + " has @Resource");
View Full Code Here

   }

   public void handleFieldAnnotations(Field field, InjectionContainer container,
         Map<AccessibleObject, Injector> injectors)
   {
      Resource ref = container.getAnnotation(Resource.class, field);
      if (ref == null)
         return;

      log.trace("field " + field + " has @Resource");
View Full Code Here

  @Override
  @SuppressWarnings("rawtypes")
  public void handleField(Class clazz, Field field)
  {
    Resource resource = (Resource) field.getAnnotation(Resource.class);
    if (resource != null)
    {
      String jndiName = getSipResourceJndiName(field);
      if (jndiName != null)
      {
View Full Code Here

        }
       
        // Initialize the annotations
       
        if (classClass.isAnnotationPresent(Resource.class)) {
            Resource annotation = (Resource)
                classClass.getAnnotation(Resource.class);
            addResource(context, annotation);
        }
        /* Process Resources annotation.
         * Ref JSR 250
         */
        if (classClass.isAnnotationPresent(Resources.class)) {
            Resources annotation = (Resources)
                classClass.getAnnotation(Resources.class);
            for (int i = 0; annotation.value() != null && i < annotation.value().length; i++) {
                addResource(context, annotation.value()[i]);
            }
        }
        /* Process EJB annotation.
         * Ref JSR 224, equivalent to the ejb-ref or ejb-local-ref
         * element in the deployment descriptor.
        if (classClass.isAnnotationPresent(EJB.class)) {
            EJB annotation = (EJB)
            classClass.getAnnotation(EJB.class);
           
            if ((annotation.mappedName().length() == 0) ||
                    annotation.mappedName().equals("Local")) {
               
                ContextLocalEjb ejb = new ContextLocalEjb();
               
                ejb.setName(annotation.name());
                ejb.setType(annotation.beanInterface().getCanonicalName());
                ejb.setDescription(annotation.description());
               
                ejb.setHome(annotation.beanName());
               
                context.getNamingResources().addLocalEjb(ejb);
               
            } else if (annotation.mappedName().equals("Remote")) {
               
                ContextEjb ejb = new ContextEjb();
               
                ejb.setName(annotation.name());
                ejb.setType(annotation.beanInterface().getCanonicalName());
                ejb.setDescription(annotation.description());
               
                ejb.setHome(annotation.beanName());
               
                context.getNamingResources().addEjb(ejb);
               
            }
           
        }
         */
        /* Process WebServiceRef annotation.
         * Ref JSR 224, equivalent to the service-ref element in
         * the deployment descriptor.
         * The service-ref registration is not implemented
        if (classClass.isAnnotationPresent(WebServiceRef.class)) {
            WebServiceRef annotation = (WebServiceRef)
            classClass.getAnnotation(WebServiceRef.class);
           
            ContextService service = new ContextService();
           
            service.setName(annotation.name());
            service.setWsdlfile(annotation.wsdlLocation());
           
            service.setType(annotation.type().getCanonicalName());
           
            if (annotation.value() == null)
                service.setServiceinterface(annotation.type().getCanonicalName());
           
            if (annotation.type().getCanonicalName().equals("Service"))
                service.setServiceinterface(annotation.type().getCanonicalName());
           
            if (annotation.value().getCanonicalName().equals("Endpoint"))
                service.setServiceendpoint(annotation.type().getCanonicalName());
           
            service.setPortlink(annotation.type().getCanonicalName());
           
            context.getNamingResources().addService(service);
           
           
        }
         */
        /* Process DeclareRoles annotation.
         * Ref JSR 250, equivalent to the security-role element in
         * the deployment descriptor
         */
        if (classClass.isAnnotationPresent(DeclareRoles.class)) {
            DeclareRoles annotation = (DeclareRoles)
                classClass.getAnnotation(DeclareRoles.class);
            for (int i = 0; annotation.value() != null && i < annotation.value().length; i++) {
                context.addSecurityRole(annotation.value()[i]);
            }
        }
       
       
    }
View Full Code Here

TOP

Related Classes of javax.annotation.Resource

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.