FileDocCategorySizeDatePackage
ServiceRefPortInfo.javaAPI DocGlassfish v2 API14642Fri May 04 22:31:22 BST 2007com.sun.enterprise.deployment

ServiceRefPortInfo

public class ServiceRefPortInfo extends Descriptor
Information about a single WSDL port or port type in a service reference.
author
Kenneth Saks

Fields Summary
private String
serviceEndpointInterface
private boolean
containerManaged
private String
portComponentLinkName
private WebServiceEndpoint
portComponentLink
private ServiceReferenceDescriptor
serviceRef
private QName
wsdlPort
private Set
stubProperties
private Set
callProperties
private String
targetEndpointAddress
private com.sun.enterprise.deployment.runtime.common.MessageSecurityBindingDescriptor
messageSecBindingDesc
private String
mtomEnabled
Constructors Summary
public ServiceRefPortInfo(ServiceRefPortInfo other)

    
       
	super(other);
	serviceEndpointInterface = other.serviceEndpointInterface;
	containerManaged = other.containerManaged;
	portComponentLinkName = other.portComponentLinkName;
	portComponentLink = other.portComponentLink; // copy as-is
	serviceRef = other.serviceRef; // copy as-is
	wsdlPort = other.wsdlPort; // copy as-is
        mtomEnabled = other.mtomEnabled;

        stubProperties = new HashSet();
	for (Iterator i = other.stubProperties.iterator(); i.hasNext();) {
	    stubProperties.add(new NameValuePairDescriptor
                ((NameValuePairDescriptor)i.next()));
	}

        callProperties = new HashSet(); // NameValuePairDescriptor
	for (Iterator i = other.callProperties.iterator(); i.hasNext();) {
	    callProperties.add(new NameValuePairDescriptor(
		(NameValuePairDescriptor)i.next()));
	}

	targetEndpointAddress = other.targetEndpointAddress; 
    
public ServiceRefPortInfo()

        stubProperties = new HashSet();
        callProperties = new HashSet();
        containerManaged = false;
    
Methods Summary
public voidaddCallProperty(NameValuePairDescriptor property)
Add call property, using property name as a key. This will replace the property value of any existing stub property with the same name.

        NameValuePairDescriptor prop = 
            getCallPropertyByName(property.getName());
        if( prop != null ) {
            prop.setValue(property.getValue());
        } else {
            callProperties.add(property);
        }
    
public voidaddStubProperty(NameValuePairDescriptor property)
Add stub property, using property name as a key. This will replace the property value of any existing stub property with the same name.

        NameValuePairDescriptor prop = 
            getStubPropertyByName(property.getName());
        if( prop != null ) {
            prop.setValue(property.getValue());
        } else {
            stubProperties.add(property);
        }
    
public voidaddStubProperty(java.lang.String name, java.lang.String value)
Add stub property, using property name as a key. This will replace the property value of any existing stub property with the same name.

        NameValuePairDescriptor nvPair = new NameValuePairDescriptor();
        nvPair.setName(name);
        nvPair.setValue(value);
        addStubProperty(nvPair);
    
private BundleDescriptorgetBundleDescriptor()

        return serviceRef.getBundleDescriptor();
    
public java.util.SetgetCallProperties()

        return callProperties;
    
public NameValuePairDescriptorgetCallPropertyByName(java.lang.String name)

        NameValuePairDescriptor prop = null;
        for(Iterator iter = callProperties.iterator(); iter.hasNext();) {
            NameValuePairDescriptor next = (NameValuePairDescriptor) 
                iter.next();
            if( next.getName().equals(name) ) {
                prop = next;
                break;
            }
        }
        return prop;
    
public com.sun.enterprise.deployment.runtime.common.MessageSecurityBindingDescriptorgetMessageSecurityBinding()

        return messageSecBindingDesc;
    
public java.lang.StringgetMtomEnabled()

        return mtomEnabled;
    
public WebServiceEndpointgetPortComponentLink()

        return portComponentLink;
    
public java.lang.StringgetPortComponentLinkName()

        return portComponentLinkName;
    
public java.lang.StringgetServiceEndpointInterface()

        return serviceEndpointInterface;
    
public ServiceReferenceDescriptorgetServiceReference()

        return serviceRef;
    
public java.util.SetgetStubProperties()

        return stubProperties;
    
public NameValuePairDescriptorgetStubPropertyByName(java.lang.String name)

        NameValuePairDescriptor prop = null;
        for(Iterator iter = stubProperties.iterator(); iter.hasNext();) {
            NameValuePairDescriptor next = (NameValuePairDescriptor) 
                iter.next();
            if( next.getName().equals(name) ) {
                prop = next;
                break;
            }
        }
        return prop;
    
public java.lang.StringgetStubPropertyValue(java.lang.String name)

        String value = null;
        for(Iterator iter = stubProperties.iterator(); iter.hasNext();) {
            NameValuePairDescriptor next = (NameValuePairDescriptor)iter.next();
            if( next.getName().equals(name) ) {
                value = next.getValue();
                break;
            }
        }
        return value;
    
public java.lang.StringgetTargetEndpointAddress()

        return targetEndpointAddress;
    
public javax.xml.namespace.QNamegetWsdlPort()

        return wsdlPort;
    
public booleanhasCallProperty(java.lang.String name)

        return (getCallPropertyByName(name) != null);
    
public booleanhasPortComponentLinkName()

        return (portComponentLinkName != null);
    
public booleanhasServiceEndpointInterface()

        return (serviceEndpointInterface != null);
    
public booleanhasStubProperty(java.lang.String name)

        return (getStubPropertyValue(name) != null);
    
public booleanhasTargetEndpointAddress()

        return (targetEndpointAddress != null);
    
public booleanhasWsdlPort()

        return (wsdlPort != null);
    
public booleanisClientManaged()

        return !containerManaged;
    
public booleanisContainerManaged()

        return containerManaged;
    
public booleanisLinkedToPortComponent()

return
true only if there is a port component link AND it has been resolved to a valid port component within the application.

        return (portComponentLinkName != null ) && (portComponentLink != null);
    
public voidremoveCallProperty(NameValuePairDescriptor property)
Remove call property, using property name as a key. This will remove the property value of an existing stub property with the matching name.

        NameValuePairDescriptor prop = 
            getCallPropertyByName(property.getName());
        if( prop != null ) {
            callProperties.remove(property);
        } 
    
public voidremoveStubProperty(NameValuePairDescriptor property)
Remove stub property, using property name as a key. This will remove the property value of an existing stub property with the matching name.

        NameValuePairDescriptor prop = 
            getStubPropertyByName(property.getName());
        if (prop != null) {
            stubProperties.remove(property);
        }
    
public WebServiceEndpointresolveLinkName()
Try to resolve the current link name value to a WebServiceEndpoint object.

return
WebServiceEndpoint to which link was resolved, or null if link name resolution failed.


        WebServiceEndpoint port = null;
        String linkName = portComponentLinkName;

        if( (linkName != null) && (linkName.length() > 0) ) {
            int hashIndex = linkName.indexOf('#");
            boolean absoluteLink = (hashIndex != -1);

            BundleDescriptor bundleDescriptor = getBundleDescriptor();
            Application app = bundleDescriptor.getApplication();
            BundleDescriptor targetBundle = bundleDescriptor;
            String portName = linkName;
            
            if( (app != null) && absoluteLink ) {
                // Resolve <module>#<port-component-name> style link
                String relativeModuleUri = linkName.substring(0, hashIndex);
                portName = linkName.substring(hashIndex + 1);
                targetBundle = app.getRelativeBundle(bundleDescriptor,
                                                     relativeModuleUri);
            }

            // targetBundle will only be null here if module lookup for
            // absolute link failed.
            if( targetBundle != null ) {
                LinkedList bundles = new LinkedList();
                bundles.addFirst(targetBundle);
                if( (app != null) && !absoluteLink ) {
                    bundles.addAll(app.getBundleDescriptors());
                }
                for(Iterator iter = bundles.iterator(); iter.hasNext();) {
                    BundleDescriptor next = (BundleDescriptor) iter.next();
                    port = next.getWebServiceEndpointByName(portName);
                    if( port != null ) {
                        setPortComponentLink(port);
                        break;
                    }
                }
            }
        }

        return port;
    
public voidsetIsContainerManaged(boolean flag)

        containerManaged = flag;
    
public voidsetMessageSecurityBinding(com.sun.enterprise.deployment.runtime.common.MessageSecurityBindingDescriptor messageSecBindingDesc)

       this.messageSecBindingDesc = messageSecBindingDesc;
    
public voidsetMtomEnabled(java.lang.String value)

        mtomEnabled = value;
    
public voidsetPortComponentLink(WebServiceEndpoint newPort)

param
portComponenet the port component to which I refer

        if( newPort != null ) {

            // Keep port component link name in synch with port component
            // object.
            BundleDescriptor bundleDescriptor = getBundleDescriptor();
            BundleDescriptor targetBundleDescriptor = 
                newPort.getBundleDescriptor();
            String linkName = newPort.getEndpointName();
            if( bundleDescriptor != targetBundleDescriptor ) {
                Application app = bundleDescriptor.getApplication();
                String relativeUri = app.getRelativeUri(bundleDescriptor,
                                                        targetBundleDescriptor);
                linkName = relativeUri + "#" + linkName;
            }
            portComponentLinkName = linkName;
        }
        portComponentLink = newPort;
    
public voidsetPortComponentLinkName(java.lang.String linkName)
Sets the name of the port component to which I refer. NOTE : Does *NOT* attempt to resolve link name. Use overloaded version or resolveLink if link resolution is required.

        setPortComponentLinkName(linkName, false);
    
public WebServiceEndpointsetPortComponentLinkName(java.lang.String linkName, boolean resolve)

        portComponentLinkName = linkName;

        return resolve ? resolveLinkName() : null;
    
public voidsetServiceEndpointInterface(java.lang.String sei)

        serviceEndpointInterface = sei;
    
public voidsetServiceReference(ServiceReferenceDescriptor desc)

        serviceRef = desc;
    
public voidsetTargetEndpointAddress(java.lang.String address)

        targetEndpointAddress = address;
    
public voidsetWsdlPort(javax.xml.namespace.QName port)

        wsdlPort = port;