FileDocCategorySizeDatePackage
WebService.javaAPI DocGlassfish v2 API8166Fri May 04 22:31:24 BST 2007com.sun.enterprise.deployment

WebService

public class WebService extends Descriptor
Information about a single webservice-description in webservices.xml
author
Kenneth Saks
author
Jerome Dochez

Fields Summary
private String
wsdlFileUri
private URL
wsdlFileUrl
Derived, non-peristent location of wsdl file. Only used at deployment/runtime.
private String
mappingFileUri
private File
mappingFile
Derived, non-peristent location of mapping file. Only used at deployment/runtime.
private HashMap
endpoints
private WebServicesDescriptor
webServicesDesc
private URL
publishUrl
Constructors Summary
public WebService()
Default constructor.

        this("");
    
public WebService(WebService other)
copy constructor.

        super(other);
	wsdlFileUri = other.wsdlFileUri; // String
        wsdlFileUrl = other.wsdlFileUrl;
	mappingFileUri = other.mappingFileUri; // String
	mappingFile = other.mappingFile; 
        publishUrl = other.publishUrl;
	webServicesDesc = other.webServicesDesc; // copy as-is
	if (other.endpoints != null) {
	    endpoints = new HashMap<String, WebServiceEndpoint>();
	    for (WebServiceEndpoint wsep : other.endpoints.values()) {
        	wsep.setWebService(this);
        	endpoints.put(wsep.getEndpointName(), wsep);
	    }
	} else {
	    endpoints = null;
	}
    
public WebService(String name)

        setName(name);
        endpoints = new HashMap();
    
Methods Summary
public voidaddEndpoint(WebServiceEndpoint endpoint)

        endpoint.setWebService(this);
        endpoints.put(endpoint.getEndpointName(), endpoint);
        super.changed();
    
public BundleDescriptorgetBundleDescriptor()

        return webServicesDesc.getBundleDescriptor();
    
public java.net.URLgetClientPublishUrl()

        return publishUrl;
    
public java.util.CollectiongetEndpoints()

        HashMap shallowCopy = new HashMap(endpoints);
        return shallowCopy.values();
    
public java.lang.StringgetGeneratedWsdlFilePath()

        if (hasWsdlFile()) {
            String xmlDir = getBundleDescriptor().getApplication().getGeneratedXMLDirectory();
            if(!getBundleDescriptor().getModuleDescriptor().isStandalone()) {
                String uri = getBundleDescriptor().getModuleDescriptor().getArchiveUri();
                xmlDir = xmlDir + File.separator + uri.replaceAll("\\.", "_");
            }
            if(xmlDir == null) {
                return null;
            }
            return  xmlDir + File.separator + wsdlFileUri;
        } else {
            return getWsdlFileUrl().getPath();
        }
    
public java.io.FilegetMappingFile()

        return mappingFile;
    
public java.lang.StringgetMappingFileUri()

        return mappingFileUri;
    
public WebServicesDescriptorgetWebServicesDescriptor()

        return webServicesDesc;
    
public java.lang.StringgetWsdlFileUri()

        return wsdlFileUri;
    
public java.net.URLgetWsdlFileUrl()

        return wsdlFileUrl;
    
public booleanhasClientPublishUrl()

        return (publishUrl != null);
    
public booleanhasFilePublishing()

        return (hasClientPublishUrl() && 
                publishUrl.getProtocol().equals("file"));
    
public booleanhasMappingFile()

        return (mappingFileUri != null);
    
public booleanhasUrlPublishing()

        return (!hasFilePublishing());
    
public booleanhasWsdlFile()

        return (wsdlFileUri != null);
    
public WebServiceEndpointpickEndpointForRelativeImports()
Select one of this webservice's endpoints to use for converting relative imports.

        WebServiceEndpoint pick = null;

        // First secure endpoint takes precedence.  
        for(WebServiceEndpoint wse : endpoints.values()) {
            if( wse.isSecure() ) {
                pick = wse;
                break;
            } 
            pick = wse;
        }
        return pick;
    
public voidprint(java.lang.StringBuffer toStringBuffer)
Returns a formatted String of the attributes of this object.

	super.print(toStringBuffer);
        toStringBuffer.append( "\n wsdl file : ").append( wsdlFileUri);
        toStringBuffer.append( "\n mapping file ").append(mappingFileUri);
        toStringBuffer.append( "\n publish url ").append(publishUrl);
        toStringBuffer.append( "\n final wsdl ").append(wsdlFileUrl);
        toStringBuffer.append( "\n endpoints ").append(endpoints);        
    
public voidremoveEndpoint(WebServiceEndpoint endpoint)

        removeEndpointByName(endpoint.getEndpointName());
        super.changed();
    
public voidremoveEndpointByName(java.lang.String endpointName)

        WebServiceEndpoint endpoint = (WebServiceEndpoint)
            endpoints.remove(endpointName);
        endpoint.setWebService(null);
        super.changed();
    
public voidsetClientPublishUrl(java.net.URL url)

        publishUrl = url;
        super.changed();
    
public voidsetMappingFile(java.io.File file)

        mappingFile = file;
        super.changed();
    
public voidsetMappingFileUri(java.lang.String uri)

        mappingFileUri = uri;
        super.changed();
    
public voidsetWebServicesDescriptor(WebServicesDescriptor webServices)

        webServicesDesc = webServices;
    
public voidsetWsdlFileUri(java.lang.String uri)

        wsdlFileUri = uri;
        super.changed();
    
public voidsetWsdlFileUrl(java.net.URL url)

        wsdlFileUrl = url;
        super.changed();