All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sun.xml.ws.client.PortInfo Maven / Gradle / Ivy

There is a newer version: 4.0.2
Show newest version
/*
 * The contents of this file are subject to the terms
 * of the Common Development and Distribution License
 * (the License).  You may not use this file except in
 * compliance with the License.
 * 
 * You can obtain a copy of the license at
 * https://glassfish.dev.java.net/public/CDDLv1.0.html.
 * See the License for the specific language governing
 * permissions and limitations under the License.
 * 
 * When distributing Covered Code, include this CDDL
 * Header Notice in each file and include the License file
 * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
 * If applicable, add the following below the CDDL Header,
 * with the fields enclosed by brackets [] replaced by
 * you own identifying information:
 * "Portions Copyrighted [year] [name of copyright owner]"
 * 
 * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
 */
package com.sun.xml.ws.client;

import com.sun.istack.NotNull;
import com.sun.istack.Nullable;
import com.sun.xml.ws.api.BindingID;
import com.sun.xml.ws.api.EndpointAddress;
import com.sun.xml.ws.api.WSService;
import com.sun.xml.ws.api.client.WSPortInfo;
import com.sun.xml.ws.api.model.wsdl.WSDLPort;
import com.sun.xml.ws.binding.BindingImpl;
import com.sun.xml.ws.binding.WebServiceFeatureList;
import com.sun.xml.ws.model.wsdl.WSDLPortImpl;

import javax.xml.namespace.QName;
import javax.xml.ws.WebServiceFeature;
import javax.xml.ws.WebServiceException;

/**
 * Information about a port.
 * 

* This object is owned by {@link WSServiceDelegate} to keep track of a port, * since a port maybe added dynamically. * * @author JAXWS Development Team */ public class PortInfo implements WSPortInfo { private final @NotNull WSServiceDelegate owner; public final @NotNull QName portName; public final @NotNull EndpointAddress targetEndpoint; public final @NotNull BindingID bindingId; /** * If a port is known statically to a WSDL, {@link PortInfo} may * have the corresponding WSDL model. This would occur when the * service was created with the WSDL location and the port is defined * in the WSDL. *

* If this is a {@link SEIPortInfo}, then this is always non-null. */ public final @Nullable WSDLPort portModel; public PortInfo(WSServiceDelegate owner, EndpointAddress targetEndpoint, QName name, BindingID bindingId) { this.owner = owner; this.targetEndpoint = targetEndpoint; this.portName = name; this.bindingId = bindingId; this.portModel = getPortModel(owner, name); } public PortInfo(@NotNull WSServiceDelegate owner, @NotNull WSDLPort port) { this.owner = owner; this.targetEndpoint = port.getAddress(); this.portName = port.getName(); this.bindingId = port.getBinding().getBindingId(); this.portModel = port; } /** * Creates {@link BindingImpl} for this {@link PortInfo}. * * @param webServiceFeatures * User-specified features. * @param portInterface * Null if this is for dispatch. Otherwise the interface the proxy is going to implement */ public BindingImpl createBinding(WebServiceFeature[] webServiceFeatures, Class portInterface) { WebServiceFeatureList r = new WebServiceFeatureList(webServiceFeatures); if (portModel != null) // merge features from WSDL r.mergeFeatures(portModel, portInterface==null/*if dispatch, true*/, false); // merge features from interceptor for( WebServiceFeature wsf : owner.serviceInterceptor.preCreateBinding(this,portInterface,r) ) r.add(wsf); BindingImpl bindingImpl = BindingImpl.create(bindingId, r.toArray()); owner.getHandlerConfigurator().configureHandlers(this,bindingImpl); return bindingImpl; } //This method is used for Dispatch client only private WSDLPort getPortModel(WSServiceDelegate owner, QName portName) { if (owner.getWsdlService() != null){ Iterable ports = owner.getWsdlService().getPorts(); for (WSDLPortImpl port : ports){ if (port.getName().equals(portName)) return port; } } return null; } // // implementation of API PortInfo interface // @Nullable public WSDLPort getPort() { return portModel; } @NotNull public WSService getOwner() { return owner; } @NotNull public BindingID getBindingId() { return bindingId; } @NotNull public EndpointAddress getEndpointAddress() { return targetEndpoint; } /** * @deprecated * Only meant to be used via {@link javax.xml.ws.handler.PortInfo}. * Use {@link WSServiceDelegate#getServiceName()}. */ public QName getServiceName() { return owner.getServiceName(); } /** * @deprecated * Only meant to be used via {@link javax.xml.ws.handler.PortInfo}. * Use {@link #portName}. */ public QName getPortName() { return portName; } /** * @deprecated * Only meant to be used via {@link javax.xml.ws.handler.PortInfo}. * Use {@link #bindingId}. */ public String getBindingID() { return bindingId.toString(); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy