Fri, 04 Oct 2013 16:21:34 +0100
8025054: Update JAX-WS RI integration to 2.2.9-b130926.1035
Reviewed-by: chegar
ohair@286 | 1 | /* |
mkos@384 | 2 | * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
ohair@286 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
ohair@286 | 4 | * |
ohair@286 | 5 | * This code is free software; you can redistribute it and/or modify it |
ohair@286 | 6 | * under the terms of the GNU General Public License version 2 only, as |
ohair@286 | 7 | * published by the Free Software Foundation. Oracle designates this |
ohair@286 | 8 | * particular file as subject to the "Classpath" exception as provided |
ohair@286 | 9 | * by Oracle in the LICENSE file that accompanied this code. |
ohair@286 | 10 | * |
ohair@286 | 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
ohair@286 | 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ohair@286 | 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ohair@286 | 14 | * version 2 for more details (a copy is included in the LICENSE file that |
ohair@286 | 15 | * accompanied this code). |
ohair@286 | 16 | * |
ohair@286 | 17 | * You should have received a copy of the GNU General Public License version |
ohair@286 | 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
ohair@286 | 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
ohair@286 | 20 | * |
ohair@286 | 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ohair@286 | 22 | * or visit www.oracle.com if you need additional information or have any |
ohair@286 | 23 | * questions. |
ohair@286 | 24 | */ |
ohair@286 | 25 | |
ohair@286 | 26 | package com.sun.xml.internal.ws.model.wsdl; |
ohair@286 | 27 | |
ohair@286 | 28 | import com.sun.istack.internal.NotNull; |
ohair@286 | 29 | import com.sun.xml.internal.ws.api.model.wsdl.WSDLOperation; |
mkos@408 | 30 | import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLFault; |
mkos@408 | 31 | import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLInput; |
mkos@408 | 32 | import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLMessage; |
mkos@408 | 33 | import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLModel; |
mkos@408 | 34 | import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLOperation; |
mkos@408 | 35 | import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLOutput; |
mkos@408 | 36 | import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLPart; |
mkos@408 | 37 | import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLPortType; |
ohair@286 | 38 | import com.sun.xml.internal.ws.util.QNameMap; |
ohair@286 | 39 | |
ohair@286 | 40 | import javax.xml.namespace.QName; |
ohair@286 | 41 | import javax.xml.stream.XMLStreamReader; |
mkos@408 | 42 | |
ohair@286 | 43 | import java.util.ArrayList; |
ohair@286 | 44 | import java.util.List; |
ohair@286 | 45 | |
ohair@286 | 46 | /** |
ohair@286 | 47 | * Implementaiton of {@link WSDLOperation} |
ohair@286 | 48 | * |
ohair@286 | 49 | * @author Vivek Pandey |
ohair@286 | 50 | */ |
mkos@408 | 51 | public final class WSDLOperationImpl extends AbstractExtensibleImpl implements EditableWSDLOperation { |
ohair@286 | 52 | private final QName name; |
ohair@286 | 53 | private String parameterOrder; |
mkos@408 | 54 | private EditableWSDLInput input; |
mkos@408 | 55 | private EditableWSDLOutput output; |
mkos@408 | 56 | private final List<EditableWSDLFault> faults; |
mkos@408 | 57 | private final QNameMap<EditableWSDLFault> faultMap; |
mkos@408 | 58 | protected Iterable<EditableWSDLMessage> messages; |
mkos@408 | 59 | private final EditableWSDLPortType owner; |
ohair@286 | 60 | |
mkos@408 | 61 | public WSDLOperationImpl(XMLStreamReader xsr, EditableWSDLPortType owner, QName name) { |
ohair@286 | 62 | super(xsr); |
ohair@286 | 63 | this.name = name; |
mkos@408 | 64 | this.faults = new ArrayList<EditableWSDLFault>(); |
mkos@408 | 65 | this.faultMap = new QNameMap<EditableWSDLFault>(); |
ohair@286 | 66 | this.owner = owner; |
ohair@286 | 67 | } |
ohair@286 | 68 | |
ohair@286 | 69 | public QName getName() { |
ohair@286 | 70 | return name; |
ohair@286 | 71 | } |
ohair@286 | 72 | |
ohair@286 | 73 | public String getParameterOrder() { |
ohair@286 | 74 | return parameterOrder; |
ohair@286 | 75 | } |
ohair@286 | 76 | |
ohair@286 | 77 | public void setParameterOrder(String parameterOrder) { |
ohair@286 | 78 | this.parameterOrder = parameterOrder; |
ohair@286 | 79 | } |
ohair@286 | 80 | |
mkos@408 | 81 | public EditableWSDLInput getInput() { |
ohair@286 | 82 | return input; |
ohair@286 | 83 | } |
ohair@286 | 84 | |
mkos@408 | 85 | public void setInput(EditableWSDLInput input) { |
ohair@286 | 86 | this.input = input; |
ohair@286 | 87 | } |
ohair@286 | 88 | |
mkos@408 | 89 | public EditableWSDLOutput getOutput() { |
ohair@286 | 90 | return output; |
ohair@286 | 91 | } |
ohair@286 | 92 | |
ohair@286 | 93 | public boolean isOneWay() { |
ohair@286 | 94 | return output == null; |
ohair@286 | 95 | } |
ohair@286 | 96 | |
mkos@408 | 97 | public void setOutput(EditableWSDLOutput output) { |
ohair@286 | 98 | this.output = output; |
ohair@286 | 99 | } |
ohair@286 | 100 | |
mkos@408 | 101 | public Iterable<EditableWSDLFault> getFaults() { |
ohair@286 | 102 | return faults; |
ohair@286 | 103 | } |
ohair@286 | 104 | |
mkos@408 | 105 | public EditableWSDLFault getFault(QName faultDetailName) { |
mkos@408 | 106 | EditableWSDLFault fault = faultMap.get(faultDetailName); |
ohair@286 | 107 | if(fault != null) |
ohair@286 | 108 | return fault; |
ohair@286 | 109 | |
mkos@408 | 110 | for(EditableWSDLFault fi : faults){ |
ohair@286 | 111 | assert fi.getMessage().parts().iterator().hasNext(); |
mkos@408 | 112 | EditableWSDLPart part = fi.getMessage().parts().iterator().next(); |
ohair@286 | 113 | if(part.getDescriptor().name().equals(faultDetailName)){ |
ohair@286 | 114 | faultMap.put(faultDetailName, fi); |
ohair@286 | 115 | return fi; |
ohair@286 | 116 | } |
ohair@286 | 117 | } |
ohair@286 | 118 | return null; |
ohair@286 | 119 | } |
ohair@286 | 120 | |
ohair@286 | 121 | @NotNull |
ohair@286 | 122 | public QName getPortTypeName() { |
ohair@286 | 123 | return owner.getName(); |
ohair@286 | 124 | } |
ohair@286 | 125 | |
mkos@408 | 126 | public void addFault(EditableWSDLFault fault) { |
ohair@286 | 127 | faults.add(fault); |
ohair@286 | 128 | } |
ohair@286 | 129 | |
mkos@408 | 130 | public void freeze(EditableWSDLModel root) { |
ohair@286 | 131 | assert input != null; |
ohair@286 | 132 | input.freeze(root); |
ohair@286 | 133 | if(output != null) |
ohair@286 | 134 | output.freeze(root); |
mkos@408 | 135 | for(EditableWSDLFault fault : faults){ |
ohair@286 | 136 | fault.freeze(root); |
ohair@286 | 137 | } |
ohair@286 | 138 | } |
ohair@286 | 139 | } |