Search in sources :

Example 1 with WSDolSupport

use of com.sun.enterprise.deployment.WSDolSupport in project Payara by payara.

the class ModuleContentLinker method accept.

public void accept(ServiceReferenceDescriptor serviceRef) {
    try {
        ModuleDescriptor moduleDesc = serviceRef.getBundleDescriptor().getModuleDescriptor();
        if (serviceRef.hasWsdlFile()) {
            String wsdlFileUri = serviceRef.getWsdlFileUri();
            File tmpFile = new File(wsdlFileUri);
            if (tmpFile.isAbsolute()) {
                // This takes care of the case when we set wsdlFileUri from generated @WebClient
                // and the uri is an absolute path
                serviceRef.setWsdlFileUrl(tmpFile.toURI().toURL());
            } else {
                // If the given WSDL is an http URL, create a URL directly from this
                if (wsdlFileUri.startsWith("http")) {
                    serviceRef.setWsdlFileUrl(new URL(wsdlFileUri));
                } else {
                    // Given WSDL location is a relative path - append this to the module dir
                    URL wsdlFileUrl = internalGetUrl(moduleDesc, wsdlFileUri);
                    serviceRef.setWsdlFileUrl(wsdlFileUrl);
                }
            }
        } else {
            // Incase wsdl file is missing we can obtain it from the @WebServiceClient annotation
            ClassLoader classloader = Thread.currentThread().getContextClassLoader();
            Class serviceInterfaceClass = classloader.loadClass(serviceRef.getServiceInterface());
            WSDolSupport dolSupport = Globals.getDefaultHabitat().getService(WSDolSupport.class);
            if (dolSupport != null) {
                dolSupport.setServiceRef(serviceInterfaceClass, serviceRef);
            }
        }
        if (serviceRef.hasMappingFile()) {
            String mappingFileUri = serviceRef.getMappingFileUri();
            File mappingFile = new File(getModuleLocation(moduleDesc), mappingFileUri);
            serviceRef.setMappingFile(mappingFile);
        }
    } catch (java.net.MalformedURLException mex) {
        DOLUtils.getDefaultLogger().log(Level.SEVERE, "enterprise.deployment.backend.invalidWsdlURL", new Object[] { serviceRef.getWsdlFileUri() });
    } catch (Exception e) {
        DOLUtils.getDefaultLogger().log(Level.SEVERE, DOLUtils.INVALID_DESC_MAPPING, new Object[] { serviceRef.getName(), rootLocation_ });
    }
}
Also used : ModuleDescriptor(org.glassfish.deployment.common.ModuleDescriptor) MalformedURLException(java.net.MalformedURLException) WSDolSupport(com.sun.enterprise.deployment.WSDolSupport) File(java.io.File) URL(java.net.URL) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException)

Aggregations

WSDolSupport (com.sun.enterprise.deployment.WSDolSupport)1 File (java.io.File)1 IOException (java.io.IOException)1 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1 ModuleDescriptor (org.glassfish.deployment.common.ModuleDescriptor)1