Examples of WebServiceRef


Examples of javax.xml.ws.WebServiceRef

                    if (fields[i].isAnnotationPresent(EJB.class)) {
                        EJB annotation = (EJB) fields[i].getAnnotation(EJB.class);
                        lookupFieldResource(namingContext, managedBean, fields[i], annotation.name());
                    }
                    if (fields[i].isAnnotationPresent(WebServiceRef.class)) {
                        WebServiceRef annotation =
                            (WebServiceRef) fields[i].getAnnotation(WebServiceRef.class);
                        lookupFieldResource(namingContext, managedBean, fields[i], annotation.name());
                    }
                    if (fields[i].isAnnotationPresent(PersistenceContext.class)) {
                        PersistenceContext annotation =
                            (PersistenceContext) fields[i].getAnnotation(PersistenceContext.class);
                        lookupFieldResource(namingContext, managedBean, fields[i], annotation.name());
                    }
                    if (fields[i].isAnnotationPresent(PersistenceUnit.class)) {
                        PersistenceUnit annotation =
                            (PersistenceUnit) fields[i].getAnnotation(PersistenceUnit.class);
                        lookupFieldResource(namingContext, managedBean, fields[i], annotation.name());
                    }
                }
               
                // Initialize methods annotations
                Method[] methods = managedBean.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(namingContext, managedBean, methods[i], annotation.name());
                    }
                    if (methods[i].isAnnotationPresent(EJB.class)) {
                        EJB annotation = (EJB) methods[i].getAnnotation(EJB.class);
                        lookupMethodResource(namingContext, managedBean, methods[i], annotation.name());
                    }
                    if (methods[i].isAnnotationPresent(WebServiceRef.class)) {
                        WebServiceRef annotation =
                            (WebServiceRef) methods[i].getAnnotation(WebServiceRef.class);
                        lookupMethodResource(namingContext, managedBean, methods[i], annotation.name());
                    }
                    if (methods[i].isAnnotationPresent(PersistenceContext.class)) {
                        PersistenceContext annotation =
                            (PersistenceContext) methods[i].getAnnotation(PersistenceContext.class);
                        lookupMethodResource(namingContext, managedBean, methods[i], annotation.name());
                    }
                    if (methods[i].isAnnotationPresent(PersistenceUnit.class)) {
                        PersistenceUnit annotation =
                            (PersistenceUnit) methods[i].getAnnotation(PersistenceUnit.class);
                        lookupMethodResource(namingContext, managedBean, methods[i], annotation.name());
                    }
                }
               
            } catch (Exception e) {
                LOG.error("Injection failed on managed bean.", e);
View Full Code Here

Examples of javax.xml.ws.WebServiceRef

                    // JNDI is enabled
                    Field[] fields = Introspection.getDeclaredFields(clazz);
                    for (Field field : fields) {
                        Resource resourceAnnotation;
                        EJB ejbAnnotation;
                        WebServiceRef webServiceRefAnnotation;
                        PersistenceContext persistenceContextAnnotation;
                        PersistenceUnit persistenceUnitAnnotation;
                        if (injections != null && injections.containsKey(field.getName())) {
                            annotations.add(new AnnotationCacheEntry(
                                    field.getName(), null,
                                    injections.get(field.getName()),
                                    AnnotationCacheEntryType.FIELD));
                        } else if ((resourceAnnotation =
                                field.getAnnotation(Resource.class)) != null) {
                            annotations.add(new AnnotationCacheEntry(field.getName(), null,
                                    resourceAnnotation.name(), AnnotationCacheEntryType.FIELD));
                        } else if ((ejbAnnotation =
                                field.getAnnotation(EJB.class)) != null) {
                            annotations.add(new AnnotationCacheEntry(field.getName(), null,
                                    ejbAnnotation.name(), AnnotationCacheEntryType.FIELD));
                        } else if ((webServiceRefAnnotation =
                                field.getAnnotation(WebServiceRef.class)) != null) {
                            annotations.add(new AnnotationCacheEntry(field.getName(), null,
                                    webServiceRefAnnotation.name(),
                                    AnnotationCacheEntryType.FIELD));
                        } else if ((persistenceContextAnnotation =
                                field.getAnnotation(PersistenceContext.class)) != null) {
                            annotations.add(new AnnotationCacheEntry(field.getName(), null,
                                    persistenceContextAnnotation.name(),
                                    AnnotationCacheEntryType.FIELD));
                        } else if ((persistenceUnitAnnotation =
                                field.getAnnotation(PersistenceUnit.class)) != null) {
                            annotations.add(new AnnotationCacheEntry(field.getName(), null,
                                    persistenceUnitAnnotation.name(),
                                    AnnotationCacheEntryType.FIELD));
                        }
                    }
                }

                // Initialize methods annotations
                Method[] methods = Introspection.getDeclaredMethods(clazz);
                Method postConstruct = null;
                String postConstructFromXml = postConstructMethods.get(clazz.getName());
                Method preDestroy = null;
                String preDestroyFromXml = preDestroyMethods.get(clazz.getName());
                for (Method method : methods) {
                    if (context != null) {
                        // Resource injection only if JNDI is enabled
                        if (injections != null &&
                                Introspection.isValidSetter(method)) {
                            String fieldName = Introspection.getPropertyName(method);
                            if (injections.containsKey(fieldName)) {
                                annotations.add(new AnnotationCacheEntry(
                                        method.getName(),
                                        method.getParameterTypes(),
                                        injections.get(fieldName),
                                        AnnotationCacheEntryType.SETTER));
                                continue;
                            }
                        }
                        Resource resourceAnnotation;
                        EJB ejbAnnotation;
                        WebServiceRef webServiceRefAnnotation;
                        PersistenceContext persistenceContextAnnotation;
                        PersistenceUnit persistenceUnitAnnotation;
                        if ((resourceAnnotation =
                                method.getAnnotation(Resource.class)) != null) {
                            annotations.add(new AnnotationCacheEntry(
                                    method.getName(),
                                    method.getParameterTypes(),
                                    resourceAnnotation.name(),
                                    AnnotationCacheEntryType.SETTER));
                        } else if ((ejbAnnotation =
                                method.getAnnotation(EJB.class)) != null) {
                            annotations.add(new AnnotationCacheEntry(
                                    method.getName(),
                                    method.getParameterTypes(),
                                    ejbAnnotation.name(),
                                    AnnotationCacheEntryType.SETTER));
                        } else if ((webServiceRefAnnotation =
                                method.getAnnotation(WebServiceRef.class)) != null) {
                            annotations.add(new AnnotationCacheEntry(
                                    method.getName(),
                                    method.getParameterTypes(),
                                    webServiceRefAnnotation.name(),
                                    AnnotationCacheEntryType.SETTER));
                        } else if ((persistenceContextAnnotation =
                                method.getAnnotation(PersistenceContext.class)) != null) {
                            annotations.add(new AnnotationCacheEntry(
                                    method.getName(),
View Full Code Here

Examples of javax.xml.ws.WebServiceRef

        List<Method> methodswithWebServiceRef = classFinder.findAnnotatedMethods(WebServiceRef.class);
        List<Field> fieldswithWebServiceRef = classFinder.findAnnotatedFields(WebServiceRef.class);

        // Class-level annotation
        for (Class cls : classeswithWebServiceRef) {
            WebServiceRef webServiceRef = (WebServiceRef) cls.getAnnotation(WebServiceRef.class);
            if (webServiceRef != null) {
                addWebServiceRef(annotatedApp, webServiceRef, cls, null, null);
            }
        }

        // Method-level annotation
        for (Method method : methodswithWebServiceRef) {
            WebServiceRef webServiceRef = method.getAnnotation(WebServiceRef.class);
            if (webServiceRef != null) {
                addWebServiceRef(annotatedApp, webServiceRef, null, method, null);
            }
        }

        // Field-level annotation
        for (Field field : fieldswithWebServiceRef) {
            WebServiceRef webServiceRef = field.getAnnotation(WebServiceRef.class);
            if (webServiceRef != null) {
                addWebServiceRef(annotatedApp, webServiceRef, null, null, field);
            }
        }
View Full Code Here

Examples of javax.xml.ws.WebServiceRef

        if (log.isDebugEnabled()) {
            log.debug("addHandlerChain(): handlerChainFile: " + handlerChainFile);
        }
        // Determine ServiceRef name
        String serviceRefName;
        WebServiceRef webServiceRef = null;
        if ( method != null ) {
            webServiceRef = method.getAnnotation(WebServiceRef.class);
        }
        else if ( field != null ) {
            webServiceRef = field.getAnnotation(WebServiceRef.class);
        }
        if ( webServiceRef != null ) {
            serviceRefName = webServiceRef.name();
        }
        else {
            //TODO is this guaranteed to be ""? If so, simplify the code here
            serviceRefName = annotation.name();
        }
View Full Code Here

Examples of javax.xml.ws.WebServiceRef

      handlerChainProcessor = new WebServiceHandlerChainProcessor<E>(finder);
   }
  
   public void process(ServiceReferencesMetaData refs, E element)
   {
      WebServiceRef annotation = finder.getAnnotation(element, WebServiceRef.class);
      if(annotation == null)
         return;
      process(refs, element, annotation);
   }
View Full Code Here

Examples of javax.xml.ws.WebServiceRef

            return processor.getResource(resource, resourceReference.getResourceType());
        }

        if(resourceReference.supports(WebServiceRef.class))
        {        
            WebServiceRef resource = resourceReference.getAnnotation(WebServiceRef.class);
            return processor.getWebServiceResource(resource, resourceReference.getResourceType());

        }
               
        if(resourceReference.supports(PersistenceContext.class))
View Full Code Here

Examples of javax.xml.ws.WebServiceRef

            for (Class<?> clazz : classFinder.findAnnotatedClasses(WebServiceRefs.class)) {
                WebServiceRefs webServiceRefs = clazz.getAnnotation(WebServiceRefs.class);
                webservicerefList.addAll(asList(webServiceRefs.value()));
            }
            for (Class<?> clazz : classFinder.findAnnotatedClasses(WebServiceRef.class)) {
                WebServiceRef webServiceRef = clazz.getAnnotation(WebServiceRef.class);
                webservicerefList.add(webServiceRef);
            }

            for (WebServiceRef webserviceref : webservicerefList) {

                buildWebServiceRef(consumer, webserviceref, null, null, classLoader);
            }

            for (Field field : classFinder.findAnnotatedFields(WebServiceRef.class)) {
                WebServiceRef webserviceref = field.getAnnotation(WebServiceRef.class);
                HandlerChain handlerChain = field.getAnnotation(HandlerChain.class);

                Member member = new FieldMember(field);

                buildWebServiceRef(consumer, webserviceref, handlerChain, member, classLoader);
            }

            for (Method method : classFinder.findAnnotatedMethods(WebServiceRef.class)) {
                WebServiceRef webserviceref = method.getAnnotation(WebServiceRef.class);
                HandlerChain handlerChain = method.getAnnotation(HandlerChain.class);

                Member member = new MethodMember(method);

                buildWebServiceRef(consumer, webserviceref, handlerChain, member, classLoader);
View Full Code Here

Examples of javax.xml.ws.WebServiceRef

            for (Class<?> clazz : classFinder.findAnnotatedClasses(WebServiceRefs.class)) {
                WebServiceRefs webServiceRefs = clazz.getAnnotation(WebServiceRefs.class);
                webservicerefList.addAll(Arrays.asList(webServiceRefs.value()));
            }
            for (Class<?> clazz : classFinder.findAnnotatedClasses(WebServiceRef.class)) {
                WebServiceRef webServiceRef = clazz.getAnnotation(WebServiceRef.class);
                webservicerefList.add(webServiceRef);
            }

            for (WebServiceRef webserviceref : webservicerefList) {

                buildWebServiceRef(consumer, webserviceref, null);
            }

            for (Field field : classFinder.findAnnotatedFields(WebServiceRef.class)) {
                WebServiceRef webserviceref = field.getAnnotation(WebServiceRef.class);

                Member member = new FieldMember(field);

                buildWebServiceRef(consumer, webserviceref, member);
            }

            for (Method method : classFinder.findAnnotatedMethods(WebServiceRef.class)) {
                WebServiceRef webserviceref = method.getAnnotation(WebServiceRef.class);

                Member member = new MethodMember(method);

                buildWebServiceRef(consumer, webserviceref, member);
            }
View Full Code Here

Examples of javax.xml.ws.WebServiceRef

                    EJB annotation = fields[i].getAnnotation(EJB.class);
                    lookupFieldResource(context, instance, fields[i],
                            annotation.name(), clazz);
                }
                if (fields[i].isAnnotationPresent(WebServiceRef.class)) {
                    WebServiceRef annotation =
                        fields[i].getAnnotation(WebServiceRef.class);
                    lookupFieldResource(context, instance, fields[i],
                            annotation.name(), clazz);
                }
                if (fields[i].isAnnotationPresent(PersistenceContext.class)) {
                    PersistenceContext annotation =
                        fields[i].getAnnotation(PersistenceContext.class);
                    lookupFieldResource(context, instance, fields[i],
                            annotation.name(), clazz);
                }
                if (fields[i].isAnnotationPresent(PersistenceUnit.class)) {
                    PersistenceUnit annotation =
                        fields[i].getAnnotation(PersistenceUnit.class);
                    lookupFieldResource(context, instance, fields[i],
                            annotation.name(), clazz);
                }
            }
           
            // Initialize methods annotations
            Method[] methods = null;
            if (Globals.IS_SECURITY_ENABLED) {
                final Class<?> clazz2 = clazz;
                methods = AccessController.doPrivileged(
                        new PrivilegedAction<Method[]>(){
                    public Method[] run(){
                        return clazz2.getDeclaredMethods();
                    }
                });
            } else {
                methods = clazz.getDeclaredMethods();
            }
            for (int i = 0; i < methods.length; i++) {
                if (methods[i].isAnnotationPresent(Resource.class)) {
                    Resource annotation = methods[i].getAnnotation(Resource.class);
                    lookupMethodResource(context, instance, methods[i],
                            annotation.name(), clazz);
                }
                if (methods[i].isAnnotationPresent(EJB.class)) {
                    EJB annotation = methods[i].getAnnotation(EJB.class);
                    lookupMethodResource(context, instance, methods[i],
                            annotation.name(), clazz);
                }
                if (methods[i].isAnnotationPresent(WebServiceRef.class)) {
                    WebServiceRef annotation =
                        methods[i].getAnnotation(WebServiceRef.class);
                    lookupMethodResource(context, instance, methods[i],
                            annotation.name(), clazz);
                }
                if (methods[i].isAnnotationPresent(PersistenceContext.class)) {
                    PersistenceContext annotation =
                        methods[i].getAnnotation(PersistenceContext.class);
                    lookupMethodResource(context, instance, methods[i],
                            annotation.name(), clazz);
                }
                if (methods[i].isAnnotationPresent(PersistenceUnit.class)) {
                    PersistenceUnit annotation =
                        methods[i].getAnnotation(PersistenceUnit.class);
                    lookupMethodResource(context, instance, methods[i],
                            annotation.name(), clazz);
                }
            }
           
            clazz = clazz.getSuperclass();
        }
View Full Code Here

Examples of javax.xml.ws.WebServiceRef

                lookupFieldResource(context, instance, field, annotation.name());
            } else if (field.isAnnotationPresent(EJB.class)) {
                EJB annotation = field.getAnnotation(EJB.class);
                lookupFieldResource(context, instance, field, annotation.name());
            } else if (field.isAnnotationPresent(WebServiceRef.class)) {
                WebServiceRef annotation =
                        field.getAnnotation(WebServiceRef.class);
                lookupFieldResource(context, instance, field, annotation.name());
            } else if (field.isAnnotationPresent(PersistenceContext.class)) {
                PersistenceContext annotation =
                        field.getAnnotation(PersistenceContext.class);
                lookupFieldResource(context, instance, field, annotation.name());
            } else if (field.isAnnotationPresent(PersistenceUnit.class)) {
                PersistenceUnit annotation =
                        field.getAnnotation(PersistenceUnit.class);
                lookupFieldResource(context, instance, field, annotation.name());
            }
        }

        // Initialize methods annotations
        Method[] methods = instance.getClass().getDeclaredMethods();
        for (Method method : methods) {
            String methodName = method.getName();
            if (injections != null && methodName.startsWith("set") && methodName.length() > 3) {
                String fieldName = Character.toLowerCase(methodName.charAt(3)) + methodName.substring(4);
                if (injections.containsKey(fieldName)) {
                    lookupMethodResource(context, instance, method, injections.get(fieldName));
                    break;
                }
            }
            if (method.isAnnotationPresent(Resource.class)) {
                Resource annotation = method.getAnnotation(Resource.class);
                lookupMethodResource(context, instance, method, annotation.name());
            } else if (method.isAnnotationPresent(EJB.class)) {
                EJB annotation = method.getAnnotation(EJB.class);
                lookupMethodResource(context, instance, method, annotation.name());
            } else if (method.isAnnotationPresent(WebServiceRef.class)) {
                WebServiceRef annotation =
                        method.getAnnotation(WebServiceRef.class);
                lookupMethodResource(context, instance, method, annotation.name());
            } else if (method.isAnnotationPresent(PersistenceContext.class)) {
                PersistenceContext annotation =
                        method.getAnnotation(PersistenceContext.class);
                lookupMethodResource(context, instance, method, annotation.name());
            } else if (method.isAnnotationPresent(PersistenceUnit.class)) {
                PersistenceUnit annotation =
                        method.getAnnotation(PersistenceUnit.class);
                lookupMethodResource(context, instance, method, annotation.name());
            }
        }

    }
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.