Package com.sun.enterprise.deployment

Examples of com.sun.enterprise.deployment.InjectionTarget


                ResourceReferenceDescriptor r = it.next();           
                if(r.isWebServiceContext()) {
                    Iterator<InjectionTarget> iter = r.getInjectionTargets().iterator();
                    boolean matchingClassFound = false;
                    while(iter.hasNext()) {
                        InjectionTarget target = iter.next();
                        if(endpoint.getServletImplClass().equals(target.getClassName())) {
                            matchingClassFound = true;
                            break;
                        }
                    }
                    if(!matchingClassFound) {
View Full Code Here


                            ResourceReferenceDescriptor r = it.next();           
                            if(r.isWebServiceContext()) {
                                Iterator<InjectionTarget> iter = r.getInjectionTargets().iterator();
                                boolean matchingClassFound = false;
                                while(iter.hasNext()) {
                                    InjectionTarget target = iter.next();
                                    if(ejbDesc.getEjbClassName().equals(target.getClassName())) {
                                        matchingClassFound = true;
                                        break;
                                    }
                                }
                                if(!matchingClassFound) {
View Full Code Here

                    f.getType() : resourceAn.type();

            DescriptorInfo descriptorInfo = getDescriptors
                (resourceType, logicalName, rcContexts);
                
            InjectionTarget target = new InjectionTarget();
            target.setFieldName(f.getName());
            target.setClassName(targetClassName);
           
            for (EnvironmentProperty desc : descriptorInfo.descriptors) {           
                desc.addInjectionTarget(target);
                   
                if (desc.getName().length() == 0) { // a new one
                    processNewAnnotation(desc, descriptorInfo.dependencyType,
                                         descriptorInfo.resourceType,
                                         logicalName, resourceAn);
                } else if (desc.getInjectResourceType() == null) {             
                    // if the optional resource type is not set,
                    // set it using the resource type of field/method
                    desc.setInjectResourceType(
                        descriptorInfo.resourceType.getName());
                }
            }
        } else if (ElementType.METHOD.equals(ainfo.getElementType())) {

            Method m = (Method)ainfo.getAnnotatedElement();
            String targetClassName = m.getDeclaringClass().getName();

            String logicalName = resourceAn.name();
            if( logicalName.equals("") ) {
                // Derive javabean property name.
                String propertyName =
                        getInjectionMethodPropertyName(m, ainfo);

                // prefixing with fully qualified type name
                logicalName = targetClassName + "/" + propertyName;
            }

            validateInjectionMethod(m, ainfo);

            Class[] params = m.getParameterTypes();
            // If specified, beanInterface() overrides parameter type
            // NOTE that default value is Object.class, not null
            Class resourceType = (resourceAn.type() == Object.class) ?
                    params[0] : resourceAn.type();


            DescriptorInfo descriptorInfo = getDescriptors
                (resourceType, logicalName, rcContexts);

            InjectionTarget target = new InjectionTarget();
            target.setMethodName(m.getName());
            target.setClassName(targetClassName);
           
            for (EnvironmentProperty desc : descriptorInfo.descriptors) {
                desc.addInjectionTarget(target);
                   
                if (desc.getName().length() == 0) { // a new one
View Full Code Here

                logicalName = targetClassName + "/" + f.getName();
            }

            emfRefs = getEmfReferenceDescriptors(logicalName, rcContexts);
           
            InjectionTarget target = new InjectionTarget();
            target.setFieldName(f.getName());
            target.setClassName(targetClassName);
            for (EntityManagerFactoryReferenceDescriptor emfRef : emfRefs) {
                emfRef.addInjectionTarget(target);

                if (emfRef.getName().length() == 0) { // a new one
                    processNewEmfRefAnnotation(emfRef, logicalName, emfRefAn);
                }
            }
        } else if (ElementType.METHOD.equals(ainfo.getElementType())) {

            Method m = (Method)ainfo.getAnnotatedElement();
            String targetClassName = m.getDeclaringClass().getName();

            String logicalName = emfRefAn.name();
            if( logicalName.equals("") ) {
                // Derive javabean property name.
                String propertyName =
                    getInjectionMethodPropertyName(m, ainfo);

                // prefixing with fully qualified type name
                logicalName = targetClassName + "/" + propertyName;
            }

            validateInjectionMethod(m, ainfo);

            emfRefs = getEmfReferenceDescriptors(logicalName, rcContexts);

            InjectionTarget target = new InjectionTarget();
            target.setMethodName(m.getName());
            target.setClassName(targetClassName);           
            for (EntityManagerFactoryReferenceDescriptor emfRef : emfRefs) {

                emfRef.addInjectionTarget(target);

                if (emfRef.getName().length() == 0) { // a new one
View Full Code Here

            // If specified, beanInterface() overrides field type
            // NOTE that defaultValue is Object.class, not null
            Class beanInterface = (ejbAn.beanInterface() == Object.class) ?
                    f.getType() : ejbAn.beanInterface();

            InjectionTarget target = new InjectionTarget();
            target.setClassName(targetClassName);
            target.setFieldName(f.getName());
           
            ejbRefs = getEjbReferenceDescriptors(logicalName, rcContexts);
            for (EjbReferenceDescriptor ejbRef : ejbRefs) {
                ejbRef.addInjectionTarget(target);

                if (ejbRef.getName().length() == 0) { // a new one
                    processNewEJBAnnotation(ejbRef, beanInterface,
                                            logicalName, ejbAn);
                }
            }
        } else if (ElementType.METHOD.equals(ainfo.getElementType())) {

            Method m = (Method)ainfo.getAnnotatedElement();
            String targetClassName = m.getDeclaringClass().getName();

            String logicalName = ejbAn.name();
            if( logicalName.equals("") ) {
                // Derive javabean property name.
                String propertyName =
                        getInjectionMethodPropertyName(m, ainfo);

                // prefixing with fully qualified type name
                logicalName = targetClassName + "/" + propertyName;
            }

            validateInjectionMethod(m, ainfo);

            Class[] params = m.getParameterTypes();
            // If specified, beanInterface() overrides parameter type
            // NOTE that default value is Object.class, not null
            Class beanInterface = (ejbAn.beanInterface() == Object.class) ?
                    params[0] : ejbAn.beanInterface();

            InjectionTarget target = new InjectionTarget();
            target.setClassName(targetClassName);
            target.setMethodName(m.getName());
           
            ejbRefs = getEjbReferenceDescriptors(logicalName, rcContexts);
            for (EjbReferenceDescriptor ejbRef : ejbRefs) {

                ejbRef.addInjectionTarget(target);
View Full Code Here

            }

            aRef.setInjectResourceType("javax.jws.WebServiceRef");
           
            if (!annInfo.getElementType().equals(ElementType.TYPE)) {
                InjectionTarget target = new InjectionTarget();
                if (annInfo.getElementType().equals(ElementType.FIELD)) {
                    // this is a field injection
                    Field annotatedField = (Field) annElem;
                    target.setFieldName(annotatedField.getName());
                    target.setClassName(annotatedField.getDeclaringClass().getName());
                } else {
                    if (annInfo.getElementType().equals(ElementType.METHOD)) {
                        // this is a method injection
                        Method annotatedMethod = (Method) annElem;
                        target.setMethodName(annotatedMethod.getName());
                        target.setClassName(annotatedMethod.getDeclaringClass().getName());
                    }
                }
                aRef.addInjectionTarget(target);
            }
           
View Full Code Here

                logicalName = targetClassName + "/" + f.getName();
            }

            emRefs = getEmReferenceDescriptors(logicalName, rcContexts);
           
            InjectionTarget target = new InjectionTarget();
            target.setFieldName(f.getName());
            target.setClassName(targetClassName);           
            for (EntityManagerReferenceDescriptor emRef : emRefs) {
               
                emRef.addInjectionTarget(target);
           
                if (emRef.getName().length() == 0) { // a new one
                    processNewEmRefAnnotation(emRef, logicalName, emRefAn);
                }
            }
        } else if (ElementType.METHOD.equals(ainfo.getElementType())) {

            Method m = (Method)ainfo.getAnnotatedElement();
            String targetClassName = m.getDeclaringClass().getName();

            String logicalName = emRefAn.name();
            if( logicalName.equals("") ) {
                // Derive javabean property name.
                String propertyName =
                    getInjectionMethodPropertyName(m, ainfo);

                // prefixing with fully qualified type name
                logicalName = targetClassName + "/" + propertyName;
            }

            validateInjectionMethod(m, ainfo);

            emRefs = getEmReferenceDescriptors(logicalName, rcContexts);
           
            InjectionTarget target = new InjectionTarget();
            target.setMethodName(m.getName());
            target.setClassName(targetClassName);                  
            for (EntityManagerReferenceDescriptor emRef : emRefs) {
               
                emRef.addInjectionTarget(target);

                if (emRef.getName().length() == 0) { // a new one
View Full Code Here

                ResourceReferenceDescriptor r = it.next();
                if(r.isWebServiceContext()) {
                    Iterator<InjectionTarget> iter = r.getInjectionTargets().iterator();
                    boolean matchingClassFound = false;
                    while(iter.hasNext()) {
                        InjectionTarget target = iter.next();
                        if(endpoint.getServletImplClass().equals(target.getClassName())) {
                            matchingClassFound = true;
                            break;
                        }
                    }
                    if(!matchingClassFound) {
View Full Code Here

                        // I assume the at all inejction target are expecting the SAME service
                        // interface, therefore I take the first one.
                        if (desc.isInjectable()) {

                            InjectionTarget target = desc.getInjectionTargets().iterator().next();
                            Class serviceType = null;
                            if (target.isFieldInjectable()) {
                                java.lang.reflect.Field f = target.getField();
                                if(f == null) {
                                    String fName = target.getFieldName();
                                    Class targetClass = cl.loadClass(target.getClassName());
                                    try {
                                        f = targetClass.getDeclaredField(fName);
                                    } catch(java.lang.NoSuchFieldException nsfe) {}// ignoring exception
                                }
                                if(f != null) {
                                    serviceType = f.getType();
                                }
                            }
                            if (target.isMethodInjectable()) {
                                Method m = target.getMethod();
                                if(m == null) {
                                    String mName = target.getMethodName();
                                    Class targetClass = cl.loadClass(target.getClassName());
                                    try {
                                        m = targetClass.getDeclaredMethod(mName);
                                    } catch(java.lang.NoSuchMethodException nsfe) {}// ignoring exception
                                }
                                if (m != null && m.getParameterTypes().length==1) {
View Full Code Here

                ResourceReferenceDescriptor r = it.next();
                if(r.isWebServiceContext()) {
                    Iterator<InjectionTarget> iter = r.getInjectionTargets().iterator();
                    boolean matchingClassFound = false;
                    while(iter.hasNext()) {
                        InjectionTarget target = iter.next();
                        if(endpoint.getServletImplClass().equals(target.getClassName())) {
                            matchingClassFound = true;
                            break;
                        }
                    }
                    if(!matchingClassFound) {
View Full Code Here

TOP

Related Classes of com.sun.enterprise.deployment.InjectionTarget

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.