Package com.sun.enterprise.deployment

Examples of com.sun.enterprise.deployment.ServiceReferenceDescriptor


                        "annotation not allowed on this element."),  annInfo);
           
        }
       
        ServiceReferenceContainer[] containers = null;
        ServiceReferenceDescriptor aRef =null;
        if (annCtx instanceof ServiceReferenceContainerContext) {
            containers = ((ServiceReferenceContainerContext) annCtx).getServiceRefContainers();
        }

        if (containers==null || containers.length==0) {
            annInfo.getProcessingContext().getErrorHandler().warning(
                    new AnnotationProcessorException(
                    localStrings.getLocalString(
                    "enterprise.deployment.annotation.handlers.invalidannotationforthisclass",
                    "Illegal annotation symbol for this class will be ignored"),
                    annInfo));
            return HandlerProcessingResultImpl.getDefaultResult(getAnnotationType(), ResultType.PROCESSED);
        }
       
        // now process the annotation for all the containers.
        for (ServiceReferenceContainer container : containers) {
            try {
                aRef =container.getServiceReferenceByName(serviceRefName);
            } catch(Throwable t) {}; // ignore
              
            if (aRef==null) {
                // time to create it...
                aRef = new ServiceReferenceDescriptor();
                aRef.setName(serviceRefName);
                container.addServiceReferenceDescriptor(aRef);
            }

            // Store mapped name that is specified
            if(aRef.getMappedName() == null) {
                if(annotation.mappedName() != null && annotation.mappedName().length() != 0) {
                    aRef.setMappedName(annotation.mappedName());
                }
            }

            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);
            }
           
            if (!Object.class.equals(annotation.value())) {
                // a value was provided, which should be the Service
                // interface, the requested injection is therefore on the
                // port.
                if (aRef.getServiceInterface()==null) {
                    aRef.setServiceInterface(annotation.value().getName());
                }
               
                if (aRef.getPortInfoBySEI(annotatedType.getName())==null) {
                    ServiceRefPortInfo portInfo = new ServiceRefPortInfo();
                    portInfo.setServiceEndpointInterface(annotatedType.getName());
                    aRef.addPortInfo(portInfo);
                }
                // set the port type requested for injection
                if (aRef.getInjectionTargetType()==null) {
                    aRef.setInjectionTargetType(annotatedType.getName());
                }
            }
           
            // watch the override order
            if(aRef.getName()==null || aRef.getName().length()==0) {
                aRef.setName(annotation.name());
            }
            if (aRef.getWsdlFileUri()==null) {
                if (annotation.wsdlLocation()==null || annotation.wsdlLocation().length()!=0) {
                    aRef.setWsdlFileUri(annotation.wsdlLocation());
                }
            }
           
            // Read the WebServiceClient annotation for the service name space uri and wsdl (if required)
            WebServiceClient wsclientAnn;
            if (Object.class.equals(annotation.value())) {
                wsclientAnn =  (WebServiceClient) annotatedType.getAnnotation(WebServiceClient.class);
            } else {
                wsclientAnn = (WebServiceClient) annotation.value().getAnnotation(WebServiceClient.class);
            }
            if (wsclientAnn==null) {
                throw new AnnotationProcessorException(
                        localStrings.getLocalString(
                        "enterprise.deployment.annotation.handlers.classnotannotated",
                        "Class must be annotated with a {1} annotation\n symbol : {1}\n location: {0}",
                        new Object[] { annotatedType.toString(), WebServiceClient.class.toString() }));
            }
           
            // If wsdl file was not specified in a descriptor and not in the annotation, get it from WebServiceClient
            // annotation
            if (aRef.getWsdlFileUri()==null) {
                aRef.setWsdlFileUri(wsclientAnn.wsdlLocation());
            }
           
            // Set service name space URI and service local part
            if(aRef.getServiceName() == null) {
                aRef.setServiceNamespaceUri(wsclientAnn.targetNamespace());
                aRef.setServiceLocalPart(wsclientAnn.name());
            }
           
            if (aRef.getServiceInterface()==null) {
                aRef.setServiceInterface(annotatedType.getName());
            }
        }
        // Now force a HandlerChain annotation processing
        // This is to take care of the case where the client class does not
        // have @HandlerChain but the SEI has one specified through JAXWS customization
View Full Code Here


    }

    /** This will only be called during JAX-RPC invocation */
    public void initializeMessageExchange(ServiceRefPortInfo portInfo, boolean oneWay)
    throws ServiceEngineException {
        ServiceReferenceDescriptor serviceRef = portInfo.getServiceReference();
        QName serviceName = serviceRef.getServiceName();
        String endpointName = portInfo.hasWsdlPort()?
                                        portInfo.getWsdlPort().getLocalPart() :
                                        portInfo.getName();
        URL wsdlFileUrl = serviceRef.getWsdlFileUrl();
        initializeMessageExchange(wsdlFileUrl, serviceName, endpointName, oneWay);
    }
View Full Code Here

      properties.get("SERVICE_ENDPOINT");

  if (e != null) {
      binding = e.getMessageSecurityBinding();
  } else {
      ServiceReferenceDescriptor s = (ServiceReferenceDescriptor)
    properties.get("SERVICE_REF");
      if (s != null) {
    WSDLPort p = (WSDLPort) properties.get("WSDL_MODEL");
    QName portName = null;
    if (p != null) {
        portName = p.getName();
    }
    if (portName != null) {
        ServiceRefPortInfo i = s.getPortInfoByPort(portName);
        if (i != null) {
      binding = i.getMessageSecurityBinding();
        }
    }
      }
View Full Code Here

            ServiceRefNode serviceNode = new ServiceRefNode();

            for (Iterator serviceItr = bundleDescriptor.getServiceReferenceDescriptors()
                                                       .iterator();
                    serviceItr.hasNext();) {
                ServiceReferenceDescriptor next = (ServiceReferenceDescriptor) serviceItr.next();
                serviceNode.writeDescriptor(web,
                    WebServicesTagNames.SERVICE_REF, next);
            }
        }
View Full Code Here

     * Check Ejb for spec. conformance
     *
     * @param descriptor WebServices descriptor
     */
    public void check(Descriptor descriptor) throws Exception {
        ServiceReferenceDescriptor rootDescriptor = (ServiceReferenceDescriptor) descriptor;
        ModuleType moduleType = rootDescriptor.getBundleDescriptor()
                .getModuleType();
        if (moduleType == ModuleType.EJB)
            moduleName = Result.EJB;
        else if (moduleType == ModuleType.WAR)
            moduleName = Result.WEB;
View Full Code Here

            rvalue = getServerName(wse) + " " + getEndpointURI(wse);

        // client reference
        } else {
           
            ServiceReferenceDescriptor srd = (ServiceReferenceDescriptor)
                map.get(PipeConstants.SERVICE_REF);

            rvalue = getClientModuleID(srd) + " " + getRefName(srd,map);

        }
View Full Code Here

                    }               
                }
               
                Set refs = md.getDescriptor().getServiceReferenceDescriptors();
                for (Iterator itr = refs.iterator();itr.hasNext();) {
                    ServiceReferenceDescriptor srd = (ServiceReferenceDescriptor) itr.next();
                    subEntries.add(srd.getMappingFileUri());
                }
               
                // first copy original module files in the root on the target
                // except for .rar files contents.
                // We need to do it first so we save the list of files to be saved in the
View Full Code Here

            JaxrpcMappingDeploymentDescriptorFile jaxrpcDD =
                new JaxrpcMappingDeploymentDescriptorFile();
           
            // useful for validation errors...
            if (desc instanceof ServiceReferenceDescriptor) {
                ServiceReferenceDescriptor srd = (ServiceReferenceDescriptor) desc;
                jaxrpcDD.setDeploymentDescriptorPath(srd.getMappingFileUri());
                jaxrpcDD.setErrorReportingString(srd.getBundleDescriptor().getModuleDescriptor().getArchiveUri());
            }
            if (desc instanceof WebService) {
                WebService ws = (WebService) desc;
                jaxrpcDD.setDeploymentDescriptorPath(ws.getMappingFileUri());
                jaxrpcDD.setErrorReportingString(ws.getBundleDescriptor().getModuleDescriptor().getArchiveUri());
View Full Code Here

                        jndiContainer = endpoint.getBundleDescriptor();                
                    } else {
                        jndiContainer = (Descriptor) endpoint.getEjbComponentImpl();
                    }
                } else {
                    ServiceReferenceDescriptor ref = (ServiceReferenceDescriptor) container;
                    if(DOLUtils.ejbType().equals(ref.getBundleDescriptor().getModuleType())) {
                        EjbBundleDescriptor ejbBundle = (EjbBundleDescriptor) ref.getBundleDescriptor();
                        Iterator<? extends EjbDescriptor> ejbsIter = ejbBundle.getEjbs().iterator();
                        while(ejbsIter.hasNext()) {
                            EjbDescriptor ejb = ejbsIter.next();
                            try {
                                if(ejb.getServiceReferenceByName(ref.getName()) != null) {
                                    // found the ejb; break out of the loop
                                    jndiContainer = (Descriptor) ejb;
                                    break;
                                }
                            } catch (IllegalArgumentException illex) {
                                // this ejb does not have a service-ref by this name;
                                // swallow this exception and  go to next
                            }
                        }
                    } else {
                        jndiContainer = ref.getBundleDescriptor();
                    }
                }
                ResourceContainerContextImpl newContext = new ResourceContainerContextImpl(jndiContainer);
                ProcessingContext ctx = annInfo.getProcessingContext();
               
View Full Code Here

     * Check Ejb for spec. conformance
     *
     * @param descriptor WebServices descriptor
     */
    public void check(Descriptor descriptor) throws Exception {
        ServiceReferenceDescriptor rootDescriptor = (ServiceReferenceDescriptor) descriptor;
        ArchiveType moduleType = rootDescriptor.getBundleDescriptor()
                .getModuleType();
        if (moduleType != null && moduleType.equals(DOLUtils.ejbType()))
            moduleName = Result.EJB;
        else if (moduleType != null && moduleType.equals(DOLUtils.warType()))
            moduleName = Result.WEB;
View Full Code Here

TOP

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

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.