src/share/jaxws_classes/com/sun/tools/internal/ws/wsdl/document/PortType.java

changeset 0
373ffda63c9a
child 637
9c07ef4934dd
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/share/jaxws_classes/com/sun/tools/internal/ws/wsdl/document/PortType.java	Wed Apr 27 01:27:09 2016 +0800
     1.3 @@ -0,0 +1,156 @@
     1.4 +/*
     1.5 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.  Oracle designates this
    1.11 + * particular file as subject to the "Classpath" exception as provided
    1.12 + * by Oracle in the LICENSE file that accompanied this code.
    1.13 + *
    1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.17 + * version 2 for more details (a copy is included in the LICENSE file that
    1.18 + * accompanied this code).
    1.19 + *
    1.20 + * You should have received a copy of the GNU General Public License version
    1.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.23 + *
    1.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.25 + * or visit www.oracle.com if you need additional information or have any
    1.26 + * questions.
    1.27 + */
    1.28 +
    1.29 +package com.sun.tools.internal.ws.wsdl.document;
    1.30 +
    1.31 +import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible;
    1.32 +import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension;
    1.33 +import com.sun.tools.internal.ws.wsdl.framework.*;
    1.34 +import com.sun.tools.internal.ws.wscompile.ErrorReceiver;
    1.35 +import org.xml.sax.Locator;
    1.36 +
    1.37 +import javax.xml.namespace.QName;
    1.38 +import java.util.*;
    1.39 +
    1.40 +/**
    1.41 + * Entity corresponding to the "portType" WSDL element.
    1.42 + *
    1.43 + * @author WS Development Team
    1.44 + */
    1.45 +public class PortType extends GlobalEntity implements TWSDLExtensible {
    1.46 +
    1.47 +    public PortType(Defining defining, Locator locator, ErrorReceiver errReceiver) {
    1.48 +        super(defining, locator, errReceiver);
    1.49 +        _operations = new ArrayList();
    1.50 +        _operationKeys = new HashSet();
    1.51 +        _helper = new ExtensibilityHelper();
    1.52 +    }
    1.53 +
    1.54 +    public void add(Operation operation) {
    1.55 +        String key = operation.getUniqueKey();
    1.56 +        if (_operationKeys.contains(key))
    1.57 +            throw new ValidationException(
    1.58 +                "validation.ambiguousName",
    1.59 +                operation.getName());
    1.60 +        _operationKeys.add(key);
    1.61 +        _operations.add(operation);
    1.62 +    }
    1.63 +
    1.64 +    public Iterator operations() {
    1.65 +        return _operations.iterator();
    1.66 +    }
    1.67 +
    1.68 +    public Set getOperationsNamed(String s) {
    1.69 +        Set result = new HashSet();
    1.70 +        for (Iterator iter = _operations.iterator(); iter.hasNext();) {
    1.71 +            Operation operation = (Operation) iter.next();
    1.72 +            if (operation.getName().equals(s)) {
    1.73 +                result.add(operation);
    1.74 +            }
    1.75 +        }
    1.76 +        return result;
    1.77 +    }
    1.78 +
    1.79 +    public Kind getKind() {
    1.80 +        return Kinds.PORT_TYPE;
    1.81 +    }
    1.82 +
    1.83 +    public QName getElementName() {
    1.84 +        return WSDLConstants.QNAME_PORT_TYPE;
    1.85 +    }
    1.86 +
    1.87 +    public Documentation getDocumentation() {
    1.88 +        return _documentation;
    1.89 +    }
    1.90 +
    1.91 +    public void setDocumentation(Documentation d) {
    1.92 +        _documentation = d;
    1.93 +    }
    1.94 +
    1.95 +    public void withAllSubEntitiesDo(EntityAction action) {
    1.96 +        super.withAllSubEntitiesDo(action);
    1.97 +
    1.98 +        for (Iterator iter = _operations.iterator(); iter.hasNext();) {
    1.99 +            action.perform((Entity) iter.next());
   1.100 +        }
   1.101 +        _helper.withAllSubEntitiesDo(action);
   1.102 +    }
   1.103 +
   1.104 +    public void accept(WSDLDocumentVisitor visitor) throws Exception {
   1.105 +        visitor.preVisit(this);
   1.106 +        _helper.accept(visitor);
   1.107 +        for (Iterator iter = _operations.iterator(); iter.hasNext();) {
   1.108 +            ((Operation) iter.next()).accept(visitor);
   1.109 +        }
   1.110 +        visitor.postVisit(this);
   1.111 +    }
   1.112 +
   1.113 +    public void validateThis() {
   1.114 +        if (getName() == null) {
   1.115 +            failValidation("validation.missingRequiredAttribute", "name");
   1.116 +        }
   1.117 +    }
   1.118 +
   1.119 +    public String getNameValue() {
   1.120 +        return getName();
   1.121 +    }
   1.122 +
   1.123 +    public String getNamespaceURI() {
   1.124 +        return getDefining().getTargetNamespaceURI();
   1.125 +    }
   1.126 +
   1.127 +    public QName getWSDLElementName() {
   1.128 +        return getElementName();
   1.129 +    }
   1.130 +
   1.131 +    /* (non-Javadoc)
   1.132 +    * @see TWSDLExtensible#addExtension(ExtensionImpl)
   1.133 +    */
   1.134 +    public void addExtension(TWSDLExtension e) {
   1.135 +        _helper.addExtension(e);
   1.136 +
   1.137 +    }
   1.138 +
   1.139 +    /* (non-Javadoc)
   1.140 +     * @see TWSDLExtensible#extensions()
   1.141 +     */
   1.142 +    public Iterable<TWSDLExtension> extensions() {
   1.143 +        return _helper.extensions();
   1.144 +    }
   1.145 +
   1.146 +    public TWSDLExtensible getParent() {
   1.147 +        return parent;
   1.148 +    }
   1.149 +
   1.150 +    public void setParent(TWSDLExtensible parent) {
   1.151 +        this.parent = parent;
   1.152 +    }
   1.153 +
   1.154 +    private TWSDLExtensible parent;
   1.155 +    private Documentation _documentation;
   1.156 +    private List _operations;
   1.157 +    private Set _operationKeys;
   1.158 +    private ExtensibilityHelper _helper;
   1.159 +}

mercurial