feat(jdk8): move files to new folder to avoid resources compiled.

This commit is contained in:
2025-09-07 15:25:52 +08:00
parent 3f0047bf6f
commit 8c35cfb1c0
17415 changed files with 217 additions and 213 deletions

View File

@@ -0,0 +1,140 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.ws.model.wsdl;
import com.sun.xml.internal.ws.api.model.wsdl.WSDLExtensible;
import com.sun.xml.internal.ws.api.model.wsdl.WSDLExtension;
import com.sun.xml.internal.ws.api.model.wsdl.WSDLObject;
import com.sun.xml.internal.ws.resources.UtilMessages;
import com.sun.istack.internal.NotNull;
import javax.xml.stream.XMLStreamReader;
import javax.xml.namespace.QName;
import javax.xml.ws.WebServiceException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.xml.sax.Locator;
/**
* All the WSDL 1.1 elements that are extensible should subclass from this abstract implementation of
* {@link WSDLExtensible} interface.
*
* @author Vivek Pandey
* @author Kohsuke Kawaguchi
*/
abstract class AbstractExtensibleImpl extends AbstractObjectImpl implements WSDLExtensible {
protected final Set<WSDLExtension> extensions = new HashSet<WSDLExtension>();
// this captures any wsdl extensions that are not understood by WSDLExtensionParsers
// and have wsdl:required=true
protected List<UnknownWSDLExtension> notUnderstoodExtensions =
new ArrayList<UnknownWSDLExtension>();
protected AbstractExtensibleImpl(XMLStreamReader xsr) {
super(xsr);
}
protected AbstractExtensibleImpl(String systemId, int lineNumber) {
super(systemId, lineNumber);
}
public final Iterable<WSDLExtension> getExtensions() {
return extensions;
}
public final <T extends WSDLExtension> Iterable<T> getExtensions(Class<T> type) {
// TODO: this is a rather stupid implementation
List<T> r = new ArrayList<T>(extensions.size());
for (WSDLExtension e : extensions) {
if(type.isInstance(e))
r.add(type.cast(e));
}
return r;
}
public <T extends WSDLExtension> T getExtension(Class<T> type) {
for (WSDLExtension e : extensions) {
if(type.isInstance(e))
return type.cast(e);
}
return null;
}
public void addExtension(WSDLExtension ex) {
if(ex==null)
// I don't trust plugins. So let's always check it, instead of making this an assertion
throw new IllegalArgumentException();
extensions.add(ex);
}
public List<? extends UnknownWSDLExtension> getNotUnderstoodExtensions() {
return notUnderstoodExtensions;
}
/**
* This can be used if a WSDL extension element that has wsdl:required=true
* is not understood
* @param extnEl
* @param locator
*/
public void addNotUnderstoodExtension(QName extnEl, Locator locator) {
notUnderstoodExtensions.add(new UnknownWSDLExtension(extnEl, locator));
}
protected static class UnknownWSDLExtension implements WSDLExtension, WSDLObject {
private final QName extnEl;
private final Locator locator;
public UnknownWSDLExtension(QName extnEl, Locator locator) {
this.extnEl = extnEl;
this.locator = locator;
}
public QName getName() {
return extnEl;
}
@NotNull public Locator getLocation() {
return locator;
}
public String toString(){
return extnEl + " "+ UtilMessages.UTIL_LOCATION( locator.getLineNumber(), locator.getSystemId());
}
}
/**
* This method should be called after freezing the WSDLModel
* @return true if all wsdl required extensions on Port and Binding are understood
*/
public boolean areRequiredExtensionsUnderstood() {
if (notUnderstoodExtensions.size() != 0) {
StringBuilder buf = new StringBuilder("Unknown WSDL extensibility elements:");
for (UnknownWSDLExtension extn : notUnderstoodExtensions)
buf.append('\n').append(extn.toString());
throw new WebServiceException(buf.toString());
}
return true;
}
}

View File

@@ -0,0 +1,78 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.ws.model.wsdl;import com.sun.istack.internal.NotNull;
import com.sun.istack.internal.Nullable;
import com.sun.xml.internal.ws.api.model.wsdl.WSDLFeaturedObject;
import com.sun.xml.internal.ws.binding.WebServiceFeatureList;
import javax.xml.stream.XMLStreamReader;
import javax.xml.ws.WebServiceFeature;
/**
* @author Kohsuke Kawaguchi
*/
abstract class AbstractFeaturedObjectImpl extends AbstractExtensibleImpl implements WSDLFeaturedObject {
protected WebServiceFeatureList features;
protected AbstractFeaturedObjectImpl(XMLStreamReader xsr) {
super(xsr);
}
protected AbstractFeaturedObjectImpl(String systemId, int lineNumber) {
super(systemId, lineNumber);
}
public final void addFeature(WebServiceFeature feature) {
if (features == null)
features = new WebServiceFeatureList();
features.add(feature);
}
public @NotNull WebServiceFeatureList getFeatures() {
if(features == null)
return new WebServiceFeatureList();
return features;
}
public final WebServiceFeature getFeature(String id) {
if (features != null) {
for (WebServiceFeature f : features) {
if (f.getID().equals(id))
return f;
}
}
return null;
}
@Nullable
public <F extends WebServiceFeature> F getFeature(@NotNull Class<F> featureType) {
if(features==null)
return null;
else
return features.get(featureType);
}
}

View File

@@ -0,0 +1,62 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.ws.model.wsdl;
import com.sun.istack.internal.NotNull;
import com.sun.xml.internal.ws.api.model.wsdl.WSDLObject;
import org.xml.sax.Locator;
import org.xml.sax.helpers.LocatorImpl;
import javax.xml.stream.Location;
import javax.xml.stream.XMLStreamReader;
/**
* @author Kohsuke Kawaguchi
*/
abstract class AbstractObjectImpl implements WSDLObject {
// source location information
private final int lineNumber;
private final String systemId;
/*package*/ AbstractObjectImpl(XMLStreamReader xsr) {
Location loc = xsr.getLocation();
this.lineNumber = loc.getLineNumber();
this.systemId = loc.getSystemId();
}
/*package*/ AbstractObjectImpl(String systemId, int lineNumber) {
this.systemId = systemId;
this.lineNumber = lineNumber;
}
public final @NotNull Locator getLocation() {
LocatorImpl loc = new LocatorImpl();
loc.setSystemId(systemId);
loc.setLineNumber(lineNumber);
return loc;
}
}

View File

@@ -0,0 +1,85 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.ws.model.wsdl;
import com.sun.istack.internal.NotNull;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLBoundFault;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLBoundOperation;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLFault;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLOperation;
import javax.xml.stream.XMLStreamReader;
import javax.xml.namespace.QName;
/**
* @author Vivek Pandey
*/
public class WSDLBoundFaultImpl extends AbstractExtensibleImpl implements EditableWSDLBoundFault {
private final String name;
private EditableWSDLFault fault;
private EditableWSDLBoundOperation owner;
public WSDLBoundFaultImpl(XMLStreamReader xsr, String name, EditableWSDLBoundOperation owner) {
super(xsr);
this.name = name;
this.owner = owner;
}
public
@NotNull
String getName() {
return name;
}
public QName getQName() {
if(owner.getOperation() != null){
return new QName(owner.getOperation().getName().getNamespaceURI(), name);
}
return null;
}
public EditableWSDLFault getFault() {
return fault;
}
@NotNull
public EditableWSDLBoundOperation getBoundOperation() {
return owner;
}
public void freeze(EditableWSDLBoundOperation root) {
assert root != null;
EditableWSDLOperation op = root.getOperation();
if (op != null) {
for (EditableWSDLFault f : op.getFaults()) {
if (f.getName().equals(name)) {
this.fault = f;
break;
}
}
}
}
}

View File

@@ -0,0 +1,430 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.ws.model.wsdl;
import com.sun.istack.internal.Nullable;
import com.sun.istack.internal.NotNull;
import com.sun.xml.internal.ws.api.model.ParameterBinding;
import com.sun.xml.internal.ws.api.model.wsdl.*;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLBoundFault;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLBoundOperation;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLBoundPortType;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLMessage;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLModel;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLOperation;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLPart;
import com.sun.xml.internal.ws.model.RuntimeModeler;
import javax.jws.WebParam.Mode;
import javax.jws.soap.SOAPBinding.Style;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamReader;
import java.util.*;
/**
* Implementation of {@link WSDLBoundOperation}
*
* @author Vivek Pandey
*/
public final class WSDLBoundOperationImpl extends AbstractExtensibleImpl implements EditableWSDLBoundOperation {
private final QName name;
// map of wsdl:part to the binding
private final Map<String, ParameterBinding> inputParts;
private final Map<String, ParameterBinding> outputParts;
private final Map<String, ParameterBinding> faultParts;
private final Map<String, String> inputMimeTypes;
private final Map<String, String> outputMimeTypes;
private final Map<String, String> faultMimeTypes;
private boolean explicitInputSOAPBodyParts = false;
private boolean explicitOutputSOAPBodyParts = false;
private boolean explicitFaultSOAPBodyParts = false;
private Boolean emptyInputBody;
private Boolean emptyOutputBody;
private Boolean emptyFaultBody;
private final Map<String, EditableWSDLPart> inParts;
private final Map<String, EditableWSDLPart> outParts;
private final List<EditableWSDLBoundFault> wsdlBoundFaults;
private EditableWSDLOperation operation;
private String soapAction;
private ANONYMOUS anonymous;
private final EditableWSDLBoundPortType owner;
/**
*
* @param name wsdl:operation name qualified value
*/
public WSDLBoundOperationImpl(XMLStreamReader xsr, EditableWSDLBoundPortType owner, QName name) {
super(xsr);
this.name = name;
inputParts = new HashMap<String, ParameterBinding>();
outputParts = new HashMap<String, ParameterBinding>();
faultParts = new HashMap<String, ParameterBinding>();
inputMimeTypes = new HashMap<String, String>();
outputMimeTypes = new HashMap<String, String>();
faultMimeTypes = new HashMap<String, String>();
inParts = new HashMap<String, EditableWSDLPart>();
outParts = new HashMap<String, EditableWSDLPart>();
wsdlBoundFaults = new ArrayList<EditableWSDLBoundFault>();
this.owner = owner;
}
@Override
public QName getName(){
return name;
}
@Override
public String getSOAPAction() {
return soapAction;
}
public void setSoapAction(String soapAction) {
this.soapAction = soapAction!=null?soapAction:"";
}
@Override
public EditableWSDLPart getPart(String partName, Mode mode) {
if(mode==Mode.IN){
return inParts.get(partName);
}else if(mode==Mode.OUT){
return outParts.get(partName);
}
return null;
}
public void addPart(EditableWSDLPart part, Mode mode){
if(mode==Mode.IN)
inParts.put(part.getName(), part);
else if(mode==Mode.OUT)
outParts.put(part.getName(), part);
}
/**
* Map of wsdl:input part name and the binding as {@link ParameterBinding}
*
* @return empty Map if there is no parts
*/
public Map<String, ParameterBinding> getInputParts() {
return inputParts;
}
/**
* Map of wsdl:output part name and the binding as {@link ParameterBinding}
*
* @return empty Map if there is no parts
*/
public Map<String, ParameterBinding> getOutputParts() {
return outputParts;
}
/**
* Map of wsdl:fault part name and the binding as {@link ParameterBinding}
*
* @return empty Map if there is no parts
*/
public Map<String, ParameterBinding> getFaultParts() {
return faultParts;
}
// TODO: what's the difference between this and inputParts/outputParts?
@Override
public Map<String, ? extends EditableWSDLPart> getInParts() {
return Collections.<String, EditableWSDLPart>unmodifiableMap(inParts);
}
@Override
public Map<String, ? extends EditableWSDLPart> getOutParts() {
return Collections.<String, EditableWSDLPart>unmodifiableMap(outParts);
}
@NotNull
@Override
public List<? extends EditableWSDLBoundFault> getFaults() {
return wsdlBoundFaults;
}
public void addFault(@NotNull EditableWSDLBoundFault fault){
wsdlBoundFaults.add(fault);
}
/**
* Gets {@link ParameterBinding} for a given wsdl part in wsdl:input
*
* @param part Name of wsdl:part, must be non-null
* @return null if the part is not found.
*/
public ParameterBinding getInputBinding(String part){
if(emptyInputBody == null){
if(inputParts.get(" ") != null)
emptyInputBody = true;
else
emptyInputBody = false;
}
ParameterBinding block = inputParts.get(part);
if(block == null){
if(explicitInputSOAPBodyParts || emptyInputBody)
return ParameterBinding.UNBOUND;
return ParameterBinding.BODY;
}
return block;
}
/**
* Gets {@link ParameterBinding} for a given wsdl part in wsdl:output
*
* @param part Name of wsdl:part, must be non-null
* @return null if the part is not found.
*/
public ParameterBinding getOutputBinding(String part){
if(emptyOutputBody == null){
if(outputParts.get(" ") != null)
emptyOutputBody = true;
else
emptyOutputBody = false;
}
ParameterBinding block = outputParts.get(part);
if(block == null){
if(explicitOutputSOAPBodyParts || emptyOutputBody)
return ParameterBinding.UNBOUND;
return ParameterBinding.BODY;
}
return block;
}
/**
* Gets {@link ParameterBinding} for a given wsdl part in wsdl:fault
*
* @param part Name of wsdl:part, must be non-null
* @return null if the part is not found.
*/
public ParameterBinding getFaultBinding(String part){
if(emptyFaultBody == null){
if(faultParts.get(" ") != null)
emptyFaultBody = true;
else
emptyFaultBody = false;
}
ParameterBinding block = faultParts.get(part);
if(block == null){
if(explicitFaultSOAPBodyParts || emptyFaultBody)
return ParameterBinding.UNBOUND;
return ParameterBinding.BODY;
}
return block;
}
/**
* Gets the MIME type for a given wsdl part in wsdl:input
*
* @param part Name of wsdl:part, must be non-null
* @return null if the part is not found.
*/
public String getMimeTypeForInputPart(String part){
return inputMimeTypes.get(part);
}
/**
* Gets the MIME type for a given wsdl part in wsdl:output
*
* @param part Name of wsdl:part, must be non-null
* @return null if the part is not found.
*/
public String getMimeTypeForOutputPart(String part){
return outputMimeTypes.get(part);
}
/**
* Gets the MIME type for a given wsdl part in wsdl:fault
*
* @param part Name of wsdl:part, must be non-null
* @return null if the part is not found.
*/
public String getMimeTypeForFaultPart(String part){
return faultMimeTypes.get(part);
}
@Override
public EditableWSDLOperation getOperation() {
return operation;
}
@Override
public EditableWSDLBoundPortType getBoundPortType() {
return owner;
}
public void setInputExplicitBodyParts(boolean b) {
explicitInputSOAPBodyParts = b;
}
public void setOutputExplicitBodyParts(boolean b) {
explicitOutputSOAPBodyParts = b;
}
public void setFaultExplicitBodyParts(boolean b) {
explicitFaultSOAPBodyParts = b;
}
private Style style = Style.DOCUMENT;
public void setStyle(Style style){
this.style = style;
}
@Override
public @Nullable QName getRequestPayloadName() {
if (emptyRequestPayload)
return null;
if (requestPayloadName != null)
return requestPayloadName;
if(style.equals(Style.RPC)){
String ns = getRequestNamespace() != null ? getRequestNamespace() : name.getNamespaceURI();
requestPayloadName = new QName(ns, name.getLocalPart());
return requestPayloadName;
}else{
QName inMsgName = operation.getInput().getMessage().getName();
EditableWSDLMessage message = messages.get(inMsgName);
for(EditableWSDLPart part:message.parts()){
ParameterBinding binding = getInputBinding(part.getName());
if(binding.isBody()){
requestPayloadName = part.getDescriptor().name();
return requestPayloadName;
}
}
//Its empty payload
emptyRequestPayload = true;
}
//empty body
return null;
}
@Override
public @Nullable QName getResponsePayloadName() {
if (emptyResponsePayload)
return null;
if (responsePayloadName != null)
return responsePayloadName;
if(style.equals(Style.RPC)){
String ns = getResponseNamespace() != null ? getResponseNamespace() : name.getNamespaceURI();
responsePayloadName = new QName(ns, name.getLocalPart()+"Response");
return responsePayloadName;
}else{
QName outMsgName = operation.getOutput().getMessage().getName();
EditableWSDLMessage message = messages.get(outMsgName);
for(EditableWSDLPart part:message.parts()){
ParameterBinding binding = getOutputBinding(part.getName());
if(binding.isBody()){
responsePayloadName = part.getDescriptor().name();
return responsePayloadName;
}
}
//Its empty payload
emptyResponsePayload = true;
}
//empty body
return null;
}
private String reqNamespace;
private String respNamespace;
/**
* For rpclit gives namespace value on soapbinding:body@namespace
*
* @return non-null for rpclit and null for doclit
* @see RuntimeModeler#processRpcMethod(JavaMethodImpl, String, String, Method)
*/
@Override
public String getRequestNamespace(){
return (reqNamespace != null)?reqNamespace:name.getNamespaceURI();
}
public void setRequestNamespace(String ns){
reqNamespace = ns;
}
/**
* For rpclit gives namespace value on soapbinding:body@namespace
*
* @return non-null for rpclit and null for doclit
* @see RuntimeModeler#processRpcMethod(JavaMethodImpl, String, String, Method)
*/
@Override
public String getResponseNamespace(){
return (respNamespace!=null)?respNamespace:name.getNamespaceURI();
}
public void setResponseNamespace(String ns){
respNamespace = ns;
}
EditableWSDLBoundPortType getOwner(){
return owner;
}
private QName requestPayloadName;
private QName responsePayloadName;
private boolean emptyRequestPayload;
private boolean emptyResponsePayload;
private Map<QName, ? extends EditableWSDLMessage> messages;
public void freeze(EditableWSDLModel parent) {
messages = parent.getMessages();
operation = owner.getPortType().get(name.getLocalPart());
for(EditableWSDLBoundFault bf : wsdlBoundFaults){
bf.freeze(this);
}
}
public void setAnonymous(ANONYMOUS anonymous) {
this.anonymous = anonymous;
}
/**
* @inheritDoc
*/
@Override
public ANONYMOUS getAnonymous() {
return anonymous;
}
}

View File

@@ -0,0 +1,212 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.ws.model.wsdl;
import com.sun.istack.internal.NotNull;
import com.sun.xml.internal.ws.api.BindingID;
import com.sun.xml.internal.ws.api.SOAPVersion;
import com.sun.xml.internal.ws.api.model.ParameterBinding;
import com.sun.xml.internal.ws.api.model.wsdl.WSDLBoundOperation;
import com.sun.xml.internal.ws.api.model.wsdl.WSDLBoundPortType;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLBoundOperation;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLBoundPortType;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLModel;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLPortType;
import com.sun.xml.internal.ws.resources.ClientMessages;
import com.sun.xml.internal.ws.util.QNameMap;
import com.sun.xml.internal.ws.util.exception.LocatableWebServiceException;
import javax.jws.WebParam.Mode;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamReader;
import javax.xml.ws.soap.MTOMFeature;
/**
* Implementation of {@link WSDLBoundPortType}
*
* @author Vivek Pandey
*/
public final class WSDLBoundPortTypeImpl extends AbstractFeaturedObjectImpl implements EditableWSDLBoundPortType {
private final QName name;
private final QName portTypeName;
private EditableWSDLPortType portType;
private BindingID bindingId;
private final @NotNull EditableWSDLModel owner;
private final QNameMap<EditableWSDLBoundOperation> bindingOperations = new QNameMap<EditableWSDLBoundOperation>();
/**
* Operations keyed by the payload tag name.
*/
private QNameMap<EditableWSDLBoundOperation> payloadMap;
/**
* {@link #payloadMap} doesn't allow null key, so we store the value for it here.
*/
private EditableWSDLBoundOperation emptyPayloadOperation;
public WSDLBoundPortTypeImpl(XMLStreamReader xsr,@NotNull EditableWSDLModel owner, QName name, QName portTypeName) {
super(xsr);
this.owner = owner;
this.name = name;
this.portTypeName = portTypeName;
owner.addBinding(this);
}
public QName getName() {
return name;
}
public @NotNull EditableWSDLModel getOwner() {
return owner;
}
public EditableWSDLBoundOperation get(QName operationName) {
return bindingOperations.get(operationName);
}
/**
* Populates the Map that holds operation name as key and {@link WSDLBoundOperation} as the value.
*
* @param opName Must be non-null
* @param ptOp Must be non-null
* @throws NullPointerException if either opName or ptOp is null
*/
public void put(QName opName, EditableWSDLBoundOperation ptOp) {
bindingOperations.put(opName,ptOp);
}
public QName getPortTypeName() {
return portTypeName;
}
public EditableWSDLPortType getPortType() {
return portType;
}
public Iterable<EditableWSDLBoundOperation> getBindingOperations() {
return bindingOperations.values();
}
public BindingID getBindingId() {
//Should the default be SOAP1.1/HTTP binding? For now lets keep it for
//JBI bug 6509800
return (bindingId==null)?BindingID.SOAP11_HTTP:bindingId;
}
public void setBindingId(BindingID bindingId) {
this.bindingId = bindingId;
}
/**
* sets whether the {@link WSDLBoundPortType} is rpc or lit
*/
private Style style = Style.DOCUMENT;
public void setStyle(Style style){
this.style = style;
}
public SOAPBinding.Style getStyle() {
return style;
}
public boolean isRpcLit(){
return Style.RPC==style;
}
public boolean isDoclit(){
return Style.DOCUMENT==style;
}
/**
* Gets the {@link ParameterBinding} for a given operation, part name and the direction - IN/OUT
*
* @param operation wsdl:operation@name value. Must be non-null.
* @param part wsdl:part@name such as value of soap:header@part. Must be non-null.
* @param mode {@link Mode#IN} or {@link Mode#OUT}. Must be non-null.
* @return null if the binding could not be resolved for the part.
*/
public ParameterBinding getBinding(QName operation, String part, Mode mode) {
EditableWSDLBoundOperation op = get(operation);
if (op == null) {
//TODO throw exception
return null;
}
if ((Mode.IN == mode) || (Mode.INOUT == mode))
return op.getInputBinding(part);
else
return op.getOutputBinding(part);
}
public EditableWSDLBoundOperation getOperation(String namespaceUri, String localName) {
if(namespaceUri==null && localName == null)
return emptyPayloadOperation;
else{
return payloadMap.get((namespaceUri==null)?"":namespaceUri,localName);
}
}
public void freeze() {
portType = owner.getPortType(portTypeName);
if(portType == null){
throw new LocatableWebServiceException(
ClientMessages.UNDEFINED_PORT_TYPE(portTypeName), getLocation());
}
portType.freeze();
for (EditableWSDLBoundOperation op : bindingOperations.values()) {
op.freeze(owner);
}
freezePayloadMap();
owner.finalizeRpcLitBinding(this);
}
private void freezePayloadMap() {
if(style== Style.RPC) {
payloadMap = new QNameMap<EditableWSDLBoundOperation>();
for(EditableWSDLBoundOperation op : bindingOperations.values()){
payloadMap.put(op.getRequestPayloadName(), op);
}
} else {
payloadMap = new QNameMap<EditableWSDLBoundOperation>();
// For doclit The tag will be the operation that has the same input part descriptor value
for(EditableWSDLBoundOperation op : bindingOperations.values()){
QName name = op.getRequestPayloadName();
if(name == null){
//empty payload
emptyPayloadOperation = op;
continue;
}
payloadMap.put(name, op);
}
}
}
}

View File

@@ -0,0 +1,62 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.ws.model.wsdl;
import com.sun.xml.internal.ws.api.model.SEIModel;
import javax.xml.namespace.QName;
/**
* Replacement for {@link WSDLPortProperties} for when elements from the WSDL are known,
* but the full WSDL is not available.
*
*/
public final class WSDLDirectProperties extends WSDLProperties {
private final QName serviceName;
private final QName portName;
public WSDLDirectProperties(QName serviceName, QName portName) {
this(serviceName, portName, null);
}
public WSDLDirectProperties(QName serviceName, QName portName, SEIModel seiModel) {
super(seiModel);
this.serviceName = serviceName;
this.portName = portName;
}
public QName getWSDLService() {
return serviceName;
}
public QName getWSDLPort() {
return portName;
}
public QName getWSDLPortType() {
return null;
}
}

View File

@@ -0,0 +1,93 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.ws.model.wsdl;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLFault;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLMessage;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLModel;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLOperation;
import com.sun.istack.internal.NotNull;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamReader;
/**
* @author Vivek Pandey
*/
public final class WSDLFaultImpl extends AbstractExtensibleImpl implements EditableWSDLFault {
private final String name;
private final QName messageName;
private EditableWSDLMessage message;
private EditableWSDLOperation operation;
private String action = "";
private boolean defaultAction = true;
public WSDLFaultImpl(XMLStreamReader xsr, String name, QName messageName, EditableWSDLOperation operation) {
super(xsr);
this.name = name;
this.messageName = messageName;
this.operation = operation;
}
public String getName() {
return name;
}
public EditableWSDLMessage getMessage() {
return message;
}
@NotNull
public EditableWSDLOperation getOperation() {
return operation;
}
@NotNull
public QName getQName() {
return new QName(operation.getName().getNamespaceURI(), name);
}
@NotNull
public String getAction() {
return action;
}
public void setAction(String action) {
this.action = action;
}
public boolean isDefaultAction() {
return defaultAction;
}
public void setDefaultAction(boolean defaultAction) {
this.defaultAction = defaultAction;
}
public void freeze(EditableWSDLModel root){
message = root.getMessage(messageName);
}
}

View File

@@ -0,0 +1,94 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.ws.model.wsdl;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLInput;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLMessage;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLModel;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLOperation;
import com.sun.istack.internal.NotNull;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamReader;
/**
* @author Vivek Pandey
*/
public final class WSDLInputImpl extends AbstractExtensibleImpl implements EditableWSDLInput {
private String name;
private QName messageName;
private EditableWSDLOperation operation;
private EditableWSDLMessage message;
private String action;
private boolean defaultAction = true;
public WSDLInputImpl(XMLStreamReader xsr,String name, QName messageName, EditableWSDLOperation operation) {
super(xsr);
this.name = name;
this.messageName = messageName;
this.operation = operation;
}
public String getName() {
if(name != null)
return name;
return (operation.isOneWay())?operation.getName().getLocalPart():operation.getName().getLocalPart()+"Request";
}
public EditableWSDLMessage getMessage() {
return message;
}
public String getAction() {
return action;
}
@NotNull
public EditableWSDLOperation getOperation() {
return operation;
}
public QName getQName() {
return new QName(operation.getName().getNamespaceURI(), getName());
}
public void setAction(String action) {
this.action = action;
}
public boolean isDefaultAction() {
return defaultAction;
}
public void setDefaultAction(boolean defaultAction) {
this.defaultAction = defaultAction;
}
public void freeze(EditableWSDLModel parent) {
message = parent.getMessage(messageName);
}
}

View File

@@ -0,0 +1,64 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.ws.model.wsdl;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLMessage;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLPart;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamReader;
import java.util.ArrayList;
/**
* Provides abstraction for wsdl:message
* @author Vivek Pandey
*/
public final class WSDLMessageImpl extends AbstractExtensibleImpl implements EditableWSDLMessage {
private final QName name;
private final ArrayList<EditableWSDLPart> parts;
/**
* @param name wsdl:message name attribute value
*/
public WSDLMessageImpl(XMLStreamReader xsr,QName name) {
super(xsr);
this.name = name;
this.parts = new ArrayList<EditableWSDLPart>();
}
public QName getName() {
return name;
}
public void add(EditableWSDLPart part){
parts.add(part);
}
public Iterable<EditableWSDLPart> parts(){
return parts;
}
}

View File

@@ -0,0 +1,233 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.ws.model.wsdl;
import com.sun.istack.internal.NotNull;
import com.sun.xml.internal.ws.api.model.ParameterBinding;
import com.sun.xml.internal.ws.api.model.wsdl.WSDLMessage;
import com.sun.xml.internal.ws.api.model.wsdl.WSDLModel;
import com.sun.xml.internal.ws.api.model.wsdl.WSDLOperation;
import com.sun.xml.internal.ws.api.model.wsdl.WSDLPortType;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLBoundOperation;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLBoundPortType;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLMessage;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLModel;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLPart;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLPort;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLPortType;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLService;
import com.sun.xml.internal.ws.policy.PolicyMap;
import javax.jws.WebParam.Mode;
import javax.xml.namespace.QName;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* Implementation of {@link WSDLModel}
*
* @author Vivek Pandey
*/
public final class WSDLModelImpl extends AbstractExtensibleImpl implements EditableWSDLModel {
private final Map<QName, EditableWSDLMessage> messages = new HashMap<QName, EditableWSDLMessage>();
private final Map<QName, EditableWSDLPortType> portTypes = new HashMap<QName, EditableWSDLPortType>();
private final Map<QName, EditableWSDLBoundPortType> bindings = new HashMap<QName, EditableWSDLBoundPortType>();
private final Map<QName, EditableWSDLService> services = new LinkedHashMap<QName, EditableWSDLService>();
private PolicyMap policyMap;
private final Map<QName, EditableWSDLBoundPortType> unmBindings
= Collections.<QName, EditableWSDLBoundPortType>unmodifiableMap(bindings);
public WSDLModelImpl(@NotNull String systemId) {
super(systemId,-1);
}
/**
* To create {@link WSDLModelImpl} from WSDL that doesn't have a system ID.
*/
public WSDLModelImpl() {
super(null,-1);
}
public void addMessage(EditableWSDLMessage msg){
messages.put(msg.getName(), msg);
}
public EditableWSDLMessage getMessage(QName name){
return messages.get(name);
}
public void addPortType(EditableWSDLPortType pt){
portTypes.put(pt.getName(), pt);
}
public EditableWSDLPortType getPortType(QName name){
return portTypes.get(name);
}
public void addBinding(EditableWSDLBoundPortType boundPortType){
assert !bindings.containsValue(boundPortType);
bindings.put(boundPortType.getName(), boundPortType);
}
public EditableWSDLBoundPortType getBinding(QName name){
return bindings.get(name);
}
public void addService(EditableWSDLService svc){
services.put(svc.getName(), svc);
}
public EditableWSDLService getService(QName name){
return services.get(name);
}
public Map<QName, EditableWSDLMessage> getMessages() {
return messages;
}
public @NotNull Map<QName, EditableWSDLPortType> getPortTypes() {
return portTypes;
}
public @NotNull Map<QName, ? extends EditableWSDLBoundPortType> getBindings() {
return unmBindings;
}
public @NotNull Map<QName, EditableWSDLService> getServices(){
return services;
}
/**
* Returns the first service QName from insertion order
*/
public QName getFirstServiceName(){
if(services.isEmpty())
return null;
return services.values().iterator().next().getName();
}
/**
*
* @param serviceName non-null service QName
* @param portName non-null port QName
* @return
* WSDLBoundOperation on success otherwise null. throws NPE if any of the parameters null
*/
public EditableWSDLBoundPortType getBinding(QName serviceName, QName portName){
EditableWSDLService service = services.get(serviceName);
if(service != null){
EditableWSDLPort port = service.get(portName);
if(port != null)
return port.getBinding();
}
return null;
}
public void finalizeRpcLitBinding(EditableWSDLBoundPortType boundPortType){
assert(boundPortType != null);
QName portTypeName = boundPortType.getPortTypeName();
if(portTypeName == null)
return;
WSDLPortType pt = portTypes.get(portTypeName);
if(pt == null)
return;
for (EditableWSDLBoundOperation bop : boundPortType.getBindingOperations()) {
WSDLOperation pto = pt.get(bop.getName().getLocalPart());
WSDLMessage inMsgName = pto.getInput().getMessage();
if(inMsgName == null)
continue;
EditableWSDLMessage inMsg = messages.get(inMsgName.getName());
int bodyindex = 0;
if(inMsg != null){
for(EditableWSDLPart part:inMsg.parts()){
String name = part.getName();
ParameterBinding pb = bop.getInputBinding(name);
if(pb.isBody()){
part.setIndex(bodyindex++);
part.setBinding(pb);
bop.addPart(part, Mode.IN);
}
}
}
bodyindex=0;
if(pto.isOneWay())
continue;
WSDLMessage outMsgName = pto.getOutput().getMessage();
if(outMsgName == null)
continue;
EditableWSDLMessage outMsg = messages.get(outMsgName.getName());
if(outMsg!= null){
for(EditableWSDLPart part:outMsg.parts()){
String name = part.getName();
ParameterBinding pb = bop.getOutputBinding(name);
if(pb.isBody()){
part.setIndex(bodyindex++);
part.setBinding(pb);
bop.addPart(part, Mode.OUT);
}
}
}
}
}
/**
* Gives the PolicyMap associated with the WSDLModel
*
* @return PolicyMap
*/
public PolicyMap getPolicyMap() {
return policyMap;
}
/**
* Set PolicyMap for the WSDLModel.
* @param policyMap
*/
public void setPolicyMap(PolicyMap policyMap) {
this.policyMap = policyMap;
}
/**
* Invoked at the end of the model construction to fix up references, etc.
*/
public void freeze() {
for (EditableWSDLService service : services.values()) {
service.freeze(this);
}
for (EditableWSDLBoundPortType bp : bindings.values()) {
bp.freeze();
}
// Enforce freeze all the portTypes referenced by this endpoints, see Bug8966673 for detail
for (EditableWSDLPortType pt : portTypes.values()) {
pt.freeze();
}
}
}

View File

@@ -0,0 +1,139 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.ws.model.wsdl;
import com.sun.istack.internal.NotNull;
import com.sun.xml.internal.ws.api.model.wsdl.WSDLOperation;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLFault;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLInput;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLMessage;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLModel;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLOperation;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLOutput;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLPart;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLPortType;
import com.sun.xml.internal.ws.util.QNameMap;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamReader;
import java.util.ArrayList;
import java.util.List;
/**
* Implementaiton of {@link WSDLOperation}
*
* @author Vivek Pandey
*/
public final class WSDLOperationImpl extends AbstractExtensibleImpl implements EditableWSDLOperation {
private final QName name;
private String parameterOrder;
private EditableWSDLInput input;
private EditableWSDLOutput output;
private final List<EditableWSDLFault> faults;
private final QNameMap<EditableWSDLFault> faultMap;
protected Iterable<EditableWSDLMessage> messages;
private final EditableWSDLPortType owner;
public WSDLOperationImpl(XMLStreamReader xsr, EditableWSDLPortType owner, QName name) {
super(xsr);
this.name = name;
this.faults = new ArrayList<EditableWSDLFault>();
this.faultMap = new QNameMap<EditableWSDLFault>();
this.owner = owner;
}
public QName getName() {
return name;
}
public String getParameterOrder() {
return parameterOrder;
}
public void setParameterOrder(String parameterOrder) {
this.parameterOrder = parameterOrder;
}
public EditableWSDLInput getInput() {
return input;
}
public void setInput(EditableWSDLInput input) {
this.input = input;
}
public EditableWSDLOutput getOutput() {
return output;
}
public boolean isOneWay() {
return output == null;
}
public void setOutput(EditableWSDLOutput output) {
this.output = output;
}
public Iterable<EditableWSDLFault> getFaults() {
return faults;
}
public EditableWSDLFault getFault(QName faultDetailName) {
EditableWSDLFault fault = faultMap.get(faultDetailName);
if(fault != null)
return fault;
for(EditableWSDLFault fi : faults){
assert fi.getMessage().parts().iterator().hasNext();
EditableWSDLPart part = fi.getMessage().parts().iterator().next();
if(part.getDescriptor().name().equals(faultDetailName)){
faultMap.put(faultDetailName, fi);
return fi;
}
}
return null;
}
@NotNull
public QName getPortTypeName() {
return owner.getName();
}
public void addFault(EditableWSDLFault fault) {
faults.add(fault);
}
public void freeze(EditableWSDLModel root) {
assert input != null;
input.freeze(root);
if(output != null)
output.freeze(root);
for(EditableWSDLFault fault : faults){
fault.freeze(root);
}
}
}

View File

@@ -0,0 +1,92 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.ws.model.wsdl;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLMessage;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLModel;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLOperation;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLOutput;
import com.sun.istack.internal.NotNull;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamReader;
/**
* @author Vivek Pandey
*/
public final class WSDLOutputImpl extends AbstractExtensibleImpl implements EditableWSDLOutput {
private String name;
private QName messageName;
private EditableWSDLOperation operation;
private EditableWSDLMessage message;
private String action;
private boolean defaultAction = true;
public WSDLOutputImpl(XMLStreamReader xsr,String name, QName messageName, EditableWSDLOperation operation) {
super(xsr);
this.name = name;
this.messageName = messageName;
this.operation = operation;
}
public String getName() {
return (name == null)?operation.getName().getLocalPart()+"Response":name;
}
public EditableWSDLMessage getMessage() {
return message;
}
public String getAction() {
return action;
}
public boolean isDefaultAction() {
return defaultAction;
}
public void setDefaultAction(boolean defaultAction) {
this.defaultAction = defaultAction;
}
@NotNull
public EditableWSDLOperation getOperation() {
return operation;
}
@NotNull
public QName getQName() {
return new QName(operation.getName().getNamespaceURI(), getName());
}
public void setAction(String action) {
this.action = action;
}
public void freeze(EditableWSDLModel root) {
message = root.getMessage(messageName);
}
}

View File

@@ -0,0 +1,54 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.ws.model.wsdl;
import com.sun.xml.internal.ws.api.model.wsdl.WSDLDescriptorKind;
import com.sun.xml.internal.ws.api.model.wsdl.WSDLPartDescriptor;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamReader;
/**
* @author Vivek Pandey
*/
public final class WSDLPartDescriptorImpl extends AbstractObjectImpl implements WSDLPartDescriptor {
private QName name;
private WSDLDescriptorKind type;
public WSDLPartDescriptorImpl(XMLStreamReader xsr,QName name, WSDLDescriptorKind kind) {
super(xsr);
this.name = name;
this.type = kind;
}
public QName name() {
return name;
}
public WSDLDescriptorKind type() {
return type;
}
}

View File

@@ -0,0 +1,79 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.ws.model.wsdl;
import com.sun.xml.internal.ws.api.model.ParameterBinding;
import com.sun.xml.internal.ws.api.model.wsdl.WSDLPart;
import com.sun.xml.internal.ws.api.model.wsdl.WSDLPartDescriptor;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLPart;
import javax.xml.stream.XMLStreamReader;
/**
* Implementation of {@link WSDLPart}
*
* @author Vivek Pandey
*/
public final class WSDLPartImpl extends AbstractObjectImpl implements EditableWSDLPart {
private final String name;
private ParameterBinding binding;
private int index;
private final WSDLPartDescriptor descriptor;
public WSDLPartImpl(XMLStreamReader xsr, String partName, int index, WSDLPartDescriptor descriptor) {
super(xsr);
this.name = partName;
this.binding = ParameterBinding.UNBOUND;
this.index = index;
this.descriptor = descriptor;
}
public String getName() {
return name;
}
public ParameterBinding getBinding() {
return binding;
}
public void setBinding(ParameterBinding binding) {
this.binding = binding;
}
public int getIndex() {
return index;
}
//need to set the index in case of rpclit to reorder the body parts
public void setIndex(int index){
this.index = index;
}
public WSDLPartDescriptor getDescriptor() {
return descriptor;
}
}

View File

@@ -0,0 +1,125 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.ws.model.wsdl;
import java.util.List;
import com.sun.xml.internal.ws.api.EndpointAddress;
import com.sun.xml.internal.ws.api.SOAPVersion;
import com.sun.xml.internal.ws.api.addressing.WSEndpointReference;
import com.sun.xml.internal.ws.api.model.wsdl.WSDLPort;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLBoundPortType;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLModel;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLPort;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLService;
import com.sun.xml.internal.ws.resources.ClientMessages;
import com.sun.xml.internal.ws.util.exception.LocatableWebServiceException;
import com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser;
import com.sun.xml.internal.ws.binding.WebServiceFeatureList;
import com.sun.istack.internal.Nullable;
import com.sun.istack.internal.NotNull;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamReader;
/**
* Implementation of {@link WSDLPort}
*
* @author Vivek Pandey
*/
public final class WSDLPortImpl extends AbstractFeaturedObjectImpl implements EditableWSDLPort {
private final QName name;
private EndpointAddress address;
private final QName bindingName;
private final EditableWSDLService owner;
private WSEndpointReference epr;
/**
* To be set after the WSDL parsing is complete.
*/
private EditableWSDLBoundPortType boundPortType;
public WSDLPortImpl(XMLStreamReader xsr, EditableWSDLService owner, QName name, QName binding) {
super(xsr);
this.owner = owner;
this.name = name;
this.bindingName = binding;
}
public QName getName() {
return name;
}
public QName getBindingName() {
return bindingName;
}
public EndpointAddress getAddress() {
return address;
}
public EditableWSDLService getOwner() {
return owner;
}
/**
* Only meant for {@link RuntimeWSDLParser} to call.
*/
public void setAddress(EndpointAddress address) {
assert address!=null;
this.address = address;
}
/**
* Only meant for {@link RuntimeWSDLParser} to call.
*/
public void setEPR(@NotNull WSEndpointReference epr) {
assert epr!=null;
this.addExtension(epr);
this.epr = epr;
}
public @Nullable WSEndpointReference getEPR() {
return epr;
}
public EditableWSDLBoundPortType getBinding() {
return boundPortType;
}
@SuppressWarnings("unchecked")
public void freeze(EditableWSDLModel root) {
boundPortType = root.getBinding(bindingName);
if(boundPortType==null) {
throw new LocatableWebServiceException(
ClientMessages.UNDEFINED_BINDING(bindingName), getLocation());
}
if(features == null)
features = new WebServiceFeatureList();
features.setParentFeaturedObject(boundPortType);
notUnderstoodExtensions.addAll((List<UnknownWSDLExtension>)boundPortType.getNotUnderstoodExtensions());
}
}

View File

@@ -0,0 +1,66 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.ws.model.wsdl;
import com.sun.istack.internal.NotNull;
import com.sun.istack.internal.Nullable;
import com.sun.xml.internal.ws.api.model.SEIModel;
import com.sun.xml.internal.ws.api.model.wsdl.WSDLPort;
import javax.xml.namespace.QName;
import javax.xml.ws.handler.MessageContext;
/**
* Properties exposed from {@link WSDLPort} for {@link MessageContext}.
* Donot add this satellite if {@link WSDLPort} is null.
*
* @author Jitendra Kotamraju
*/
public final class WSDLPortProperties extends WSDLProperties {
private final @NotNull WSDLPort port;
public WSDLPortProperties(@NotNull WSDLPort port) {
this(port, null);
}
public WSDLPortProperties(@NotNull WSDLPort port, @Nullable SEIModel seiModel) {
super(seiModel);
this.port = port;
}
public QName getWSDLService() {
return port.getOwner().getName();
}
public QName getWSDLPort() {
return port.getName();
}
public QName getWSDLPortType() {
return port.getBinding().getPortTypeName();
}
}

View File

@@ -0,0 +1,88 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.ws.model.wsdl;
import com.sun.xml.internal.ws.api.model.wsdl.WSDLOperation;
import com.sun.xml.internal.ws.api.model.wsdl.WSDLPortType;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLModel;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLOperation;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLPortType;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamReader;
import java.util.Hashtable;
import java.util.Map;
/**
* Provides implementation of {@link WSDLPortType}
*
* @author Vivek Pandey
*/
public final class WSDLPortTypeImpl extends AbstractExtensibleImpl implements EditableWSDLPortType {
private QName name;
private final Map<String, EditableWSDLOperation> portTypeOperations;
private EditableWSDLModel owner;
public WSDLPortTypeImpl(XMLStreamReader xsr, EditableWSDLModel owner, QName name) {
super(xsr);
this.name = name;
this.owner = owner;
portTypeOperations = new Hashtable<String, EditableWSDLOperation>();
}
public QName getName() {
return name;
}
public EditableWSDLOperation get(String operationName) {
return portTypeOperations.get(operationName);
}
public Iterable<EditableWSDLOperation> getOperations() {
return portTypeOperations.values();
}
/**
* Populates the Map that holds operation name as key and {@link WSDLOperation} as the value.
* @param opName Must be non-null
* @param ptOp Must be non-null
* @throws NullPointerException if either opName or ptOp is null
*/
public void put(String opName, EditableWSDLOperation ptOp){
portTypeOperations.put(opName, ptOp);
}
EditableWSDLModel getOwner(){
return owner;
}
public void freeze() {
for(EditableWSDLOperation op : portTypeOperations.values()){
op.freeze(owner);
}
}
}

View File

@@ -0,0 +1,77 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.ws.model.wsdl;
import com.oracle.webservices.internal.api.message.BasePropertySet;
import com.sun.istack.internal.Nullable;
import com.sun.xml.internal.ws.api.model.SEIModel;
import com.sun.xml.internal.ws.api.model.wsdl.WSDLPort;
import javax.xml.namespace.QName;
import javax.xml.ws.handler.MessageContext;
import org.xml.sax.InputSource;
/**
* Properties exposed from {@link WSDLPort} for {@link MessageContext}.
* Donot add this satellite if {@link WSDLPort} is null.
*
* @author Jitendra Kotamraju
*/
public abstract class WSDLProperties extends BasePropertySet {
private static final PropertyMap model;
static {
model = parse(WSDLProperties.class);
}
private final @Nullable SEIModel seiModel;
protected WSDLProperties(@Nullable SEIModel seiModel) {
this.seiModel = seiModel;
}
@Property(MessageContext.WSDL_SERVICE)
public abstract QName getWSDLService();
@Property(MessageContext.WSDL_PORT)
public abstract QName getWSDLPort();
@Property(MessageContext.WSDL_INTERFACE)
public abstract QName getWSDLPortType();
@Property(MessageContext.WSDL_DESCRIPTION)
public InputSource getWSDLDescription() {
return seiModel != null ? new InputSource(seiModel.getWSDLLocation()) : null;
}
@Override
protected PropertyMap getPropertyMap() {
return model;
}
}

View File

@@ -0,0 +1,115 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.ws.model.wsdl;
import com.sun.istack.internal.NotNull;
import com.sun.istack.internal.Nullable;
import com.sun.xml.internal.ws.api.model.wsdl.WSDLPort;
import com.sun.xml.internal.ws.api.model.wsdl.WSDLService;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLModel;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLPort;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLService;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamReader;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* Implementation of {@link WSDLService}
*
* @author Vivek Pandey
*/
public final class WSDLServiceImpl extends AbstractExtensibleImpl implements EditableWSDLService {
private final QName name;
private final Map<QName, EditableWSDLPort> ports;
private final EditableWSDLModel parent;
public WSDLServiceImpl(XMLStreamReader xsr, EditableWSDLModel parent, QName name) {
super(xsr);
this.parent = parent;
this.name = name;
ports = new LinkedHashMap<QName, EditableWSDLPort>();
}
public @NotNull
EditableWSDLModel getParent() {
return parent;
}
public QName getName() {
return name;
}
public EditableWSDLPort get(QName portName) {
return ports.get(portName);
}
public EditableWSDLPort getFirstPort() {
if(ports.isEmpty())
return null;
else
return ports.values().iterator().next();
}
public Iterable<EditableWSDLPort> getPorts(){
return ports.values();
}
/**
* gets the first port in this service which matches the portType
*/
public @Nullable
EditableWSDLPort getMatchingPort(QName portTypeName){
for(EditableWSDLPort port : getPorts()){
QName ptName = port.getBinding().getPortTypeName();
assert (ptName != null);
if(ptName.equals(portTypeName))
return port;
}
return null;
}
/**
* Populates the Map that holds port name as key and {@link WSDLPort} as the value.
*
* @param portName Must be non-null
* @param port Must be non-null
* @throws NullPointerException if either opName or ptOp is null
*/
public void put(QName portName, EditableWSDLPort port) {
if (portName == null || port == null)
throw new NullPointerException();
ports.put(portName, port);
}
public void freeze(EditableWSDLModel root) {
for (EditableWSDLPort port : ports.values()) {
port.freeze(root);
}
}
}