feat(jdk8): move files to new folder to avoid resources compiled.
This commit is contained in:
170
jdkSrc/jdk8/com/sun/tools/internal/ws/wsdl/document/Binding.java
Normal file
170
jdkSrc/jdk8/com/sun/tools/internal/ws/wsdl/document/Binding.java
Normal file
@@ -0,0 +1,170 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document;
|
||||
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible;
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.*;
|
||||
import com.sun.tools.internal.ws.resources.WsdlMessages;
|
||||
import com.sun.tools.internal.ws.wscompile.AbortException;
|
||||
import com.sun.tools.internal.ws.wscompile.ErrorReceiver;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Entity corresponding to the "binding" WSDL element.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class Binding extends GlobalEntity implements TWSDLExtensible {
|
||||
|
||||
public Binding(Defining defining, Locator locator, ErrorReceiver receiver) {
|
||||
super(defining, locator, receiver);
|
||||
_operations = new ArrayList();
|
||||
_helper = new ExtensibilityHelper();
|
||||
}
|
||||
|
||||
public void add(BindingOperation operation) {
|
||||
_operations.add(operation);
|
||||
}
|
||||
|
||||
public Iterator operations() {
|
||||
return _operations.iterator();
|
||||
}
|
||||
|
||||
public QName getPortType() {
|
||||
return _portType;
|
||||
}
|
||||
|
||||
public void setPortType(QName n) {
|
||||
_portType = n;
|
||||
}
|
||||
|
||||
public PortType resolvePortType(AbstractDocument document) {
|
||||
try {
|
||||
return (PortType) document.find(Kinds.PORT_TYPE, _portType);
|
||||
} catch (NoSuchEntityException e) {
|
||||
errorReceiver.error(getLocator(), WsdlMessages.ENTITY_NOT_FOUND_PORT_TYPE(_portType, new QName(getNamespaceURI(), getName())));
|
||||
throw new AbortException();
|
||||
}
|
||||
}
|
||||
|
||||
public Kind getKind() {
|
||||
return Kinds.BINDING;
|
||||
}
|
||||
|
||||
public QName getElementName() {
|
||||
return WSDLConstants.QNAME_BINDING;
|
||||
}
|
||||
|
||||
public Documentation getDocumentation() {
|
||||
return _documentation;
|
||||
}
|
||||
|
||||
public void setDocumentation(Documentation d) {
|
||||
_documentation = d;
|
||||
}
|
||||
|
||||
public void withAllSubEntitiesDo(EntityAction action) {
|
||||
for (Iterator iter = _operations.iterator(); iter.hasNext();) {
|
||||
action.perform((Entity) iter.next());
|
||||
}
|
||||
_helper.withAllSubEntitiesDo(action);
|
||||
}
|
||||
|
||||
public void withAllQNamesDo(QNameAction action) {
|
||||
super.withAllQNamesDo(action);
|
||||
|
||||
if (_portType != null) {
|
||||
action.perform(_portType);
|
||||
}
|
||||
}
|
||||
|
||||
public void withAllEntityReferencesDo(EntityReferenceAction action) {
|
||||
super.withAllEntityReferencesDo(action);
|
||||
if (_portType != null) {
|
||||
action.perform(Kinds.PORT_TYPE, _portType);
|
||||
}
|
||||
}
|
||||
|
||||
public void accept(WSDLDocumentVisitor visitor) throws Exception {
|
||||
visitor.preVisit(this);
|
||||
//bug fix: 4947340, extensions should be the first element
|
||||
_helper.accept(visitor);
|
||||
for (Iterator iter = _operations.iterator(); iter.hasNext();) {
|
||||
((BindingOperation) iter.next()).accept(visitor);
|
||||
}
|
||||
visitor.postVisit(this);
|
||||
}
|
||||
|
||||
public void validateThis() {
|
||||
if (getName() == null) {
|
||||
failValidation("validation.missingRequiredAttribute", "name");
|
||||
}
|
||||
if (_portType == null) {
|
||||
failValidation("validation.missingRequiredAttribute", "type");
|
||||
}
|
||||
}
|
||||
|
||||
public String getNameValue() {
|
||||
return getName();
|
||||
}
|
||||
|
||||
public String getNamespaceURI() {
|
||||
return getDefining().getTargetNamespaceURI();
|
||||
}
|
||||
|
||||
public QName getWSDLElementName() {
|
||||
return getElementName();
|
||||
}
|
||||
|
||||
public void addExtension(TWSDLExtension e) {
|
||||
_helper.addExtension(e);
|
||||
}
|
||||
|
||||
public Iterable<TWSDLExtension> extensions() {
|
||||
return _helper.extensions();
|
||||
}
|
||||
|
||||
public TWSDLExtensible getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
private ExtensibilityHelper _helper;
|
||||
private Documentation _documentation;
|
||||
private QName _portType;
|
||||
private List _operations;
|
||||
|
||||
public void setParent(TWSDLExtensible parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
private TWSDLExtensible parent;
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document;
|
||||
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible;
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.Entity;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.EntityAction;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.ExtensibilityHelper;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* Entity corresponding to the "fault" child element of a binding operation.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class BindingFault extends Entity implements TWSDLExtensible {
|
||||
|
||||
public BindingFault(Locator locator) {
|
||||
super(locator);
|
||||
_helper = new ExtensibilityHelper();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return _name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
_name = name;
|
||||
}
|
||||
|
||||
public QName getElementName() {
|
||||
return WSDLConstants.QNAME_FAULT;
|
||||
}
|
||||
|
||||
public Documentation getDocumentation() {
|
||||
return _documentation;
|
||||
}
|
||||
|
||||
public void setDocumentation(Documentation d) {
|
||||
_documentation = d;
|
||||
}
|
||||
|
||||
public String getNameValue() {
|
||||
return getName();
|
||||
}
|
||||
|
||||
public String getNamespaceURI() {
|
||||
return getParent().getNamespaceURI();
|
||||
}
|
||||
|
||||
public QName getWSDLElementName() {
|
||||
return getElementName();
|
||||
}
|
||||
|
||||
public void addExtension(TWSDLExtension e) {
|
||||
_helper.addExtension(e);
|
||||
}
|
||||
|
||||
public Iterable<TWSDLExtension> extensions() {
|
||||
return _helper.extensions();
|
||||
}
|
||||
|
||||
public TWSDLExtensible getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
public void withAllSubEntitiesDo(EntityAction action) {
|
||||
_helper.withAllSubEntitiesDo(action);
|
||||
}
|
||||
|
||||
public void accept(WSDLDocumentVisitor visitor) throws Exception {
|
||||
visitor.preVisit(this);
|
||||
_helper.accept(visitor);
|
||||
visitor.postVisit(this);
|
||||
}
|
||||
|
||||
public void validateThis() {
|
||||
if (_name == null) {
|
||||
failValidation("validation.missingRequiredAttribute", "name");
|
||||
}
|
||||
}
|
||||
|
||||
private ExtensibilityHelper _helper;
|
||||
private Documentation _documentation;
|
||||
private String _name;
|
||||
|
||||
public void setParent(TWSDLExtensible parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
private TWSDLExtensible parent;
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document;
|
||||
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible;
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.Entity;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.EntityAction;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.ExtensibilityHelper;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* Entity corresponding to the "input" child element of a binding operation.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class BindingInput extends Entity implements TWSDLExtensible {
|
||||
|
||||
public BindingInput(Locator locator) {
|
||||
super(locator);
|
||||
_helper = new ExtensibilityHelper();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return _name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
_name = name;
|
||||
}
|
||||
|
||||
public QName getElementName() {
|
||||
return WSDLConstants.QNAME_INPUT;
|
||||
}
|
||||
|
||||
public Documentation getDocumentation() {
|
||||
return _documentation;
|
||||
}
|
||||
|
||||
public void setDocumentation(Documentation d) {
|
||||
_documentation = d;
|
||||
}
|
||||
|
||||
public String getNameValue() {
|
||||
return getName();
|
||||
}
|
||||
|
||||
public String getNamespaceURI() {
|
||||
return getParent().getNamespaceURI();
|
||||
}
|
||||
|
||||
public QName getWSDLElementName() {
|
||||
return getElementName();
|
||||
}
|
||||
|
||||
public void addExtension(TWSDLExtension e) {
|
||||
_helper.addExtension(e);
|
||||
}
|
||||
|
||||
public Iterable<TWSDLExtension> extensions() {
|
||||
return _helper.extensions();
|
||||
}
|
||||
|
||||
public TWSDLExtensible getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
public void withAllSubEntitiesDo(EntityAction action) {
|
||||
_helper.withAllSubEntitiesDo(action);
|
||||
}
|
||||
|
||||
public void accept(WSDLDocumentVisitor visitor) throws Exception {
|
||||
visitor.preVisit(this);
|
||||
_helper.accept(visitor);
|
||||
visitor.postVisit(this);
|
||||
}
|
||||
|
||||
public void validateThis() {
|
||||
}
|
||||
|
||||
private ExtensibilityHelper _helper;
|
||||
private Documentation _documentation;
|
||||
private String _name;
|
||||
|
||||
public void setParent(TWSDLExtensible parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
private TWSDLExtensible parent;
|
||||
}
|
||||
@@ -0,0 +1,234 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document;
|
||||
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible;
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.Entity;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.EntityAction;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.ExtensibilityHelper;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Entity corresponding to the "operation" child element of a WSDL "binding" element.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class BindingOperation extends Entity implements TWSDLExtensible {
|
||||
|
||||
public BindingOperation(Locator locator) {
|
||||
super(locator);
|
||||
_faults = new ArrayList<BindingFault>();
|
||||
_helper = new ExtensibilityHelper();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return _name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
_name = name;
|
||||
}
|
||||
|
||||
public String getUniqueKey() {
|
||||
if (_uniqueKey == null) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(_name);
|
||||
sb.append(' ');
|
||||
if (_input != null) {
|
||||
sb.append(_input.getName());
|
||||
} else {
|
||||
sb.append(_name);
|
||||
if (_style == OperationStyle.REQUEST_RESPONSE) {
|
||||
sb.append("Request");
|
||||
} else if (_style == OperationStyle.SOLICIT_RESPONSE) {
|
||||
sb.append("Response");
|
||||
}
|
||||
}
|
||||
sb.append(' ');
|
||||
if (_output != null) {
|
||||
sb.append(_output.getName());
|
||||
} else {
|
||||
sb.append(_name);
|
||||
if (_style == OperationStyle.SOLICIT_RESPONSE) {
|
||||
sb.append("Solicit");
|
||||
} else if (_style == OperationStyle.REQUEST_RESPONSE) {
|
||||
sb.append("Response");
|
||||
}
|
||||
}
|
||||
_uniqueKey = sb.toString();
|
||||
}
|
||||
|
||||
return _uniqueKey;
|
||||
}
|
||||
|
||||
public OperationStyle getStyle() {
|
||||
return _style;
|
||||
}
|
||||
|
||||
public void setStyle(OperationStyle s) {
|
||||
_style = s;
|
||||
}
|
||||
|
||||
public BindingInput getInput() {
|
||||
return _input;
|
||||
}
|
||||
|
||||
public void setInput(BindingInput i) {
|
||||
_input = i;
|
||||
}
|
||||
|
||||
public BindingOutput getOutput() {
|
||||
return _output;
|
||||
}
|
||||
|
||||
public void setOutput(BindingOutput o) {
|
||||
_output = o;
|
||||
}
|
||||
|
||||
public void addFault(BindingFault f) {
|
||||
_faults.add(f);
|
||||
}
|
||||
|
||||
public Iterable<BindingFault> faults() {
|
||||
return _faults;
|
||||
}
|
||||
|
||||
@Override
|
||||
public QName getElementName() {
|
||||
return WSDLConstants.QNAME_OPERATION;
|
||||
}
|
||||
|
||||
public Documentation getDocumentation() {
|
||||
return _documentation;
|
||||
}
|
||||
|
||||
public void setDocumentation(Documentation d) {
|
||||
_documentation = d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNameValue() {
|
||||
return getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNamespaceURI() {
|
||||
return (parent == null) ? null : parent.getNamespaceURI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public QName getWSDLElementName() {
|
||||
return getElementName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addExtension(TWSDLExtension e) {
|
||||
_helper.addExtension(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<TWSDLExtension> extensions() {
|
||||
return _helper.extensions();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TWSDLExtensible getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void withAllSubEntitiesDo(EntityAction action) {
|
||||
if (_input != null) {
|
||||
action.perform(_input);
|
||||
}
|
||||
if (_output != null) {
|
||||
action.perform(_output);
|
||||
}
|
||||
for (BindingFault _fault : _faults) {
|
||||
action.perform(_fault);
|
||||
}
|
||||
_helper.withAllSubEntitiesDo(action);
|
||||
}
|
||||
|
||||
public void accept(WSDLDocumentVisitor visitor) throws Exception {
|
||||
visitor.preVisit(this);
|
||||
//bug fix: 4947340, extensions should be the first element
|
||||
_helper.accept(visitor);
|
||||
if (_input != null) {
|
||||
_input.accept(visitor);
|
||||
}
|
||||
if (_output != null) {
|
||||
_output.accept(visitor);
|
||||
}
|
||||
for (BindingFault _fault : _faults) {
|
||||
_fault.accept(visitor);
|
||||
}
|
||||
visitor.postVisit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateThis() {
|
||||
if (_name == null) {
|
||||
failValidation("validation.missingRequiredAttribute", "name");
|
||||
}
|
||||
if (_style == null) {
|
||||
failValidation("validation.missingRequiredProperty", "style");
|
||||
}
|
||||
|
||||
// verify operation style
|
||||
if (_style == OperationStyle.ONE_WAY) {
|
||||
if (_input == null) {
|
||||
failValidation("validation.missingRequiredSubEntity", "input");
|
||||
}
|
||||
if (_output != null) {
|
||||
failValidation("validation.invalidSubEntity", "output");
|
||||
}
|
||||
if (_faults != null && !_faults.isEmpty()) {
|
||||
failValidation("validation.invalidSubEntity", "fault");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ExtensibilityHelper _helper;
|
||||
private Documentation _documentation;
|
||||
private String _name;
|
||||
private BindingInput _input;
|
||||
private BindingOutput _output;
|
||||
private List<BindingFault> _faults;
|
||||
private OperationStyle _style;
|
||||
private String _uniqueKey;
|
||||
|
||||
public void setParent(TWSDLExtensible parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
private TWSDLExtensible parent;
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document;
|
||||
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible;
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.Entity;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.EntityAction;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.ExtensibilityHelper;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* Entity corresponding to the "output" child element of a binding operation.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class BindingOutput extends Entity implements TWSDLExtensible {
|
||||
|
||||
public BindingOutput(Locator locator) {
|
||||
super(locator);
|
||||
_helper = new ExtensibilityHelper();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return _name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
_name = name;
|
||||
}
|
||||
|
||||
public QName getElementName() {
|
||||
return WSDLConstants.QNAME_OUTPUT;
|
||||
}
|
||||
|
||||
public Documentation getDocumentation() {
|
||||
return _documentation;
|
||||
}
|
||||
|
||||
public void setDocumentation(Documentation d) {
|
||||
_documentation = d;
|
||||
}
|
||||
|
||||
public String getNameValue() {
|
||||
return getName();
|
||||
}
|
||||
|
||||
public String getNamespaceURI() {
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
public QName getWSDLElementName() {
|
||||
return getElementName();
|
||||
}
|
||||
|
||||
public void addExtension(TWSDLExtension e) {
|
||||
_helper.addExtension(e);
|
||||
}
|
||||
|
||||
public Iterable<TWSDLExtension> extensions() {
|
||||
return _helper.extensions();
|
||||
}
|
||||
|
||||
public TWSDLExtensible getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
public void withAllSubEntitiesDo(EntityAction action) {
|
||||
_helper.withAllSubEntitiesDo(action);
|
||||
}
|
||||
|
||||
public void accept(WSDLDocumentVisitor visitor) throws Exception {
|
||||
visitor.preVisit(this);
|
||||
_helper.accept(visitor);
|
||||
visitor.postVisit(this);
|
||||
}
|
||||
|
||||
public void validateThis() {
|
||||
}
|
||||
|
||||
|
||||
public void setParent(TWSDLExtensible parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
private TWSDLExtensible parent;
|
||||
private ExtensibilityHelper _helper;
|
||||
private Documentation _documentation;
|
||||
private String _name;
|
||||
}
|
||||
@@ -0,0 +1,237 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document;
|
||||
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible;
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.*;
|
||||
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Entity corresponding to the "definitions" WSDL element.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class Definitions extends Entity implements Defining, TWSDLExtensible {
|
||||
|
||||
public Definitions(AbstractDocument document, Locator locator) {
|
||||
super(locator);
|
||||
_document = document;
|
||||
_bindings = new ArrayList();
|
||||
_imports = new ArrayList();
|
||||
_messages = new ArrayList();
|
||||
_portTypes = new ArrayList();
|
||||
_services = new ArrayList();
|
||||
_importedNamespaces = new HashSet();
|
||||
_helper = new ExtensibilityHelper();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return _name;
|
||||
}
|
||||
|
||||
public void setName(String s) {
|
||||
_name = s;
|
||||
}
|
||||
|
||||
public String getTargetNamespaceURI() {
|
||||
return _targetNsURI;
|
||||
}
|
||||
|
||||
public void setTargetNamespaceURI(String s) {
|
||||
_targetNsURI = s;
|
||||
}
|
||||
|
||||
public void setTypes(Types t) {
|
||||
_types = t;
|
||||
}
|
||||
|
||||
public Types getTypes() {
|
||||
return _types;
|
||||
}
|
||||
|
||||
public void add(Message m) {
|
||||
_document.define(m);
|
||||
_messages.add(m);
|
||||
}
|
||||
|
||||
public void add(PortType p) {
|
||||
_document.define(p);
|
||||
_portTypes.add(p);
|
||||
}
|
||||
|
||||
public void add(Binding b) {
|
||||
_document.define(b);
|
||||
_bindings.add(b);
|
||||
}
|
||||
|
||||
public void add(Service s) {
|
||||
_document.define(s);
|
||||
_services.add(s);
|
||||
}
|
||||
|
||||
public void addServiceOveride(Service s) {
|
||||
_services.add(s);
|
||||
}
|
||||
|
||||
public void add(Import i) {
|
||||
_imports.add(i);
|
||||
_importedNamespaces.add(i.getNamespace());
|
||||
}
|
||||
|
||||
public Iterator imports() {
|
||||
return _imports.iterator();
|
||||
}
|
||||
|
||||
public Iterator messages() {
|
||||
return _messages.iterator();
|
||||
}
|
||||
|
||||
public Iterator portTypes() {
|
||||
return _portTypes.iterator();
|
||||
}
|
||||
|
||||
public Iterator bindings() {
|
||||
return _bindings.iterator();
|
||||
}
|
||||
|
||||
public Iterator<Service> services() {
|
||||
return _services.iterator();
|
||||
}
|
||||
|
||||
public String getNameValue() {
|
||||
return getName();
|
||||
}
|
||||
|
||||
public String getNamespaceURI() {
|
||||
return getTargetNamespaceURI();
|
||||
}
|
||||
|
||||
public QName getWSDLElementName() {
|
||||
return WSDLConstants.QNAME_DEFINITIONS;
|
||||
}
|
||||
|
||||
public Documentation getDocumentation() {
|
||||
return _documentation;
|
||||
}
|
||||
|
||||
public void setDocumentation(Documentation d) {
|
||||
_documentation = d;
|
||||
}
|
||||
|
||||
public void addExtension(TWSDLExtension e) {
|
||||
_helper.addExtension(e);
|
||||
}
|
||||
|
||||
public Iterable<TWSDLExtension> extensions() {
|
||||
return _helper.extensions();
|
||||
}
|
||||
|
||||
/**
|
||||
* wsdl:definition is the root hence no parent so return null.
|
||||
*/
|
||||
public TWSDLExtensible getParent() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void withAllSubEntitiesDo(EntityAction action) {
|
||||
if (_types != null) {
|
||||
action.perform(_types);
|
||||
}
|
||||
for (Iterator iter = _messages.iterator(); iter.hasNext();) {
|
||||
action.perform((Entity) iter.next());
|
||||
}
|
||||
for (Iterator iter = _portTypes.iterator(); iter.hasNext();) {
|
||||
action.perform((Entity) iter.next());
|
||||
}
|
||||
for (Iterator iter = _bindings.iterator(); iter.hasNext();) {
|
||||
action.perform((Entity) iter.next());
|
||||
}
|
||||
for (Iterator iter = _services.iterator(); iter.hasNext();) {
|
||||
action.perform((Entity) iter.next());
|
||||
}
|
||||
for (Iterator iter = _imports.iterator(); iter.hasNext();) {
|
||||
action.perform((Entity) iter.next());
|
||||
}
|
||||
_helper.withAllSubEntitiesDo(action);
|
||||
}
|
||||
|
||||
public void accept(WSDLDocumentVisitor visitor) throws Exception {
|
||||
visitor.preVisit(this);
|
||||
|
||||
for (Iterator iter = _imports.iterator(); iter.hasNext();) {
|
||||
((Import) iter.next()).accept(visitor);
|
||||
}
|
||||
|
||||
if (_types != null) {
|
||||
_types.accept(visitor);
|
||||
}
|
||||
|
||||
for (Iterator iter = _messages.iterator(); iter.hasNext();) {
|
||||
((Message) iter.next()).accept(visitor);
|
||||
}
|
||||
for (Iterator iter = _portTypes.iterator(); iter.hasNext();) {
|
||||
((PortType) iter.next()).accept(visitor);
|
||||
}
|
||||
for (Iterator iter = _bindings.iterator(); iter.hasNext();) {
|
||||
((Binding) iter.next()).accept(visitor);
|
||||
}
|
||||
for (Iterator iter = _services.iterator(); iter.hasNext();) {
|
||||
((Service) iter.next()).accept(visitor);
|
||||
}
|
||||
|
||||
_helper.accept(visitor);
|
||||
visitor.postVisit(this);
|
||||
}
|
||||
|
||||
public void validateThis() {
|
||||
}
|
||||
|
||||
public Map resolveBindings() {
|
||||
return _document.getMap(Kinds.BINDING);
|
||||
}
|
||||
|
||||
private AbstractDocument _document;
|
||||
private ExtensibilityHelper _helper;
|
||||
private Documentation _documentation;
|
||||
private String _name;
|
||||
private String _targetNsURI;
|
||||
private Types _types;
|
||||
private List _messages;
|
||||
private List _portTypes;
|
||||
private List _bindings;
|
||||
private List<Service> _services;
|
||||
private List _imports;
|
||||
private Set _importedNamespaces;
|
||||
|
||||
public QName getElementName() {
|
||||
return getWSDLElementName();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document;
|
||||
|
||||
/**
|
||||
* Entity corresponding to the "documentation" WSDL element.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class Documentation {
|
||||
|
||||
public Documentation(String s) {
|
||||
content = s;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String s) {
|
||||
content = s;
|
||||
}
|
||||
|
||||
public void accept(WSDLDocumentVisitor visitor) throws Exception {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
private String content;
|
||||
}
|
||||
167
jdkSrc/jdk8/com/sun/tools/internal/ws/wsdl/document/Fault.java
Normal file
167
jdkSrc/jdk8/com/sun/tools/internal/ws/wsdl/document/Fault.java
Normal file
@@ -0,0 +1,167 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document;
|
||||
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible;
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.*;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* Entity corresponding to the "fault" child element of a port type operation.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class Fault extends Entity implements TWSDLExtensible {
|
||||
|
||||
public Fault(Locator locator) {
|
||||
super(locator);
|
||||
_helper = new ExtensibilityHelper();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return _name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
_name = name;
|
||||
}
|
||||
|
||||
public QName getMessage() {
|
||||
return _message;
|
||||
}
|
||||
|
||||
public void setMessage(QName n) {
|
||||
_message = n;
|
||||
}
|
||||
|
||||
public Message resolveMessage(AbstractDocument document) {
|
||||
return (Message) document.find(Kinds.MESSAGE, _message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public QName getElementName() {
|
||||
return WSDLConstants.QNAME_FAULT;
|
||||
}
|
||||
|
||||
public Documentation getDocumentation() {
|
||||
return _documentation;
|
||||
}
|
||||
|
||||
public void setDocumentation(Documentation d) {
|
||||
_documentation = d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void withAllQNamesDo(QNameAction action) {
|
||||
if (_message != null) {
|
||||
action.perform(_message);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void withAllEntityReferencesDo(EntityReferenceAction action) {
|
||||
super.withAllEntityReferencesDo(action);
|
||||
if (_message != null) {
|
||||
action.perform(Kinds.MESSAGE, _message);
|
||||
}
|
||||
}
|
||||
|
||||
public void accept(WSDLDocumentVisitor visitor) throws Exception {
|
||||
visitor.preVisit(this);
|
||||
visitor.postVisit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateThis() {
|
||||
if (_name == null) {
|
||||
failValidation("validation.missingRequiredAttribute", "name");
|
||||
}
|
||||
if (_message == null) {
|
||||
failValidation("validation.missingRequiredAttribute", "message");
|
||||
}
|
||||
}
|
||||
|
||||
private Documentation _documentation;
|
||||
private String _name;
|
||||
private QName _message;
|
||||
private String _action;
|
||||
private ExtensibilityHelper _helper;
|
||||
|
||||
@Override
|
||||
public String getNameValue() {
|
||||
return getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNamespaceURI() {
|
||||
return (parent == null) ? null : parent.getNamespaceURI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public QName getWSDLElementName() {
|
||||
return getElementName();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see TWSDLExtensible#addExtension(ExtensionImpl)
|
||||
*/
|
||||
@Override
|
||||
public void addExtension(TWSDLExtension e) {
|
||||
_helper.addExtension(e);
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see TWSDLExtensible#extensions()
|
||||
*/
|
||||
@Override
|
||||
public Iterable<TWSDLExtension> extensions() {
|
||||
return _helper.extensions();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TWSDLExtensible getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
|
||||
public void setParent(TWSDLExtensible parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
private TWSDLExtensible parent;
|
||||
|
||||
public String getAction() {
|
||||
return _action;
|
||||
}
|
||||
|
||||
public void setAction(String _action) {
|
||||
this._action = _action;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document;
|
||||
|
||||
import com.sun.tools.internal.ws.wsdl.framework.Entity;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* Entity corresponding to the "import" WSDL element.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class Import extends Entity{
|
||||
|
||||
public Import(Locator locator) {
|
||||
super(locator);
|
||||
}
|
||||
|
||||
public String getNamespace() {
|
||||
return _namespace;
|
||||
}
|
||||
|
||||
public void setNamespace(String s) {
|
||||
_namespace = s;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return _location;
|
||||
}
|
||||
|
||||
public void setLocation(String s) {
|
||||
_location = s;
|
||||
}
|
||||
|
||||
public QName getElementName() {
|
||||
return WSDLConstants.QNAME_IMPORT;
|
||||
}
|
||||
|
||||
public Documentation getDocumentation() {
|
||||
return _documentation;
|
||||
}
|
||||
|
||||
public void setDocumentation(Documentation d) {
|
||||
_documentation = d;
|
||||
}
|
||||
|
||||
public void accept(WSDLDocumentVisitor visitor) throws Exception {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
public void validateThis() {
|
||||
if (_location == null) {
|
||||
failValidation("validation.missingRequiredAttribute", "location");
|
||||
}
|
||||
if (_namespace == null) {
|
||||
failValidation("validation.missingRequiredAttribute", "namespace");
|
||||
}
|
||||
}
|
||||
|
||||
private Documentation _documentation;
|
||||
private String _location;
|
||||
private String _namespace;
|
||||
}
|
||||
150
jdkSrc/jdk8/com/sun/tools/internal/ws/wsdl/document/Input.java
Normal file
150
jdkSrc/jdk8/com/sun/tools/internal/ws/wsdl/document/Input.java
Normal file
@@ -0,0 +1,150 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document;
|
||||
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible;
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.*;
|
||||
import com.sun.tools.internal.ws.wscompile.ErrorReceiver;
|
||||
import com.sun.tools.internal.ws.wscompile.AbortException;
|
||||
import com.sun.tools.internal.ws.resources.WsdlMessages;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* Entity corresponding to the "input" child element of a port type operation.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class Input extends Entity implements TWSDLExtensible {
|
||||
|
||||
public Input(Locator locator, ErrorReceiver errReceiver) {
|
||||
super(locator);
|
||||
this.errorReceiver = errReceiver;
|
||||
_helper = new ExtensibilityHelper();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return _name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
_name = name;
|
||||
}
|
||||
|
||||
public QName getMessage() {
|
||||
return _message;
|
||||
}
|
||||
|
||||
public void setMessage(QName n) {
|
||||
_message = n;
|
||||
}
|
||||
|
||||
public Message resolveMessage(AbstractDocument document) {
|
||||
return (Message) document.find(Kinds.MESSAGE, _message);
|
||||
}
|
||||
|
||||
public QName getElementName() {
|
||||
return WSDLConstants.QNAME_INPUT;
|
||||
}
|
||||
|
||||
public Documentation getDocumentation() {
|
||||
return _documentation;
|
||||
}
|
||||
|
||||
public void setDocumentation(Documentation d) {
|
||||
_documentation = d;
|
||||
}
|
||||
|
||||
public void withAllQNamesDo(QNameAction action) {
|
||||
if (_message != null) {
|
||||
action.perform(_message);
|
||||
}
|
||||
}
|
||||
|
||||
public void withAllEntityReferencesDo(EntityReferenceAction action) {
|
||||
super.withAllEntityReferencesDo(action);
|
||||
if (_message != null) {
|
||||
action.perform(Kinds.MESSAGE, _message);
|
||||
}
|
||||
}
|
||||
|
||||
public void accept(WSDLDocumentVisitor visitor) throws Exception {
|
||||
visitor.preVisit(this);
|
||||
visitor.postVisit(this);
|
||||
}
|
||||
|
||||
public void validateThis() {
|
||||
if (_message == null) {
|
||||
errorReceiver.error(getLocator(), WsdlMessages.VALIDATION_MISSING_REQUIRED_ATTRIBUTE("name", "wsdl:message"));
|
||||
throw new AbortException();
|
||||
}
|
||||
}
|
||||
|
||||
private Documentation _documentation;
|
||||
private String _name;
|
||||
private QName _message;
|
||||
private String _action;
|
||||
private ExtensibilityHelper _helper;
|
||||
private TWSDLExtensible parent;
|
||||
|
||||
public void addExtension(TWSDLExtension e) {
|
||||
_helper.addExtension(e);
|
||||
}
|
||||
|
||||
public QName getWSDLElementName() {
|
||||
return getElementName();
|
||||
}
|
||||
|
||||
public TWSDLExtensible getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
public void setParent(TWSDLExtensible parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public String getNamespaceURI() {
|
||||
return getElementName().getNamespaceURI();
|
||||
}
|
||||
|
||||
public String getNameValue() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Iterable<? extends TWSDLExtension> extensions() {
|
||||
return _helper.extensions();
|
||||
}
|
||||
|
||||
public String getAction() {
|
||||
return _action;
|
||||
}
|
||||
|
||||
public void setAction(String _action) {
|
||||
this._action = _action;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document;
|
||||
|
||||
import com.sun.tools.internal.ws.wsdl.framework.Kind;
|
||||
|
||||
/**
|
||||
* Enumeration of the kind of entities that can be defined in a WSDL "definitions" element.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class Kinds {
|
||||
public static final Kind BINDING = new Kind("wsdl:binding");
|
||||
public static final Kind MESSAGE = new Kind("wsdl:message");
|
||||
public static final Kind PORT = new Kind("wsdl:port");
|
||||
public static final Kind PORT_TYPE = new Kind("wsdl:portType");
|
||||
public static final Kind SERVICE = new Kind("wsdl:service");
|
||||
|
||||
private Kinds() {
|
||||
}
|
||||
}
|
||||
121
jdkSrc/jdk8/com/sun/tools/internal/ws/wsdl/document/Message.java
Normal file
121
jdkSrc/jdk8/com/sun/tools/internal/ws/wsdl/document/Message.java
Normal file
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document;
|
||||
|
||||
import com.sun.tools.internal.ws.wsdl.framework.*;
|
||||
import com.sun.tools.internal.ws.wscompile.ErrorReceiver;
|
||||
import com.sun.tools.internal.ws.wscompile.AbortException;
|
||||
import com.sun.tools.internal.ws.resources.WsdlMessages;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Entity corresponding to the "message" WSDL element.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class Message extends GlobalEntity {
|
||||
|
||||
public Message(Defining defining, Locator locator, ErrorReceiver errReceiver) {
|
||||
super(defining, locator, errReceiver);
|
||||
_parts = new ArrayList<MessagePart>();
|
||||
_partsByName = new HashMap<String, MessagePart>();
|
||||
}
|
||||
|
||||
public void add(MessagePart part) {
|
||||
if (_partsByName.get(part.getName()) != null){
|
||||
errorReceiver.error(part.getLocator(), WsdlMessages.VALIDATION_DUPLICATE_PART_NAME(getName(), part.getName()));
|
||||
throw new AbortException();
|
||||
}
|
||||
|
||||
if(part.getDescriptor() != null && part.getDescriptorKind() != null) {
|
||||
_partsByName.put(part.getName(), part);
|
||||
_parts.add(part);
|
||||
} else
|
||||
errorReceiver.warning(part.getLocator(), WsdlMessages.PARSING_ELEMENT_OR_TYPE_REQUIRED(part.getName()));
|
||||
}
|
||||
|
||||
public Iterator<MessagePart> parts() {
|
||||
return _parts.iterator();
|
||||
}
|
||||
|
||||
public List<MessagePart> getParts(){
|
||||
return _parts;
|
||||
}
|
||||
|
||||
public MessagePart getPart(String name) {
|
||||
return _partsByName.get(name);
|
||||
}
|
||||
|
||||
public int numParts() {
|
||||
return _parts.size();
|
||||
}
|
||||
|
||||
public Kind getKind() {
|
||||
return Kinds.MESSAGE;
|
||||
}
|
||||
|
||||
public QName getElementName() {
|
||||
return WSDLConstants.QNAME_MESSAGE;
|
||||
}
|
||||
|
||||
public Documentation getDocumentation() {
|
||||
return _documentation;
|
||||
}
|
||||
|
||||
public void setDocumentation(Documentation d) {
|
||||
_documentation = d;
|
||||
}
|
||||
|
||||
public void withAllSubEntitiesDo(EntityAction action) {
|
||||
super.withAllSubEntitiesDo(action);
|
||||
|
||||
for (Iterator iter = _parts.iterator(); iter.hasNext();) {
|
||||
action.perform((Entity) iter.next());
|
||||
}
|
||||
}
|
||||
|
||||
public void accept(WSDLDocumentVisitor visitor) throws Exception {
|
||||
visitor.preVisit(this);
|
||||
for (Iterator<MessagePart> iter = _parts.iterator(); iter.hasNext();) {
|
||||
iter.next().accept(visitor);
|
||||
}
|
||||
visitor.postVisit(this);
|
||||
}
|
||||
|
||||
public void validateThis() {
|
||||
if (getName() == null) {
|
||||
errorReceiver.error(getLocator(), WsdlMessages.VALIDATION_MISSING_REQUIRED_ATTRIBUTE("name", "wsdl:message"));
|
||||
throw new AbortException();
|
||||
}
|
||||
}
|
||||
|
||||
private Documentation _documentation;
|
||||
private List<MessagePart> _parts;
|
||||
private Map<String, MessagePart> _partsByName;
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document;
|
||||
|
||||
import com.sun.tools.internal.ws.wsdl.framework.Entity;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.EntityReferenceAction;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.Kind;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.QNameAction;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.jws.WebParam.Mode;
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* Entity corresponding to a WSDL message part.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class MessagePart extends Entity {
|
||||
|
||||
public static final int SOAP_BODY_BINDING = 1;
|
||||
public static final int SOAP_HEADER_BINDING = 2;
|
||||
public static final int SOAP_HEADERFAULT_BINDING = 3;
|
||||
public static final int SOAP_FAULT_BINDING = 4;
|
||||
public static final int WSDL_MIME_BINDING = 5;
|
||||
public static final int PART_NOT_BOUNDED = -1;
|
||||
|
||||
public MessagePart(Locator locator) {
|
||||
super(locator);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return _name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
_name = name;
|
||||
}
|
||||
|
||||
public QName getDescriptor() {
|
||||
return _descriptor;
|
||||
}
|
||||
|
||||
public void setDescriptor(QName n) {
|
||||
_descriptor = n;
|
||||
}
|
||||
|
||||
public Kind getDescriptorKind() {
|
||||
return _descriptorKind;
|
||||
}
|
||||
|
||||
public void setDescriptorKind(Kind k) {
|
||||
_descriptorKind = k;
|
||||
}
|
||||
|
||||
public QName getElementName() {
|
||||
return WSDLConstants.QNAME_PART;
|
||||
}
|
||||
|
||||
public int getBindingExtensibilityElementKind(){
|
||||
return _bindingKind;
|
||||
}
|
||||
|
||||
public void setBindingExtensibilityElementKind(int kind) {
|
||||
_bindingKind = kind;
|
||||
}
|
||||
|
||||
public void withAllQNamesDo(QNameAction action) {
|
||||
if (_descriptor != null) {
|
||||
action.perform(_descriptor);
|
||||
}
|
||||
}
|
||||
|
||||
public void withAllEntityReferencesDo(EntityReferenceAction action) {
|
||||
super.withAllEntityReferencesDo(action);
|
||||
if (_descriptor != null && _descriptorKind != null) {
|
||||
action.perform(_descriptorKind, _descriptor);
|
||||
}
|
||||
}
|
||||
|
||||
public void accept(WSDLDocumentVisitor visitor) throws Exception {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
public void validateThis() {
|
||||
if(_descriptor != null && _descriptor.getLocalPart().equals("")){
|
||||
failValidation("validation.invalidElement", _descriptor.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public void setMode(Mode mode){
|
||||
this.mode = mode;
|
||||
}
|
||||
|
||||
public Mode getMode(){
|
||||
return mode;
|
||||
}
|
||||
|
||||
public boolean isINOUT(){
|
||||
if(mode!=null)
|
||||
return (mode == Mode.INOUT);
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isIN(){
|
||||
if(mode!=null)
|
||||
return (mode == Mode.IN);
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isOUT(){
|
||||
if(mode!=null)
|
||||
return (mode == Mode.OUT);
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setReturn(boolean ret){
|
||||
isRet=ret;
|
||||
}
|
||||
|
||||
public boolean isReturn(){
|
||||
return isRet;
|
||||
}
|
||||
|
||||
|
||||
private boolean isRet;
|
||||
private String _name;
|
||||
private QName _descriptor;
|
||||
private Kind _descriptorKind;
|
||||
private int _bindingKind;
|
||||
|
||||
private Mode mode;
|
||||
}
|
||||
@@ -0,0 +1,255 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document;
|
||||
|
||||
import com.sun.codemodel.internal.JClass;
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible;
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension;
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLOperation;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.Entity;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.EntityAction;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.ExtensibilityHelper;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Entity corresponding to the "operation" child element of a "portType" WSDL element.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class Operation extends Entity implements TWSDLOperation {
|
||||
|
||||
public Operation(Locator locator) {
|
||||
super(locator);
|
||||
_faults = new ArrayList<Fault>();
|
||||
_helper = new ExtensibilityHelper();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return _name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
_name = name;
|
||||
}
|
||||
|
||||
public String getUniqueKey() {
|
||||
if (_uniqueKey == null) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(_name);
|
||||
sb.append(' ');
|
||||
if (_input != null) {
|
||||
sb.append(_input.getName());
|
||||
} else {
|
||||
sb.append(_name);
|
||||
if (_style == OperationStyle.REQUEST_RESPONSE) {
|
||||
sb.append("Request");
|
||||
} else if (_style == OperationStyle.SOLICIT_RESPONSE) {
|
||||
sb.append("Response");
|
||||
}
|
||||
}
|
||||
sb.append(' ');
|
||||
if (_output != null) {
|
||||
sb.append(_output.getName());
|
||||
} else {
|
||||
sb.append(_name);
|
||||
if (_style == OperationStyle.SOLICIT_RESPONSE) {
|
||||
sb.append("Solicit");
|
||||
} else if (_style == OperationStyle.REQUEST_RESPONSE) {
|
||||
sb.append("Response");
|
||||
}
|
||||
}
|
||||
_uniqueKey = sb.toString();
|
||||
}
|
||||
|
||||
return _uniqueKey;
|
||||
}
|
||||
|
||||
public OperationStyle getStyle() {
|
||||
return _style;
|
||||
}
|
||||
|
||||
public void setStyle(OperationStyle s) {
|
||||
_style = s;
|
||||
}
|
||||
|
||||
public Input getInput() {
|
||||
return _input;
|
||||
}
|
||||
|
||||
public void setInput(Input i) {
|
||||
_input = i;
|
||||
}
|
||||
|
||||
public Output getOutput() {
|
||||
return _output;
|
||||
}
|
||||
|
||||
public void setOutput(Output o) {
|
||||
_output = o;
|
||||
}
|
||||
|
||||
public void addFault(Fault f) {
|
||||
_faults.add(f);
|
||||
}
|
||||
|
||||
public Iterable<Fault> faults() {
|
||||
return _faults;
|
||||
}
|
||||
|
||||
public String getParameterOrder() {
|
||||
return _parameterOrder;
|
||||
}
|
||||
|
||||
public void setParameterOrder(String s) {
|
||||
_parameterOrder = s;
|
||||
}
|
||||
|
||||
public QName getElementName() {
|
||||
return WSDLConstants.QNAME_OPERATION;
|
||||
}
|
||||
|
||||
public Documentation getDocumentation() {
|
||||
return _documentation;
|
||||
}
|
||||
|
||||
public void setDocumentation(Documentation d) {
|
||||
_documentation = d;
|
||||
}
|
||||
|
||||
public void withAllSubEntitiesDo(EntityAction action) {
|
||||
super.withAllSubEntitiesDo(action);
|
||||
|
||||
if (_input != null) {
|
||||
action.perform(_input);
|
||||
}
|
||||
if (_output != null) {
|
||||
action.perform(_output);
|
||||
}
|
||||
for (Fault _fault : _faults) {
|
||||
action.perform(_fault);
|
||||
}
|
||||
_helper.withAllSubEntitiesDo(action);
|
||||
}
|
||||
|
||||
public void accept(WSDLDocumentVisitor visitor) throws Exception {
|
||||
visitor.preVisit(this);
|
||||
if (_input != null) {
|
||||
_input.accept(visitor);
|
||||
}
|
||||
if (_output != null) {
|
||||
_output.accept(visitor);
|
||||
}
|
||||
for (Fault _fault : _faults) {
|
||||
_fault.accept(visitor);
|
||||
}
|
||||
visitor.postVisit(this);
|
||||
}
|
||||
|
||||
public void validateThis() {
|
||||
if (_name == null) {
|
||||
failValidation("validation.missingRequiredAttribute", "name");
|
||||
}
|
||||
if (_style == null) {
|
||||
failValidation("validation.missingRequiredProperty", "style");
|
||||
}
|
||||
|
||||
// verify operation style
|
||||
if (_style == OperationStyle.ONE_WAY) {
|
||||
if (_input == null) {
|
||||
failValidation("validation.missingRequiredSubEntity", "input");
|
||||
}
|
||||
if (_output != null) {
|
||||
failValidation("validation.invalidSubEntity", "output");
|
||||
}
|
||||
if (_faults != null && _faults.size() != 0) {
|
||||
failValidation("validation.invalidSubEntity", "fault");
|
||||
}
|
||||
} else if (_style == OperationStyle.NOTIFICATION) {
|
||||
if (_parameterOrder != null) {
|
||||
failValidation("validation.invalidAttribute", "parameterOrder");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getNameValue() {
|
||||
return getName();
|
||||
}
|
||||
|
||||
public String getNamespaceURI() {
|
||||
return parent.getNamespaceURI();
|
||||
}
|
||||
|
||||
public QName getWSDLElementName() {
|
||||
return getElementName();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see TWSDLExtensible#addExtension(ExtensionImpl)
|
||||
*/
|
||||
public void addExtension(TWSDLExtension e) {
|
||||
_helper.addExtension(e);
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see TWSDLExtensible#extensions()
|
||||
*/
|
||||
public Iterable<? extends TWSDLExtension> extensions() {
|
||||
return _helper.extensions();
|
||||
}
|
||||
|
||||
public TWSDLExtensible getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
public void setParent(TWSDLExtensible parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public Map<String, JClass> getFaults() {
|
||||
return unmodifiableFaultClassMap;
|
||||
}
|
||||
|
||||
public void putFault(String faultName, JClass exception){
|
||||
faultClassMap.put(faultName, exception);
|
||||
}
|
||||
|
||||
private TWSDLExtensible parent;
|
||||
private Documentation _documentation;
|
||||
private String _name;
|
||||
private Input _input;
|
||||
private Output _output;
|
||||
private List<Fault> _faults;
|
||||
private OperationStyle _style;
|
||||
private String _parameterOrder;
|
||||
private String _uniqueKey;
|
||||
private ExtensibilityHelper _helper;
|
||||
private final Map<String, JClass> faultClassMap = new HashMap<String, JClass>();
|
||||
private final Map<String, JClass> unmodifiableFaultClassMap = Collections.unmodifiableMap(faultClassMap);
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document;
|
||||
|
||||
/**
|
||||
* Enumeration of the supported WSDL operation styles.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public final class OperationStyle {
|
||||
|
||||
public static final OperationStyle ONE_WAY = new OperationStyle();
|
||||
public static final OperationStyle REQUEST_RESPONSE = new OperationStyle();
|
||||
public static final OperationStyle SOLICIT_RESPONSE = new OperationStyle();
|
||||
public static final OperationStyle NOTIFICATION = new OperationStyle();
|
||||
|
||||
private OperationStyle() {
|
||||
}
|
||||
}
|
||||
149
jdkSrc/jdk8/com/sun/tools/internal/ws/wsdl/document/Output.java
Normal file
149
jdkSrc/jdk8/com/sun/tools/internal/ws/wsdl/document/Output.java
Normal file
@@ -0,0 +1,149 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document;
|
||||
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible;
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.*;
|
||||
import com.sun.tools.internal.ws.wscompile.ErrorReceiver;
|
||||
import com.sun.tools.internal.ws.wscompile.AbortException;
|
||||
import com.sun.tools.internal.ws.resources.WsdlMessages;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* Entity corresponding to the "output" child element of a port type operation.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class Output extends Entity implements TWSDLExtensible {
|
||||
|
||||
public Output(Locator locator, ErrorReceiver errReceiver) {
|
||||
super(locator);
|
||||
this.errorReceiver = errReceiver;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return _name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
_name = name;
|
||||
}
|
||||
|
||||
public QName getMessage() {
|
||||
return _message;
|
||||
}
|
||||
|
||||
public void setMessage(QName n) {
|
||||
_message = n;
|
||||
}
|
||||
|
||||
public Message resolveMessage(AbstractDocument document) {
|
||||
return (Message) document.find(Kinds.MESSAGE, _message);
|
||||
}
|
||||
|
||||
public QName getElementName() {
|
||||
return WSDLConstants.QNAME_OUTPUT;
|
||||
}
|
||||
|
||||
public Documentation getDocumentation() {
|
||||
return _documentation;
|
||||
}
|
||||
|
||||
public void setDocumentation(Documentation d) {
|
||||
_documentation = d;
|
||||
}
|
||||
|
||||
public void withAllQNamesDo(QNameAction action) {
|
||||
if (_message != null) {
|
||||
action.perform(_message);
|
||||
}
|
||||
}
|
||||
|
||||
public void withAllEntityReferencesDo(EntityReferenceAction action) {
|
||||
super.withAllEntityReferencesDo(action);
|
||||
if (_message != null) {
|
||||
action.perform(Kinds.MESSAGE, _message);
|
||||
}
|
||||
}
|
||||
|
||||
public void accept(WSDLDocumentVisitor visitor) throws Exception {
|
||||
visitor.preVisit(this);
|
||||
visitor.postVisit(this);
|
||||
}
|
||||
|
||||
public void validateThis() {
|
||||
if (_message == null) {
|
||||
errorReceiver.error(getLocator(), WsdlMessages.VALIDATION_MISSING_REQUIRED_ATTRIBUTE("name", "wsdl:message"));
|
||||
throw new AbortException();
|
||||
}
|
||||
}
|
||||
|
||||
private Documentation _documentation;
|
||||
private String _name;
|
||||
private QName _message;
|
||||
private String _action;
|
||||
private ExtensibilityHelper _helper;
|
||||
private TWSDLExtensible parent;
|
||||
|
||||
public void addExtension(TWSDLExtension e) {
|
||||
_helper.addExtension(e);
|
||||
}
|
||||
|
||||
public QName getWSDLElementName() {
|
||||
return getElementName();
|
||||
}
|
||||
|
||||
public TWSDLExtensible getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
public void setParent(TWSDLExtensible parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public String getNamespaceURI() {
|
||||
return getElementName().getNamespaceURI();
|
||||
}
|
||||
|
||||
public String getNameValue() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Iterable<? extends TWSDLExtension> extensions() {
|
||||
return _helper.extensions();
|
||||
}
|
||||
|
||||
public String getAction() {
|
||||
return _action;
|
||||
}
|
||||
|
||||
public void setAction(String _action) {
|
||||
this._action = _action;
|
||||
}
|
||||
}
|
||||
159
jdkSrc/jdk8/com/sun/tools/internal/ws/wsdl/document/Port.java
Normal file
159
jdkSrc/jdk8/com/sun/tools/internal/ws/wsdl/document/Port.java
Normal file
@@ -0,0 +1,159 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document;
|
||||
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible;
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.*;
|
||||
import com.sun.tools.internal.ws.resources.WsdlMessages;
|
||||
import com.sun.tools.internal.ws.wscompile.AbortException;
|
||||
import com.sun.tools.internal.ws.wscompile.ErrorReceiver;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* Entity corresponding to the "port" WSDL element.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class Port extends GlobalEntity implements TWSDLExtensible {
|
||||
|
||||
public Port(Defining defining, Locator locator, ErrorReceiver errReceiver) {
|
||||
super(defining, locator, errReceiver);
|
||||
_helper = new ExtensibilityHelper();
|
||||
}
|
||||
|
||||
public Service getService() {
|
||||
return _service;
|
||||
}
|
||||
|
||||
public void setService(Service s) {
|
||||
_service = s;
|
||||
}
|
||||
|
||||
public QName getBinding() {
|
||||
return _binding;
|
||||
}
|
||||
|
||||
public void setBinding(QName n) {
|
||||
_binding = n;
|
||||
}
|
||||
|
||||
public Binding resolveBinding(AbstractDocument document) {
|
||||
try{
|
||||
return (Binding) document.find(Kinds.BINDING, _binding);
|
||||
} catch (NoSuchEntityException e) {
|
||||
errorReceiver.error(getLocator(), WsdlMessages.ENTITY_NOT_FOUND_BINDING(_binding, new QName(getNamespaceURI(), getName())));
|
||||
throw new AbortException();
|
||||
}
|
||||
}
|
||||
|
||||
public Kind getKind() {
|
||||
return Kinds.PORT;
|
||||
}
|
||||
|
||||
public String getNameValue() {
|
||||
return getName();
|
||||
}
|
||||
|
||||
public String getNamespaceURI() {
|
||||
return getDefining().getTargetNamespaceURI();
|
||||
}
|
||||
|
||||
public QName getWSDLElementName() {
|
||||
return WSDLConstants.QNAME_PORT;
|
||||
}
|
||||
|
||||
public Documentation getDocumentation() {
|
||||
return _documentation;
|
||||
}
|
||||
|
||||
public void setDocumentation(Documentation d) {
|
||||
_documentation = d;
|
||||
}
|
||||
|
||||
public void withAllQNamesDo(QNameAction action) {
|
||||
super.withAllQNamesDo(action);
|
||||
|
||||
if (_binding != null) {
|
||||
action.perform(_binding);
|
||||
}
|
||||
}
|
||||
|
||||
public void withAllEntityReferencesDo(EntityReferenceAction action) {
|
||||
super.withAllEntityReferencesDo(action);
|
||||
if (_binding != null) {
|
||||
action.perform(Kinds.BINDING, _binding);
|
||||
}
|
||||
}
|
||||
|
||||
public void accept(WSDLDocumentVisitor visitor) throws Exception {
|
||||
visitor.preVisit(this);
|
||||
_helper.accept(visitor);
|
||||
visitor.postVisit(this);
|
||||
}
|
||||
|
||||
public void validateThis() {
|
||||
if (getName() == null) {
|
||||
failValidation("validation.missingRequiredAttribute", "name");
|
||||
}
|
||||
if (_binding == null) {
|
||||
failValidation("validation.missingRequiredAttribute", "binding");
|
||||
}
|
||||
}
|
||||
|
||||
public void addExtension(TWSDLExtension e) {
|
||||
_helper.addExtension(e);
|
||||
}
|
||||
|
||||
public Iterable<TWSDLExtension> extensions() {
|
||||
return _helper.extensions();
|
||||
}
|
||||
|
||||
public TWSDLExtensible getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
public void setParent(TWSDLExtensible parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public void withAllSubEntitiesDo(EntityAction action) {
|
||||
_helper.withAllSubEntitiesDo(action);
|
||||
}
|
||||
|
||||
private ExtensibilityHelper _helper;
|
||||
private Documentation _documentation;
|
||||
private Service _service;
|
||||
private QName _binding;
|
||||
|
||||
public QName getElementName() {
|
||||
return getWSDLElementName();
|
||||
}
|
||||
|
||||
private TWSDLExtensible parent;
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document;
|
||||
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible;
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.*;
|
||||
import com.sun.tools.internal.ws.wscompile.ErrorReceiver;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Entity corresponding to the "portType" WSDL element.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class PortType extends GlobalEntity implements TWSDLExtensible {
|
||||
|
||||
public PortType(Defining defining, Locator locator, ErrorReceiver errReceiver) {
|
||||
super(defining, locator, errReceiver);
|
||||
_operations = new ArrayList();
|
||||
_operationKeys = new HashSet();
|
||||
_helper = new ExtensibilityHelper();
|
||||
}
|
||||
|
||||
public void add(Operation operation) {
|
||||
String key = operation.getUniqueKey();
|
||||
if (_operationKeys.contains(key))
|
||||
throw new ValidationException(
|
||||
"validation.ambiguousName",
|
||||
operation.getName());
|
||||
_operationKeys.add(key);
|
||||
_operations.add(operation);
|
||||
}
|
||||
|
||||
public Iterator operations() {
|
||||
return _operations.iterator();
|
||||
}
|
||||
|
||||
public Set getOperationsNamed(String s) {
|
||||
Set result = new HashSet();
|
||||
for (Iterator iter = _operations.iterator(); iter.hasNext();) {
|
||||
Operation operation = (Operation) iter.next();
|
||||
if (operation.getName().equals(s)) {
|
||||
result.add(operation);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public Kind getKind() {
|
||||
return Kinds.PORT_TYPE;
|
||||
}
|
||||
|
||||
public QName getElementName() {
|
||||
return WSDLConstants.QNAME_PORT_TYPE;
|
||||
}
|
||||
|
||||
public Documentation getDocumentation() {
|
||||
return _documentation;
|
||||
}
|
||||
|
||||
public void setDocumentation(Documentation d) {
|
||||
_documentation = d;
|
||||
}
|
||||
|
||||
public void withAllSubEntitiesDo(EntityAction action) {
|
||||
super.withAllSubEntitiesDo(action);
|
||||
|
||||
for (Iterator iter = _operations.iterator(); iter.hasNext();) {
|
||||
action.perform((Entity) iter.next());
|
||||
}
|
||||
_helper.withAllSubEntitiesDo(action);
|
||||
}
|
||||
|
||||
public void accept(WSDLDocumentVisitor visitor) throws Exception {
|
||||
visitor.preVisit(this);
|
||||
_helper.accept(visitor);
|
||||
for (Iterator iter = _operations.iterator(); iter.hasNext();) {
|
||||
((Operation) iter.next()).accept(visitor);
|
||||
}
|
||||
visitor.postVisit(this);
|
||||
}
|
||||
|
||||
public void validateThis() {
|
||||
if (getName() == null) {
|
||||
failValidation("validation.missingRequiredAttribute", "name");
|
||||
}
|
||||
}
|
||||
|
||||
public String getNameValue() {
|
||||
return getName();
|
||||
}
|
||||
|
||||
public String getNamespaceURI() {
|
||||
return getDefining().getTargetNamespaceURI();
|
||||
}
|
||||
|
||||
public QName getWSDLElementName() {
|
||||
return getElementName();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see TWSDLExtensible#addExtension(ExtensionImpl)
|
||||
*/
|
||||
public void addExtension(TWSDLExtension e) {
|
||||
_helper.addExtension(e);
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see TWSDLExtensible#extensions()
|
||||
*/
|
||||
public Iterable<TWSDLExtension> extensions() {
|
||||
return _helper.extensions();
|
||||
}
|
||||
|
||||
public TWSDLExtensible getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
public void setParent(TWSDLExtensible parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
private TWSDLExtensible parent;
|
||||
private Documentation _documentation;
|
||||
private List _operations;
|
||||
private Set _operationKeys;
|
||||
private ExtensibilityHelper _helper;
|
||||
}
|
||||
126
jdkSrc/jdk8/com/sun/tools/internal/ws/wsdl/document/Service.java
Normal file
126
jdkSrc/jdk8/com/sun/tools/internal/ws/wsdl/document/Service.java
Normal file
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document;
|
||||
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible;
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.*;
|
||||
import com.sun.tools.internal.ws.wscompile.ErrorReceiver;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Entity corresponding to the "service" WSDL element.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class Service extends GlobalEntity implements TWSDLExtensible {
|
||||
|
||||
public Service(Defining defining, Locator locator, ErrorReceiver errReceiver) {
|
||||
super(defining, locator, errReceiver);
|
||||
_ports = new ArrayList();
|
||||
_helper = new ExtensibilityHelper();
|
||||
}
|
||||
|
||||
public void add(Port port) {
|
||||
port.setService(this);
|
||||
_ports.add(port);
|
||||
}
|
||||
|
||||
public Iterator <Port> ports() {
|
||||
return _ports.iterator();
|
||||
}
|
||||
|
||||
public Kind getKind() {
|
||||
return Kinds.SERVICE;
|
||||
}
|
||||
|
||||
public QName getElementName() {
|
||||
return WSDLConstants.QNAME_SERVICE;
|
||||
}
|
||||
|
||||
public Documentation getDocumentation() {
|
||||
return _documentation;
|
||||
}
|
||||
|
||||
public void setDocumentation(Documentation d) {
|
||||
_documentation = d;
|
||||
}
|
||||
|
||||
public void withAllSubEntitiesDo(EntityAction action) {
|
||||
for (Iterator iter = _ports.iterator(); iter.hasNext();) {
|
||||
action.perform((Entity) iter.next());
|
||||
}
|
||||
_helper.withAllSubEntitiesDo(action);
|
||||
}
|
||||
|
||||
public void accept(WSDLDocumentVisitor visitor) throws Exception {
|
||||
visitor.preVisit(this);
|
||||
for (Iterator iter = _ports.iterator(); iter.hasNext();) {
|
||||
((Port) iter.next()).accept(visitor);
|
||||
}
|
||||
_helper.accept(visitor);
|
||||
visitor.postVisit(this);
|
||||
}
|
||||
|
||||
public void validateThis() {
|
||||
if (getName() == null) {
|
||||
failValidation("validation.missingRequiredAttribute", "name");
|
||||
}
|
||||
}
|
||||
|
||||
public String getNameValue() {
|
||||
return getName();
|
||||
}
|
||||
|
||||
public String getNamespaceURI() {
|
||||
return getDefining().getTargetNamespaceURI();
|
||||
}
|
||||
|
||||
public QName getWSDLElementName() {
|
||||
return getElementName();
|
||||
}
|
||||
|
||||
public void addExtension(TWSDLExtension e) {
|
||||
_helper.addExtension(e);
|
||||
}
|
||||
|
||||
public Iterable<TWSDLExtension> extensions() {
|
||||
return _helper.extensions();
|
||||
}
|
||||
|
||||
public TWSDLExtensible getParent() {
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
private ExtensibilityHelper _helper;
|
||||
private Documentation _documentation;
|
||||
private List <Port> _ports;
|
||||
}
|
||||
122
jdkSrc/jdk8/com/sun/tools/internal/ws/wsdl/document/Types.java
Normal file
122
jdkSrc/jdk8/com/sun/tools/internal/ws/wsdl/document/Types.java
Normal file
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document;
|
||||
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible;
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.Entity;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.EntityAction;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.ExtensibilityHelper;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.ExtensionVisitor;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* Entity corresponding to the "types" WSDL element.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class Types extends Entity implements TWSDLExtensible {
|
||||
|
||||
public Types(Locator locator) {
|
||||
super(locator);
|
||||
_helper = new ExtensibilityHelper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public QName getElementName() {
|
||||
return WSDLConstants.QNAME_TYPES;
|
||||
}
|
||||
|
||||
public Documentation getDocumentation() {
|
||||
return _documentation;
|
||||
}
|
||||
|
||||
public void setDocumentation(Documentation d) {
|
||||
_documentation = d;
|
||||
}
|
||||
|
||||
public void accept(WSDLDocumentVisitor visitor) throws Exception {
|
||||
visitor.preVisit(this);
|
||||
_helper.accept(visitor);
|
||||
visitor.postVisit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateThis() {
|
||||
}
|
||||
|
||||
/**
|
||||
* wsdl:type does not have any name attribute
|
||||
*/
|
||||
@Override
|
||||
public String getNameValue() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNamespaceURI() {
|
||||
return (parent == null) ? null : parent.getNamespaceURI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public QName getWSDLElementName() {
|
||||
return getElementName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addExtension(TWSDLExtension e) {
|
||||
_helper.addExtension(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<TWSDLExtension> extensions() {
|
||||
return _helper.extensions();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TWSDLExtensible getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
public void setParent(TWSDLExtensible parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void withAllSubEntitiesDo(EntityAction action) {
|
||||
_helper.withAllSubEntitiesDo(action);
|
||||
}
|
||||
|
||||
public void accept(ExtensionVisitor visitor) throws Exception {
|
||||
_helper.accept(visitor);
|
||||
}
|
||||
|
||||
private TWSDLExtensible parent;
|
||||
private ExtensibilityHelper _helper;
|
||||
private Documentation _documentation;
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* Interface defining WSDL-related constants.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public interface WSDLConstants {
|
||||
|
||||
// namespace URIs
|
||||
static final String NS_XMLNS = "http://www.w3.org/2000/xmlns/";
|
||||
static final String NS_WSDL = "http://schemas.xmlsoap.org/wsdl/";
|
||||
|
||||
// QNames
|
||||
static final QName QNAME_BINDING = new QName(NS_WSDL, "binding");
|
||||
static final QName QNAME_DEFINITIONS = new QName(NS_WSDL, "definitions");
|
||||
static final QName QNAME_DOCUMENTATION = new QName(NS_WSDL, "documentation");
|
||||
static final QName QNAME_FAULT = new QName(NS_WSDL, "fault");
|
||||
static final QName QNAME_IMPORT = new QName(NS_WSDL, "import");
|
||||
static final QName QNAME_INPUT = new QName(NS_WSDL, "input");
|
||||
static final QName QNAME_MESSAGE = new QName(NS_WSDL, "message");
|
||||
static final QName QNAME_OPERATION = new QName(NS_WSDL, "operation");
|
||||
static final QName QNAME_OUTPUT = new QName(NS_WSDL, "output");
|
||||
static final QName QNAME_PART = new QName(NS_WSDL, "part");
|
||||
static final QName QNAME_PORT = new QName(NS_WSDL, "port");
|
||||
static final QName QNAME_PORT_TYPE = new QName(NS_WSDL, "portType");
|
||||
static final QName QNAME_SERVICE = new QName(NS_WSDL, "service");
|
||||
static final QName QNAME_TYPES = new QName(NS_WSDL, "types");
|
||||
|
||||
static final QName QNAME_ATTR_ARRAY_TYPE = new QName(NS_WSDL, "arrayType");
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document;
|
||||
|
||||
import com.sun.tools.internal.ws.wsdl.framework.*;
|
||||
import com.sun.tools.internal.ws.wsdl.parser.MetadataFinder;
|
||||
import com.sun.tools.internal.ws.wscompile.ErrorReceiver;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* A WSDL document.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class WSDLDocument extends AbstractDocument{
|
||||
|
||||
public WSDLDocument(MetadataFinder forest, ErrorReceiver errReceiver) {
|
||||
super(forest, errReceiver);
|
||||
}
|
||||
|
||||
public Definitions getDefinitions() {
|
||||
return _definitions;
|
||||
}
|
||||
|
||||
public void setDefinitions(Definitions d) {
|
||||
_definitions = d;
|
||||
}
|
||||
|
||||
public QName[] getAllServiceQNames() {
|
||||
|
||||
ArrayList serviceQNames = new ArrayList();
|
||||
|
||||
for (Iterator iter = getDefinitions().services(); iter.hasNext();) {
|
||||
Service next = (Service) iter.next();
|
||||
String targetNamespace = next.getDefining().getTargetNamespaceURI();
|
||||
String localName = next.getName();
|
||||
QName serviceQName = new QName(targetNamespace, localName);
|
||||
serviceQNames.add(serviceQName);
|
||||
}
|
||||
return (QName[]) serviceQNames.toArray(new QName[serviceQNames.size()]);
|
||||
}
|
||||
|
||||
public QName[] getAllPortQNames() {
|
||||
ArrayList portQNames = new ArrayList();
|
||||
|
||||
for (Iterator iter = getDefinitions().services(); iter.hasNext();) {
|
||||
Service next = (Service) iter.next();
|
||||
//Iterator ports = next.ports();
|
||||
for (Iterator piter = next.ports(); piter.hasNext();) {
|
||||
// If it's a relative import
|
||||
Port pnext = (Port) piter.next();
|
||||
String targetNamespace =
|
||||
pnext.getDefining().getTargetNamespaceURI();
|
||||
String localName = pnext.getName();
|
||||
QName portQName = new QName(targetNamespace, localName);
|
||||
portQNames.add(portQName);
|
||||
}
|
||||
}
|
||||
return (QName[]) portQNames.toArray(new QName[portQNames.size()]);
|
||||
}
|
||||
|
||||
public QName[] getPortQNames(String serviceNameLocalPart) {
|
||||
|
||||
ArrayList portQNames = new ArrayList();
|
||||
|
||||
for (Iterator iter = getDefinitions().services(); iter.hasNext();) {
|
||||
Service next = (Service) iter.next();
|
||||
if (next.getName().equals(serviceNameLocalPart)) {
|
||||
for (Iterator piter = next.ports(); piter.hasNext();) {
|
||||
Port pnext = (Port) piter.next();
|
||||
String targetNamespace =
|
||||
pnext.getDefining().getTargetNamespaceURI();
|
||||
String localName = pnext.getName();
|
||||
QName portQName = new QName(targetNamespace, localName);
|
||||
portQNames.add(portQName);
|
||||
}
|
||||
}
|
||||
}
|
||||
return (QName[]) portQNames.toArray(new QName[portQNames.size()]);
|
||||
}
|
||||
|
||||
public void accept(WSDLDocumentVisitor visitor) throws Exception {
|
||||
_definitions.accept(visitor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate(EntityReferenceValidator validator) {
|
||||
GloballyValidatingAction action =
|
||||
new GloballyValidatingAction(this, validator);
|
||||
withAllSubEntitiesDo(action);
|
||||
if (action.getException() != null) {
|
||||
throw action.getException();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Entity getRoot() {
|
||||
return _definitions;
|
||||
}
|
||||
|
||||
private Definitions _definitions;
|
||||
|
||||
private static class GloballyValidatingAction implements EntityAction, EntityReferenceAction {
|
||||
public GloballyValidatingAction(
|
||||
AbstractDocument document,
|
||||
EntityReferenceValidator validator) {
|
||||
_document = document;
|
||||
_validator = validator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform(Entity entity) {
|
||||
try {
|
||||
entity.validateThis();
|
||||
entity.withAllEntityReferencesDo(this);
|
||||
entity.withAllSubEntitiesDo(this);
|
||||
} catch (ValidationException e) {
|
||||
if (_exception == null) {
|
||||
_exception = e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform(Kind kind, QName name) {
|
||||
try {
|
||||
_document.find(kind, name);
|
||||
} catch (NoSuchEntityException e) {
|
||||
// failed to resolve, check with the validator
|
||||
if (_exception == null) {
|
||||
if (_validator == null
|
||||
|| !_validator.isValid(kind, name)) {
|
||||
_exception = e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ValidationException getException() {
|
||||
return _exception;
|
||||
}
|
||||
|
||||
private ValidationException _exception;
|
||||
private AbstractDocument _document;
|
||||
private EntityReferenceValidator _validator;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document;
|
||||
|
||||
import com.sun.tools.internal.ws.wsdl.framework.ExtensionVisitor;
|
||||
|
||||
/**
|
||||
* A visitor for WSDL documents.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public interface WSDLDocumentVisitor extends ExtensionVisitor {
|
||||
|
||||
public void preVisit(Definitions definitions) throws Exception;
|
||||
public void postVisit(Definitions definitions) throws Exception;
|
||||
public void visit(Import i) throws Exception;
|
||||
public void preVisit(Types types) throws Exception;
|
||||
public void postVisit(Types types) throws Exception;
|
||||
public void preVisit(Message message) throws Exception;
|
||||
public void postVisit(Message message) throws Exception;
|
||||
public void visit(MessagePart part) throws Exception;
|
||||
public void preVisit(PortType portType) throws Exception;
|
||||
public void postVisit(PortType portType) throws Exception;
|
||||
public void preVisit(Operation operation) throws Exception;
|
||||
public void postVisit(Operation operation) throws Exception;
|
||||
public void preVisit(Input input) throws Exception;
|
||||
public void postVisit(Input input) throws Exception;
|
||||
public void preVisit(Output output) throws Exception;
|
||||
public void postVisit(Output output) throws Exception;
|
||||
public void preVisit(Fault fault) throws Exception;
|
||||
public void postVisit(Fault fault) throws Exception;
|
||||
public void preVisit(Binding binding) throws Exception;
|
||||
public void postVisit(Binding binding) throws Exception;
|
||||
public void preVisit(BindingOperation operation) throws Exception;
|
||||
public void postVisit(BindingOperation operation) throws Exception;
|
||||
public void preVisit(BindingInput input) throws Exception;
|
||||
public void postVisit(BindingInput input) throws Exception;
|
||||
public void preVisit(BindingOutput output) throws Exception;
|
||||
public void postVisit(BindingOutput output) throws Exception;
|
||||
public void preVisit(BindingFault fault) throws Exception;
|
||||
public void postVisit(BindingFault fault) throws Exception;
|
||||
public void preVisit(Service service) throws Exception;
|
||||
public void postVisit(Service service) throws Exception;
|
||||
public void preVisit(Port port) throws Exception;
|
||||
public void postVisit(Port port) throws Exception;
|
||||
public void visit(Documentation documentation) throws Exception;
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document;
|
||||
|
||||
import com.sun.tools.internal.ws.wsdl.framework.ExtensionVisitorBase;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class WSDLDocumentVisitorBase extends ExtensionVisitorBase {
|
||||
public WSDLDocumentVisitorBase() {
|
||||
}
|
||||
|
||||
public void preVisit(Definitions definitions) throws Exception {
|
||||
}
|
||||
public void postVisit(Definitions definitions) throws Exception {
|
||||
}
|
||||
public void visit(Import i) throws Exception {
|
||||
}
|
||||
public void preVisit(Types types) throws Exception {
|
||||
}
|
||||
public void postVisit(Types types) throws Exception {
|
||||
}
|
||||
public void preVisit(Message message) throws Exception {
|
||||
}
|
||||
public void postVisit(Message message) throws Exception {
|
||||
}
|
||||
public void visit(MessagePart part) throws Exception {
|
||||
}
|
||||
public void preVisit(PortType portType) throws Exception {
|
||||
}
|
||||
public void postVisit(PortType portType) throws Exception {
|
||||
}
|
||||
public void preVisit(Operation operation) throws Exception {
|
||||
}
|
||||
public void postVisit(Operation operation) throws Exception {
|
||||
}
|
||||
public void preVisit(Input input) throws Exception {
|
||||
}
|
||||
public void postVisit(Input input) throws Exception {
|
||||
}
|
||||
public void preVisit(Output output) throws Exception {
|
||||
}
|
||||
public void postVisit(Output output) throws Exception {
|
||||
}
|
||||
public void preVisit(Fault fault) throws Exception {
|
||||
}
|
||||
public void postVisit(Fault fault) throws Exception {
|
||||
}
|
||||
public void preVisit(Binding binding) throws Exception {
|
||||
}
|
||||
public void postVisit(Binding binding) throws Exception {
|
||||
}
|
||||
public void preVisit(BindingOperation operation) throws Exception {
|
||||
}
|
||||
public void postVisit(BindingOperation operation) throws Exception {
|
||||
}
|
||||
public void preVisit(BindingInput input) throws Exception {
|
||||
}
|
||||
public void postVisit(BindingInput input) throws Exception {
|
||||
}
|
||||
public void preVisit(BindingOutput output) throws Exception {
|
||||
}
|
||||
public void postVisit(BindingOutput output) throws Exception {
|
||||
}
|
||||
public void preVisit(BindingFault fault) throws Exception {
|
||||
}
|
||||
public void postVisit(BindingFault fault) throws Exception {
|
||||
}
|
||||
public void preVisit(Service service) throws Exception {
|
||||
}
|
||||
public void postVisit(Service service) throws Exception {
|
||||
}
|
||||
public void preVisit(Port port) throws Exception {
|
||||
}
|
||||
public void postVisit(Port port) throws Exception {
|
||||
}
|
||||
public void visit(Documentation documentation) throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document.http;
|
||||
|
||||
import com.sun.tools.internal.ws.wsdl.framework.ExtensionImpl;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* A HTTP address extension.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class HTTPAddress extends ExtensionImpl {
|
||||
|
||||
public HTTPAddress(Locator locator) {
|
||||
super(locator);
|
||||
}
|
||||
|
||||
public QName getElementName() {
|
||||
return HTTPConstants.QNAME_ADDRESS;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return _location;
|
||||
}
|
||||
|
||||
public void setLocation(String s) {
|
||||
_location = s;
|
||||
}
|
||||
|
||||
public void validateThis() {
|
||||
if (_location == null) {
|
||||
failValidation("validation.missingRequiredAttribute", "location");
|
||||
}
|
||||
}
|
||||
|
||||
private String _location;
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document.http;
|
||||
|
||||
import com.sun.tools.internal.ws.wsdl.framework.ExtensionImpl;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* A HTTP binding extension.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class HTTPBinding extends ExtensionImpl {
|
||||
|
||||
public HTTPBinding(Locator locator) {
|
||||
super(locator);
|
||||
}
|
||||
|
||||
public QName getElementName() {
|
||||
return HTTPConstants.QNAME_BINDING;
|
||||
}
|
||||
|
||||
public String getVerb() {
|
||||
return _verb;
|
||||
}
|
||||
|
||||
public void setVerb(String s) {
|
||||
_verb = s;
|
||||
}
|
||||
|
||||
public void validateThis() {
|
||||
if (_verb == null) {
|
||||
failValidation("validation.missingRequiredAttribute", "verb");
|
||||
}
|
||||
}
|
||||
|
||||
private String _verb;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document.http;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* Interface defining HTTP-extension-related constants.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public interface HTTPConstants {
|
||||
|
||||
// namespace URIs
|
||||
static final String NS_WSDL_HTTP = "http://schemas.xmlsoap.org/wsdl/http/";
|
||||
|
||||
// QNames
|
||||
static final QName QNAME_ADDRESS = new QName(NS_WSDL_HTTP, "address");
|
||||
static final QName QNAME_BINDING = new QName(NS_WSDL_HTTP, "binding");
|
||||
static final QName QNAME_OPERATION = new QName(NS_WSDL_HTTP, "operation");
|
||||
static final QName QNAME_URL_ENCODED = new QName(NS_WSDL_HTTP, "urlEncoded");
|
||||
static final QName QNAME_URL_REPLACEMENT = new QName(NS_WSDL_HTTP, "urlReplacement");
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document.http;
|
||||
|
||||
import com.sun.tools.internal.ws.wsdl.framework.ExtensionImpl;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* A HTTP operation extension.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class HTTPOperation extends ExtensionImpl {
|
||||
|
||||
public HTTPOperation(Locator locator) {
|
||||
super(locator);
|
||||
}
|
||||
|
||||
public QName getElementName() {
|
||||
return HTTPConstants.QNAME_OPERATION;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return _location;
|
||||
}
|
||||
|
||||
public void setLocation(String s) {
|
||||
_location = s;
|
||||
}
|
||||
|
||||
public void validateThis() {
|
||||
if (_location == null) {
|
||||
failValidation("validation.missingRequiredAttribute", "location");
|
||||
}
|
||||
}
|
||||
|
||||
private String _location;
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document.http;
|
||||
|
||||
import com.sun.tools.internal.ws.wsdl.framework.ExtensionImpl;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* A HTTP urlEncoded extension.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class HTTPUrlEncoded extends ExtensionImpl {
|
||||
|
||||
public HTTPUrlEncoded(Locator locator) {
|
||||
super(locator);
|
||||
}
|
||||
|
||||
public QName getElementName() {
|
||||
return HTTPConstants.QNAME_URL_ENCODED;
|
||||
}
|
||||
|
||||
public void validateThis() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document.http;
|
||||
|
||||
import com.sun.tools.internal.ws.wsdl.framework.ExtensionImpl;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* A HTTP urlReplacement extension.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class HTTPUrlReplacement extends ExtensionImpl {
|
||||
|
||||
public HTTPUrlReplacement(Locator locator) {
|
||||
super(locator);
|
||||
}
|
||||
|
||||
public QName getElementName() {
|
||||
return HTTPConstants.QNAME_URL_REPLACEMENT;
|
||||
}
|
||||
|
||||
public void validateThis() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document.jaxws;
|
||||
|
||||
|
||||
/**
|
||||
* @author Vivek Pandey
|
||||
*
|
||||
* To change the template for this generated type comment go to
|
||||
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||
*/
|
||||
public class CustomName {
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public CustomName() {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public CustomName(String name, String javaDoc) {
|
||||
this.name = name;
|
||||
this.javaDoc = javaDoc;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the javaDoc.
|
||||
*/
|
||||
public String getJavaDoc() {
|
||||
return javaDoc;
|
||||
}
|
||||
/**
|
||||
* @param javaDoc The javaDoc to set.
|
||||
*/
|
||||
public void setJavaDoc(String javaDoc) {
|
||||
this.javaDoc = javaDoc;
|
||||
}
|
||||
/**
|
||||
* @return Returns the name.
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
/**
|
||||
* @param name The name to set.
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
private String javaDoc;
|
||||
private String name;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document.jaxws;
|
||||
|
||||
/**
|
||||
* @author Vivek Pandey
|
||||
*
|
||||
* class representing jaxws:exception
|
||||
*
|
||||
*/
|
||||
public class Exception {
|
||||
|
||||
public Exception(){}
|
||||
|
||||
public Exception(CustomName name){
|
||||
this.className = name;
|
||||
}
|
||||
|
||||
private CustomName className;
|
||||
/**
|
||||
* @return Returns the className.
|
||||
*/
|
||||
public CustomName getClassName() {
|
||||
return className;
|
||||
}
|
||||
/**
|
||||
* @param className The className to set.
|
||||
*/
|
||||
public void setClassName(CustomName className) {
|
||||
this.className = className;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,314 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document.jaxws;
|
||||
|
||||
import com.sun.tools.internal.ws.wsdl.framework.ExtensionImpl;
|
||||
import org.w3c.dom.Element;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
/**
|
||||
* @author Vivek Pandey
|
||||
*
|
||||
* To change the template for this generated type comment go to
|
||||
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||
*/
|
||||
public class JAXWSBinding extends ExtensionImpl {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public JAXWSBinding(Locator locator){
|
||||
super(locator);
|
||||
jaxbBindings = new HashSet<Element>();
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see Entity#validateThis()
|
||||
*/
|
||||
public void validateThis(){
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see Elemental#getElementName()
|
||||
*/
|
||||
public QName getElementName(){
|
||||
// TODO Auto-generated method stub
|
||||
return JAXWSBindingsConstants.JAXWS_BINDINGS;
|
||||
}
|
||||
|
||||
public QName getWSDLElementName() {
|
||||
return getElementName();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see TWSDLExtensible#addExtension(ExtensionImpl)
|
||||
*/
|
||||
public void addExtension(ExtensionImpl e) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see TWSDLExtensible#extensions()
|
||||
*/
|
||||
public Iterable<ExtensionImpl> extensions() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
// /**
|
||||
// * @return Returns the enableAdditionalHeaderMapping.
|
||||
// */
|
||||
// public Boolean isEnableAdditionalHeaderMapping() {
|
||||
// return enableAdditionalHeaderMapping;
|
||||
// }
|
||||
// /**
|
||||
// * @param enableAdditionalHeaderMapping The enableAdditionalHeaderMapping to set.
|
||||
// */
|
||||
// public void setEnableAdditionalHeaderMapping(
|
||||
// Boolean enableAdditionalHeaderMapping) {
|
||||
// this.enableAdditionalHeaderMapping = enableAdditionalHeaderMapping;
|
||||
// }
|
||||
/**
|
||||
* @return Returns the enableAsyncMapping.
|
||||
*/
|
||||
public Boolean isEnableAsyncMapping() {
|
||||
return enableAsyncMapping;
|
||||
}
|
||||
/**
|
||||
* @param enableAsyncMapping The enableAsyncMapping to set.
|
||||
*/
|
||||
public void setEnableAsyncMapping(Boolean enableAsyncMapping) {
|
||||
this.enableAsyncMapping = enableAsyncMapping;
|
||||
}
|
||||
/**
|
||||
* @return Returns the enableMimeContentMapping.
|
||||
*/
|
||||
public Boolean isEnableMimeContentMapping() {
|
||||
return enableMimeContentMapping;
|
||||
}
|
||||
/**
|
||||
* @param enableMimeContentMapping The enableMimeContentMapping to set.
|
||||
*/
|
||||
public void setEnableMimeContentMapping(Boolean enableMimeContentMapping) {
|
||||
this.enableMimeContentMapping = enableMimeContentMapping;
|
||||
}
|
||||
/**
|
||||
* @return Returns the enableWrapperStyle.
|
||||
*/
|
||||
public Boolean isEnableWrapperStyle() {
|
||||
return enableWrapperStyle;
|
||||
}
|
||||
/**
|
||||
* @param enableWrapperStyle The enableWrapperStyle to set.
|
||||
*/
|
||||
public void setEnableWrapperStyle(Boolean enableWrapperStyle) {
|
||||
this.enableWrapperStyle = enableWrapperStyle;
|
||||
}
|
||||
/**
|
||||
* @return Returns the jaxwsPackage.
|
||||
*/
|
||||
public CustomName getJaxwsPackage() {
|
||||
return jaxwsPackage;
|
||||
}
|
||||
/**
|
||||
* @param jaxwsPackage The jaxwsPackage to set.
|
||||
*/
|
||||
public void setJaxwsPackage(CustomName jaxwsPackage) {
|
||||
this.jaxwsPackage = jaxwsPackage;
|
||||
}
|
||||
/**
|
||||
* @return Returns the node.
|
||||
*/
|
||||
public String getNode() {
|
||||
return node;
|
||||
}
|
||||
/**
|
||||
* @param node The node to set.
|
||||
*/
|
||||
public void setNode(String node) {
|
||||
this.node = node;
|
||||
}
|
||||
/**
|
||||
* @return Returns the version.
|
||||
*/
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
/**
|
||||
* @param version The version to set.
|
||||
*/
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the wsdlLocation.
|
||||
*/
|
||||
public String getWsdlLocation() {
|
||||
return wsdlLocation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param wsdlLocation The wsdlLocation to set.
|
||||
*/
|
||||
public void setWsdlLocation(String wsdlLocation) {
|
||||
this.wsdlLocation = wsdlLocation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the wsdlNamespace.
|
||||
*/
|
||||
public String getWsdlNamespace() {
|
||||
return wsdlNamespace;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param wsdlNamespace The wsdlNamespace to set.
|
||||
*/
|
||||
public void setWsdlNamespace(String wsdlNamespace) {
|
||||
this.wsdlNamespace = wsdlNamespace;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the jaxbBindings.
|
||||
*/
|
||||
public Set<Element> getJaxbBindings() {
|
||||
return jaxbBindings;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param jaxbBinding The jaxbBindings to set.
|
||||
*/
|
||||
public void addJaxbBindings(Element jaxbBinding) {
|
||||
if(jaxbBindings == null)
|
||||
return;
|
||||
this.jaxbBindings.add(jaxbBinding);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the isProvider.
|
||||
*/
|
||||
public Boolean isProvider() {
|
||||
return isProvider;
|
||||
}
|
||||
/**
|
||||
* @param isProvider The isProvider to set.
|
||||
*/
|
||||
public void setProvider(Boolean isProvider) {
|
||||
this.isProvider = isProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the methodName.
|
||||
*/
|
||||
public CustomName getMethodName() {
|
||||
return methodName;
|
||||
}
|
||||
/**
|
||||
* @param methodName The methodName to set.
|
||||
*/
|
||||
public void setMethodName(CustomName methodName) {
|
||||
this.methodName = methodName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the parameter.
|
||||
*/
|
||||
public Iterator<Parameter> parameters() {
|
||||
return parameters.iterator();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param parameter The parameter to set.
|
||||
*/
|
||||
public void addParameter(Parameter parameter) {
|
||||
if(parameters == null)
|
||||
parameters = new ArrayList<Parameter>();
|
||||
parameters.add(parameter);
|
||||
}
|
||||
|
||||
public String getParameterName(String msgName, String wsdlPartName, QName element, boolean wrapperStyle){
|
||||
if(msgName == null || wsdlPartName == null || element == null || parameters == null)
|
||||
return null;
|
||||
for(Parameter param : parameters){
|
||||
if(param.getMessageName().equals(msgName) && param.getPart().equals(wsdlPartName)){
|
||||
if(wrapperStyle && (param.getElement() != null)){
|
||||
if(param.getElement().equals(element))
|
||||
return param.getName();
|
||||
}else if(!wrapperStyle){
|
||||
return param.getName();
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the className.
|
||||
*/
|
||||
public CustomName getClassName() {
|
||||
return className;
|
||||
}
|
||||
/**
|
||||
* @param className The className to set.
|
||||
*/
|
||||
public void setClassName(CustomName className) {
|
||||
this.className = className;
|
||||
}
|
||||
|
||||
private String wsdlNamespace;
|
||||
private String wsdlLocation;
|
||||
private String node;
|
||||
private String version;
|
||||
|
||||
private CustomName jaxwsPackage;
|
||||
private List<Parameter> parameters;
|
||||
private Boolean enableWrapperStyle;
|
||||
private Boolean enableAsyncMapping;
|
||||
// private Boolean enableAdditionalHeaderMapping;
|
||||
private Boolean enableMimeContentMapping;
|
||||
private Boolean isProvider;
|
||||
|
||||
private Set<Element> jaxbBindings;
|
||||
|
||||
// portType className
|
||||
private CustomName className;
|
||||
|
||||
//portType WSDLOperation
|
||||
private CustomName methodName;
|
||||
}
|
||||
@@ -0,0 +1,194 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document.jaxws;
|
||||
|
||||
import com.sun.tools.internal.ws.wsdl.parser.Constants;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* @author Vivek Pandey
|
||||
*
|
||||
*/
|
||||
public interface JAXWSBindingsConstants {
|
||||
|
||||
static final String NS_JAXWS_BINDINGS = "http://java.sun.com/xml/ns/jaxws";
|
||||
static final String NS_JAXB_BINDINGS = "http://java.sun.com/xml/ns/jaxb";
|
||||
static final String NS_XJC_BINDINGS = "http://java.sun.com/xml/ns/jaxb/xjc";
|
||||
|
||||
/**
|
||||
* jaxws:bindings schema component
|
||||
*
|
||||
* <jaxws:bindings wsdlLocation="xs:anyURI"? node="xs:string"?
|
||||
* version="string"?> binding declarations...
|
||||
* </jaxws:bindings>
|
||||
*
|
||||
* wsdlLocation="xs:anyURI"? node="xs:string"? version="string"?> binding
|
||||
* declarations... </jaxws:bindings>
|
||||
*
|
||||
* <code>@wsdlLocation</code> A URI pointing to a WSDL file establishing the scope of the
|
||||
* contents of this binding declaration. It MUST NOT be
|
||||
* present if the binding declaration is used as an extension
|
||||
* inside a WSDL document or if there is an ancestor binding
|
||||
* declaration that contains this attribute.
|
||||
*
|
||||
* <code>@node</code> An XPath expression pointing to the element in the WSDL file in
|
||||
* scope that this binding declaration is attached to.
|
||||
*
|
||||
* <code>@version</code> A version identifier. It MAY only appear on jaxws:bindings
|
||||
* elements that don't have any jaxws:bindings ancestors (i.e. on
|
||||
* outermost binding declarations).
|
||||
*/
|
||||
static final QName JAXWS_BINDINGS = new QName(NS_JAXWS_BINDINGS, "bindings");
|
||||
static final String WSDL_LOCATION_ATTR = "wsdlLocation";
|
||||
static final String NODE_ATTR = "node";
|
||||
static final String VERSION_ATTR = "version";
|
||||
|
||||
/*
|
||||
* <jaxws:package name="xs:string">? <jaxws:javadoc>xs:string
|
||||
* </jaxws:javadoc> </jaxws:package>
|
||||
*/
|
||||
static final QName PACKAGE = new QName(NS_JAXWS_BINDINGS, "package");
|
||||
static final String NAME_ATTR = "name";
|
||||
static final QName JAVADOC = new QName(NS_JAXWS_BINDINGS, "javadoc");
|
||||
|
||||
/*
|
||||
* <jaxws:enableWrapperStyle>xs:boolean </jaxws:enableWrapperStyle>?
|
||||
*/
|
||||
static final QName ENABLE_WRAPPER_STYLE = new QName(NS_JAXWS_BINDINGS, "enableWrapperStyle");
|
||||
|
||||
/*
|
||||
* <jaxws:enableAsynchronousMapping>xs:boolean
|
||||
* </jaxws:enableAsynchronousMapping>?
|
||||
*/
|
||||
static final QName ENABLE_ASYNC_MAPPING = new QName(NS_JAXWS_BINDINGS, "enableAsyncMapping");
|
||||
|
||||
/*
|
||||
* <jaxws:enableAdditionalSOAPHeaderMapping>xs:boolean</jaxws:enableAdditionalSOAPHeaderMapping>?
|
||||
*/
|
||||
static final QName ENABLE_ADDITIONAL_SOAPHEADER_MAPPING = new QName(NS_JAXWS_BINDINGS, "enableAdditionalSOAPHeaderMapping");
|
||||
|
||||
/*
|
||||
* <jaxws:enableMIMEContent>xs:boolean</jaxws:enableMIMEContent>?
|
||||
*/
|
||||
static final QName ENABLE_MIME_CONTENT = new QName(NS_JAXWS_BINDINGS, "enableMIMEContent");
|
||||
|
||||
/*
|
||||
* <jaxwsc:provider>xs:boolean</jaxws:provider>?
|
||||
*/
|
||||
static final QName PROVIDER = new QName(NS_JAXWS_BINDINGS, "provider");
|
||||
|
||||
/*
|
||||
* PortType
|
||||
*
|
||||
* <jaxws:class name="xs:string">?
|
||||
* <jaxws:javadoc>xs:string</jaxws:javadoc>?
|
||||
* </jaxws:class>
|
||||
*
|
||||
* <jaxws:enableWrapperStyle>
|
||||
* xs:boolean
|
||||
* </jaxws:enableWrapperStyle>?
|
||||
*
|
||||
* <jaxws:enableAsynchronousMapping>
|
||||
* xs:boolean
|
||||
* </jaxws:enableAsynchronousMapping>?
|
||||
*
|
||||
*/
|
||||
|
||||
static final QName CLASS = new QName(NS_JAXWS_BINDINGS, "class");
|
||||
|
||||
/*
|
||||
* PortType WSDLOperation
|
||||
*
|
||||
* <jaxws:method name="xs:string">?
|
||||
* <jaxws:javadoc>xs:string</jaxws:javadoc>?
|
||||
* </jaxws:method>
|
||||
*
|
||||
* <jaxws:enableWrapperStyle>
|
||||
* xs:boolean
|
||||
* </jaxws:enableWrapperStyle>?
|
||||
*
|
||||
* <jaxws:enableAsyncMapping>
|
||||
* xs:boolean
|
||||
* </jaxws:enableAsyncMapping>?
|
||||
*
|
||||
* <jaxws:parameter part="xs:string"
|
||||
* childElementName="xs:QName"?
|
||||
* name="xs:string"/>*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
static final QName METHOD = new QName(NS_JAXWS_BINDINGS, "method");
|
||||
static final QName PARAMETER = new QName(NS_JAXWS_BINDINGS, "parameter");
|
||||
static final String PART_ATTR = "part";
|
||||
static final String ELEMENT_ATTR = "childElementName";
|
||||
|
||||
/*
|
||||
* Binding
|
||||
*
|
||||
* <jaxws:enableAdditionalSOAPHeaderMapping>
|
||||
* xs:boolean
|
||||
* </jaxws:enableAdditionalSOAPHeaderMapping>?
|
||||
*
|
||||
* <jaxws:enableMIMEContent>
|
||||
* xs:boolean
|
||||
* </jaxws:enableMIMEContent>?
|
||||
*/
|
||||
|
||||
/*
|
||||
* WSDLBoundOperation
|
||||
*
|
||||
* <jaxws:enableAdditionalSOAPHeaderMapping>
|
||||
* xs:boolean
|
||||
* </jaxws:enableAdditionalSOAPHeaderMapping>?
|
||||
*
|
||||
* <jaxws:enableMIMEContent>
|
||||
* xs:boolean
|
||||
* </jaxws:enableMIMEContent>?
|
||||
*
|
||||
* <jaxws:parameter part="xs:string"
|
||||
* element="xs:QName"?
|
||||
* name="xs:string"/>*
|
||||
*
|
||||
* <jaxws:exception part="xs:string">*
|
||||
* <jaxws:class name="xs:string">?
|
||||
* <jaxws:javadoc>xs:string</jaxws:javadoc>?
|
||||
* </jaxws:class>
|
||||
* </jaxws:exception>
|
||||
*/
|
||||
|
||||
static final QName EXCEPTION = new QName(NS_JAXWS_BINDINGS, "exception");
|
||||
|
||||
|
||||
/*
|
||||
* jaxb:bindgs QName
|
||||
*/
|
||||
static final QName JAXB_BINDINGS = new QName(NS_JAXB_BINDINGS, "bindings");
|
||||
static final String JAXB_BINDING_VERSION = "2.0";
|
||||
static final QName XSD_APPINFO = new QName(Constants.NS_XSD, "appinfo");
|
||||
static final QName XSD_ANNOTATION = new QName(Constants.NS_XSD, "annotation");
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document.jaxws;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* @author Vivek Pandey
|
||||
*
|
||||
* class representing jaxws:parameter
|
||||
*
|
||||
*/
|
||||
public class Parameter {
|
||||
private String part;
|
||||
private QName element;
|
||||
private String name;
|
||||
private String messageName;
|
||||
|
||||
/**
|
||||
* @param part
|
||||
* @param element
|
||||
* @param name
|
||||
*/
|
||||
public Parameter(String msgName, String part, QName element, String name) {
|
||||
this.part = part;
|
||||
this.element = element;
|
||||
this.name = name;
|
||||
this.messageName = msgName;
|
||||
}
|
||||
|
||||
public String getMessageName() {
|
||||
return messageName;
|
||||
}
|
||||
|
||||
public void setMessageName(String messageName) {
|
||||
this.messageName = messageName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the element.
|
||||
*/
|
||||
public QName getElement() {
|
||||
return element;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param element The element to set.
|
||||
*/
|
||||
public void setElement(QName element) {
|
||||
this.element = element;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the name.
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name The name to set.
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the part.
|
||||
*/
|
||||
public String getPart() {
|
||||
return part;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param part The part to set.
|
||||
*/
|
||||
public void setPart(String part) {
|
||||
this.part = part;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document.mime;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* Interface defining MIME-extension-related constants.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public interface MIMEConstants {
|
||||
|
||||
// namespace URIs
|
||||
static final String NS_WSDL_MIME = "http://schemas.xmlsoap.org/wsdl/mime/";
|
||||
|
||||
// QNames
|
||||
static final QName QNAME_CONTENT = new QName(NS_WSDL_MIME, "content");
|
||||
static final QName QNAME_MULTIPART_RELATED = new QName(NS_WSDL_MIME, "multipartRelated");
|
||||
static final QName QNAME_PART = new QName(NS_WSDL_MIME, "part");
|
||||
static final QName QNAME_MIME_XML = new QName(NS_WSDL_MIME, "mimeXml");
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document.mime;
|
||||
|
||||
import com.sun.tools.internal.ws.wsdl.framework.ExtensionImpl;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* A MIME content extension.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class MIMEContent extends ExtensionImpl {
|
||||
|
||||
public MIMEContent(Locator locator) {
|
||||
super(locator);
|
||||
}
|
||||
|
||||
public QName getElementName() {
|
||||
return MIMEConstants.QNAME_CONTENT;
|
||||
}
|
||||
|
||||
public String getPart() {
|
||||
return _part;
|
||||
}
|
||||
|
||||
public void setPart(String s) {
|
||||
_part = s;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return _type;
|
||||
}
|
||||
|
||||
public void setType(String s) {
|
||||
_type = s;
|
||||
}
|
||||
|
||||
public void validateThis() {
|
||||
}
|
||||
|
||||
private String _part;
|
||||
private String _type;
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document.mime;
|
||||
|
||||
import com.sun.tools.internal.ws.wsdl.framework.Entity;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.EntityAction;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.ExtensionImpl;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.ExtensionVisitor;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A MIME multipartRelated extension.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class MIMEMultipartRelated extends ExtensionImpl {
|
||||
|
||||
public MIMEMultipartRelated(Locator locator) {
|
||||
super(locator);
|
||||
_parts = new ArrayList<MIMEPart>();
|
||||
}
|
||||
|
||||
public QName getElementName() {
|
||||
return MIMEConstants.QNAME_MULTIPART_RELATED;
|
||||
}
|
||||
|
||||
public void add(MIMEPart part) {
|
||||
_parts.add(part);
|
||||
}
|
||||
|
||||
public Iterable<MIMEPart> getParts() {
|
||||
return _parts;
|
||||
}
|
||||
|
||||
public void withAllSubEntitiesDo(EntityAction action) {
|
||||
super.withAllSubEntitiesDo(action);
|
||||
|
||||
for (Iterator iter = _parts.iterator(); iter.hasNext();) {
|
||||
action.perform((Entity) iter.next());
|
||||
}
|
||||
}
|
||||
|
||||
public void accept(ExtensionVisitor visitor) throws Exception {
|
||||
visitor.preVisit(this);
|
||||
visitor.postVisit(this);
|
||||
}
|
||||
|
||||
public void validateThis() {
|
||||
}
|
||||
|
||||
private List<MIMEPart> _parts;
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document.mime;
|
||||
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible;
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.EntityAction;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.ExtensibilityHelper;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.ExtensionImpl;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* A MIME part extension.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class MIMEPart extends ExtensionImpl implements TWSDLExtensible {
|
||||
|
||||
public MIMEPart(Locator locator) {
|
||||
super(locator);
|
||||
_helper = new ExtensibilityHelper();
|
||||
}
|
||||
|
||||
public QName getElementName() {
|
||||
return MIMEConstants.QNAME_PART;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return _name;
|
||||
}
|
||||
|
||||
public void setName(String s) {
|
||||
_name = s;
|
||||
}
|
||||
|
||||
public String getNameValue() {
|
||||
return getName();
|
||||
}
|
||||
|
||||
public String getNamespaceURI() {
|
||||
return getParent().getNamespaceURI();
|
||||
}
|
||||
|
||||
public QName getWSDLElementName() {
|
||||
return getElementName();
|
||||
}
|
||||
|
||||
public void addExtension(TWSDLExtension e) {
|
||||
_helper.addExtension(e);
|
||||
}
|
||||
|
||||
public Iterable<TWSDLExtension> extensions() {
|
||||
return _helper.extensions();
|
||||
}
|
||||
|
||||
public void withAllSubEntitiesDo(EntityAction action) {
|
||||
_helper.withAllSubEntitiesDo(action);
|
||||
}
|
||||
|
||||
public void validateThis() {
|
||||
}
|
||||
|
||||
private String _name;
|
||||
private ExtensibilityHelper _helper;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document.mime;
|
||||
|
||||
import com.sun.tools.internal.ws.wsdl.framework.ExtensionImpl;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* A MIME mimeXml extension.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class MIMEXml extends ExtensionImpl {
|
||||
|
||||
public MIMEXml(Locator locator) {
|
||||
super(locator);
|
||||
}
|
||||
|
||||
public QName getElementName() {
|
||||
return MIMEConstants.QNAME_MIME_XML;
|
||||
}
|
||||
|
||||
public String getPart() {
|
||||
return _part;
|
||||
}
|
||||
|
||||
public void setPart(String s) {
|
||||
_part = s;
|
||||
}
|
||||
|
||||
public void validateThis() {
|
||||
}
|
||||
|
||||
private String _part;
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document.schema;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public interface SchemaConstants {
|
||||
|
||||
// namespace URIs
|
||||
static final String NS_XMLNS = "http://www.w3.org/2000/xmlns/";
|
||||
static final String NS_XSD = "http://www.w3.org/2001/XMLSchema";
|
||||
static final String NS_XSI = "http://www.w3.org/2001/XMLSchema-instance";
|
||||
|
||||
// QNames
|
||||
static final QName QNAME_ALL = new QName(NS_XSD, "all");
|
||||
static final QName QNAME_ANNOTATION = new QName(NS_XSD, "annotation");
|
||||
static final QName QNAME_ANY = new QName(NS_XSD, "any");
|
||||
static final QName QNAME_ANY_ATTRIBUTE = new QName(NS_XSD, "anyAttribute");
|
||||
static final QName QNAME_ATTRIBUTE = new QName(NS_XSD, "attribute");
|
||||
static final QName QNAME_ATTRIBUTE_GROUP = new QName(NS_XSD, "attributeGroup");
|
||||
static final QName QNAME_CHOICE = new QName(NS_XSD, "choice");
|
||||
static final QName QNAME_COMPLEX_CONTENT = new QName(NS_XSD, "complexContent");
|
||||
static final QName QNAME_COMPLEX_TYPE = new QName(NS_XSD, "complexType");
|
||||
static final QName QNAME_ELEMENT = new QName(NS_XSD, "element");
|
||||
static final QName QNAME_ENUMERATION = new QName(NS_XSD, "enumeration");
|
||||
static final QName QNAME_EXTENSION = new QName(NS_XSD, "extension");
|
||||
static final QName QNAME_FIELD = new QName(NS_XSD, "field");
|
||||
static final QName QNAME_FRACTION_DIGITS = new QName(NS_XSD, "fractionDigits");
|
||||
static final QName QNAME_GROUP = new QName(NS_XSD, "group");
|
||||
static final QName QNAME_IMPORT = new QName(NS_XSD, "import");
|
||||
static final QName QNAME_INCLUDE = new QName(NS_XSD, "include");
|
||||
static final QName QNAME_KEY = new QName(NS_XSD, "key");
|
||||
static final QName QNAME_KEYREF = new QName(NS_XSD, "keyref");
|
||||
static final QName QNAME_LENGTH = new QName(NS_XSD, "length");
|
||||
static final QName QNAME_LIST = new QName(NS_XSD, "list");
|
||||
static final QName QNAME_MAX_EXCLUSIVE = new QName(NS_XSD, "maxExclusive");
|
||||
static final QName QNAME_MAX_INCLUSIVE = new QName(NS_XSD, "maxInclusive");
|
||||
static final QName QNAME_MAX_LENGTH = new QName(NS_XSD, "maxLength");
|
||||
static final QName QNAME_MIN_EXCLUSIVE = new QName(NS_XSD, "minExclusive");
|
||||
static final QName QNAME_MIN_INCLUSIVE = new QName(NS_XSD, "minInclusive");
|
||||
static final QName QNAME_MIN_LENGTH = new QName(NS_XSD, "minLength");
|
||||
static final QName QNAME_NOTATION = new QName(NS_XSD, "notation");
|
||||
static final QName QNAME_RESTRICTION = new QName(NS_XSD, "restriction");
|
||||
static final QName QNAME_PATTERN = new QName(NS_XSD, "pattern");
|
||||
static final QName QNAME_PRECISION = new QName(NS_XSD, "precision");
|
||||
static final QName QNAME_REDEFINE = new QName(NS_XSD, "redefine");
|
||||
static final QName QNAME_SCALE = new QName(NS_XSD, "scale");
|
||||
static final QName QNAME_SCHEMA = new QName(NS_XSD, "schema");
|
||||
static final QName QNAME_SELECTOR = new QName(NS_XSD, "selector");
|
||||
static final QName QNAME_SEQUENCE = new QName(NS_XSD, "sequence");
|
||||
static final QName QNAME_SIMPLE_CONTENT =
|
||||
new QName(NS_XSD, "simpleContent");
|
||||
static final QName QNAME_SIMPLE_TYPE = new QName(NS_XSD, "simpleType");
|
||||
static final QName QNAME_TOTAL_DIGITS = new QName(NS_XSD, "totalDigits");
|
||||
static final QName QNAME_UNIQUE = new QName(NS_XSD, "unique");
|
||||
static final QName QNAME_UNION = new QName(NS_XSD, "union");
|
||||
static final QName QNAME_WHITE_SPACE = new QName(NS_XSD, "whiteSpace");
|
||||
|
||||
// QNames for built-in XSD types
|
||||
static final QName QNAME_TYPE_STRING = new QName(NS_XSD, "string");
|
||||
static final QName QNAME_TYPE_NORMALIZED_STRING = new QName(NS_XSD, "normalizedString");
|
||||
static final QName QNAME_TYPE_TOKEN = new QName(NS_XSD, "token");
|
||||
static final QName QNAME_TYPE_BYTE = new QName(NS_XSD, "byte");
|
||||
static final QName QNAME_TYPE_UNSIGNED_BYTE = new QName(NS_XSD, "unsignedByte");
|
||||
static final QName QNAME_TYPE_BASE64_BINARY = new QName(NS_XSD, "base64Binary");
|
||||
static final QName QNAME_TYPE_HEX_BINARY = new QName(NS_XSD, "hexBinary");
|
||||
static final QName QNAME_TYPE_INTEGER = new QName(NS_XSD, "integer");
|
||||
static final QName QNAME_TYPE_POSITIVE_INTEGER = new QName(NS_XSD, "positiveInteger");
|
||||
static final QName QNAME_TYPE_NEGATIVE_INTEGER = new QName(NS_XSD, "negativeInteger");
|
||||
static final QName QNAME_TYPE_NON_NEGATIVE_INTEGER = new QName(NS_XSD, "nonNegativeInteger");
|
||||
static final QName QNAME_TYPE_NON_POSITIVE_INTEGER = new QName(NS_XSD, "nonPositiveInteger");
|
||||
static final QName QNAME_TYPE_INT = new QName(NS_XSD, "int");
|
||||
static final QName QNAME_TYPE_UNSIGNED_INT = new QName(NS_XSD, "unsignedInt");
|
||||
static final QName QNAME_TYPE_LONG = new QName(NS_XSD, "long");
|
||||
static final QName QNAME_TYPE_UNSIGNED_LONG = new QName(NS_XSD, "unsignedLong");
|
||||
static final QName QNAME_TYPE_SHORT = new QName(NS_XSD, "short");
|
||||
static final QName QNAME_TYPE_UNSIGNED_SHORT = new QName(NS_XSD, "unsignedShort");
|
||||
static final QName QNAME_TYPE_DECIMAL = new QName(NS_XSD, "decimal");
|
||||
static final QName QNAME_TYPE_FLOAT = new QName(NS_XSD, "float");
|
||||
static final QName QNAME_TYPE_DOUBLE = new QName(NS_XSD, "double");
|
||||
static final QName QNAME_TYPE_BOOLEAN = new QName(NS_XSD, "boolean");
|
||||
static final QName QNAME_TYPE_TIME = new QName(NS_XSD, "time");
|
||||
static final QName QNAME_TYPE_DATE_TIME = new QName(NS_XSD, "dateTime");
|
||||
static final QName QNAME_TYPE_DURATION = new QName(NS_XSD, "duration");
|
||||
static final QName QNAME_TYPE_DATE = new QName(NS_XSD, "date");
|
||||
static final QName QNAME_TYPE_G_MONTH = new QName(NS_XSD, "gMonth");
|
||||
static final QName QNAME_TYPE_G_YEAR = new QName(NS_XSD, "gYear");
|
||||
static final QName QNAME_TYPE_G_YEAR_MONTH = new QName(NS_XSD, "gYearMonth");
|
||||
static final QName QNAME_TYPE_G_DAY = new QName(NS_XSD, "gDay");
|
||||
static final QName QNAME_TYPE_G_MONTH_DAY = new QName(NS_XSD, "gMonthDay");
|
||||
static final QName QNAME_TYPE_NAME = new QName(NS_XSD, "Name");
|
||||
static final QName QNAME_TYPE_QNAME = new QName(NS_XSD, "QName");
|
||||
static final QName QNAME_TYPE_NCNAME = new QName(NS_XSD, "NCName");
|
||||
static final QName QNAME_TYPE_ANY_URI = new QName(NS_XSD, "anyURI");
|
||||
static final QName QNAME_TYPE_ID = new QName(NS_XSD, "ID");
|
||||
static final QName QNAME_TYPE_IDREF = new QName(NS_XSD, "IDREF");
|
||||
static final QName QNAME_TYPE_IDREFS = new QName(NS_XSD, "IDREFS");
|
||||
static final QName QNAME_TYPE_ENTITY = new QName(NS_XSD, "ENTITY");
|
||||
static final QName QNAME_TYPE_ENTITIES = new QName(NS_XSD, "ENTITIES");
|
||||
static final QName QNAME_TYPE_NOTATION = new QName(NS_XSD, "NOTATION");
|
||||
static final QName QNAME_TYPE_NMTOKEN = new QName(NS_XSD, "NMTOKEN");
|
||||
static final QName QNAME_TYPE_NMTOKENS = new QName(NS_XSD, "NMTOKENS");
|
||||
|
||||
static final QName QNAME_TYPE_LANGUAGE = new QName(NS_XSD, "language");
|
||||
|
||||
// QNames for special types
|
||||
static final QName QNAME_TYPE_URTYPE = new QName(NS_XSD, "anyType");
|
||||
static final QName QNAME_TYPE_SIMPLE_URTYPE = new QName(NS_XSD, "anySimpleType");
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document.schema;
|
||||
|
||||
import com.sun.tools.internal.ws.wsdl.framework.Kind;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class SchemaKinds {
|
||||
public static final Kind XSD_ATTRIBUTE = new Kind("xsd:attribute");
|
||||
public static final Kind XSD_ATTRIBUTE_GROUP =
|
||||
new Kind("xsd:attributeGroup");
|
||||
public static final Kind XSD_CONSTRAINT = new Kind("xsd:constraint");
|
||||
public static final Kind XSD_ELEMENT = new Kind("xsd:element");
|
||||
public static final Kind XSD_GROUP = new Kind("xsd:group");
|
||||
public static final Kind XSD_IDENTITY_CONSTRAINT =
|
||||
new Kind("xsd:identityConstraint");
|
||||
public static final Kind XSD_NOTATION = new Kind("xsd:notation");
|
||||
public static final Kind XSD_TYPE = new Kind("xsd:type");
|
||||
|
||||
private SchemaKinds() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document.soap;
|
||||
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
public class SOAP12Binding extends SOAPBinding{
|
||||
public SOAP12Binding(Locator locator) {
|
||||
super(locator);
|
||||
}
|
||||
|
||||
@Override public QName getElementName() {
|
||||
return SOAP12Constants.QNAME_BINDING;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document.soap;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* Interface defining SOAP1.2-related constants.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public interface SOAP12Constants {
|
||||
|
||||
// namespace URIs
|
||||
static final String NS_WSDL_SOAP = "http://schemas.xmlsoap.org/wsdl/soap12/";
|
||||
static final String NS_SOAP_ENCODING = "http://schemas.xmlsoap.org/soap/encoding/";
|
||||
|
||||
// other URIs
|
||||
static final String URI_SOAP_TRANSPORT_HTTP = "http://www.w3.org/2003/05/soap/bindings/HTTP/";
|
||||
|
||||
// QNames
|
||||
static final QName QNAME_ADDRESS = new QName(NS_WSDL_SOAP, "address");
|
||||
static final QName QNAME_BINDING = new QName(NS_WSDL_SOAP, "binding");
|
||||
static final QName QNAME_BODY = new QName(NS_WSDL_SOAP, "body");
|
||||
static final QName QNAME_FAULT = new QName(NS_WSDL_SOAP, "fault");
|
||||
static final QName QNAME_HEADER = new QName(NS_WSDL_SOAP, "header");
|
||||
static final QName QNAME_HEADERFAULT = new QName(NS_WSDL_SOAP, "headerfault");
|
||||
static final QName QNAME_OPERATION = new QName(NS_WSDL_SOAP, "operation");
|
||||
|
||||
// SOAP encoding QNames
|
||||
static final QName QNAME_TYPE_ARRAY = new QName(NS_SOAP_ENCODING, "Array");
|
||||
static final QName QNAME_ATTR_GROUP_COMMON_ATTRIBUTES = new QName(NS_SOAP_ENCODING, "commonAttributes");
|
||||
static final QName QNAME_ATTR_ARRAY_TYPE = new QName(NS_SOAP_ENCODING, "arrayType");
|
||||
static final QName QNAME_ATTR_ITEM_TYPE = new QName(NS_SOAP_ENCODING, "itemType");
|
||||
static final QName QNAME_ATTR_ARRAY_SIZE = new QName(NS_SOAP_ENCODING, "arraySize");
|
||||
static final QName QNAME_ATTR_OFFSET = new QName(NS_SOAP_ENCODING, "offset");
|
||||
static final QName QNAME_ATTR_POSITION = new QName(NS_SOAP_ENCODING, "position");
|
||||
|
||||
static final QName QNAME_TYPE_BASE64 = new QName(NS_SOAP_ENCODING, "base64");
|
||||
|
||||
static final QName QNAME_ELEMENT_STRING = new QName(NS_SOAP_ENCODING, "string");
|
||||
static final QName QNAME_ELEMENT_NORMALIZED_STRING = new QName(NS_SOAP_ENCODING, "normalizedString");
|
||||
static final QName QNAME_ELEMENT_TOKEN = new QName(NS_SOAP_ENCODING, "token");
|
||||
static final QName QNAME_ELEMENT_BYTE = new QName(NS_SOAP_ENCODING, "byte");
|
||||
static final QName QNAME_ELEMENT_UNSIGNED_BYTE = new QName(NS_SOAP_ENCODING, "unsignedByte");
|
||||
static final QName QNAME_ELEMENT_BASE64_BINARY = new QName(NS_SOAP_ENCODING, "base64Binary");
|
||||
static final QName QNAME_ELEMENT_HEX_BINARY = new QName(NS_SOAP_ENCODING, "hexBinary");
|
||||
static final QName QNAME_ELEMENT_INTEGER = new QName(NS_SOAP_ENCODING, "integer");
|
||||
static final QName QNAME_ELEMENT_POSITIVE_INTEGER = new QName(NS_SOAP_ENCODING, "positiveInteger");
|
||||
static final QName QNAME_ELEMENT_NEGATIVE_INTEGER = new QName(NS_SOAP_ENCODING, "negativeInteger");
|
||||
static final QName QNAME_ELEMENT_NON_NEGATIVE_INTEGER = new QName(NS_SOAP_ENCODING, "nonNegativeInteger");
|
||||
static final QName QNAME_ELEMENT_NON_POSITIVE_INTEGER = new QName(NS_SOAP_ENCODING, "nonPositiveInteger");
|
||||
static final QName QNAME_ELEMENT_INT = new QName(NS_SOAP_ENCODING, "int");
|
||||
static final QName QNAME_ELEMENT_UNSIGNED_INT = new QName(NS_SOAP_ENCODING, "unsignedInt");
|
||||
static final QName QNAME_ELEMENT_LONG = new QName(NS_SOAP_ENCODING, "long");
|
||||
static final QName QNAME_ELEMENT_UNSIGNED_LONG = new QName(NS_SOAP_ENCODING, "unsignedLong");
|
||||
static final QName QNAME_ELEMENT_SHORT = new QName(NS_SOAP_ENCODING, "short");
|
||||
static final QName QNAME_ELEMENT_UNSIGNED_SHORT = new QName(NS_SOAP_ENCODING, "unsignedShort");
|
||||
static final QName QNAME_ELEMENT_DECIMAL = new QName(NS_SOAP_ENCODING, "decimal");
|
||||
static final QName QNAME_ELEMENT_FLOAT = new QName(NS_SOAP_ENCODING, "float");
|
||||
static final QName QNAME_ELEMENT_DOUBLE = new QName(NS_SOAP_ENCODING, "double");
|
||||
static final QName QNAME_ELEMENT_BOOLEAN = new QName(NS_SOAP_ENCODING, "boolean");
|
||||
static final QName QNAME_ELEMENT_TIME = new QName(NS_SOAP_ENCODING, "time");
|
||||
static final QName QNAME_ELEMENT_DATE_TIME = new QName(NS_SOAP_ENCODING, "dateTime");
|
||||
static final QName QNAME_ELEMENT_DURATION = new QName(NS_SOAP_ENCODING, "duration");
|
||||
static final QName QNAME_ELEMENT_DATE = new QName(NS_SOAP_ENCODING, "date");
|
||||
static final QName QNAME_ELEMENT_G_MONTH = new QName(NS_SOAP_ENCODING, "gMonth");
|
||||
static final QName QNAME_ELEMENT_G_YEAR = new QName(NS_SOAP_ENCODING, "gYear");
|
||||
static final QName QNAME_ELEMENT_G_YEAR_MONTH = new QName(NS_SOAP_ENCODING, "gYearMonth");
|
||||
static final QName QNAME_ELEMENT_G_DAY = new QName(NS_SOAP_ENCODING, "gDay");
|
||||
static final QName QNAME_ELEMENT_G_MONTH_DAY = new QName(NS_SOAP_ENCODING, "gMonthDay");
|
||||
static final QName QNAME_ELEMENT_NAME = new QName(NS_SOAP_ENCODING, "Name");
|
||||
static final QName QNAME_ELEMENT_QNAME = new QName(NS_SOAP_ENCODING, "QName");
|
||||
static final QName QNAME_ELEMENT_NCNAME = new QName(NS_SOAP_ENCODING, "NCName");
|
||||
static final QName QNAME_ELEMENT_ANY_URI = new QName(NS_SOAP_ENCODING, "anyURI");
|
||||
static final QName QNAME_ELEMENT_ID = new QName(NS_SOAP_ENCODING, "ID");
|
||||
static final QName QNAME_ELEMENT_IDREF = new QName(NS_SOAP_ENCODING, "IDREF");
|
||||
static final QName QNAME_ELEMENT_IDREFS = new QName(NS_SOAP_ENCODING, "IDREFS");
|
||||
static final QName QNAME_ELEMENT_ENTITY = new QName(NS_SOAP_ENCODING, "ENTITY");
|
||||
static final QName QNAME_ELEMENT_ENTITIES = new QName(NS_SOAP_ENCODING, "ENTITIES");
|
||||
static final QName QNAME_ELEMENT_NOTATION = new QName(NS_SOAP_ENCODING, "NOTATION");
|
||||
static final QName QNAME_ELEMENT_NMTOKEN = new QName(NS_SOAP_ENCODING, "NMTOKEN");
|
||||
static final QName QNAME_ELEMENT_NMTOKENS = new QName(NS_SOAP_ENCODING, "NMTOKENS");
|
||||
|
||||
static final QName QNAME_TYPE_STRING = new QName(NS_SOAP_ENCODING, "string");
|
||||
static final QName QNAME_TYPE_NORMALIZED_STRING = new QName(NS_SOAP_ENCODING, "normalizedString");
|
||||
static final QName QNAME_TYPE_TOKEN = new QName(NS_SOAP_ENCODING, "token");
|
||||
static final QName QNAME_TYPE_BYTE = new QName(NS_SOAP_ENCODING, "byte");
|
||||
static final QName QNAME_TYPE_UNSIGNED_BYTE = new QName(NS_SOAP_ENCODING, "unsignedByte");
|
||||
static final QName QNAME_TYPE_BASE64_BINARY = new QName(NS_SOAP_ENCODING, "base64Binary");
|
||||
static final QName QNAME_TYPE_HEX_BINARY = new QName(NS_SOAP_ENCODING, "hexBinary");
|
||||
static final QName QNAME_TYPE_INTEGER = new QName(NS_SOAP_ENCODING, "integer");
|
||||
static final QName QNAME_TYPE_POSITIVE_INTEGER = new QName(NS_SOAP_ENCODING, "positiveInteger");
|
||||
static final QName QNAME_TYPE_NEGATIVE_INTEGER = new QName(NS_SOAP_ENCODING, "negativeInteger");
|
||||
static final QName QNAME_TYPE_NON_NEGATIVE_INTEGER = new QName(NS_SOAP_ENCODING, "nonNegativeInteger");
|
||||
static final QName QNAME_TYPE_NON_POSITIVE_INTEGER = new QName(NS_SOAP_ENCODING, "nonPositiveInteger");
|
||||
static final QName QNAME_TYPE_INT = new QName(NS_SOAP_ENCODING, "int");
|
||||
static final QName QNAME_TYPE_UNSIGNED_INT = new QName(NS_SOAP_ENCODING, "unsignedInt");
|
||||
static final QName QNAME_TYPE_LONG = new QName(NS_SOAP_ENCODING, "long");
|
||||
static final QName QNAME_TYPE_UNSIGNED_LONG = new QName(NS_SOAP_ENCODING, "unsignedLong");
|
||||
static final QName QNAME_TYPE_SHORT = new QName(NS_SOAP_ENCODING, "short");
|
||||
static final QName QNAME_TYPE_UNSIGNED_SHORT = new QName(NS_SOAP_ENCODING, "unsignedShort");
|
||||
static final QName QNAME_TYPE_DECIMAL = new QName(NS_SOAP_ENCODING, "decimal");
|
||||
static final QName QNAME_TYPE_FLOAT = new QName(NS_SOAP_ENCODING, "float");
|
||||
static final QName QNAME_TYPE_DOUBLE = new QName(NS_SOAP_ENCODING, "double");
|
||||
static final QName QNAME_TYPE_BOOLEAN = new QName(NS_SOAP_ENCODING, "boolean");
|
||||
static final QName QNAME_TYPE_TIME = new QName(NS_SOAP_ENCODING, "time");
|
||||
static final QName QNAME_TYPE_DATE_TIME = new QName(NS_SOAP_ENCODING, "dateTime");
|
||||
static final QName QNAME_TYPE_DURATION = new QName(NS_SOAP_ENCODING, "duration");
|
||||
static final QName QNAME_TYPE_DATE = new QName(NS_SOAP_ENCODING, "date");
|
||||
static final QName QNAME_TYPE_G_MONTH = new QName(NS_SOAP_ENCODING, "gMonth");
|
||||
static final QName QNAME_TYPE_G_YEAR = new QName(NS_SOAP_ENCODING, "gYear");
|
||||
static final QName QNAME_TYPE_G_YEAR_MONTH = new QName(NS_SOAP_ENCODING, "gYearMonth");
|
||||
static final QName QNAME_TYPE_G_DAY = new QName(NS_SOAP_ENCODING, "gDay");
|
||||
static final QName QNAME_TYPE_G_MONTH_DAY = new QName(NS_SOAP_ENCODING, "gMonthDay");
|
||||
static final QName QNAME_TYPE_NAME = new QName(NS_SOAP_ENCODING, "Name");
|
||||
static final QName QNAME_TYPE_QNAME = new QName(NS_SOAP_ENCODING, "QName");
|
||||
static final QName QNAME_TYPE_NCNAME = new QName(NS_SOAP_ENCODING, "NCName");
|
||||
static final QName QNAME_TYPE_ANY_URI = new QName(NS_SOAP_ENCODING, "anyURI");
|
||||
static final QName QNAME_TYPE_ID = new QName(NS_SOAP_ENCODING, "ID");
|
||||
static final QName QNAME_TYPE_IDREF = new QName(NS_SOAP_ENCODING, "IDREF");
|
||||
static final QName QNAME_TYPE_IDREFS = new QName(NS_SOAP_ENCODING, "IDREFS");
|
||||
static final QName QNAME_TYPE_ENTITY = new QName(NS_SOAP_ENCODING, "ENTITY");
|
||||
static final QName QNAME_TYPE_ENTITIES = new QName(NS_SOAP_ENCODING, "ENTITIES");
|
||||
static final QName QNAME_TYPE_NOTATION = new QName(NS_SOAP_ENCODING, "NOTATION");
|
||||
static final QName QNAME_TYPE_NMTOKEN = new QName(NS_SOAP_ENCODING, "NMTOKEN");
|
||||
static final QName QNAME_TYPE_NMTOKENS = new QName(NS_SOAP_ENCODING, "NMTOKENS");
|
||||
static final QName QNAME_TYPE_LANGUAGE = new QName(NS_SOAP_ENCODING, "LANGUAGE");
|
||||
|
||||
// SOAP attributes with non-colonized names
|
||||
static final QName QNAME_ATTR_ID = new QName("", "id");
|
||||
static final QName QNAME_ATTR_HREF = new QName("", "ref");
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document.soap;
|
||||
|
||||
import com.sun.tools.internal.ws.wsdl.framework.ExtensionImpl;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* A SOAP address extension.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class SOAPAddress extends ExtensionImpl {
|
||||
|
||||
public SOAPAddress(Locator locator) {
|
||||
super(locator);
|
||||
}
|
||||
|
||||
public QName getElementName() {
|
||||
return SOAPConstants.QNAME_ADDRESS;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return _location;
|
||||
}
|
||||
|
||||
public void setLocation(String s) {
|
||||
_location = s;
|
||||
}
|
||||
|
||||
public void validateThis() {
|
||||
if (_location == null) {
|
||||
failValidation("validation.missingRequiredAttribute", "location");
|
||||
}
|
||||
}
|
||||
|
||||
private String _location;
|
||||
}
|
||||
@@ -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.tools.internal.ws.wsdl.document.soap;
|
||||
|
||||
import com.sun.tools.internal.ws.wsdl.framework.ExtensionImpl;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* A SOAP binding extension.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class SOAPBinding extends ExtensionImpl {
|
||||
|
||||
public SOAPBinding(Locator locator) {
|
||||
super(locator);
|
||||
_style = SOAPStyle.DOCUMENT;
|
||||
}
|
||||
|
||||
public QName getElementName() {
|
||||
return SOAPConstants.QNAME_BINDING;
|
||||
}
|
||||
|
||||
public String getTransport() {
|
||||
return _transport;
|
||||
}
|
||||
|
||||
public void setTransport(String s) {
|
||||
_transport = s;
|
||||
}
|
||||
|
||||
public SOAPStyle getStyle() {
|
||||
return _style;
|
||||
}
|
||||
|
||||
public void setStyle(SOAPStyle s) {
|
||||
_style = s;
|
||||
}
|
||||
|
||||
public boolean isDocument() {
|
||||
return _style == SOAPStyle.DOCUMENT;
|
||||
}
|
||||
|
||||
public boolean isRPC() {
|
||||
return _style == SOAPStyle.RPC;
|
||||
}
|
||||
|
||||
public void validateThis() {
|
||||
}
|
||||
|
||||
private String _transport;
|
||||
private SOAPStyle _style;
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document.soap;
|
||||
|
||||
import com.sun.tools.internal.ws.wsdl.framework.ExtensionImpl;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.ValidationException;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* A SOAP body extension.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class SOAPBody extends ExtensionImpl {
|
||||
|
||||
public SOAPBody(Locator locator) {
|
||||
super(locator);
|
||||
}
|
||||
|
||||
public QName getElementName() {
|
||||
return SOAPConstants.QNAME_BODY;
|
||||
}
|
||||
|
||||
public String getNamespace() {
|
||||
return _namespace;
|
||||
}
|
||||
|
||||
public void setNamespace(String s) {
|
||||
_namespace = s;
|
||||
}
|
||||
|
||||
public SOAPUse getUse() {
|
||||
return _use;
|
||||
}
|
||||
|
||||
public void setUse(SOAPUse u) {
|
||||
_use = u;
|
||||
}
|
||||
|
||||
public boolean isEncoded() {
|
||||
return _use == SOAPUse.ENCODED;
|
||||
}
|
||||
|
||||
public boolean isLiteral() {
|
||||
return _use == SOAPUse.LITERAL;
|
||||
}
|
||||
|
||||
public String getEncodingStyle() {
|
||||
return _encodingStyle;
|
||||
}
|
||||
|
||||
public void setEncodingStyle(String s) {
|
||||
_encodingStyle = s;
|
||||
}
|
||||
|
||||
public String getParts() {
|
||||
return _parts;
|
||||
}
|
||||
|
||||
public void setParts(String s) {
|
||||
_parts = s;
|
||||
}
|
||||
|
||||
public void validateThis() {
|
||||
if(_use == SOAPUse.ENCODED) {
|
||||
throw new ValidationException("validation.unsupportedUse.encoded", getLocator().getLineNumber(),getLocator().getSystemId());
|
||||
}
|
||||
}
|
||||
|
||||
private String _encodingStyle;
|
||||
private String _namespace;
|
||||
private String _parts;
|
||||
private SOAPUse _use=SOAPUse.LITERAL;
|
||||
}
|
||||
@@ -0,0 +1,259 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document.soap;
|
||||
|
||||
import com.sun.xml.internal.ws.encoding.soap.streaming.SOAPNamespaceConstants;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* Interface defining SOAP-related constants.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public interface SOAPConstants {
|
||||
|
||||
// namespace URIs
|
||||
public static final String URI_ENVELOPE = SOAPNamespaceConstants.ENVELOPE;
|
||||
public static final String NS_WSDL_SOAP =
|
||||
"http://schemas.xmlsoap.org/wsdl/soap/";
|
||||
public static final String NS_SOAP_ENCODING = "http://schemas.xmlsoap.org/soap/encoding/";
|
||||
|
||||
// other URIs
|
||||
public final String URI_SOAP_TRANSPORT_HTTP =
|
||||
"http://schemas.xmlsoap.org/soap/http";
|
||||
|
||||
// QNames
|
||||
public static final QName QNAME_ADDRESS =
|
||||
new QName(NS_WSDL_SOAP, "address");
|
||||
public static final QName QNAME_BINDING =
|
||||
new QName(NS_WSDL_SOAP, "binding");
|
||||
public static final QName QNAME_BODY = new QName(NS_WSDL_SOAP, "body");
|
||||
public static final QName QNAME_FAULT = new QName(NS_WSDL_SOAP, "fault");
|
||||
public static final QName QNAME_HEADER = new QName(NS_WSDL_SOAP, "header");
|
||||
public static final QName QNAME_HEADERFAULT =
|
||||
new QName(NS_WSDL_SOAP, "headerfault");
|
||||
public static final QName QNAME_OPERATION =
|
||||
new QName(NS_WSDL_SOAP, "operation");
|
||||
public static final QName QNAME_MUSTUNDERSTAND =
|
||||
new QName(URI_ENVELOPE, "mustUnderstand");
|
||||
|
||||
|
||||
// SOAP encoding QNames
|
||||
public static final QName QNAME_TYPE_ARRAY =
|
||||
new QName(NS_SOAP_ENCODING, "Array");
|
||||
public static final QName QNAME_ATTR_GROUP_COMMON_ATTRIBUTES =
|
||||
new QName(NS_SOAP_ENCODING, "commonAttributes");
|
||||
public static final QName QNAME_ATTR_ARRAY_TYPE =
|
||||
new QName(NS_SOAP_ENCODING, "arrayType");
|
||||
public static final QName QNAME_ATTR_OFFSET =
|
||||
new QName(NS_SOAP_ENCODING, "offset");
|
||||
public static final QName QNAME_ATTR_POSITION =
|
||||
new QName(NS_SOAP_ENCODING, "position");
|
||||
|
||||
public static final QName QNAME_TYPE_BASE64 =
|
||||
new QName(NS_SOAP_ENCODING, "base64");
|
||||
|
||||
public static final QName QNAME_ELEMENT_STRING =
|
||||
new QName(NS_SOAP_ENCODING, "string");
|
||||
public static final QName QNAME_ELEMENT_NORMALIZED_STRING =
|
||||
new QName(NS_SOAP_ENCODING, "normalizedString");
|
||||
public static final QName QNAME_ELEMENT_TOKEN =
|
||||
new QName(NS_SOAP_ENCODING, "token");
|
||||
public static final QName QNAME_ELEMENT_BYTE =
|
||||
new QName(NS_SOAP_ENCODING, "byte");
|
||||
public static final QName QNAME_ELEMENT_UNSIGNED_BYTE =
|
||||
new QName(NS_SOAP_ENCODING, "unsignedByte");
|
||||
public static final QName QNAME_ELEMENT_BASE64_BINARY =
|
||||
new QName(NS_SOAP_ENCODING, "base64Binary");
|
||||
public static final QName QNAME_ELEMENT_HEX_BINARY =
|
||||
new QName(NS_SOAP_ENCODING, "hexBinary");
|
||||
public static final QName QNAME_ELEMENT_INTEGER =
|
||||
new QName(NS_SOAP_ENCODING, "integer");
|
||||
public static final QName QNAME_ELEMENT_POSITIVE_INTEGER =
|
||||
new QName(NS_SOAP_ENCODING, "positiveInteger");
|
||||
public static final QName QNAME_ELEMENT_NEGATIVE_INTEGER =
|
||||
new QName(NS_SOAP_ENCODING, "negativeInteger");
|
||||
public static final QName QNAME_ELEMENT_NON_NEGATIVE_INTEGER =
|
||||
new QName(NS_SOAP_ENCODING, "nonNegativeInteger");
|
||||
public static final QName QNAME_ELEMENT_NON_POSITIVE_INTEGER =
|
||||
new QName(NS_SOAP_ENCODING, "nonPositiveInteger");
|
||||
public static final QName QNAME_ELEMENT_INT =
|
||||
new QName(NS_SOAP_ENCODING, "int");
|
||||
public static final QName QNAME_ELEMENT_UNSIGNED_INT =
|
||||
new QName(NS_SOAP_ENCODING, "unsignedInt");
|
||||
public static final QName QNAME_ELEMENT_LONG =
|
||||
new QName(NS_SOAP_ENCODING, "long");
|
||||
public static final QName QNAME_ELEMENT_UNSIGNED_LONG =
|
||||
new QName(NS_SOAP_ENCODING, "unsignedLong");
|
||||
public static final QName QNAME_ELEMENT_SHORT =
|
||||
new QName(NS_SOAP_ENCODING, "short");
|
||||
public static final QName QNAME_ELEMENT_UNSIGNED_SHORT =
|
||||
new QName(NS_SOAP_ENCODING, "unsignedShort");
|
||||
public static final QName QNAME_ELEMENT_DECIMAL =
|
||||
new QName(NS_SOAP_ENCODING, "decimal");
|
||||
public static final QName QNAME_ELEMENT_FLOAT =
|
||||
new QName(NS_SOAP_ENCODING, "float");
|
||||
public static final QName QNAME_ELEMENT_DOUBLE =
|
||||
new QName(NS_SOAP_ENCODING, "double");
|
||||
public static final QName QNAME_ELEMENT_BOOLEAN =
|
||||
new QName(NS_SOAP_ENCODING, "boolean");
|
||||
public static final QName QNAME_ELEMENT_TIME =
|
||||
new QName(NS_SOAP_ENCODING, "time");
|
||||
public static final QName QNAME_ELEMENT_DATE_TIME =
|
||||
new QName(NS_SOAP_ENCODING, "dateTime");
|
||||
public static final QName QNAME_ELEMENT_DURATION =
|
||||
new QName(NS_SOAP_ENCODING, "duration");
|
||||
public static final QName QNAME_ELEMENT_DATE =
|
||||
new QName(NS_SOAP_ENCODING, "date");
|
||||
public static final QName QNAME_ELEMENT_G_MONTH =
|
||||
new QName(NS_SOAP_ENCODING, "gMonth");
|
||||
public static final QName QNAME_ELEMENT_G_YEAR =
|
||||
new QName(NS_SOAP_ENCODING, "gYear");
|
||||
public static final QName QNAME_ELEMENT_G_YEAR_MONTH =
|
||||
new QName(NS_SOAP_ENCODING, "gYearMonth");
|
||||
public static final QName QNAME_ELEMENT_G_DAY =
|
||||
new QName(NS_SOAP_ENCODING, "gDay");
|
||||
public static final QName QNAME_ELEMENT_G_MONTH_DAY =
|
||||
new QName(NS_SOAP_ENCODING, "gMonthDay");
|
||||
public static final QName QNAME_ELEMENT_NAME =
|
||||
new QName(NS_SOAP_ENCODING, "Name");
|
||||
public static final QName QNAME_ELEMENT_QNAME =
|
||||
new QName(NS_SOAP_ENCODING, "QName");
|
||||
public static final QName QNAME_ELEMENT_NCNAME =
|
||||
new QName(NS_SOAP_ENCODING, "NCName");
|
||||
public static final QName QNAME_ELEMENT_ANY_URI =
|
||||
new QName(NS_SOAP_ENCODING, "anyURI");
|
||||
public static final QName QNAME_ELEMENT_ID =
|
||||
new QName(NS_SOAP_ENCODING, "ID");
|
||||
public static final QName QNAME_ELEMENT_IDREF =
|
||||
new QName(NS_SOAP_ENCODING, "IDREF");
|
||||
public static final QName QNAME_ELEMENT_IDREFS =
|
||||
new QName(NS_SOAP_ENCODING, "IDREFS");
|
||||
public static final QName QNAME_ELEMENT_ENTITY =
|
||||
new QName(NS_SOAP_ENCODING, "ENTITY");
|
||||
public static final QName QNAME_ELEMENT_ENTITIES =
|
||||
new QName(NS_SOAP_ENCODING, "ENTITIES");
|
||||
public static final QName QNAME_ELEMENT_NOTATION =
|
||||
new QName(NS_SOAP_ENCODING, "NOTATION");
|
||||
public static final QName QNAME_ELEMENT_NMTOKEN =
|
||||
new QName(NS_SOAP_ENCODING, "NMTOKEN");
|
||||
public static final QName QNAME_ELEMENT_NMTOKENS =
|
||||
new QName(NS_SOAP_ENCODING, "NMTOKENS");
|
||||
|
||||
public static final QName QNAME_TYPE_STRING =
|
||||
new QName(NS_SOAP_ENCODING, "string");
|
||||
public static final QName QNAME_TYPE_NORMALIZED_STRING =
|
||||
new QName(NS_SOAP_ENCODING, "normalizedString");
|
||||
public static final QName QNAME_TYPE_TOKEN =
|
||||
new QName(NS_SOAP_ENCODING, "token");
|
||||
public static final QName QNAME_TYPE_BYTE =
|
||||
new QName(NS_SOAP_ENCODING, "byte");
|
||||
public static final QName QNAME_TYPE_UNSIGNED_BYTE =
|
||||
new QName(NS_SOAP_ENCODING, "unsignedByte");
|
||||
public static final QName QNAME_TYPE_BASE64_BINARY =
|
||||
new QName(NS_SOAP_ENCODING, "base64Binary");
|
||||
public static final QName QNAME_TYPE_HEX_BINARY =
|
||||
new QName(NS_SOAP_ENCODING, "hexBinary");
|
||||
public static final QName QNAME_TYPE_INTEGER =
|
||||
new QName(NS_SOAP_ENCODING, "integer");
|
||||
public static final QName QNAME_TYPE_POSITIVE_INTEGER =
|
||||
new QName(NS_SOAP_ENCODING, "positiveInteger");
|
||||
public static final QName QNAME_TYPE_NEGATIVE_INTEGER =
|
||||
new QName(NS_SOAP_ENCODING, "negativeInteger");
|
||||
public static final QName QNAME_TYPE_NON_NEGATIVE_INTEGER =
|
||||
new QName(NS_SOAP_ENCODING, "nonNegativeInteger");
|
||||
public static final QName QNAME_TYPE_NON_POSITIVE_INTEGER =
|
||||
new QName(NS_SOAP_ENCODING, "nonPositiveInteger");
|
||||
public static final QName QNAME_TYPE_INT =
|
||||
new QName(NS_SOAP_ENCODING, "int");
|
||||
public static final QName QNAME_TYPE_UNSIGNED_INT =
|
||||
new QName(NS_SOAP_ENCODING, "unsignedInt");
|
||||
public static final QName QNAME_TYPE_LONG =
|
||||
new QName(NS_SOAP_ENCODING, "long");
|
||||
public static final QName QNAME_TYPE_UNSIGNED_LONG =
|
||||
new QName(NS_SOAP_ENCODING, "unsignedLong");
|
||||
public static final QName QNAME_TYPE_SHORT =
|
||||
new QName(NS_SOAP_ENCODING, "short");
|
||||
public static final QName QNAME_TYPE_UNSIGNED_SHORT =
|
||||
new QName(NS_SOAP_ENCODING, "unsignedShort");
|
||||
public static final QName QNAME_TYPE_DECIMAL =
|
||||
new QName(NS_SOAP_ENCODING, "decimal");
|
||||
public static final QName QNAME_TYPE_FLOAT =
|
||||
new QName(NS_SOAP_ENCODING, "float");
|
||||
public static final QName QNAME_TYPE_DOUBLE =
|
||||
new QName(NS_SOAP_ENCODING, "double");
|
||||
public static final QName QNAME_TYPE_BOOLEAN =
|
||||
new QName(NS_SOAP_ENCODING, "boolean");
|
||||
public static final QName QNAME_TYPE_TIME =
|
||||
new QName(NS_SOAP_ENCODING, "time");
|
||||
public static final QName QNAME_TYPE_DATE_TIME =
|
||||
new QName(NS_SOAP_ENCODING, "dateTime");
|
||||
public static final QName QNAME_TYPE_DURATION =
|
||||
new QName(NS_SOAP_ENCODING, "duration");
|
||||
public static final QName QNAME_TYPE_DATE =
|
||||
new QName(NS_SOAP_ENCODING, "date");
|
||||
public static final QName QNAME_TYPE_G_MONTH =
|
||||
new QName(NS_SOAP_ENCODING, "gMonth");
|
||||
public static final QName QNAME_TYPE_G_YEAR =
|
||||
new QName(NS_SOAP_ENCODING, "gYear");
|
||||
public static final QName QNAME_TYPE_G_YEAR_MONTH =
|
||||
new QName(NS_SOAP_ENCODING, "gYearMonth");
|
||||
public static final QName QNAME_TYPE_G_DAY =
|
||||
new QName(NS_SOAP_ENCODING, "gDay");
|
||||
public static final QName QNAME_TYPE_G_MONTH_DAY =
|
||||
new QName(NS_SOAP_ENCODING, "gMonthDay");
|
||||
public static final QName QNAME_TYPE_NAME =
|
||||
new QName(NS_SOAP_ENCODING, "Name");
|
||||
public static final QName QNAME_TYPE_QNAME =
|
||||
new QName(NS_SOAP_ENCODING, "QName");
|
||||
public static final QName QNAME_TYPE_NCNAME =
|
||||
new QName(NS_SOAP_ENCODING, "NCName");
|
||||
public static final QName QNAME_TYPE_ANY_URI =
|
||||
new QName(NS_SOAP_ENCODING, "anyURI");
|
||||
public static final QName QNAME_TYPE_ID = new QName(NS_SOAP_ENCODING, "ID");
|
||||
public static final QName QNAME_TYPE_IDREF =
|
||||
new QName(NS_SOAP_ENCODING, "IDREF");
|
||||
public static final QName QNAME_TYPE_IDREFS =
|
||||
new QName(NS_SOAP_ENCODING, "IDREFS");
|
||||
public static final QName QNAME_TYPE_ENTITY =
|
||||
new QName(NS_SOAP_ENCODING, "ENTITY");
|
||||
public static final QName QNAME_TYPE_ENTITIES =
|
||||
new QName(NS_SOAP_ENCODING, "ENTITIES");
|
||||
public static final QName QNAME_TYPE_NOTATION =
|
||||
new QName(NS_SOAP_ENCODING, "NOTATION");
|
||||
public static final QName QNAME_TYPE_NMTOKEN =
|
||||
new QName(NS_SOAP_ENCODING, "NMTOKEN");
|
||||
public static final QName QNAME_TYPE_NMTOKENS =
|
||||
new QName(NS_SOAP_ENCODING, "NMTOKENS");
|
||||
public static final QName QNAME_TYPE_LANGUAGE =
|
||||
new QName(NS_SOAP_ENCODING, "LANGUAGE");
|
||||
|
||||
// SOAP attributes with non-colonized names
|
||||
public static final QName QNAME_ATTR_ID = new QName("", "id");
|
||||
public static final QName QNAME_ATTR_HREF = new QName("", "href");
|
||||
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document.soap;
|
||||
|
||||
import com.sun.tools.internal.ws.wsdl.framework.ExtensionImpl;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.ValidationException;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* A SOAP fault extension.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class SOAPFault extends ExtensionImpl {
|
||||
|
||||
public SOAPFault(Locator locator) {
|
||||
super(locator);
|
||||
_use = SOAPUse.LITERAL;
|
||||
}
|
||||
|
||||
public QName getElementName() {
|
||||
return SOAPConstants.QNAME_FAULT;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return _name;
|
||||
}
|
||||
|
||||
public void setName(String s) {
|
||||
_name = s;
|
||||
}
|
||||
|
||||
public String getNamespace() {
|
||||
return _namespace;
|
||||
}
|
||||
|
||||
public void setNamespace(String s) {
|
||||
_namespace = s;
|
||||
}
|
||||
|
||||
public SOAPUse getUse() {
|
||||
return _use;
|
||||
}
|
||||
|
||||
public void setUse(SOAPUse u) {
|
||||
_use = u;
|
||||
}
|
||||
|
||||
public boolean isEncoded() {
|
||||
return _use == SOAPUse.ENCODED;
|
||||
}
|
||||
|
||||
public boolean isLiteral() {
|
||||
return _use == SOAPUse.LITERAL;
|
||||
}
|
||||
|
||||
public String getEncodingStyle() {
|
||||
return _encodingStyle;
|
||||
}
|
||||
|
||||
public void setEncodingStyle(String s) {
|
||||
_encodingStyle = s;
|
||||
}
|
||||
|
||||
public void validateThis() {
|
||||
if(_use == SOAPUse.ENCODED) {
|
||||
throw new ValidationException("validation.unsupportedUse.encoded", getLocator().getLineNumber(),getLocator().getSystemId());
|
||||
}
|
||||
}
|
||||
|
||||
private String _name;
|
||||
private String _encodingStyle;
|
||||
private String _namespace;
|
||||
private SOAPUse _use = SOAPUse.LITERAL;
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document.soap;
|
||||
|
||||
import com.sun.tools.internal.ws.wsdl.framework.*;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A SOAP header extension.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class SOAPHeader extends ExtensionImpl {
|
||||
|
||||
public SOAPHeader(Locator locator) {
|
||||
super(locator);
|
||||
_faults = new ArrayList();
|
||||
}
|
||||
|
||||
public void add(SOAPHeaderFault fault) {
|
||||
_faults.add(fault);
|
||||
}
|
||||
|
||||
public Iterator faults() {
|
||||
return _faults.iterator();
|
||||
}
|
||||
|
||||
public QName getElementName() {
|
||||
return SOAPConstants.QNAME_HEADER;
|
||||
}
|
||||
|
||||
public String getNamespace() {
|
||||
return _namespace;
|
||||
}
|
||||
|
||||
public void setNamespace(String s) {
|
||||
_namespace = s;
|
||||
}
|
||||
|
||||
public SOAPUse getUse() {
|
||||
return _use;
|
||||
}
|
||||
|
||||
public void setUse(SOAPUse u) {
|
||||
_use = u;
|
||||
}
|
||||
|
||||
public boolean isEncoded() {
|
||||
return _use == SOAPUse.ENCODED;
|
||||
}
|
||||
|
||||
public boolean isLiteral() {
|
||||
return _use == SOAPUse.LITERAL;
|
||||
}
|
||||
|
||||
public String getEncodingStyle() {
|
||||
return _encodingStyle;
|
||||
}
|
||||
|
||||
public void setEncodingStyle(String s) {
|
||||
_encodingStyle = s;
|
||||
}
|
||||
|
||||
public String getPart() {
|
||||
return _part;
|
||||
}
|
||||
|
||||
public void setMessage(QName message) {
|
||||
_message = message;
|
||||
}
|
||||
|
||||
public QName getMessage() {
|
||||
return _message;
|
||||
}
|
||||
|
||||
public void setPart(String s) {
|
||||
_part = s;
|
||||
}
|
||||
|
||||
public void withAllSubEntitiesDo(EntityAction action) {
|
||||
super.withAllSubEntitiesDo(action);
|
||||
|
||||
for (Iterator iter = _faults.iterator(); iter.hasNext();) {
|
||||
action.perform((Entity) iter.next());
|
||||
}
|
||||
}
|
||||
|
||||
public void withAllQNamesDo(QNameAction action) {
|
||||
super.withAllQNamesDo(action);
|
||||
|
||||
if (_message != null) {
|
||||
action.perform(_message);
|
||||
}
|
||||
}
|
||||
|
||||
public void accept(ExtensionVisitor visitor) throws Exception {
|
||||
visitor.preVisit(this);
|
||||
for (Iterator iter = _faults.iterator(); iter.hasNext();) {
|
||||
((SOAPHeaderFault) iter.next()).accept(visitor);
|
||||
}
|
||||
visitor.postVisit(this);
|
||||
}
|
||||
|
||||
public void validateThis() {
|
||||
if (_message == null) {
|
||||
failValidation("validation.missingRequiredAttribute", "message");
|
||||
}
|
||||
if (_part == null) {
|
||||
failValidation("validation.missingRequiredAttribute", "part");
|
||||
}
|
||||
// Fix for bug 4851427
|
||||
// if (_use == null) {
|
||||
// failValidation("validation.missingRequiredAttribute", "use");
|
||||
// }
|
||||
|
||||
if(_use == SOAPUse.ENCODED) {
|
||||
throw new ValidationException("validation.unsupportedUse.encoded", getLocator().getLineNumber(),getLocator().getSystemId());
|
||||
}
|
||||
}
|
||||
|
||||
private String _encodingStyle;
|
||||
private String _namespace;
|
||||
private String _part;
|
||||
private QName _message;
|
||||
private SOAPUse _use=SOAPUse.LITERAL;
|
||||
private List _faults;
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document.soap;
|
||||
|
||||
import com.sun.tools.internal.ws.wsdl.framework.ExtensionImpl;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.QNameAction;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.ValidationException;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* A SOAP header fault extension.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class SOAPHeaderFault extends ExtensionImpl {
|
||||
|
||||
public SOAPHeaderFault(Locator locator) {
|
||||
super(locator);
|
||||
}
|
||||
|
||||
public QName getElementName() {
|
||||
return SOAPConstants.QNAME_HEADERFAULT;
|
||||
}
|
||||
|
||||
public String getNamespace() {
|
||||
return _namespace;
|
||||
}
|
||||
|
||||
public void setNamespace(String s) {
|
||||
_namespace = s;
|
||||
}
|
||||
|
||||
public SOAPUse getUse() {
|
||||
return _use;
|
||||
}
|
||||
|
||||
public void setUse(SOAPUse u) {
|
||||
_use = u;
|
||||
}
|
||||
|
||||
public boolean isEncoded() {
|
||||
return _use == SOAPUse.ENCODED;
|
||||
}
|
||||
|
||||
public boolean isLiteral() {
|
||||
return _use == SOAPUse.LITERAL;
|
||||
}
|
||||
|
||||
public String getEncodingStyle() {
|
||||
return _encodingStyle;
|
||||
}
|
||||
|
||||
public void setEncodingStyle(String s) {
|
||||
_encodingStyle = s;
|
||||
}
|
||||
|
||||
public String getPart() {
|
||||
return _part;
|
||||
}
|
||||
|
||||
public void setMessage(QName message) {
|
||||
_message = message;
|
||||
}
|
||||
|
||||
public QName getMessage() {
|
||||
return _message;
|
||||
}
|
||||
|
||||
public void setPart(String s) {
|
||||
_part = s;
|
||||
}
|
||||
|
||||
public void withAllQNamesDo(QNameAction action) {
|
||||
super.withAllQNamesDo(action);
|
||||
|
||||
if (_message != null) {
|
||||
action.perform(_message);
|
||||
}
|
||||
}
|
||||
|
||||
public void validateThis() {
|
||||
if (_message == null) {
|
||||
failValidation("validation.missingRequiredAttribute", "message");
|
||||
}
|
||||
if (_part == null) {
|
||||
failValidation("validation.missingRequiredAttribute", "part");
|
||||
}
|
||||
if(_use == SOAPUse.ENCODED) {
|
||||
throw new ValidationException("validation.unsupportedUse.encoded", getLocator().getLineNumber(),getLocator().getSystemId());
|
||||
}
|
||||
}
|
||||
|
||||
private String _encodingStyle;
|
||||
private String _namespace;
|
||||
private String _part;
|
||||
private QName _message;
|
||||
private SOAPUse _use=SOAPUse.LITERAL;
|
||||
}
|
||||
@@ -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.tools.internal.ws.wsdl.document.soap;
|
||||
|
||||
import com.sun.tools.internal.ws.wsdl.framework.ExtensionImpl;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* A SOAP operation extension.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class SOAPOperation extends ExtensionImpl {
|
||||
|
||||
public SOAPOperation(Locator locator) {
|
||||
super(locator);
|
||||
|
||||
}
|
||||
|
||||
public QName getElementName() {
|
||||
return SOAPConstants.QNAME_OPERATION;
|
||||
}
|
||||
|
||||
public String getSOAPAction() {
|
||||
return _soapAction;
|
||||
}
|
||||
|
||||
public void setSOAPAction(String s) {
|
||||
_soapAction = s;
|
||||
}
|
||||
|
||||
public SOAPStyle getStyle() {
|
||||
return _style;
|
||||
}
|
||||
|
||||
public void setStyle(SOAPStyle s) {
|
||||
_style = s;
|
||||
}
|
||||
|
||||
public boolean isDocument() {
|
||||
return _style == SOAPStyle.DOCUMENT;
|
||||
}
|
||||
|
||||
public boolean isRPC() {
|
||||
return _style == SOAPStyle.RPC;
|
||||
}
|
||||
|
||||
public void validateThis() {
|
||||
}
|
||||
|
||||
private String _soapAction;
|
||||
private SOAPStyle _style;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document.soap;
|
||||
|
||||
/**
|
||||
* A SOAP "style" enumeration.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public final class SOAPStyle {
|
||||
|
||||
public static final SOAPStyle RPC = new SOAPStyle();
|
||||
public static final SOAPStyle DOCUMENT = new SOAPStyle();
|
||||
|
||||
private SOAPStyle() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.document.soap;
|
||||
|
||||
/**
|
||||
* A SOAP "use" enumeration.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public final class SOAPUse {
|
||||
|
||||
public static final SOAPUse LITERAL = new SOAPUse();
|
||||
public static final SOAPUse ENCODED = new SOAPUse();
|
||||
|
||||
private SOAPUse() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.framework;
|
||||
|
||||
import com.sun.tools.internal.ws.wsdl.parser.MetadataFinder;
|
||||
import com.sun.tools.internal.ws.wsdl.parser.DOMForest;
|
||||
import com.sun.tools.internal.ws.wscompile.ErrorReceiver;
|
||||
import com.sun.tools.internal.ws.wscompile.AbortException;
|
||||
import com.sun.tools.internal.ws.resources.WsdlMessages;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* An abstract class for documents containing entities.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public abstract class AbstractDocument {
|
||||
|
||||
protected final DOMForest forest;
|
||||
protected final ErrorReceiver errReceiver;
|
||||
|
||||
protected AbstractDocument(MetadataFinder forest, ErrorReceiver errReceiver) {
|
||||
this.forest = forest;
|
||||
this.errReceiver = errReceiver;
|
||||
kinds = new HashMap();
|
||||
importedEntities = new ArrayList();
|
||||
importedDocuments = new HashSet();
|
||||
includedEntities = new ArrayList();
|
||||
includedDocuments = new HashSet();
|
||||
}
|
||||
|
||||
public String getSystemId() {
|
||||
return _systemId;
|
||||
}
|
||||
|
||||
public void setSystemId(String s) {
|
||||
if (_systemId != null && !_systemId.equals(s)) {
|
||||
// avoid redefinition of a system identifier
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
_systemId = s;
|
||||
if (s != null) {
|
||||
importedDocuments.add(s);
|
||||
}
|
||||
}
|
||||
|
||||
public void addIncludedDocument(String systemId) {
|
||||
includedDocuments.add(systemId);
|
||||
}
|
||||
|
||||
public boolean isIncludedDocument(String systemId) {
|
||||
return includedDocuments.contains(systemId);
|
||||
}
|
||||
|
||||
public void addIncludedEntity(Entity entity) {
|
||||
includedEntities.add(entity);
|
||||
}
|
||||
|
||||
public void addImportedDocument(String systemId) {
|
||||
importedDocuments.add(systemId);
|
||||
}
|
||||
|
||||
public boolean isImportedDocument(String systemId) {
|
||||
return importedDocuments.contains(systemId);
|
||||
}
|
||||
|
||||
public void addImportedEntity(Entity entity) {
|
||||
importedEntities.add(entity);
|
||||
}
|
||||
|
||||
public void withAllSubEntitiesDo(EntityAction action) {
|
||||
if (getRoot() != null) {
|
||||
action.perform(getRoot());
|
||||
}
|
||||
|
||||
for (Iterator iter = importedEntities.iterator(); iter.hasNext();) {
|
||||
action.perform((Entity) iter.next());
|
||||
}
|
||||
|
||||
for (Iterator iter = includedEntities.iterator(); iter.hasNext();) {
|
||||
action.perform((Entity) iter.next());
|
||||
}
|
||||
}
|
||||
|
||||
public Map getMap(Kind k) {
|
||||
Map m = (Map) kinds.get(k.getName());
|
||||
if (m == null) {
|
||||
m = new HashMap();
|
||||
kinds.put(k.getName(), m);
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
||||
public void define(GloballyKnown e) {
|
||||
Map map = getMap(e.getKind());
|
||||
if (e.getName() == null)
|
||||
return;
|
||||
QName name =
|
||||
new QName(e.getDefining().getTargetNamespaceURI(), e.getName());
|
||||
|
||||
if (map.containsKey(name)){
|
||||
errReceiver.error(e.getLocator(), WsdlMessages.ENTITY_DUPLICATE_WITH_TYPE(e.getElementName().getLocalPart(), e.getName()));
|
||||
throw new AbortException();
|
||||
}else{
|
||||
map.put(name, e);
|
||||
}
|
||||
}
|
||||
|
||||
public GloballyKnown find(Kind k, QName name) {
|
||||
Map map = getMap(k);
|
||||
Object result = map.get(name);
|
||||
if (result == null){
|
||||
errReceiver.error(null, WsdlMessages.ENTITY_NOT_FOUND_BY_Q_NAME(k.getName(), name, _systemId));
|
||||
throw new AbortException();
|
||||
}
|
||||
return (GloballyKnown) result;
|
||||
}
|
||||
|
||||
public void validateLocally() {
|
||||
LocallyValidatingAction action = new LocallyValidatingAction();
|
||||
withAllSubEntitiesDo(action);
|
||||
if (action.getException() != null) {
|
||||
throw action.getException();
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void validate(EntityReferenceValidator validator);
|
||||
|
||||
protected abstract Entity getRoot();
|
||||
|
||||
private final Map kinds;
|
||||
private String _systemId;
|
||||
private final Set importedDocuments;
|
||||
private final List importedEntities;
|
||||
private final Set includedDocuments;
|
||||
private final List includedEntities;
|
||||
|
||||
private static class LocallyValidatingAction implements EntityAction {
|
||||
public LocallyValidatingAction() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform(Entity entity) {
|
||||
try {
|
||||
entity.validateThis();
|
||||
entity.withAllSubEntitiesDo(this);
|
||||
} catch (ValidationException e) {
|
||||
if (_exception == null) {
|
||||
_exception = e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ValidationException getException() {
|
||||
return _exception;
|
||||
}
|
||||
|
||||
private ValidationException _exception;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.framework;
|
||||
|
||||
/**
|
||||
* An interface implemented by entities that define target namespaces.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public interface Defining extends Elemental {
|
||||
public String getTargetNamespaceURI();
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.framework;
|
||||
|
||||
/**
|
||||
* An exception signalling that an entity with the given name/id has already been defined.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class DuplicateEntityException extends ValidationException {
|
||||
|
||||
public DuplicateEntityException(GloballyKnown entity) {
|
||||
super(
|
||||
"entity.duplicateWithType",
|
||||
entity.getElementName().getLocalPart(),
|
||||
entity.getName());
|
||||
}
|
||||
|
||||
public DuplicateEntityException(Identifiable entity) {
|
||||
super(
|
||||
"entity.duplicateWithType",
|
||||
entity.getElementName().getLocalPart(),
|
||||
entity.getID());
|
||||
}
|
||||
|
||||
public DuplicateEntityException(Entity entity, String name) {
|
||||
super(
|
||||
"entity.duplicateWithType",
|
||||
entity.getElementName().getLocalPart(), name);
|
||||
}
|
||||
|
||||
public String getDefaultResourceBundleName() {
|
||||
return "com.sun.tools.internal.ws.resources.wsdl";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.framework;
|
||||
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* Interface implemented by classes that are mappable to XML elements.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public interface Elemental {
|
||||
public QName getElementName();
|
||||
public Locator getLocator();
|
||||
}
|
||||
105
jdkSrc/jdk8/com/sun/tools/internal/ws/wsdl/framework/Entity.java
Normal file
105
jdkSrc/jdk8/com/sun/tools/internal/ws/wsdl/framework/Entity.java
Normal file
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.framework;
|
||||
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.sun.tools.internal.ws.wscompile.ErrorReceiver;
|
||||
|
||||
/**
|
||||
* An entity, typically corresponding to an XML element.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public abstract class Entity implements Elemental {
|
||||
|
||||
private final Locator locator;
|
||||
protected ErrorReceiver errorReceiver;
|
||||
public Entity(Locator locator) {
|
||||
this.locator = locator;
|
||||
}
|
||||
|
||||
public void setErrorReceiver(ErrorReceiver errorReceiver) {
|
||||
this.errorReceiver = errorReceiver;
|
||||
}
|
||||
|
||||
public Locator getLocator() {
|
||||
return locator;
|
||||
}
|
||||
|
||||
public Object getProperty(String key) {
|
||||
if (_properties == null)
|
||||
return null;
|
||||
return _properties.get(key);
|
||||
}
|
||||
|
||||
public void setProperty(String key, Object value) {
|
||||
if (value == null) {
|
||||
removeProperty(key);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_properties == null) {
|
||||
_properties = new HashMap();
|
||||
}
|
||||
_properties.put(key, value);
|
||||
}
|
||||
|
||||
public void removeProperty(String key) {
|
||||
if (_properties != null) {
|
||||
_properties.remove(key);
|
||||
}
|
||||
}
|
||||
|
||||
public void withAllSubEntitiesDo(EntityAction action) {
|
||||
// no-op by default
|
||||
}
|
||||
|
||||
public void withAllQNamesDo(QNameAction action) {
|
||||
action.perform(getElementName());
|
||||
}
|
||||
|
||||
public void withAllEntityReferencesDo(EntityReferenceAction action) {
|
||||
// no-op by default
|
||||
}
|
||||
|
||||
public abstract void validateThis();
|
||||
|
||||
protected void failValidation(String key) {
|
||||
throw new ValidationException(key, getElementName().getLocalPart());
|
||||
}
|
||||
|
||||
protected void failValidation(String key, String arg) {
|
||||
throw new ValidationException(
|
||||
key,
|
||||
new Object[] { arg, getElementName().getLocalPart()});
|
||||
}
|
||||
|
||||
private Map _properties;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.framework;
|
||||
|
||||
/**
|
||||
* An action operating on an entity.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public interface EntityAction {
|
||||
public void perform(Entity entity);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.framework;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* An action operating on an entity reference composed of a kind and a QName.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public interface EntityReferenceAction {
|
||||
public void perform(Kind kind, QName name);
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.framework;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* An interface implemented by a class that is capable of validating
|
||||
* a QName/Kind pair referring to an external entity.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public interface EntityReferenceValidator {
|
||||
public boolean isValid(Kind kind, QName name);
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.framework;
|
||||
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A helper class for extensible entities.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class ExtensibilityHelper {
|
||||
|
||||
public ExtensibilityHelper() {
|
||||
}
|
||||
|
||||
public void addExtension(TWSDLExtension e) {
|
||||
if (_extensions == null) {
|
||||
_extensions = new ArrayList();
|
||||
}
|
||||
_extensions.add(e);
|
||||
}
|
||||
|
||||
public Iterable<TWSDLExtension> extensions() {
|
||||
if (_extensions == null) {
|
||||
return new ArrayList<TWSDLExtension>();
|
||||
} else {
|
||||
return _extensions;
|
||||
}
|
||||
}
|
||||
|
||||
public void withAllSubEntitiesDo(EntityAction action) {
|
||||
if (_extensions != null) {
|
||||
for (Iterator iter = _extensions.iterator(); iter.hasNext();) {
|
||||
action.perform((Entity) iter.next());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void accept(ExtensionVisitor visitor) throws Exception {
|
||||
if (_extensions != null) {
|
||||
for (Iterator iter = _extensions.iterator(); iter.hasNext();) {
|
||||
((ExtensionImpl) iter.next()).accept(visitor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<TWSDLExtension> _extensions;
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.framework;
|
||||
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible;
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
/**
|
||||
* An entity extending another entity.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public abstract class ExtensionImpl extends Entity implements TWSDLExtension {
|
||||
|
||||
public ExtensionImpl(Locator locator) {
|
||||
super(locator);
|
||||
}
|
||||
|
||||
public TWSDLExtensible getParent() {
|
||||
return _parent;
|
||||
}
|
||||
|
||||
public void setParent(TWSDLExtensible parent) {
|
||||
_parent = parent;
|
||||
}
|
||||
|
||||
public void accept(ExtensionVisitor visitor) throws Exception {
|
||||
visitor.preVisit(this);
|
||||
visitor.postVisit(this);
|
||||
}
|
||||
|
||||
private TWSDLExtensible _parent;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.framework;
|
||||
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension;
|
||||
|
||||
/**
|
||||
* A visitor working on extension entities.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public interface ExtensionVisitor {
|
||||
public void preVisit(TWSDLExtension extension) throws Exception;
|
||||
public void postVisit(TWSDLExtension extension) throws Exception;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.framework;
|
||||
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension;
|
||||
|
||||
/**
|
||||
* A base class for extension visitors.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class ExtensionVisitorBase implements ExtensionVisitor {
|
||||
public ExtensionVisitorBase() {
|
||||
}
|
||||
|
||||
public void preVisit(TWSDLExtension extension) throws Exception {
|
||||
}
|
||||
public void postVisit(TWSDLExtension extension) throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.framework;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* A reference to a globally known entity in a document.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class ExternalEntityReference {
|
||||
|
||||
public ExternalEntityReference(
|
||||
AbstractDocument document,
|
||||
Kind kind,
|
||||
QName name) {
|
||||
_document = document;
|
||||
_kind = kind;
|
||||
_name = name;
|
||||
}
|
||||
|
||||
public AbstractDocument getDocument() {
|
||||
return _document;
|
||||
}
|
||||
|
||||
public Kind getKind() {
|
||||
return _kind;
|
||||
}
|
||||
|
||||
public QName getName() {
|
||||
return _name;
|
||||
}
|
||||
|
||||
public GloballyKnown resolve() {
|
||||
return _document.find(_kind, _name);
|
||||
}
|
||||
|
||||
private AbstractDocument _document;
|
||||
private Kind _kind;
|
||||
private QName _name;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.framework;
|
||||
|
||||
import org.xml.sax.Locator;
|
||||
import com.sun.tools.internal.ws.wscompile.ErrorReceiver;
|
||||
|
||||
/**
|
||||
* An entity that can be defined in a target namespace.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public abstract class GlobalEntity extends Entity implements GloballyKnown {
|
||||
|
||||
public GlobalEntity(Defining defining, Locator locator, ErrorReceiver errorReceiver) {
|
||||
super(locator);
|
||||
_defining = defining;
|
||||
this.errorReceiver = errorReceiver;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return _name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
_name = name;
|
||||
}
|
||||
|
||||
public abstract Kind getKind();
|
||||
|
||||
public Defining getDefining() {
|
||||
return _defining;
|
||||
}
|
||||
|
||||
private Defining _defining;
|
||||
private String _name;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.framework;
|
||||
|
||||
/**
|
||||
* An interface implemented by entities which can be defined in a target namespace.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public interface GloballyKnown extends Elemental {
|
||||
public String getName();
|
||||
public Kind getKind();
|
||||
public Defining getDefining();
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.framework;
|
||||
|
||||
/**
|
||||
* An interface implemented by entities which have an ID.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public interface Identifiable extends Elemental {
|
||||
public String getID();
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.framework;
|
||||
|
||||
/**
|
||||
* A kind of entity.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public final class Kind {
|
||||
|
||||
public Kind(String s) {
|
||||
_name = s;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return _name;
|
||||
}
|
||||
|
||||
private String _name;
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.framework;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* An exception signalling that an entity with the given name/id does not exist.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class NoSuchEntityException extends ValidationException {
|
||||
|
||||
public NoSuchEntityException(QName name) {
|
||||
super(
|
||||
"entity.notFoundByQName",
|
||||
name.getLocalPart(), name.getNamespaceURI());
|
||||
}
|
||||
|
||||
public NoSuchEntityException(String id) {
|
||||
super("entity.notFoundByID", id);
|
||||
}
|
||||
|
||||
public String getDefaultResourceBundleName() {
|
||||
return "com.sun.tools.internal.ws.resources.wsdl";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.framework;
|
||||
|
||||
import com.sun.istack.internal.localization.Localizable;
|
||||
import com.sun.xml.internal.ws.util.exception.JAXWSExceptionBase;
|
||||
|
||||
/**
|
||||
* An exception signalling a parsing error.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class ParseException extends JAXWSExceptionBase {
|
||||
|
||||
public ParseException(String key, Object... args) {
|
||||
super(key, args);
|
||||
}
|
||||
|
||||
public ParseException(Localizable message){
|
||||
super("localized.error", message);
|
||||
}
|
||||
|
||||
public ParseException(Throwable throwable) {
|
||||
super(throwable);
|
||||
}
|
||||
|
||||
public String getDefaultResourceBundleName() {
|
||||
return "com.sun.tools.internal.ws.resources.wsdl";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.framework;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* A listener for parsing-related events.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public interface ParserListener {
|
||||
public void ignoringExtension(Entity entity, QName name, QName parent);
|
||||
public void doneParsingEntity(QName element, Entity entity);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.framework;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* An action operating on a QName.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public interface QNameAction {
|
||||
public void perform(QName name);
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.framework;
|
||||
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext;
|
||||
import com.sun.tools.internal.ws.wsdl.parser.DOMForest;
|
||||
import com.sun.tools.internal.ws.wscompile.ErrorReceiver;
|
||||
import com.sun.tools.internal.ws.resources.WsdlMessages;
|
||||
import com.sun.xml.internal.ws.util.NamespaceSupport;
|
||||
import com.sun.xml.internal.ws.util.xml.XmlUtil;
|
||||
import org.w3c.dom.Attr;
|
||||
import org.w3c.dom.Element;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The context used by parser classes.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class TWSDLParserContextImpl implements TWSDLParserContext {
|
||||
|
||||
private final static String PREFIX_XMLNS = "xmlns";
|
||||
private boolean _followImports;
|
||||
private final AbstractDocument _document;
|
||||
private final NamespaceSupport _nsSupport;
|
||||
private final ArrayList<ParserListener> _listeners;
|
||||
private final WSDLLocation _wsdlLocation;
|
||||
private final DOMForest forest;
|
||||
private final ErrorReceiver errorReceiver;
|
||||
|
||||
public TWSDLParserContextImpl(DOMForest forest, AbstractDocument doc, ArrayList<ParserListener> listeners, ErrorReceiver errReceiver) {
|
||||
this._document = doc;
|
||||
this._listeners = listeners;
|
||||
this._nsSupport = new NamespaceSupport();
|
||||
this._wsdlLocation = new WSDLLocation();
|
||||
this.forest = forest;
|
||||
this.errorReceiver = errReceiver;
|
||||
}
|
||||
|
||||
public AbstractDocument getDocument() {
|
||||
return _document;
|
||||
}
|
||||
|
||||
public boolean getFollowImports() {
|
||||
return _followImports;
|
||||
}
|
||||
|
||||
public void setFollowImports(boolean b) {
|
||||
_followImports = b;
|
||||
}
|
||||
|
||||
public void push() {
|
||||
_nsSupport.pushContext();
|
||||
}
|
||||
|
||||
public void pop() {
|
||||
_nsSupport.popContext();
|
||||
}
|
||||
|
||||
public String getNamespaceURI(String prefix) {
|
||||
return _nsSupport.getURI(prefix);
|
||||
}
|
||||
|
||||
public Iterable<String> getPrefixes() {
|
||||
return _nsSupport.getPrefixes();
|
||||
}
|
||||
|
||||
public String getDefaultNamespaceURI() {
|
||||
return getNamespaceURI("");
|
||||
}
|
||||
|
||||
public void registerNamespaces(Element e) {
|
||||
for (Iterator iter = XmlUtil.getAllAttributes(e); iter.hasNext();) {
|
||||
Attr a = (Attr) iter.next();
|
||||
if (a.getName().equals(PREFIX_XMLNS)) {
|
||||
// default namespace declaration
|
||||
_nsSupport.declarePrefix("", a.getValue());
|
||||
} else {
|
||||
String prefix = XmlUtil.getPrefix(a.getName());
|
||||
if (prefix != null && prefix.equals(PREFIX_XMLNS)) {
|
||||
String nsPrefix = XmlUtil.getLocalPart(a.getName());
|
||||
String uri = a.getValue();
|
||||
_nsSupport.declarePrefix(nsPrefix, uri);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Locator getLocation(Element e) {
|
||||
return forest.locatorTable.getStartLocation(e);
|
||||
}
|
||||
|
||||
public QName translateQualifiedName(Locator locator, String s) {
|
||||
if (s == null)
|
||||
return null;
|
||||
|
||||
String prefix = XmlUtil.getPrefix(s);
|
||||
String uri = null;
|
||||
|
||||
if (prefix == null) {
|
||||
uri = getDefaultNamespaceURI();
|
||||
} else {
|
||||
uri = getNamespaceURI(prefix);
|
||||
if (uri == null) {
|
||||
errorReceiver.error(locator, WsdlMessages.PARSING_UNKNOWN_NAMESPACE_PREFIX(prefix));
|
||||
}
|
||||
}
|
||||
|
||||
return new QName(uri, XmlUtil.getLocalPart(s));
|
||||
}
|
||||
|
||||
public void fireIgnoringExtension(Element e, Entity entity) {
|
||||
QName name = new QName(e.getNamespaceURI(), e.getLocalName());
|
||||
QName parent = entity.getElementName();
|
||||
List _targets = null;
|
||||
|
||||
synchronized (this) {
|
||||
if (_listeners != null) {
|
||||
_targets = (List) _listeners.clone();
|
||||
}
|
||||
}
|
||||
|
||||
if (_targets != null) {
|
||||
for (Iterator iter = _targets.iterator(); iter.hasNext();) {
|
||||
ParserListener l = (ParserListener) iter.next();
|
||||
l.ignoringExtension(entity, name, parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void fireDoneParsingEntity(QName element, Entity entity) {
|
||||
List _targets = null;
|
||||
|
||||
synchronized (this) {
|
||||
if (_listeners != null) {
|
||||
_targets = (List) _listeners.clone();
|
||||
}
|
||||
}
|
||||
|
||||
if (_targets != null) {
|
||||
for (Iterator iter = _targets.iterator(); iter.hasNext();) {
|
||||
ParserListener l = (ParserListener) iter.next();
|
||||
l.doneParsingEntity(element, entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//bug fix: 4856674, WSDLLocation context maintainence
|
||||
//and utility funcitons
|
||||
public void pushWSDLLocation() {
|
||||
_wsdlLocation.push();
|
||||
}
|
||||
|
||||
public void popWSDLLocation() {
|
||||
_wsdlLocation.pop();
|
||||
}
|
||||
|
||||
public void setWSDLLocation(String loc) {
|
||||
_wsdlLocation.setLocation(loc);
|
||||
}
|
||||
|
||||
public String getWSDLLocation() {
|
||||
return _wsdlLocation.getLocation();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.framework;
|
||||
|
||||
import com.sun.xml.internal.ws.util.exception.JAXWSExceptionBase;
|
||||
|
||||
/**
|
||||
* An exception signalling that validation of an entity failed.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class ValidationException extends JAXWSExceptionBase {
|
||||
|
||||
public ValidationException(String key, Object... args) {
|
||||
super(key, args);
|
||||
}
|
||||
|
||||
public ValidationException(Throwable throwable) {
|
||||
super(throwable);
|
||||
}
|
||||
|
||||
public String getDefaultResourceBundleName() {
|
||||
return "com.sun.tools.internal.ws.resources.wsdl";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.framework;
|
||||
|
||||
/**
|
||||
*
|
||||
* Maintains wsdl:location context. This is used with
|
||||
* TWSDLParserContextImpl, where one each WSDL being imported its location is pushed.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class WSDLLocation {
|
||||
WSDLLocation() {
|
||||
reset();
|
||||
}
|
||||
|
||||
public void push() {
|
||||
int max = contexts.length;
|
||||
idPos++;
|
||||
if (idPos >= max) {
|
||||
LocationContext newContexts[] = new LocationContext[max * 2];
|
||||
System.arraycopy(contexts, 0, newContexts, 0, max);
|
||||
contexts = newContexts;
|
||||
}
|
||||
currentContext = contexts[idPos];
|
||||
if (currentContext == null) {
|
||||
contexts[idPos] = currentContext = new LocationContext();
|
||||
}
|
||||
}
|
||||
|
||||
public void pop() {
|
||||
idPos--;
|
||||
if (idPos >= 0) {
|
||||
currentContext = contexts[idPos];
|
||||
}
|
||||
}
|
||||
|
||||
public final void reset() {
|
||||
contexts = new LocationContext[32];
|
||||
idPos = 0;
|
||||
contexts[idPos] = currentContext = new LocationContext();
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return currentContext.getLocation();
|
||||
}
|
||||
|
||||
public void setLocation(String loc) {
|
||||
currentContext.setLocation(loc);
|
||||
}
|
||||
|
||||
private LocationContext[] contexts;
|
||||
private int idPos;
|
||||
private LocationContext currentContext;
|
||||
|
||||
// LocationContext - inner class
|
||||
private static class LocationContext {
|
||||
void setLocation(String loc) {
|
||||
location = loc;
|
||||
}
|
||||
|
||||
String getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
private String location;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.parser;
|
||||
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible;
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensionHandler;
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext;
|
||||
import com.sun.tools.internal.ws.wsdl.document.mime.MIMEConstants;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* An abstract implementation class of {@link TWSDLExtensionHandler}
|
||||
*
|
||||
* @author Vivek Pandey
|
||||
*/
|
||||
public abstract class AbstractExtensionHandler extends TWSDLExtensionHandler {
|
||||
private final Map<String, AbstractExtensionHandler> extensionHandlers;
|
||||
private final Map<String, AbstractExtensionHandler> unmodExtenHandlers;
|
||||
|
||||
public AbstractExtensionHandler(Map<String, AbstractExtensionHandler> extensionHandlerMap) {
|
||||
this.extensionHandlers = extensionHandlerMap;
|
||||
this.unmodExtenHandlers = Collections.unmodifiableMap(extensionHandlers);
|
||||
}
|
||||
|
||||
public Map<String, AbstractExtensionHandler> getExtensionHandlers(){
|
||||
return unmodExtenHandlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback that gets called by the WSDL parser or any other extension handler on finding an extensibility element
|
||||
* that it can't understand.
|
||||
*
|
||||
* @param parent The Parent element within which the extensibility element is defined
|
||||
* @param e The extensibility elemenet
|
||||
* @return false if there was some error during the extension handling otherwise returns true. If returned false
|
||||
* then the WSDL parser can abort if the wsdl extensibility element had <code>required</code> attribute set to true
|
||||
*/
|
||||
public boolean doHandleExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
|
||||
if (parent.getWSDLElementName().equals(MIMEConstants.QNAME_PART)) {
|
||||
return handleMIMEPartExtension(context, parent, e);
|
||||
} else {
|
||||
return super.doHandleExtension(context, parent, e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for <code>wsdl:mime</code>
|
||||
*
|
||||
* @param context Parser context that will be passed on by the wsdl parser
|
||||
* @param parent The Parent element within which the extensibility element is defined
|
||||
* @param e The extensibility elemenet
|
||||
* @return false if there was some error during the extension handling otherwise returns true. If returned false
|
||||
* then the WSDL parser can abort if the wsdl extensibility element had <code>required</code> attribute set to true
|
||||
*/
|
||||
protected boolean handleMIMEPartExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.parser;
|
||||
|
||||
import com.sun.istack.internal.SAXParseException2;
|
||||
import com.sun.tools.internal.ws.resources.WsdlMessages;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.SAXParseException;
|
||||
import org.xml.sax.helpers.XMLFilterImpl;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* XMLFilter that finds references to other schema files from
|
||||
* SAX events.
|
||||
*
|
||||
* This implementation is a base implementation for typical case
|
||||
* where we just need to look for a particular attribute which
|
||||
* contains an URL to another schema file.
|
||||
*
|
||||
* @author
|
||||
* Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
* Vivek Pandey
|
||||
*/
|
||||
public abstract class AbstractReferenceFinderImpl extends XMLFilterImpl {
|
||||
protected final DOMForest parent;
|
||||
|
||||
protected AbstractReferenceFinderImpl( DOMForest _parent ) {
|
||||
this.parent = _parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* IF the given element contains a reference to an external resource,
|
||||
* return its URL.
|
||||
*
|
||||
* @param nsURI
|
||||
* Namespace URI of the current element
|
||||
* @param localName
|
||||
* Local name of the current element
|
||||
* @return
|
||||
* It's OK to return a relative URL.
|
||||
*/
|
||||
protected abstract String findExternalResource( String nsURI, String localName, Attributes atts);
|
||||
|
||||
@Override
|
||||
public void startElement(String namespaceURI, String localName, String qName, Attributes atts)
|
||||
throws SAXException {
|
||||
super.startElement(namespaceURI, localName, qName, atts);
|
||||
|
||||
String relativeRef = findExternalResource(namespaceURI,localName,atts);
|
||||
if(relativeRef==null) return; // non found
|
||||
|
||||
try {
|
||||
// absolutize URL.
|
||||
assert locator != null;
|
||||
String lsi = locator.getSystemId();
|
||||
String ref;
|
||||
if (lsi.startsWith("jar:")) {
|
||||
int bangIdx = lsi.indexOf('!');
|
||||
if (bangIdx > 0) {
|
||||
ref = new URL(new URL(lsi), relativeRef).toString();
|
||||
} else
|
||||
ref = relativeRef;
|
||||
} else
|
||||
ref = new URI(lsi).resolve(new URI(relativeRef)).toString();
|
||||
|
||||
// then parse this schema as well,
|
||||
// but don't mark this document as a root.
|
||||
parent.parse(ref,false);
|
||||
} catch( URISyntaxException e ) {
|
||||
SAXParseException spe = new SAXParseException2(
|
||||
WsdlMessages.ABSTRACT_REFERENCE_FINDER_IMPL_UNABLE_TO_PARSE(relativeRef,e.getMessage()),
|
||||
locator, e );
|
||||
|
||||
fatalError(spe);
|
||||
throw spe;
|
||||
} catch( IOException e ) {
|
||||
SAXParseException spe = new SAXParseException2(
|
||||
WsdlMessages.ABSTRACT_REFERENCE_FINDER_IMPL_UNABLE_TO_PARSE(relativeRef,e.getMessage()),
|
||||
locator, e );
|
||||
|
||||
fatalError(spe);
|
||||
throw spe;
|
||||
}
|
||||
}
|
||||
|
||||
private Locator locator;
|
||||
|
||||
@Override
|
||||
public void setDocumentLocator(Locator locator) {
|
||||
super.setDocumentLocator(locator);
|
||||
this.locator = locator;
|
||||
}
|
||||
}
|
||||
145
jdkSrc/jdk8/com/sun/tools/internal/ws/wsdl/parser/Constants.java
Normal file
145
jdkSrc/jdk8/com/sun/tools/internal/ws/wsdl/parser/Constants.java
Normal file
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.parser;
|
||||
|
||||
/**
|
||||
* An interface defining constants needed to read and write WSDL documents.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public interface Constants {
|
||||
// WSDL element tags
|
||||
static final String TAG_BINDING = "binding";
|
||||
static final String TAG_DEFINITIONS = "definitions";
|
||||
static final String TAG_DOCUMENTATION = "documentation";
|
||||
static final String TAG_MESSAGE = "message";
|
||||
static final String TAG_PART = "part";
|
||||
static final String TAG_PORT_TYPE = "portType";
|
||||
static final String TAG_TYPES = "types";
|
||||
static final String TAG_OPERATION = "operation";
|
||||
static final String TAG_INPUT = "input";
|
||||
static final String TAG_OUTPUT = "output";
|
||||
static final String TAG_FAULT = "fault";
|
||||
static final String TAG_SERVICE = "service";
|
||||
static final String TAG_PORT = "port";
|
||||
static final String TAG_ = "";
|
||||
|
||||
// WSDL attribute names
|
||||
static final String ATTR_ELEMENT = "element";
|
||||
static final String ATTR_NAME = "name";
|
||||
static final String ATTR_REQUIRED = "required";
|
||||
static final String ATTR_TARGET_NAMESPACE = "targetNamespace";
|
||||
static final String ATTR_TYPE = "type";
|
||||
static final String ATTR_MESSAGE = "message";
|
||||
static final String ATTR_BINDING = "binding";
|
||||
static final String ATTR_LOCATION = "location";
|
||||
static final String ATTR_TRANSPORT = "transport";
|
||||
static final String ATTR_STYLE = "style";
|
||||
static final String ATTR_USE = "use";
|
||||
static final String ATTR_NAMESPACE = "namespace";
|
||||
static final String ATTR_ENCODING_STYLE = "encodingStyle";
|
||||
static final String ATTR_PART = "part";
|
||||
static final String ATTR_PARTS = "parts";
|
||||
static final String ATTR_SOAP_ACTION = "soapAction";
|
||||
static final String ATTR_PARAMETER_ORDER = "parameterOrder";
|
||||
static final String ATTR_VERB = "verb";
|
||||
|
||||
// schema attribute names
|
||||
static final String ATTR_ID = "id";
|
||||
static final String ATTR_VERSION = "version";
|
||||
static final String ATTR_ATTRIBUTE_FORM_DEFAULT = "attributeFormDefault";
|
||||
static final String ATTR_BLOCK_DEFAULT = "blockDefault";
|
||||
static final String ATTR_ELEMENT_FORM_DEFAULT = "elementFormDefault";
|
||||
static final String ATTR_FINAL_DEFAULT = "finalDefault";
|
||||
static final String ATTR_ABSTRACT = "abstract";
|
||||
static final String ATTR_NILLABLE = "nillable";
|
||||
static final String ATTR_DEFAULT = "default";
|
||||
static final String ATTR_FIXED = "fixed";
|
||||
static final String ATTR_FORM = "form";
|
||||
static final String ATTR_BLOCK = "block";
|
||||
static final String ATTR_FINAL = "final";
|
||||
static final String ATTR_REF = "ref";
|
||||
static final String ATTR_SUBSTITUTION_GROUP = "substitutionGroup";
|
||||
static final String ATTR_MIN_OCCURS = "minOccurs";
|
||||
static final String ATTR_MAX_OCCURS = "maxOccurs";
|
||||
static final String ATTR_PROCESS_CONTENTS = "processContents";
|
||||
static final String ATTR_MIXED = "mixed";
|
||||
static final String ATTR_BASE = "base";
|
||||
static final String ATTR_VALUE = "value";
|
||||
static final String ATTR_XPATH = "xpath";
|
||||
static final String ATTR_SCHEMA_LOCATION = "schemaLocation";
|
||||
static final String ATTR_REFER = "refer";
|
||||
static final String ATTR_ITEM_TYPE = "itemType";
|
||||
static final String ATTR_PUBLIC = "public";
|
||||
static final String ATTR_SYSTEM = "system";
|
||||
static final String ATTR_MEMBER_TYPES = "memberTypes";
|
||||
static final String ATTR_ = "";
|
||||
|
||||
// WSDL attribute values
|
||||
static final String ATTRVALUE_RPC = "rpc";
|
||||
static final String ATTRVALUE_DOCUMENT = "document";
|
||||
static final String ATTRVALUE_LITERAL = "literal";
|
||||
static final String ATTRVALUE_ENCODED = "encoded";
|
||||
|
||||
// schema attribute values
|
||||
static final String ATTRVALUE_QUALIFIED = "qualified";
|
||||
static final String ATTRVALUE_UNQUALIFIED = "unqualified";
|
||||
static final String ATTRVALUE_ALL = "#all";
|
||||
static final String ATTRVALUE_SUBSTITUTION = "substitution";
|
||||
static final String ATTRVALUE_EXTENSION = "extension";
|
||||
static final String ATTRVALUE_RESTRICTION = "restriction";
|
||||
static final String ATTRVALUE_LIST = "list";
|
||||
static final String ATTRVALUE_UNION = "union";
|
||||
static final String ATTRVALUE_UNBOUNDED = "unbounded";
|
||||
static final String ATTRVALUE_PROHIBITED = "prohibited";
|
||||
static final String ATTRVALUE_OPTIONAL = "optional";
|
||||
static final String ATTRVALUE_REQUIRED = "required";
|
||||
static final String ATTRVALUE_LAX = "lax";
|
||||
static final String ATTRVALUE_SKIP = "skip";
|
||||
static final String ATTRVALUE_STRICT = "strict";
|
||||
static final String ATTRVALUE_ANY = "##any";
|
||||
static final String ATTRVALUE_LOCAL = "##local";
|
||||
static final String ATTRVALUE_OTHER = "##other";
|
||||
static final String ATTRVALUE_TARGET_NAMESPACE = "##targetNamespace";
|
||||
static final String ATTRVALUE_ = "";
|
||||
|
||||
// namespace URIs
|
||||
static final String NS_XML = "http://www.w3.org/XML/1998/namespace";
|
||||
static final String NS_XMLNS = "http://www.w3.org/2000/xmlns/";
|
||||
static final String NS_WSDL = "http://schemas.xmlsoap.org/wsdl/";
|
||||
static final String NS_WSDL_SOAP = "http://schemas.xmlsoap.org/wsdl/soap/";
|
||||
static final String NS_WSDL_SOAP12 = "http://schemas.xmlsoap.org/wsdl/soap12/";
|
||||
static final String NS_WSDL_HTTP = "http://schemas.xmlsoap.org/wsdl/http/";
|
||||
static final String NS_WSDL_MIME = "http://schemas.xmlsoap.org/wsdl/mime/";
|
||||
static final String NS_XSD = "http://www.w3.org/2001/XMLSchema";
|
||||
static final String NS_XSI = "http://www.w3.org/2001/XMLSchema-instance";
|
||||
static final String NS_ = "";
|
||||
|
||||
// other constants
|
||||
static final String XMLNS = "xmlns";
|
||||
static final String TRUE = "true";
|
||||
static final String FALSE = "false";
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 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.tools.internal.ws.wsdl.parser;
|
||||
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
/**
|
||||
* Simple utility ensuring that the value is cached only in case it is non-internal implementation
|
||||
*/
|
||||
abstract class ContextClassloaderLocal<V> {
|
||||
|
||||
private static final String FAILED_TO_CREATE_NEW_INSTANCE = "FAILED_TO_CREATE_NEW_INSTANCE";
|
||||
|
||||
private WeakHashMap<ClassLoader, V> CACHE = new WeakHashMap<ClassLoader, V>();
|
||||
|
||||
public V get() throws Error {
|
||||
ClassLoader tccl = getContextClassLoader();
|
||||
V instance = CACHE.get(tccl);
|
||||
if (instance == null) {
|
||||
instance = createNewInstance();
|
||||
CACHE.put(tccl, instance);
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void set(V instance) {
|
||||
CACHE.put(getContextClassLoader(), instance);
|
||||
}
|
||||
|
||||
protected abstract V initialValue() throws Exception;
|
||||
|
||||
private V createNewInstance() {
|
||||
try {
|
||||
return initialValue();
|
||||
} catch (Exception e) {
|
||||
throw new Error(format(FAILED_TO_CREATE_NEW_INSTANCE, getClass().getName()), e);
|
||||
}
|
||||
}
|
||||
|
||||
private static String format(String property, Object... args) {
|
||||
String text = ResourceBundle.getBundle(ContextClassloaderLocal.class.getName()).getString(property);
|
||||
return MessageFormat.format(text, args);
|
||||
}
|
||||
|
||||
private static ClassLoader getContextClassLoader() {
|
||||
return (ClassLoader)
|
||||
AccessController.doPrivileged(new PrivilegedAction() {
|
||||
public Object run() {
|
||||
ClassLoader cl = null;
|
||||
try {
|
||||
cl = Thread.currentThread().getContextClassLoader();
|
||||
} catch (SecurityException ex) {
|
||||
}
|
||||
return cl;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.parser;
|
||||
|
||||
import com.sun.tools.internal.ws.wsdl.document.jaxws.JAXWSBindingsConstants;
|
||||
import com.sun.tools.internal.xjc.reader.internalizer.LocatorTable;
|
||||
import com.sun.xml.internal.bind.marshaller.SAX2DOMEx;
|
||||
import org.w3c.dom.Comment;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.ext.LexicalHandler;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Builds DOM while keeping the location information.
|
||||
*
|
||||
* <p>
|
||||
* This class also looks for outer most <jaxws:bindings>
|
||||
* customizations.
|
||||
*
|
||||
* @author
|
||||
* Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
* Vivek Pandey
|
||||
*/
|
||||
class DOMBuilder extends SAX2DOMEx implements LexicalHandler {
|
||||
/**
|
||||
* Grows a DOM tree under the given document, and
|
||||
* stores location information to the given table.
|
||||
*
|
||||
* @param outerMostBindings
|
||||
* This set will receive newly found outermost
|
||||
* jaxb:bindings customizations.
|
||||
*/
|
||||
public DOMBuilder( Document dom, LocatorTable ltable, Set outerMostBindings ) {
|
||||
super( dom );
|
||||
this.locatorTable = ltable;
|
||||
this.outerMostBindings = outerMostBindings;
|
||||
}
|
||||
|
||||
/** Location information will be stored into this object. */
|
||||
private final LocatorTable locatorTable;
|
||||
|
||||
private final Set outerMostBindings;
|
||||
|
||||
private Locator locator;
|
||||
|
||||
public void setDocumentLocator(Locator locator) {
|
||||
this.locator = locator;
|
||||
super.setDocumentLocator(locator);
|
||||
}
|
||||
|
||||
|
||||
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) {
|
||||
super.startElement(namespaceURI, localName, qName, atts);
|
||||
|
||||
Element e = getCurrentElement();
|
||||
locatorTable.storeStartLocation( e, locator );
|
||||
|
||||
// check if this element is an outer-most <jaxb:bindings>
|
||||
if( JAXWSBindingsConstants.JAXWS_BINDINGS.getNamespaceURI().equals(e.getNamespaceURI())
|
||||
&& "bindings".equals(e.getLocalName()) ) {
|
||||
|
||||
// if this is the root node (meaning that this file is an
|
||||
// external binding file) or if the parent is XML Schema element
|
||||
// (meaning that this is an "inlined" external binding)
|
||||
Node p = e.getParentNode();
|
||||
if( p instanceof Document) {
|
||||
outerMostBindings.add(e); // remember this value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void endElement(String namespaceURI, String localName, String qName) {
|
||||
locatorTable.storeEndLocation( getCurrentElement(), locator );
|
||||
super.endElement(namespaceURI, localName, qName);
|
||||
}
|
||||
|
||||
public void startDTD(String name, String publicId, String systemId) throws SAXException {}
|
||||
|
||||
public void endDTD() throws SAXException {}
|
||||
|
||||
public void startEntity(String name) throws SAXException {}
|
||||
|
||||
public void endEntity(String name) throws SAXException {}
|
||||
|
||||
public void startCDATA() throws SAXException {}
|
||||
|
||||
public void endCDATA() throws SAXException {}
|
||||
|
||||
public void comment(char[] ch, int start, int length) throws SAXException {
|
||||
//Element e = getCurrentElement(); // does not work as the comments at the top of the document would return Document Node
|
||||
// instead of Element
|
||||
Node parent = nodeStack.peek();
|
||||
Comment comment = document.createComment(new String(ch,start,length));
|
||||
parent.appendChild(comment);
|
||||
}
|
||||
}
|
||||
385
jdkSrc/jdk8/com/sun/tools/internal/ws/wsdl/parser/DOMForest.java
Normal file
385
jdkSrc/jdk8/com/sun/tools/internal/ws/wsdl/parser/DOMForest.java
Normal file
@@ -0,0 +1,385 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2017, 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.tools.internal.ws.wsdl.parser;
|
||||
|
||||
import com.sun.istack.internal.NotNull;
|
||||
import com.sun.tools.internal.ws.util.xml.XmlUtil;
|
||||
import com.sun.tools.internal.ws.wscompile.ErrorReceiver;
|
||||
import com.sun.tools.internal.ws.wscompile.WsimportOptions;
|
||||
import com.sun.tools.internal.ws.wsdl.document.schema.SchemaConstants;
|
||||
import com.sun.tools.internal.xjc.reader.internalizer.LocatorTable;
|
||||
import com.sun.xml.internal.bind.marshaller.DataWriter;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.*;
|
||||
import org.xml.sax.helpers.XMLFilterImpl;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.parsers.SAXParserFactory;
|
||||
import javax.xml.transform.Transformer;
|
||||
import javax.xml.transform.TransformerException;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.transform.sax.SAXResult;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.net.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Vivek Pandey
|
||||
*/
|
||||
public class DOMForest {
|
||||
/**
|
||||
* To correctly feed documents to a schema parser, we need to remember
|
||||
* which documents (of the forest) were given as the root
|
||||
* documents, and which of them are read as included/imported
|
||||
* documents.
|
||||
* <p/>
|
||||
* <p/>
|
||||
* Set of system ids as strings.
|
||||
*/
|
||||
protected final Set<String> rootDocuments = new HashSet<String>();
|
||||
|
||||
/**
|
||||
* Contains wsdl:import(s)
|
||||
*/
|
||||
protected final Set<String> externalReferences = new HashSet<String>();
|
||||
|
||||
/**
|
||||
* actual data storage map<SystemId,Document>.
|
||||
*/
|
||||
protected final Map<String, Document> core = new HashMap<String, Document>();
|
||||
protected final ErrorReceiver errorReceiver;
|
||||
|
||||
private final DocumentBuilder documentBuilder;
|
||||
private final SAXParserFactory parserFactory;
|
||||
|
||||
/**
|
||||
* inlined schema elements inside wsdl:type section
|
||||
*/
|
||||
protected final List<Element> inlinedSchemaElements = new ArrayList<Element>();
|
||||
|
||||
|
||||
/**
|
||||
* Stores location information for all the trees in this forest.
|
||||
*/
|
||||
public final LocatorTable locatorTable = new LocatorTable();
|
||||
|
||||
protected final EntityResolver entityResolver;
|
||||
/**
|
||||
* Stores all the outer-most <jaxb:bindings> customizations.
|
||||
*/
|
||||
public final Set<Element> outerMostBindings = new HashSet<Element>();
|
||||
|
||||
/**
|
||||
* Schema language dependent part of the processing.
|
||||
*/
|
||||
protected final InternalizationLogic logic;
|
||||
protected final WsimportOptions options;
|
||||
|
||||
public DOMForest(InternalizationLogic logic, @NotNull EntityResolver entityResolver, WsimportOptions options, ErrorReceiver errReceiver) {
|
||||
this.options = options;
|
||||
this.entityResolver = entityResolver;
|
||||
this.errorReceiver = errReceiver;
|
||||
this.logic = logic;
|
||||
// secure xml processing can be switched off if input requires it
|
||||
boolean disableXmlSecurity = options == null ? false : options.disableXmlSecurity;
|
||||
|
||||
DocumentBuilderFactory dbf = XmlUtil.newDocumentBuilderFactory(disableXmlSecurity);
|
||||
this.parserFactory = XmlUtil.newSAXParserFactory(disableXmlSecurity);
|
||||
try {
|
||||
this.documentBuilder = dbf.newDocumentBuilder();
|
||||
} catch (ParserConfigurationException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
}
|
||||
|
||||
public List<Element> getInlinedSchemaElement() {
|
||||
return inlinedSchemaElements;
|
||||
}
|
||||
|
||||
public @NotNull Document parse(InputSource source, boolean root) throws SAXException, IOException {
|
||||
if (source.getSystemId() == null)
|
||||
throw new IllegalArgumentException();
|
||||
return parse(source.getSystemId(), source, root);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses an XML at the given location (
|
||||
* and XMLs referenced by it) into DOM trees
|
||||
* and stores them to this forest.
|
||||
*
|
||||
* @return the parsed DOM document object.
|
||||
*/
|
||||
public Document parse(String systemId, boolean root) throws SAXException, IOException{
|
||||
|
||||
systemId = normalizeSystemId(systemId);
|
||||
|
||||
InputSource is = null;
|
||||
|
||||
// allow entity resolver to find the actual byte stream.
|
||||
is = entityResolver.resolveEntity(null, systemId);
|
||||
if (is == null)
|
||||
is = new InputSource(systemId);
|
||||
else {
|
||||
resolvedCache.put(systemId, is.getSystemId());
|
||||
systemId=is.getSystemId();
|
||||
}
|
||||
|
||||
if (core.containsKey(systemId)) {
|
||||
// this document has already been parsed. Just ignore.
|
||||
return core.get(systemId);
|
||||
}
|
||||
|
||||
if(!root)
|
||||
addExternalReferences(systemId);
|
||||
|
||||
// but we still use the original system Id as the key.
|
||||
return parse(systemId, is, root);
|
||||
}
|
||||
protected Map<String,String> resolvedCache = new HashMap<String,String>();
|
||||
|
||||
public Map<String,String> getReferencedEntityMap() {
|
||||
return resolvedCache;
|
||||
}
|
||||
/**
|
||||
* Parses the given document and add it to the DOM forest.
|
||||
*
|
||||
* @return null if there was a parse error. otherwise non-null.
|
||||
*/
|
||||
private @NotNull Document parse(String systemId, InputSource inputSource, boolean root) throws SAXException, IOException{
|
||||
Document dom = documentBuilder.newDocument();
|
||||
|
||||
systemId = normalizeSystemId(systemId);
|
||||
|
||||
// put into the map before growing a tree, to
|
||||
// prevent recursive reference from causing infinite loop.
|
||||
core.put(systemId, dom);
|
||||
|
||||
dom.setDocumentURI(systemId);
|
||||
if (root)
|
||||
rootDocuments.add(systemId);
|
||||
|
||||
try {
|
||||
XMLReader reader = createReader(dom);
|
||||
|
||||
InputStream is = null;
|
||||
if(inputSource.getByteStream() == null){
|
||||
inputSource = entityResolver.resolveEntity(null, systemId);
|
||||
}
|
||||
reader.parse(inputSource);
|
||||
Element doc = dom.getDocumentElement();
|
||||
if (doc == null) {
|
||||
return null;
|
||||
}
|
||||
NodeList schemas = doc.getElementsByTagNameNS(SchemaConstants.NS_XSD, "schema");
|
||||
for (int i = 0; i < schemas.getLength(); i++) {
|
||||
inlinedSchemaElements.add((Element) schemas.item(i));
|
||||
}
|
||||
} catch (ParserConfigurationException e) {
|
||||
errorReceiver.error(e);
|
||||
throw new SAXException(e.getMessage());
|
||||
}
|
||||
resolvedCache.put(systemId, dom.getDocumentURI());
|
||||
return dom;
|
||||
}
|
||||
|
||||
public void addExternalReferences(String ref) {
|
||||
if (!externalReferences.contains(ref))
|
||||
externalReferences.add(ref);
|
||||
}
|
||||
|
||||
|
||||
public Set<String> getExternalReferences() {
|
||||
return externalReferences;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public interface Handler extends ContentHandler {
|
||||
/**
|
||||
* Gets the DOM that was built.
|
||||
*/
|
||||
public Document getDocument();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@link org.xml.sax.XMLReader} to parse a document into this DOM forest.
|
||||
* <p/>
|
||||
* This version requires that the DOM object to be created and registered
|
||||
* to the map beforehand.
|
||||
*/
|
||||
private XMLReader createReader(Document dom) throws SAXException, ParserConfigurationException {
|
||||
XMLReader reader = parserFactory.newSAXParser().getXMLReader();
|
||||
DOMBuilder dombuilder = new DOMBuilder(dom, locatorTable, outerMostBindings);
|
||||
try {
|
||||
reader.setProperty("http://xml.org/sax/properties/lexical-handler", dombuilder);
|
||||
} catch(SAXException e) {
|
||||
errorReceiver.debug(e.getMessage());
|
||||
}
|
||||
|
||||
ContentHandler handler = new WhitespaceStripper(dombuilder, errorReceiver, entityResolver);
|
||||
handler = new VersionChecker(handler, errorReceiver, entityResolver);
|
||||
|
||||
// insert the reference finder so that
|
||||
// included/imported schemas will be also parsed
|
||||
XMLFilterImpl f = logic.createExternalReferenceFinder(this);
|
||||
f.setContentHandler(handler);
|
||||
if (errorReceiver != null)
|
||||
f.setErrorHandler(errorReceiver);
|
||||
f.setEntityResolver(entityResolver);
|
||||
|
||||
reader.setContentHandler(f);
|
||||
if (errorReceiver != null)
|
||||
reader.setErrorHandler(errorReceiver);
|
||||
reader.setEntityResolver(entityResolver);
|
||||
return reader;
|
||||
}
|
||||
|
||||
private String normalizeSystemId(String systemId) {
|
||||
try {
|
||||
systemId = new URI(systemId).normalize().toString();
|
||||
} catch (URISyntaxException e) {
|
||||
// leave the system ID untouched. In my experience URI is often too strict
|
||||
}
|
||||
return systemId;
|
||||
}
|
||||
|
||||
boolean isExtensionMode() {
|
||||
return options.isExtensionMode();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the DOM tree associated with the specified system ID,
|
||||
* or null if none is found.
|
||||
*/
|
||||
public Document get(String systemId) {
|
||||
Document doc = core.get(systemId);
|
||||
|
||||
if (doc == null && systemId.startsWith("file:/") && !systemId.startsWith("file://")) {
|
||||
// As of JDK1.4, java.net.URL.toExternal method returns URLs like
|
||||
// "file:/abc/def/ghi" which is an incorrect file protocol URL according to RFC1738.
|
||||
// Some other correctly functioning parts return the correct URLs ("file:///abc/def/ghi"),
|
||||
// and this descripancy breaks DOM look up by system ID.
|
||||
|
||||
// this extra check solves this problem.
|
||||
doc = core.get("file://" + systemId.substring(5));
|
||||
}
|
||||
|
||||
if (doc == null && systemId.startsWith("file:")) {
|
||||
// on Windows, filenames are case insensitive.
|
||||
// perform case-insensitive search for improved user experience
|
||||
String systemPath = getPath(systemId);
|
||||
for (String key : core.keySet()) {
|
||||
if (key.startsWith("file:") && getPath(key).equalsIgnoreCase(systemPath)) {
|
||||
doc = core.get(key);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return doc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Strips off the leading 'file:///' portion from an URL.
|
||||
*/
|
||||
private String getPath(String key) {
|
||||
key = key.substring(5); // skip 'file:'
|
||||
while (key.length() > 0 && key.charAt(0) == '/')
|
||||
key = key.substring(1);
|
||||
return key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all the system IDs of the documents.
|
||||
*/
|
||||
public String[] listSystemIDs() {
|
||||
return core.keySet().toArray(new String[core.keySet().size()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the system ID from which the given DOM is parsed.
|
||||
* <p/>
|
||||
* Poor-man's base URI.
|
||||
*/
|
||||
public String getSystemId(Document dom) {
|
||||
for (Map.Entry<String, Document> e : core.entrySet()) {
|
||||
if (e.getValue() == dom)
|
||||
return e.getKey();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the first one (which is more or less random) in {@link #rootDocuments}.
|
||||
*/
|
||||
public String getFirstRootDocument() {
|
||||
if(rootDocuments.isEmpty()) return null;
|
||||
return rootDocuments.iterator().next();
|
||||
}
|
||||
|
||||
public Set<String> getRootDocuments() {
|
||||
return rootDocuments;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dumps the contents of the forest to the specified stream.
|
||||
* <p/>
|
||||
* This is a debug method. As such, error handling is sloppy.
|
||||
*/
|
||||
public void dump(OutputStream out) throws IOException {
|
||||
try {
|
||||
// create identity transformer
|
||||
// secure xml processing can be switched off if input requires it
|
||||
boolean secureProcessingEnabled = options == null || !options.disableXmlSecurity;
|
||||
TransformerFactory tf = XmlUtil.newTransformerFactory(secureProcessingEnabled);
|
||||
Transformer it = tf.newTransformer();
|
||||
|
||||
for (Map.Entry<String, Document> e : core.entrySet()) {
|
||||
out.write(("---<< " + e.getKey() + '\n').getBytes());
|
||||
|
||||
DataWriter dw = new DataWriter(new OutputStreamWriter(out), null);
|
||||
dw.setIndentStep(" ");
|
||||
it.transform(new DOMSource(e.getValue()),
|
||||
new SAXResult(dw));
|
||||
|
||||
out.write("\n\n\n".getBytes());
|
||||
}
|
||||
} catch (TransformerException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.parser;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.EntityResolver;
|
||||
import org.xml.sax.ErrorHandler;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import com.sun.xml.internal.xsom.parser.XMLParser;
|
||||
|
||||
/**
|
||||
* {@link XMLParser} implementation that
|
||||
* parses XML from a DOM forest instead of parsing it from
|
||||
* its original location.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
* @author Vivek Pandey
|
||||
*/
|
||||
public class DOMForestParser implements XMLParser {
|
||||
|
||||
/**
|
||||
* DOM forest to be "parsed".
|
||||
*/
|
||||
private final DOMForest forest;
|
||||
|
||||
/**
|
||||
* Scanner object will do the actual SAX events generation.
|
||||
*/
|
||||
private final DOMForestScanner scanner;
|
||||
|
||||
private final XMLParser fallbackParser;
|
||||
|
||||
/**
|
||||
* @param fallbackParser This parser will be used when DOMForestParser needs to parse
|
||||
* documents that are not in the forest.
|
||||
*/
|
||||
public DOMForestParser(DOMForest forest, XMLParser fallbackParser) {
|
||||
this.forest = forest;
|
||||
this.scanner = new DOMForestScanner(forest);
|
||||
this.fallbackParser = fallbackParser;
|
||||
}
|
||||
|
||||
|
||||
public void parse(InputSource source, ContentHandler handler, EntityResolver entityResolver, ErrorHandler errHandler) throws SAXException, IOException {
|
||||
|
||||
}
|
||||
|
||||
public void parse(InputSource source, ContentHandler handler, ErrorHandler errorHandler, EntityResolver entityResolver)
|
||||
|
||||
throws SAXException, IOException {
|
||||
String systemId = source.getSystemId();
|
||||
Document dom = forest.get(systemId);
|
||||
|
||||
if (dom == null) {
|
||||
// if no DOM tree is built for it,
|
||||
// let the fall back parser parse the original document.
|
||||
//
|
||||
// for example, XSOM parses datatypes.xsd (XML Schema part 2)
|
||||
// but this will never be built into the forest.
|
||||
fallbackParser.parse(source, handler, errorHandler, entityResolver);
|
||||
return;
|
||||
}
|
||||
|
||||
scanner.scan(dom, handler);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.parser;
|
||||
|
||||
import com.sun.xml.internal.bind.unmarshaller.DOMScanner;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.helpers.XMLFilterImpl;
|
||||
|
||||
/**
|
||||
* Produces a complete series of SAX events from any DOM node
|
||||
* in the DOMForest.
|
||||
*
|
||||
* <p>
|
||||
* This class hides a logic of re-associating {@link org.xml.sax.Locator}
|
||||
* to the generated SAX event stream.
|
||||
*
|
||||
* @author
|
||||
* Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
*/
|
||||
public class DOMForestScanner {
|
||||
|
||||
private final DOMForest forest;
|
||||
|
||||
/**
|
||||
* Scans DOM nodes of the given forest.
|
||||
*
|
||||
* DOM node parameters to the scan method must be a part of
|
||||
* this forest.
|
||||
*/
|
||||
public DOMForestScanner( DOMForest _forest ) {
|
||||
this.forest = _forest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the whole set of SAX events by treating
|
||||
* element e as if it's a root element.
|
||||
*/
|
||||
public void scan( Element e, ContentHandler contentHandler ) throws SAXException {
|
||||
DOMScanner scanner = new DOMScanner();
|
||||
|
||||
// insert the location resolver into the pipe line
|
||||
LocationResolver resolver = new LocationResolver(scanner);
|
||||
resolver.setContentHandler(contentHandler);
|
||||
|
||||
// parse this DOM.
|
||||
scanner.setContentHandler(resolver);
|
||||
scanner.scan(e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the whole set of SAX events from the given Document
|
||||
* in the DOMForest.
|
||||
*/
|
||||
public void scan( Document d, ContentHandler contentHandler ) throws SAXException {
|
||||
scan( d.getDocumentElement(), contentHandler );
|
||||
}
|
||||
|
||||
/**
|
||||
* Intercepts the invocation of the setDocumentLocator method
|
||||
* and passes itself as the locator.
|
||||
*
|
||||
* If the client calls one of the methods on the Locator interface,
|
||||
* use the LocatorTable to resolve the source location.
|
||||
*/
|
||||
private class LocationResolver extends XMLFilterImpl implements Locator {
|
||||
LocationResolver( DOMScanner _parent ) {
|
||||
this.parent = _parent;
|
||||
}
|
||||
|
||||
private final DOMScanner parent;
|
||||
|
||||
/**
|
||||
* Flag that tells us whether we are processing a start element event
|
||||
* or an end element event.
|
||||
*
|
||||
* DOMScanner's getCurrentLocation method doesn't tell us which, but
|
||||
* this information is necessary to return the correct source line information.
|
||||
*
|
||||
* Thus we set this flag appropriately before we pass an event to
|
||||
* the next ContentHandler, thereby making it possible to figure
|
||||
* out which location to return.
|
||||
*/
|
||||
private boolean inStart = false;
|
||||
|
||||
public void setDocumentLocator(Locator locator) {
|
||||
// ignore one set by the parent.
|
||||
|
||||
super.setDocumentLocator(this);
|
||||
}
|
||||
|
||||
public void endElement(String namespaceURI, String localName, String qName) throws SAXException {
|
||||
inStart = false;
|
||||
super.endElement(namespaceURI, localName, qName);
|
||||
}
|
||||
|
||||
public void startElement(String namespaceURI, String localName, String qName, Attributes atts)
|
||||
throws SAXException {
|
||||
inStart = true;
|
||||
super.startElement(namespaceURI, localName, qName, atts);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private Locator findLocator() {
|
||||
Node n = parent.getCurrentLocation();
|
||||
if( n instanceof Element ) {
|
||||
Element e = (Element)n;
|
||||
if( inStart )
|
||||
return forest.locatorTable.getStartLocation( e );
|
||||
else
|
||||
return forest.locatorTable.getEndLocation( e );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
// Locator methods
|
||||
//
|
||||
//
|
||||
public int getColumnNumber() {
|
||||
Locator l = findLocator();
|
||||
if(l!=null) return l.getColumnNumber();
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int getLineNumber() {
|
||||
Locator l = findLocator();
|
||||
if(l!=null) return l.getLineNumber();
|
||||
return -1;
|
||||
}
|
||||
|
||||
public String getPublicId() {
|
||||
Locator l = findLocator();
|
||||
if(l!=null) return l.getPublicId();
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getSystemId() {
|
||||
Locator l = findLocator();
|
||||
if(l!=null) return l.getSystemId();
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,216 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.parser;
|
||||
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible;
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext;
|
||||
import com.sun.tools.internal.ws.util.xml.XmlUtil;
|
||||
import com.sun.tools.internal.ws.wsdl.document.http.*;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* The HTTP extension handler for WSDL.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class HTTPExtensionHandler extends AbstractExtensionHandler {
|
||||
|
||||
|
||||
public HTTPExtensionHandler(Map<String, AbstractExtensionHandler> extensionHandlerMap) {
|
||||
super(extensionHandlerMap);
|
||||
}
|
||||
|
||||
public String getNamespaceURI() {
|
||||
return Constants.NS_WSDL_HTTP;
|
||||
}
|
||||
|
||||
public boolean handleDefinitionsExtension(
|
||||
TWSDLParserContext context,
|
||||
TWSDLExtensible parent,
|
||||
Element e) {
|
||||
Util.fail(
|
||||
"parsing.invalidExtensionElement",
|
||||
e.getTagName(),
|
||||
e.getNamespaceURI());
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean handleTypesExtension(
|
||||
com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext context,
|
||||
TWSDLExtensible parent,
|
||||
Element e) {
|
||||
Util.fail(
|
||||
"parsing.invalidExtensionElement",
|
||||
e.getTagName(),
|
||||
e.getNamespaceURI());
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean handleBindingExtension(
|
||||
TWSDLParserContext context,
|
||||
TWSDLExtensible parent,
|
||||
Element e) {
|
||||
if (XmlUtil.matchesTagNS(e, HTTPConstants.QNAME_BINDING)) {
|
||||
context.push();
|
||||
context.registerNamespaces(e);
|
||||
|
||||
HTTPBinding binding = new HTTPBinding(context.getLocation(e));
|
||||
|
||||
String verb = Util.getRequiredAttribute(e, Constants.ATTR_VERB);
|
||||
binding.setVerb(verb);
|
||||
|
||||
parent.addExtension(binding);
|
||||
context.pop();
|
||||
// context.fireDoneParsingEntity(HTTPConstants.QNAME_BINDING, binding);
|
||||
return true;
|
||||
} else {
|
||||
Util.fail(
|
||||
"parsing.invalidExtensionElement",
|
||||
e.getTagName(),
|
||||
e.getNamespaceURI());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean handleOperationExtension(
|
||||
TWSDLParserContext context,
|
||||
TWSDLExtensible parent,
|
||||
Element e) {
|
||||
if (XmlUtil.matchesTagNS(e, HTTPConstants.QNAME_OPERATION)) {
|
||||
context.push();
|
||||
context.registerNamespaces(e);
|
||||
|
||||
HTTPOperation operation = new HTTPOperation(context.getLocation(e));
|
||||
|
||||
String location =
|
||||
Util.getRequiredAttribute(e, Constants.ATTR_LOCATION);
|
||||
operation.setLocation(location);
|
||||
|
||||
parent.addExtension(operation);
|
||||
context.pop();
|
||||
// context.fireDoneParsingEntity(
|
||||
// HTTPConstants.QNAME_OPERATION,
|
||||
// operation);
|
||||
return true;
|
||||
} else {
|
||||
Util.fail(
|
||||
"parsing.invalidExtensionElement",
|
||||
e.getTagName(),
|
||||
e.getNamespaceURI());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean handleInputExtension(
|
||||
TWSDLParserContext context,
|
||||
TWSDLExtensible parent,
|
||||
Element e) {
|
||||
if (XmlUtil.matchesTagNS(e, HTTPConstants.QNAME_URL_ENCODED)) {
|
||||
parent.addExtension(new HTTPUrlEncoded(context.getLocation(e)));
|
||||
return true;
|
||||
} else if (
|
||||
XmlUtil.matchesTagNS(e, HTTPConstants.QNAME_URL_REPLACEMENT)) {
|
||||
parent.addExtension(new HTTPUrlReplacement(context.getLocation(e)));
|
||||
return true;
|
||||
} else {
|
||||
Util.fail(
|
||||
"parsing.invalidExtensionElement",
|
||||
e.getTagName(),
|
||||
e.getNamespaceURI());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean handleOutputExtension(
|
||||
TWSDLParserContext context,
|
||||
TWSDLExtensible parent,
|
||||
Element e) {
|
||||
Util.fail(
|
||||
"parsing.invalidExtensionElement",
|
||||
e.getTagName(),
|
||||
e.getNamespaceURI());
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean handleFaultExtension(
|
||||
TWSDLParserContext context,
|
||||
TWSDLExtensible parent,
|
||||
Element e) {
|
||||
Util.fail(
|
||||
"parsing.invalidExtensionElement",
|
||||
e.getTagName(),
|
||||
e.getNamespaceURI());
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean handleServiceExtension(
|
||||
TWSDLParserContext context,
|
||||
TWSDLExtensible parent,
|
||||
Element e) {
|
||||
Util.fail(
|
||||
"parsing.invalidExtensionElement",
|
||||
e.getTagName(),
|
||||
e.getNamespaceURI());
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean handlePortExtension(
|
||||
TWSDLParserContext context,
|
||||
TWSDLExtensible parent,
|
||||
Element e) {
|
||||
if (XmlUtil.matchesTagNS(e, HTTPConstants.QNAME_ADDRESS)) {
|
||||
context.push();
|
||||
context.registerNamespaces(e);
|
||||
|
||||
HTTPAddress address = new HTTPAddress(context.getLocation(e));
|
||||
|
||||
String location =
|
||||
Util.getRequiredAttribute(e, Constants.ATTR_LOCATION);
|
||||
address.setLocation(location);
|
||||
|
||||
parent.addExtension(address);
|
||||
context.pop();
|
||||
// context.fireDoneParsingEntity(HTTPConstants.QNAME_ADDRESS, address);
|
||||
return true;
|
||||
} else {
|
||||
Util.fail(
|
||||
"parsing.invalidExtensionElement",
|
||||
e.getTagName(),
|
||||
e.getNamespaceURI());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean handlePortTypeExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
|
||||
Util.fail(
|
||||
"parsing.invalidExtensionElement",
|
||||
e.getTagName(),
|
||||
e.getNamespaceURI());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.parser;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
import org.xml.sax.helpers.XMLFilterImpl;
|
||||
|
||||
/**
|
||||
* Encapsulates schema-language dependent internalization logic.
|
||||
*
|
||||
* {@link com.sun.tools.internal.xjc.reader.internalizer.Internalizer} and {@link DOMForest} are responsible for
|
||||
* doing schema language independent part, and this object is responsible
|
||||
* for schema language dependent part.
|
||||
*
|
||||
* @author
|
||||
* Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
* Vivek Pandey
|
||||
*/
|
||||
public interface InternalizationLogic {
|
||||
/**
|
||||
* Creates a new instance of XMLFilter that can be used to
|
||||
* find references to external schemas.
|
||||
*
|
||||
* <p>
|
||||
* Schemas that are included/imported need to be a part of
|
||||
* {@link DOMForest}, and this filter will be expected to
|
||||
* find such references.
|
||||
*
|
||||
* <p>
|
||||
* Once such a reference is found, the filter is expected to
|
||||
* call the parse method of DOMForest.
|
||||
*
|
||||
* <p>
|
||||
* {@link DOMForest} will register ErrorHandler to the returned
|
||||
* object, so any error should be sent to that error handler.
|
||||
*
|
||||
* @return
|
||||
* This method returns {@link org.xml.sax.helpers.XMLFilterImpl} because
|
||||
* the filter has to be usable for two directions
|
||||
* (wrapping a reader and wrapping a ContentHandler)
|
||||
*/
|
||||
XMLFilterImpl createExternalReferenceFinder( DOMForest parent );
|
||||
|
||||
/**
|
||||
* Checks if the specified element is a valid target node
|
||||
* to attach a customization.
|
||||
*
|
||||
* @param parent
|
||||
* The owner DOMForest object. Probably useful only
|
||||
* to obtain context information, such as error handler.
|
||||
* @param bindings
|
||||
* <jaxb:bindings> element or a customization element.
|
||||
* @return
|
||||
* true if it's OK, false if not.
|
||||
*/
|
||||
boolean checkIfValidTargetNode( DOMForest parent, Element bindings, Element target );
|
||||
|
||||
/**
|
||||
* Prepares an element that actually receives customizations.
|
||||
*
|
||||
* <p>
|
||||
* For example, in XML Schema, target nodes can be any schema
|
||||
* element but it is always the <xsd:appinfo> element that
|
||||
* receives customization.
|
||||
*
|
||||
* @param target
|
||||
* The target node designated by the customization.
|
||||
* @return
|
||||
* Always return non-null valid object
|
||||
*/
|
||||
Element refineSchemaTarget( Element target );
|
||||
|
||||
/**
|
||||
* Prepares a WSDL element that actually receives customizations.
|
||||
*
|
||||
*
|
||||
* @param target
|
||||
* The target node designated by the customization.
|
||||
* @return
|
||||
* Always return non-null valid object
|
||||
*/
|
||||
Element refineWSDLTarget( Element target );
|
||||
|
||||
}
|
||||
@@ -0,0 +1,522 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2014, 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.tools.internal.ws.wsdl.parser;
|
||||
|
||||
import com.sun.istack.internal.NotNull;
|
||||
import com.sun.istack.internal.Nullable;
|
||||
import com.sun.istack.internal.SAXParseException2;
|
||||
import com.sun.tools.internal.ws.resources.WsdlMessages;
|
||||
import com.sun.tools.internal.ws.wscompile.ErrorReceiver;
|
||||
import com.sun.tools.internal.ws.wscompile.WsimportOptions;
|
||||
import com.sun.tools.internal.ws.wsdl.document.jaxws.JAXWSBindingsConstants;
|
||||
import com.sun.tools.internal.xjc.util.DOMUtils;
|
||||
import com.sun.xml.internal.bind.v2.util.EditDistance;
|
||||
import com.sun.xml.internal.ws.util.DOMUtil;
|
||||
import com.sun.xml.internal.ws.util.JAXWSUtils;
|
||||
import com.sun.xml.internal.ws.util.xml.XmlUtil;
|
||||
import org.w3c.dom.*;
|
||||
import org.xml.sax.SAXParseException;
|
||||
|
||||
import javax.xml.namespace.NamespaceContext;
|
||||
import javax.xml.xpath.XPath;
|
||||
import javax.xml.xpath.XPathConstants;
|
||||
import javax.xml.xpath.XPathExpressionException;
|
||||
import javax.xml.xpath.XPathFactory;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
/**
|
||||
* Internalizes external binding declarations.
|
||||
*
|
||||
* @author Vivek Pandey
|
||||
*/
|
||||
public class Internalizer {
|
||||
|
||||
private final XPath xpath = xpf.get().newXPath();
|
||||
private final DOMForest forest;
|
||||
private final ErrorReceiver errorReceiver;
|
||||
|
||||
public Internalizer(DOMForest forest, WsimportOptions options, ErrorReceiver errorReceiver) {
|
||||
this.forest = forest;
|
||||
this.errorReceiver = errorReceiver;
|
||||
}
|
||||
|
||||
public void transform() {
|
||||
for (Element jaxwsBinding : forest.outerMostBindings) {
|
||||
internalize(jaxwsBinding, jaxwsBinding);
|
||||
}
|
||||
}
|
||||
|
||||
private static final ContextClassloaderLocal<XPathFactory> xpf = new ContextClassloaderLocal<XPathFactory>() {
|
||||
@Override
|
||||
protected XPathFactory initialValue() throws Exception {
|
||||
return XPathFactory.newInstance();
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Validates attributes of a <JAXWS:bindings> element.
|
||||
*/
|
||||
private void validate(Element bindings) {
|
||||
NamedNodeMap atts = bindings.getAttributes();
|
||||
for (int i = 0; i < atts.getLength(); i++) {
|
||||
Attr a = (Attr) atts.item(i);
|
||||
if (a.getNamespaceURI() != null) {
|
||||
continue; // all foreign namespace OK.
|
||||
}
|
||||
if (a.getLocalName().equals("node")) {
|
||||
continue;
|
||||
}
|
||||
if (a.getLocalName().equals("wsdlLocation")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// TODO: flag error for this undefined attribute
|
||||
}
|
||||
}
|
||||
|
||||
private void internalize(Element bindings, Node inheritedTarget) {
|
||||
// start by the inherited target
|
||||
Node target = inheritedTarget;
|
||||
|
||||
validate(bindings); // validate this node
|
||||
|
||||
// look for @wsdlLocation
|
||||
if (isTopLevelBinding(bindings)) {
|
||||
String wsdlLocation;
|
||||
if (bindings.getAttributeNode("wsdlLocation") != null) {
|
||||
wsdlLocation = bindings.getAttribute("wsdlLocation");
|
||||
|
||||
try {
|
||||
// absolutize this URI.
|
||||
// TODO: use the URI class
|
||||
// TODO: honor xml:base
|
||||
wsdlLocation = new URL(new URL(forest.getSystemId(bindings.getOwnerDocument())),
|
||||
wsdlLocation).toExternalForm();
|
||||
} catch (MalformedURLException e) {
|
||||
wsdlLocation = JAXWSUtils.absolutize(JAXWSUtils.getFileOrURLName(wsdlLocation));
|
||||
}
|
||||
} else {
|
||||
//the node does not have
|
||||
wsdlLocation = forest.getFirstRootDocument();
|
||||
}
|
||||
target = forest.get(wsdlLocation);
|
||||
|
||||
if (target == null) {
|
||||
reportError(bindings, WsdlMessages.INTERNALIZER_INCORRECT_SCHEMA_REFERENCE(wsdlLocation, EditDistance.findNearest(wsdlLocation, forest.listSystemIDs())));
|
||||
return; // abort processing this <JAXWS:bindings>
|
||||
}
|
||||
}
|
||||
|
||||
//if the target node is xs:schema, declare the jaxb version on it as latter on it will be
|
||||
//required by the inlined schema bindings
|
||||
|
||||
Element element = DOMUtil.getFirstElementChild(target);
|
||||
if (element != null && element.getNamespaceURI().equals(Constants.NS_WSDL) && element.getLocalName().equals("definitions")) {
|
||||
//get all schema elements
|
||||
Element type = DOMUtils.getFirstChildElement(element, Constants.NS_WSDL, "types");
|
||||
if (type != null) {
|
||||
for (Element schemaElement : DOMUtils.getChildElements(type, Constants.NS_XSD, "schema")) {
|
||||
if (!schemaElement.hasAttributeNS(Constants.NS_XMLNS, "jaxb")) {
|
||||
schemaElement.setAttributeNS(Constants.NS_XMLNS, "xmlns:jaxb", JAXWSBindingsConstants.NS_JAXB_BINDINGS);
|
||||
}
|
||||
|
||||
//add jaxb:bindings version info. Lets put it to 1.0, may need to change latter
|
||||
if (!schemaElement.hasAttributeNS(JAXWSBindingsConstants.NS_JAXB_BINDINGS, "version")) {
|
||||
schemaElement.setAttributeNS(JAXWSBindingsConstants.NS_JAXB_BINDINGS, "jaxb:version", JAXWSBindingsConstants.JAXB_BINDING_VERSION);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NodeList targetNodes = null;
|
||||
boolean hasNode = true;
|
||||
boolean isToplevelBinding = isTopLevelBinding(bindings);
|
||||
if ((isJAXWSBindings(bindings) || isJAXBBindings(bindings)) && bindings.getAttributeNode("node") != null) {
|
||||
targetNodes = evaluateXPathMultiNode(bindings, target, bindings.getAttribute("node"), new NamespaceContextImpl(bindings));
|
||||
} else
|
||||
if (isJAXWSBindings(bindings) && (bindings.getAttributeNode("node") == null) && !isToplevelBinding) {
|
||||
hasNode = false;
|
||||
} else
|
||||
if (isGlobalBinding(bindings) && !isWSDLDefinition(target) && isTopLevelBinding(bindings.getParentNode())) {
|
||||
targetNodes = getWSDLDefintionNode(bindings, target);
|
||||
}
|
||||
|
||||
//if target is null or empty it means the xpath evaluation has some problem,
|
||||
// just return
|
||||
if (targetNodes == null && hasNode && !isToplevelBinding) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (hasNode) {
|
||||
if (targetNodes != null) {
|
||||
for (int i = 0; i < targetNodes.getLength(); i++) {
|
||||
insertBinding(bindings, targetNodes.item(i));
|
||||
// look for child <JAXWS:bindings> and process them recursively
|
||||
Element[] children = getChildElements(bindings);
|
||||
for (Element child : children) {
|
||||
if ("bindings".equals(child.getLocalName())) {
|
||||
internalize(child, targetNodes.item(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (targetNodes == null) {
|
||||
// look for child <JAXWS:bindings> and process them recursively
|
||||
Element[] children = getChildElements(bindings);
|
||||
|
||||
for (Element child : children) {
|
||||
internalize(child, target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves JAXWS customizations under their respective target nodes.
|
||||
*/
|
||||
private void insertBinding(@NotNull Element bindings, @NotNull Node target) {
|
||||
if ("bindings".equals(bindings.getLocalName())) {
|
||||
Element[] children = DOMUtils.getChildElements(bindings);
|
||||
for (Element item : children) {
|
||||
if ("bindings".equals(item.getLocalName())) {
|
||||
//done
|
||||
} else {
|
||||
moveUnder(item, (Element) target);
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
moveUnder(bindings, (Element) target);
|
||||
}
|
||||
}
|
||||
|
||||
private NodeList getWSDLDefintionNode(Node bindings, Node target) {
|
||||
return evaluateXPathMultiNode(bindings, target, "wsdl:definitions",
|
||||
new NamespaceContext() {
|
||||
@Override
|
||||
public String getNamespaceURI(String prefix) {
|
||||
return "http://schemas.xmlsoap.org/wsdl/";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrefix(String nsURI) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator getPrefixes(String namespaceURI) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private boolean isWSDLDefinition(Node target) {
|
||||
if (target == null) {
|
||||
return false;
|
||||
}
|
||||
String localName = target.getLocalName();
|
||||
String nsURI = target.getNamespaceURI();
|
||||
return fixNull(localName).equals("definitions") && fixNull(nsURI).equals("http://schemas.xmlsoap.org/wsdl/");
|
||||
}
|
||||
|
||||
private boolean isTopLevelBinding(Node node) {
|
||||
return node.getOwnerDocument().getDocumentElement() == node;
|
||||
}
|
||||
|
||||
private boolean isJAXWSBindings(Node bindings) {
|
||||
return (bindings.getNamespaceURI().equals(JAXWSBindingsConstants.NS_JAXWS_BINDINGS) && bindings.getLocalName().equals("bindings"));
|
||||
}
|
||||
|
||||
private boolean isJAXBBindings(Node bindings) {
|
||||
return (bindings.getNamespaceURI().equals(JAXWSBindingsConstants.NS_JAXB_BINDINGS) && bindings.getLocalName().equals("bindings"));
|
||||
}
|
||||
|
||||
private boolean isGlobalBinding(Node bindings) {
|
||||
if (bindings.getNamespaceURI() == null) {
|
||||
errorReceiver.warning(forest.locatorTable.getStartLocation((Element) bindings), WsdlMessages.INVALID_CUSTOMIZATION_NAMESPACE(bindings.getLocalName()));
|
||||
return false;
|
||||
}
|
||||
return (bindings.getNamespaceURI().equals(JAXWSBindingsConstants.NS_JAXWS_BINDINGS) &&
|
||||
(bindings.getLocalName().equals("package") ||
|
||||
bindings.getLocalName().equals("enableAsyncMapping") ||
|
||||
bindings.getLocalName().equals("enableAdditionalSOAPHeaderMapping") ||
|
||||
bindings.getLocalName().equals("enableWrapperStyle") ||
|
||||
bindings.getLocalName().equals("enableMIMEContent")));
|
||||
}
|
||||
|
||||
private static Element[] getChildElements(Element parent) {
|
||||
ArrayList<Element> a = new ArrayList<Element>();
|
||||
NodeList children = parent.getChildNodes();
|
||||
for (int i = 0; i < children.getLength(); i++) {
|
||||
Node item = children.item(i);
|
||||
if (!(item instanceof Element)) {
|
||||
continue;
|
||||
}
|
||||
if (JAXWSBindingsConstants.NS_JAXWS_BINDINGS.equals(item.getNamespaceURI()) ||
|
||||
JAXWSBindingsConstants.NS_JAXB_BINDINGS.equals(item.getNamespaceURI())) {
|
||||
a.add((Element) item);
|
||||
}
|
||||
}
|
||||
return a.toArray(new Element[a.size()]);
|
||||
}
|
||||
|
||||
private NodeList evaluateXPathMultiNode(Node bindings, Node target, String expression, NamespaceContext namespaceContext) {
|
||||
NodeList nlst;
|
||||
try {
|
||||
xpath.setNamespaceContext(namespaceContext);
|
||||
nlst = (NodeList) xpath.evaluate(expression, target, XPathConstants.NODESET);
|
||||
} catch (XPathExpressionException e) {
|
||||
reportError((Element) bindings, WsdlMessages.INTERNALIZER_X_PATH_EVALUATION_ERROR(e.getMessage()), e);
|
||||
return null; // abort processing this <jaxb:bindings>
|
||||
}
|
||||
|
||||
if (nlst.getLength() == 0) {
|
||||
reportError((Element) bindings, WsdlMessages.INTERNALIZER_X_PATH_EVALUATES_TO_NO_TARGET(expression));
|
||||
return null; // abort
|
||||
}
|
||||
|
||||
return nlst;
|
||||
}
|
||||
|
||||
private boolean isJAXBBindingElement(Element e) {
|
||||
return fixNull(e.getNamespaceURI()).equals(JAXWSBindingsConstants.NS_JAXB_BINDINGS);
|
||||
}
|
||||
|
||||
private boolean isJAXWSBindingElement(Element e) {
|
||||
return fixNull(e.getNamespaceURI()).equals(JAXWSBindingsConstants.NS_JAXWS_BINDINGS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves the "decl" node under the "target" node.
|
||||
*
|
||||
* @param decl A JAXWS customization element (e.g., <JAXWS:class>)
|
||||
* @param target XML wsdl element under which the declaration should move.
|
||||
* For example, <xs:element>
|
||||
*/
|
||||
private void moveUnder(Element decl, Element target) {
|
||||
|
||||
//if there is @node on decl and has a child element jaxb:bindings, move it under the target
|
||||
//Element jaxb = getJAXBBindingElement(decl);
|
||||
if (isJAXBBindingElement(decl)) {
|
||||
//add jaxb namespace declaration
|
||||
if (!target.hasAttributeNS(Constants.NS_XMLNS, "jaxb")) {
|
||||
target.setAttributeNS(Constants.NS_XMLNS, "xmlns:jaxb", JAXWSBindingsConstants.NS_JAXB_BINDINGS);
|
||||
}
|
||||
|
||||
//add jaxb:bindings version info. Lets put it to 1.0, may need to change latter
|
||||
if (!target.hasAttributeNS(JAXWSBindingsConstants.NS_JAXB_BINDINGS, "version")) {
|
||||
target.setAttributeNS(JAXWSBindingsConstants.NS_JAXB_BINDINGS, "jaxb:version", JAXWSBindingsConstants.JAXB_BINDING_VERSION);
|
||||
}
|
||||
|
||||
// HACK: allow XJC extension all the time. This allows people to specify
|
||||
// the <xjc:someExtension> in the external bindings. Otherwise users lack the ability
|
||||
// to specify jaxb:extensionBindingPrefixes, so it won't work.
|
||||
//
|
||||
// the current workaround is still problematic in the sense that
|
||||
// it can't support user-defined extensions. This needs more careful thought.
|
||||
|
||||
//JAXB doesn't allow writing jaxb:extensionbindingPrefix anywhere other than root element so lets write only on <xs:schema>
|
||||
if (target.getLocalName().equals("schema") && target.getNamespaceURI().equals(Constants.NS_XSD) && !target.hasAttributeNS(JAXWSBindingsConstants.NS_JAXB_BINDINGS, "extensionBindingPrefixes")) {
|
||||
target.setAttributeNS(JAXWSBindingsConstants.NS_JAXB_BINDINGS, "jaxb:extensionBindingPrefixes", "xjc");
|
||||
target.setAttributeNS(Constants.NS_XMLNS, "xmlns:xjc", JAXWSBindingsConstants.NS_XJC_BINDINGS);
|
||||
}
|
||||
|
||||
//insert xs:annotation/xs:appinfo where in jaxb:binding will be put
|
||||
target = refineSchemaTarget(target);
|
||||
copyInscopeNSAttributes(decl);
|
||||
} else if (isJAXWSBindingElement(decl)) {
|
||||
//add jaxb namespace declaration
|
||||
if (!target.hasAttributeNS(Constants.NS_XMLNS, "JAXWS")) {
|
||||
target.setAttributeNS(Constants.NS_XMLNS, "xmlns:JAXWS", JAXWSBindingsConstants.NS_JAXWS_BINDINGS);
|
||||
}
|
||||
|
||||
//insert xs:annotation/xs:appinfo where in jaxb:binding will be put
|
||||
target = refineWSDLTarget(target);
|
||||
copyInscopeNSAttributes(decl);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
// finally move the declaration to the target node.
|
||||
if (target.getOwnerDocument() != decl.getOwnerDocument()) {
|
||||
// if they belong to different DOM documents, we need to clone them
|
||||
decl = (Element) target.getOwnerDocument().importNode(decl, true);
|
||||
|
||||
}
|
||||
|
||||
target.appendChild(decl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy in-scope namespace declarations of the decl node
|
||||
* to the decl node itself so that this move won't change
|
||||
* the in-scope namespace bindings.
|
||||
*/
|
||||
private void copyInscopeNSAttributes(Element e) {
|
||||
Element p = e;
|
||||
Set<String> inscopes = new HashSet<String>();
|
||||
while (true) {
|
||||
NamedNodeMap atts = p.getAttributes();
|
||||
for (int i = 0; i < atts.getLength(); i++) {
|
||||
Attr a = (Attr) atts.item(i);
|
||||
if (Constants.NS_XMLNS.equals(a.getNamespaceURI())) {
|
||||
String prefix;
|
||||
if (a.getName().indexOf(':') == -1) {
|
||||
prefix = "";
|
||||
} else {
|
||||
prefix = a.getLocalName();
|
||||
}
|
||||
|
||||
if (inscopes.add(prefix) && p != e) {
|
||||
// if this is the first time we see this namespace bindings,
|
||||
// copy the declaration.
|
||||
// if p==decl, there's no need to. Note that
|
||||
// we want to add prefix to inscopes even if p==Decl
|
||||
|
||||
e.setAttributeNodeNS((Attr) a.cloneNode(true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (p.getParentNode() instanceof Document) {
|
||||
break;
|
||||
}
|
||||
|
||||
p = (Element) p.getParentNode();
|
||||
}
|
||||
|
||||
if (!inscopes.contains("")) {
|
||||
// if the default namespace was undeclared in the context of decl,
|
||||
// it must be explicitly set to "" since the new environment might
|
||||
// have a different default namespace URI.
|
||||
e.setAttributeNS(Constants.NS_XMLNS, "xmlns", "");
|
||||
}
|
||||
}
|
||||
|
||||
public Element refineSchemaTarget(Element target) {
|
||||
// look for existing xs:annotation
|
||||
Element annotation = DOMUtils.getFirstChildElement(target, Constants.NS_XSD, "annotation");
|
||||
if (annotation == null) {
|
||||
// none exists. need to make one
|
||||
annotation = insertXMLSchemaElement(target, "annotation");
|
||||
}
|
||||
|
||||
// then look for appinfo
|
||||
Element appinfo = DOMUtils.getFirstChildElement(annotation, Constants.NS_XSD, "appinfo");
|
||||
if (appinfo == null) {
|
||||
// none exists. need to make one
|
||||
appinfo = insertXMLSchemaElement(annotation, "appinfo");
|
||||
}
|
||||
|
||||
return appinfo;
|
||||
}
|
||||
|
||||
public Element refineWSDLTarget(Element target) {
|
||||
// look for existing xs:annotation
|
||||
Element JAXWSBindings = DOMUtils.getFirstChildElement(target, JAXWSBindingsConstants.NS_JAXWS_BINDINGS, "bindings");
|
||||
if (JAXWSBindings == null) {
|
||||
// none exists. need to make one
|
||||
JAXWSBindings = insertJAXWSBindingsElement(target, "bindings");
|
||||
}
|
||||
return JAXWSBindings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new XML Schema element of the given local name
|
||||
* and insert it as the first child of the given parent node.
|
||||
*
|
||||
* @return Newly create element.
|
||||
*/
|
||||
private Element insertXMLSchemaElement(Element parent, String localName) {
|
||||
// use the same prefix as the parent node to avoid modifying
|
||||
// the namespace binding.
|
||||
String qname = parent.getTagName();
|
||||
int idx = qname.indexOf(':');
|
||||
if (idx == -1) {
|
||||
qname = localName;
|
||||
} else {
|
||||
qname = qname.substring(0, idx + 1) + localName;
|
||||
}
|
||||
|
||||
Element child = parent.getOwnerDocument().createElementNS(Constants.NS_XSD, qname);
|
||||
|
||||
NodeList children = parent.getChildNodes();
|
||||
|
||||
if (children.getLength() == 0) {
|
||||
parent.appendChild(child);
|
||||
} else {
|
||||
parent.insertBefore(child, children.item(0));
|
||||
}
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
private Element insertJAXWSBindingsElement(Element parent, String localName) {
|
||||
String qname = "JAXWS:" + localName;
|
||||
|
||||
Element child = parent.getOwnerDocument().createElementNS(JAXWSBindingsConstants.NS_JAXWS_BINDINGS, qname);
|
||||
|
||||
NodeList children = parent.getChildNodes();
|
||||
|
||||
if (children.getLength() == 0) {
|
||||
parent.appendChild(child);
|
||||
} else {
|
||||
parent.insertBefore(child, children.item(0));
|
||||
}
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
static String fixNull(@Nullable String s) {
|
||||
if (s == null) {
|
||||
return "";
|
||||
} else {
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
private void reportError(Element errorSource, String formattedMsg) {
|
||||
reportError(errorSource, formattedMsg, null);
|
||||
}
|
||||
|
||||
private void reportError(Element errorSource,
|
||||
String formattedMsg, Exception nestedException) {
|
||||
|
||||
SAXParseException e = new SAXParseException2(formattedMsg,
|
||||
forest.locatorTable.getStartLocation(errorSource),
|
||||
nestedException);
|
||||
errorReceiver.error(e);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,661 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2014, 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.tools.internal.ws.wsdl.parser;
|
||||
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible;
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension;
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext;
|
||||
import com.sun.tools.internal.ws.util.xml.XmlUtil;
|
||||
import com.sun.tools.internal.ws.wsdl.document.*;
|
||||
import com.sun.tools.internal.ws.wsdl.document.jaxws.CustomName;
|
||||
import com.sun.tools.internal.ws.wsdl.document.jaxws.JAXWSBinding;
|
||||
import com.sun.tools.internal.ws.wsdl.document.jaxws.JAXWSBindingsConstants;
|
||||
import com.sun.tools.internal.ws.wsdl.document.jaxws.Parameter;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import javax.xml.namespace.NamespaceContext;
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.xpath.*;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @author Vivek Pandey
|
||||
*
|
||||
* jaxws:bindings exension handler.
|
||||
*
|
||||
*/
|
||||
public class JAXWSBindingExtensionHandler extends AbstractExtensionHandler {
|
||||
|
||||
// xml security enabled always, xpath used for parsing "part" attribute
|
||||
private static final ContextClassloaderLocal<XPathFactory> xpf = new ContextClassloaderLocal<XPathFactory>() {
|
||||
@Override
|
||||
protected XPathFactory initialValue() throws Exception {
|
||||
return XPathFactory.newInstance();
|
||||
}
|
||||
};
|
||||
|
||||
private final XPath xpath = xpf.get().newXPath();
|
||||
|
||||
public JAXWSBindingExtensionHandler(Map<String, AbstractExtensionHandler> extensionHandlerMap) {
|
||||
super(extensionHandlerMap);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see AbstractExtensionHandler#getNamespaceURI()
|
||||
*/
|
||||
@Override
|
||||
public String getNamespaceURI() {
|
||||
return JAXWSBindingsConstants.NS_JAXWS_BINDINGS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @param parent
|
||||
* @param e
|
||||
*/
|
||||
private boolean parseGlobalJAXWSBindings(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
|
||||
context.push();
|
||||
context.registerNamespaces(e);
|
||||
|
||||
JAXWSBinding jaxwsBinding = getJAXWSExtension(parent);
|
||||
if(jaxwsBinding == null) {
|
||||
jaxwsBinding = new JAXWSBinding(context.getLocation(e));
|
||||
}
|
||||
String attr = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.WSDL_LOCATION_ATTR);
|
||||
if (attr != null) {
|
||||
jaxwsBinding.setWsdlLocation(attr);
|
||||
}
|
||||
|
||||
attr = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.NODE_ATTR);
|
||||
if (attr != null) {
|
||||
jaxwsBinding.setNode(attr);
|
||||
}
|
||||
|
||||
attr = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.VERSION_ATTR);
|
||||
if (attr != null) {
|
||||
jaxwsBinding.setVersion(attr);
|
||||
}
|
||||
|
||||
for(Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();){
|
||||
Element e2 = Util.nextElement(iter);
|
||||
if (e2 == null) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.PACKAGE)) {
|
||||
parsePackage(context, jaxwsBinding, e2);
|
||||
if ((jaxwsBinding.getJaxwsPackage() != null) && (jaxwsBinding.getJaxwsPackage().getJavaDoc() != null)) {
|
||||
((Definitions) parent).setDocumentation(new Documentation(jaxwsBinding.getJaxwsPackage().getJavaDoc()));
|
||||
}
|
||||
} else if (XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.ENABLE_WRAPPER_STYLE)) {
|
||||
parseWrapperStyle(context, jaxwsBinding, e2);
|
||||
} else if (XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.ENABLE_ASYNC_MAPPING)) {
|
||||
parseAsynMapping(context, jaxwsBinding, e2);
|
||||
} // else if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.ENABLE_ADDITIONAL_SOAPHEADER_MAPPING)){
|
||||
// parseAdditionalSOAPHeaderMapping(context, jaxwsBinding, e2);
|
||||
// }
|
||||
else if (XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.ENABLE_MIME_CONTENT)) {
|
||||
parseMimeContent(context, jaxwsBinding, e2);
|
||||
} else {
|
||||
Util.fail(
|
||||
"parsing.invalidExtensionElement",
|
||||
e2.getTagName(),
|
||||
e2.getNamespaceURI());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
parent.addExtension(jaxwsBinding);
|
||||
context.pop();
|
||||
// context.fireDoneParsingEntity(
|
||||
// JAXWSBindingsConstants.JAXWS_BINDINGS,
|
||||
// jaxwsBinding);
|
||||
return true;
|
||||
}
|
||||
|
||||
private static JAXWSBinding getJAXWSExtension(TWSDLExtensible extensible) {
|
||||
for (TWSDLExtension extension:extensible.extensions()) {
|
||||
if (extension.getClass().equals(JAXWSBinding.class)) {
|
||||
return (JAXWSBinding)extension;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @param parent
|
||||
* @param e
|
||||
*/
|
||||
private void parseProvider(com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext context, JAXWSBinding parent, Element e) {
|
||||
String val = e.getTextContent();
|
||||
if (val == null) {
|
||||
return;
|
||||
}
|
||||
if (val.equals("false") || val.equals("0")) {
|
||||
((JAXWSBinding)parent).setProvider(Boolean.FALSE);
|
||||
} else if(val.equals("true") || val.equals("1")) {
|
||||
((JAXWSBinding)parent).setProvider(Boolean.TRUE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @param parent
|
||||
* @param e
|
||||
*/
|
||||
private void parsePackage(com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext context, JAXWSBinding parent, Element e) {
|
||||
//System.out.println("In handlePackageExtension: " + e.getNodeName());
|
||||
String packageName = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.NAME_ATTR);
|
||||
JAXWSBinding binding = (JAXWSBinding)parent;
|
||||
binding.setJaxwsPackage(new CustomName(packageName, getJavaDoc(e)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @param parent
|
||||
* @param e
|
||||
*/
|
||||
private void parseWrapperStyle(com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext context, JAXWSBinding parent, Element e) {
|
||||
//System.out.println("In handleWrapperStyleExtension: " + e.getNodeName());
|
||||
String val = e.getTextContent();
|
||||
if (val == null) {
|
||||
return;
|
||||
}
|
||||
if (val.equals("false") || val.equals("0")) {
|
||||
((JAXWSBinding) parent).setEnableWrapperStyle(Boolean.FALSE);
|
||||
} else if (val.equals("true") || val.equals("1")) {
|
||||
((JAXWSBinding) parent).setEnableWrapperStyle(Boolean.TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @param parent
|
||||
* @param e
|
||||
*/
|
||||
// private void parseAdditionalSOAPHeaderMapping(TWSDLParserContextImpl context, TWSDLExtensible parent, Element e) {
|
||||
// //System.out.println("In handleAdditionalSOAPHeaderExtension: " + e.getNodeName());
|
||||
// String val = e.getTextContent();
|
||||
// if(val == null)
|
||||
// return;
|
||||
// if(val.equals("false") || val.equals("0")){
|
||||
// ((JAXWSBinding)parent).setEnableAdditionalHeaderMapping(Boolean.FALSE);
|
||||
// }else if(val.equals("true") || val.equals("1")){
|
||||
// ((JAXWSBinding)parent).setEnableAdditionalHeaderMapping(Boolean.TRUE);
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @param parent
|
||||
* @param e
|
||||
*/
|
||||
private void parseAsynMapping(com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext context, JAXWSBinding parent, Element e) {
|
||||
//System.out.println("In handleAsynMappingExtension: " + e.getNodeName());
|
||||
String val = e.getTextContent();
|
||||
if (val == null) {
|
||||
return;
|
||||
}
|
||||
if (val.equals("false") || val.equals("0")) {
|
||||
((JAXWSBinding) parent).setEnableAsyncMapping(Boolean.FALSE);
|
||||
} else if (val.equals("true") || val.equals("1")) {
|
||||
((JAXWSBinding) parent).setEnableAsyncMapping(Boolean.TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @param parent
|
||||
* @param e
|
||||
*/
|
||||
private void parseMimeContent(com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext context, JAXWSBinding parent, Element e) {
|
||||
//System.out.println("In handleMimeContentExtension: " + e.getNodeName());
|
||||
String val = e.getTextContent();
|
||||
if (val == null) {
|
||||
return;
|
||||
}
|
||||
if (val.equals("false") || val.equals("0")) {
|
||||
((JAXWSBinding) parent).setEnableMimeContentMapping(Boolean.FALSE);
|
||||
} else if (val.equals("true") || val.equals("1")) {
|
||||
((JAXWSBinding) parent).setEnableMimeContentMapping(Boolean.TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @param jaxwsBinding
|
||||
* @param e
|
||||
*/
|
||||
private void parseMethod(com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext context, JAXWSBinding jaxwsBinding, Element e) {
|
||||
String methodName = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.NAME_ATTR);
|
||||
String javaDoc = getJavaDoc(e);
|
||||
CustomName name = new CustomName(methodName, javaDoc);
|
||||
jaxwsBinding.setMethodName(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @param jaxwsBinding
|
||||
* @param e
|
||||
*/
|
||||
private void parseParameter(com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext context, JAXWSBinding jaxwsBinding, Element e) {
|
||||
String part = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.PART_ATTR);
|
||||
Element msgPartElm = evaluateXPathNode(e.getOwnerDocument(), part, new NamespaceContextImpl(e));
|
||||
Node msgElm = msgPartElm.getParentNode();
|
||||
//MessagePart msgPart = new MessagePart();
|
||||
|
||||
String partName = XmlUtil.getAttributeOrNull(msgPartElm, "name");
|
||||
String msgName = XmlUtil.getAttributeOrNull((Element)msgElm, "name");
|
||||
if ((partName == null) || (msgName == null)) {
|
||||
return;
|
||||
}
|
||||
|
||||
String element = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.ELEMENT_ATTR);
|
||||
String name = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.NAME_ATTR);
|
||||
|
||||
QName elementName = null;
|
||||
if(element != null){
|
||||
String uri = e.lookupNamespaceURI(XmlUtil.getPrefix(element));
|
||||
elementName = (uri == null)?null:new QName(uri, XmlUtil.getLocalPart(element));
|
||||
}
|
||||
|
||||
jaxwsBinding.addParameter(new Parameter(msgName, partName, elementName, name));
|
||||
}
|
||||
|
||||
private Element evaluateXPathNode(Node target, String expression, NamespaceContext namespaceContext) {
|
||||
NodeList nlst;
|
||||
try {
|
||||
xpath.setNamespaceContext(namespaceContext);
|
||||
nlst = (NodeList)xpath.evaluate(expression, target, XPathConstants.NODESET);
|
||||
} catch (XPathExpressionException e) {
|
||||
Util.fail("internalizer.XPathEvaluationError", e.getMessage());
|
||||
return null; // abort processing this <jaxb:bindings>
|
||||
}
|
||||
|
||||
if( nlst.getLength()==0 ) {
|
||||
Util.fail("internalizer.XPathEvaluatesToNoTarget", new Object[]{expression});
|
||||
return null; // abort
|
||||
}
|
||||
|
||||
if( nlst.getLength()!=1 ) {
|
||||
Util.fail("internalizer.XPathEvaulatesToTooManyTargets", new Object[]{expression, nlst.getLength()});
|
||||
return null; // abort
|
||||
}
|
||||
|
||||
Node rnode = nlst.item(0);
|
||||
if(!(rnode instanceof Element )) {
|
||||
Util.fail("internalizer.XPathEvaluatesToNonElement", new Object[]{expression});
|
||||
return null; // abort
|
||||
}
|
||||
return (Element)rnode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @param jaxwsBinding
|
||||
* @param e
|
||||
*/
|
||||
private void parseClass(com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext context, JAXWSBinding jaxwsBinding, Element e) {
|
||||
String className = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.NAME_ATTR);
|
||||
String javaDoc = getJavaDoc(e);
|
||||
jaxwsBinding.setClassName(new CustomName(className, javaDoc));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean handleDefinitionsExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
|
||||
return parseGlobalJAXWSBindings(context, parent, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handlePortTypeExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
|
||||
if(XmlUtil.matchesTagNS(e, JAXWSBindingsConstants.JAXWS_BINDINGS)){
|
||||
context.push();
|
||||
context.registerNamespaces(e);
|
||||
JAXWSBinding jaxwsBinding = new JAXWSBinding(context.getLocation(e));
|
||||
|
||||
for(Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();){
|
||||
Element e2 = Util.nextElement(iter);
|
||||
if (e2 == null) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.ENABLE_WRAPPER_STYLE)) {
|
||||
parseWrapperStyle(context, jaxwsBinding, e2);
|
||||
} else if (XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.ENABLE_ASYNC_MAPPING)) {
|
||||
parseAsynMapping(context, jaxwsBinding, e2);
|
||||
} else if (XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.CLASS)) {
|
||||
parseClass(context, jaxwsBinding, e2);
|
||||
if ((jaxwsBinding.getClassName() != null) && (jaxwsBinding.getClassName().getJavaDoc() != null) && (parent instanceof PortType)) {
|
||||
((PortType) parent).setDocumentation(new Documentation(jaxwsBinding.getClassName().getJavaDoc()));
|
||||
}
|
||||
} else {
|
||||
Util.fail(
|
||||
"parsing.invalidExtensionElement",
|
||||
e2.getTagName(),
|
||||
e2.getNamespaceURI());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
parent.addExtension(jaxwsBinding);
|
||||
context.pop();
|
||||
// context.fireDoneParsingEntity(
|
||||
// JAXWSBindingsConstants.JAXWS_BINDINGS,
|
||||
// jaxwsBinding);
|
||||
return true;
|
||||
}else {
|
||||
Util.fail(
|
||||
"parsing.invalidExtensionElement",
|
||||
e.getTagName(),
|
||||
e.getNamespaceURI());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleOperationExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
|
||||
if(XmlUtil.matchesTagNS(e, JAXWSBindingsConstants.JAXWS_BINDINGS)){
|
||||
if(parent instanceof Operation){
|
||||
return handlePortTypeOperation(context, (Operation)parent, e);
|
||||
}else if(parent instanceof BindingOperation){
|
||||
return handleBindingOperation(context, (BindingOperation)parent, e);
|
||||
}
|
||||
}else {
|
||||
Util.fail(
|
||||
"parsing.invalidExtensionElement",
|
||||
e.getTagName(),
|
||||
e.getNamespaceURI());
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean handleBindingOperation(TWSDLParserContext context, BindingOperation operation, Element e) {
|
||||
if(XmlUtil.matchesTagNS(e, JAXWSBindingsConstants.JAXWS_BINDINGS)){
|
||||
context.push();
|
||||
context.registerNamespaces(e);
|
||||
JAXWSBinding jaxwsBinding = new JAXWSBinding(context.getLocation(e));
|
||||
|
||||
for(Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();){
|
||||
Element e2 = Util.nextElement(iter);
|
||||
if (e2 == null) {
|
||||
break;
|
||||
}
|
||||
|
||||
// if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.ENABLE_ADDITIONAL_SOAPHEADER_MAPPING)){
|
||||
// parseAdditionalSOAPHeaderMapping(context, jaxwsBinding, e2);
|
||||
// }else
|
||||
if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.ENABLE_MIME_CONTENT)){
|
||||
parseMimeContent(context, jaxwsBinding, e2);
|
||||
}else if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.PARAMETER)){
|
||||
parseParameter(context, jaxwsBinding, e2);
|
||||
}else{
|
||||
Util.fail(
|
||||
"parsing.invalidExtensionElement",
|
||||
e2.getTagName(),
|
||||
e2.getNamespaceURI());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
operation.addExtension(jaxwsBinding);
|
||||
context.pop();
|
||||
// context.fireDoneParsingEntity(
|
||||
// JAXWSBindingsConstants.JAXWS_BINDINGS,
|
||||
// jaxwsBinding);
|
||||
return true;
|
||||
}else {
|
||||
Util.fail(
|
||||
"parsing.invalidExtensionElement",
|
||||
e.getTagName(),
|
||||
e.getNamespaceURI());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean handlePortTypeOperation(TWSDLParserContext context, Operation parent, Element e) {
|
||||
context.push();
|
||||
context.registerNamespaces(e);
|
||||
JAXWSBinding jaxwsBinding = new JAXWSBinding(context.getLocation(e));
|
||||
|
||||
for(Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();){
|
||||
Element e2 = Util.nextElement(iter);
|
||||
if (e2 == null) {
|
||||
break;
|
||||
}
|
||||
|
||||
if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.ENABLE_WRAPPER_STYLE)){
|
||||
parseWrapperStyle(context, jaxwsBinding, e2);
|
||||
}else if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.ENABLE_ASYNC_MAPPING)){
|
||||
parseAsynMapping(context, jaxwsBinding, e2);
|
||||
}else if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.METHOD)){
|
||||
parseMethod(context, jaxwsBinding, e2);
|
||||
if((jaxwsBinding.getMethodName() != null) && (jaxwsBinding.getMethodName().getJavaDoc() != null)){
|
||||
parent.setDocumentation(new Documentation(jaxwsBinding.getMethodName().getJavaDoc()));
|
||||
}
|
||||
}else if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.PARAMETER)){
|
||||
parseParameter(context, jaxwsBinding, e2);
|
||||
}else{
|
||||
Util.fail(
|
||||
"parsing.invalidExtensionElement",
|
||||
e2.getTagName(),
|
||||
e2.getNamespaceURI());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
parent.addExtension(jaxwsBinding);
|
||||
context.pop();
|
||||
// context.fireDoneParsingEntity(
|
||||
// JAXWSBindingsConstants.JAXWS_BINDINGS,
|
||||
// jaxwsBinding);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleBindingExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
|
||||
if(XmlUtil.matchesTagNS(e, JAXWSBindingsConstants.JAXWS_BINDINGS)){
|
||||
context.push();
|
||||
context.registerNamespaces(e);
|
||||
JAXWSBinding jaxwsBinding = new JAXWSBinding(context.getLocation(e));
|
||||
|
||||
for(Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();){
|
||||
Element e2 = Util.nextElement(iter);
|
||||
if (e2 == null) {
|
||||
break;
|
||||
}
|
||||
|
||||
// if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.ENABLE_ADDITIONAL_SOAPHEADER_MAPPING)){
|
||||
// parseAdditionalSOAPHeaderMapping(context, jaxwsBinding, e2);
|
||||
// }else
|
||||
if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.ENABLE_MIME_CONTENT)){
|
||||
parseMimeContent(context, jaxwsBinding, e2);
|
||||
}else{
|
||||
Util.fail(
|
||||
"parsing.invalidExtensionElement",
|
||||
e2.getTagName(),
|
||||
e2.getNamespaceURI());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
parent.addExtension(jaxwsBinding);
|
||||
context.pop();
|
||||
// context.fireDoneParsingEntity(
|
||||
// JAXWSBindingsConstants.JAXWS_BINDINGS,
|
||||
// jaxwsBinding);
|
||||
return true;
|
||||
}else {
|
||||
Util.fail(
|
||||
"parsing.invalidExtensionElement",
|
||||
e.getTagName(),
|
||||
e.getNamespaceURI());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ExtensionHandlerBase#handleFaultExtension(TWSDLParserContextImpl, TWSDLExtensible, org.w3c.dom.Element)
|
||||
*/
|
||||
@Override
|
||||
public boolean handleFaultExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
|
||||
if(XmlUtil.matchesTagNS(e, JAXWSBindingsConstants.JAXWS_BINDINGS)){
|
||||
context.push();
|
||||
context.registerNamespaces(e);
|
||||
JAXWSBinding jaxwsBinding = new JAXWSBinding(context.getLocation(e));
|
||||
|
||||
for(Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();){
|
||||
Element e2 = Util.nextElement(iter);
|
||||
if (e2 == null) {
|
||||
break;
|
||||
}
|
||||
if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.CLASS)){
|
||||
parseClass(context, jaxwsBinding, e2);
|
||||
if((jaxwsBinding.getClassName() != null) && (jaxwsBinding.getClassName().getJavaDoc() != null)){
|
||||
((Fault)parent).setDocumentation(new Documentation(jaxwsBinding.getClassName().getJavaDoc()));
|
||||
}
|
||||
}else{
|
||||
Util.fail(
|
||||
"parsing.invalidExtensionElement",
|
||||
e2.getTagName(),
|
||||
e2.getNamespaceURI());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
parent.addExtension(jaxwsBinding);
|
||||
context.pop();
|
||||
// context.fireDoneParsingEntity(
|
||||
// JAXWSBindingsConstants.JAXWS_BINDINGS,
|
||||
// jaxwsBinding);
|
||||
return true;
|
||||
}else {
|
||||
Util.fail(
|
||||
"parsing.invalidExtensionElement",
|
||||
e.getTagName(),
|
||||
e.getNamespaceURI());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleServiceExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
|
||||
if(XmlUtil.matchesTagNS(e, JAXWSBindingsConstants.JAXWS_BINDINGS)){
|
||||
context.push();
|
||||
context.registerNamespaces(e);
|
||||
JAXWSBinding jaxwsBinding = new JAXWSBinding(context.getLocation(e));
|
||||
|
||||
for(Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();){
|
||||
Element e2 = Util.nextElement(iter);
|
||||
if (e2 == null) {
|
||||
break;
|
||||
}
|
||||
if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.CLASS)){
|
||||
parseClass(context, jaxwsBinding, e2);
|
||||
if((jaxwsBinding.getClassName() != null) && (jaxwsBinding.getClassName().getJavaDoc() != null)){
|
||||
((Service)parent).setDocumentation(new Documentation(jaxwsBinding.getClassName().getJavaDoc()));
|
||||
}
|
||||
}else{
|
||||
Util.fail(
|
||||
"parsing.invalidExtensionElement",
|
||||
e2.getTagName(),
|
||||
e2.getNamespaceURI());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
parent.addExtension(jaxwsBinding);
|
||||
context.pop();
|
||||
// context.fireDoneParsingEntity(
|
||||
// JAXWSBindingsConstants.JAXWS_BINDINGS,
|
||||
// jaxwsBinding);
|
||||
return true;
|
||||
}else {
|
||||
Util.fail(
|
||||
"parsing.invalidExtensionElement",
|
||||
e.getTagName(),
|
||||
e.getNamespaceURI());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handlePortExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
|
||||
if(XmlUtil.matchesTagNS(e, JAXWSBindingsConstants.JAXWS_BINDINGS)){
|
||||
context.push();
|
||||
context.registerNamespaces(e);
|
||||
JAXWSBinding jaxwsBinding = new JAXWSBinding(context.getLocation(e));
|
||||
|
||||
for(Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();){
|
||||
Element e2 = Util.nextElement(iter);
|
||||
if (e2 == null) {
|
||||
break;
|
||||
}
|
||||
|
||||
if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.PROVIDER)){
|
||||
parseProvider(context, jaxwsBinding, e2);
|
||||
}else if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.METHOD)){
|
||||
parseMethod(context, jaxwsBinding, e2);
|
||||
if((jaxwsBinding.getMethodName() != null) && (jaxwsBinding.getMethodName().getJavaDoc() != null)){
|
||||
((Port)parent).setDocumentation(new Documentation(jaxwsBinding.getMethodName().getJavaDoc()));
|
||||
}
|
||||
}else{
|
||||
Util.fail(
|
||||
"parsing.invalidExtensionElement",
|
||||
e2.getTagName(),
|
||||
e2.getNamespaceURI());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
parent.addExtension(jaxwsBinding);
|
||||
context.pop();
|
||||
// context.fireDoneParsingEntity(
|
||||
// JAXWSBindingsConstants.JAXWS_BINDINGS,
|
||||
// jaxwsBinding);
|
||||
return true;
|
||||
}else {
|
||||
Util.fail(
|
||||
"parsing.invalidExtensionElement",
|
||||
e.getTagName(),
|
||||
e.getNamespaceURI());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private String getJavaDoc(Element e){
|
||||
for(Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();){
|
||||
Element e2 = Util.nextElement(iter);
|
||||
if (e2 == null) {
|
||||
break;
|
||||
}
|
||||
if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.JAVADOC)){
|
||||
return XmlUtil.getTextForNode(e2);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,228 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.parser;
|
||||
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible;
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext;
|
||||
import com.sun.tools.internal.ws.util.xml.XmlUtil;
|
||||
import com.sun.tools.internal.ws.wsdl.document.WSDLConstants;
|
||||
import com.sun.tools.internal.ws.wsdl.document.mime.*;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* The MIME extension handler for WSDL.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class MIMEExtensionHandler extends AbstractExtensionHandler {
|
||||
|
||||
public MIMEExtensionHandler(Map<String, AbstractExtensionHandler> extensionHandlerMap) {
|
||||
super(extensionHandlerMap);
|
||||
}
|
||||
|
||||
public String getNamespaceURI() {
|
||||
return Constants.NS_WSDL_MIME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doHandleExtension(
|
||||
TWSDLParserContext context,
|
||||
TWSDLExtensible parent,
|
||||
Element e) {
|
||||
if (parent.getWSDLElementName().equals(WSDLConstants.QNAME_OUTPUT)) {
|
||||
return handleInputOutputExtension(context, parent, e);
|
||||
} else if (parent.getWSDLElementName().equals(WSDLConstants.QNAME_INPUT)) {
|
||||
return handleInputOutputExtension(context, parent, e);
|
||||
} else if (parent.getWSDLElementName().equals(MIMEConstants.QNAME_PART)) {
|
||||
return handleMIMEPartExtension(context, parent, e);
|
||||
} else {
|
||||
// context.fireIgnoringExtension(
|
||||
// new QName(e.getNamespaceURI(), e.getLocalName()),
|
||||
// parent.getWSDLElementName());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean handleInputOutputExtension(
|
||||
TWSDLParserContext context,
|
||||
TWSDLExtensible parent,
|
||||
Element e) {
|
||||
if (XmlUtil.matchesTagNS(e, MIMEConstants.QNAME_MULTIPART_RELATED)) {
|
||||
context.push();
|
||||
context.registerNamespaces(e);
|
||||
|
||||
MIMEMultipartRelated mpr = new MIMEMultipartRelated(context.getLocation(e));
|
||||
|
||||
for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) {
|
||||
Element e2 = Util.nextElement(iter);
|
||||
if (e2 == null)
|
||||
break;
|
||||
|
||||
if (XmlUtil.matchesTagNS(e2, MIMEConstants.QNAME_PART)) {
|
||||
context.push();
|
||||
context.registerNamespaces(e2);
|
||||
|
||||
MIMEPart part = new MIMEPart(context.getLocation(e2));
|
||||
|
||||
String name =
|
||||
XmlUtil.getAttributeOrNull(e2, Constants.ATTR_NAME);
|
||||
if (name != null) {
|
||||
part.setName(name);
|
||||
}
|
||||
|
||||
for (Iterator iter2 = XmlUtil.getAllChildren(e2);
|
||||
iter2.hasNext();
|
||||
) {
|
||||
Element e3 = Util.nextElement(iter2);
|
||||
if (e3 == null)
|
||||
break;
|
||||
|
||||
AbstractExtensionHandler h = getExtensionHandlers().get(e3.getNamespaceURI());
|
||||
boolean handled = false;
|
||||
if (h != null) {
|
||||
handled = h.doHandleExtension(context, part, e3);
|
||||
}
|
||||
|
||||
if (!handled) {
|
||||
String required =
|
||||
XmlUtil.getAttributeNSOrNull(
|
||||
e3,
|
||||
Constants.ATTR_REQUIRED,
|
||||
Constants.NS_WSDL);
|
||||
if (required != null
|
||||
&& required.equals(Constants.TRUE)) {
|
||||
Util.fail(
|
||||
"parsing.requiredExtensibilityElement",
|
||||
e3.getTagName(),
|
||||
e3.getNamespaceURI());
|
||||
} else {
|
||||
// context.fireIgnoringExtension(
|
||||
// new QName(
|
||||
// e3.getNamespaceURI(),
|
||||
// e3.getLocalName()),
|
||||
// part.getElementName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mpr.add(part);
|
||||
context.pop();
|
||||
// context.fireDoneParsingEntity(
|
||||
// MIMEConstants.QNAME_PART,
|
||||
// part);
|
||||
} else {
|
||||
Util.fail(
|
||||
"parsing.invalidElement",
|
||||
e2.getTagName(),
|
||||
e2.getNamespaceURI());
|
||||
}
|
||||
}
|
||||
|
||||
parent.addExtension(mpr);
|
||||
context.pop();
|
||||
// context.fireDoneParsingEntity(
|
||||
// MIMEConstants.QNAME_MULTIPART_RELATED,
|
||||
// mpr);
|
||||
return true;
|
||||
} else if (XmlUtil.matchesTagNS(e, MIMEConstants.QNAME_CONTENT)) {
|
||||
MIMEContent content = parseMIMEContent(context, e);
|
||||
parent.addExtension(content);
|
||||
return true;
|
||||
} else if (XmlUtil.matchesTagNS(e, MIMEConstants.QNAME_MIME_XML)) {
|
||||
MIMEXml mimeXml = parseMIMEXml(context, e);
|
||||
parent.addExtension(mimeXml);
|
||||
return true;
|
||||
} else {
|
||||
Util.fail(
|
||||
"parsing.invalidExtensionElement",
|
||||
e.getTagName(),
|
||||
e.getNamespaceURI());
|
||||
return false; // keep compiler happy
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean handleMIMEPartExtension(
|
||||
TWSDLParserContext context,
|
||||
TWSDLExtensible parent,
|
||||
Element e) {
|
||||
if (XmlUtil.matchesTagNS(e, MIMEConstants.QNAME_CONTENT)) {
|
||||
MIMEContent content = parseMIMEContent(context, e);
|
||||
parent.addExtension(content);
|
||||
return true;
|
||||
} else if (XmlUtil.matchesTagNS(e, MIMEConstants.QNAME_MIME_XML)) {
|
||||
MIMEXml mimeXml = parseMIMEXml(context, e);
|
||||
parent.addExtension(mimeXml);
|
||||
return true;
|
||||
} else {
|
||||
Util.fail(
|
||||
"parsing.invalidExtensionElement",
|
||||
e.getTagName(),
|
||||
e.getNamespaceURI());
|
||||
return false; // keep compiler happy
|
||||
}
|
||||
}
|
||||
|
||||
protected MIMEContent parseMIMEContent(TWSDLParserContext context, Element e) {
|
||||
context.push();
|
||||
context.registerNamespaces(e);
|
||||
|
||||
MIMEContent content = new MIMEContent(context.getLocation(e));
|
||||
|
||||
String part = XmlUtil.getAttributeOrNull(e, Constants.ATTR_PART);
|
||||
if (part != null) {
|
||||
content.setPart(part);
|
||||
}
|
||||
|
||||
String type = XmlUtil.getAttributeOrNull(e, Constants.ATTR_TYPE);
|
||||
if (type != null) {
|
||||
content.setType(type);
|
||||
}
|
||||
|
||||
context.pop();
|
||||
// context.fireDoneParsingEntity(MIMEConstants.QNAME_CONTENT, content);
|
||||
return content;
|
||||
}
|
||||
|
||||
protected MIMEXml parseMIMEXml(TWSDLParserContext context, Element e) {
|
||||
context.push();
|
||||
context.registerNamespaces(e);
|
||||
|
||||
MIMEXml mimeXml = new MIMEXml(context.getLocation(e));
|
||||
|
||||
String part = XmlUtil.getAttributeOrNull(e, Constants.ATTR_PART);
|
||||
if (part != null) {
|
||||
mimeXml.setPart(part);
|
||||
}
|
||||
|
||||
context.pop();
|
||||
// context.fireDoneParsingEntity(MIMEConstants.QNAME_MIME_XML, mimeXml);
|
||||
return mimeXml;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.parser;
|
||||
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible;
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext;
|
||||
import com.sun.tools.internal.ws.resources.ModelerMessages;
|
||||
import com.sun.tools.internal.ws.resources.WsdlMessages;
|
||||
import com.sun.tools.internal.ws.util.xml.XmlUtil;
|
||||
import com.sun.tools.internal.ws.wscompile.ErrorReceiver;
|
||||
import com.sun.tools.internal.ws.wsdl.document.Fault;
|
||||
import com.sun.tools.internal.ws.wsdl.document.Input;
|
||||
import com.sun.tools.internal.ws.wsdl.document.Output;
|
||||
import com.sun.xml.internal.ws.addressing.W3CAddressingMetadataConstants;
|
||||
import com.sun.xml.internal.ws.api.addressing.AddressingVersion;
|
||||
import org.w3c.dom.Element;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.sun.xml.internal.ws.addressing.v200408.MemberSubmissionAddressingConstants.WSA_ACTION_QNAME;
|
||||
|
||||
/**
|
||||
* @author Arun Gupta
|
||||
*/
|
||||
public class MemberSubmissionAddressingExtensionHandler extends W3CAddressingExtensionHandler {
|
||||
|
||||
private ErrorReceiver errReceiver;
|
||||
private boolean extensionModeOn;
|
||||
|
||||
public MemberSubmissionAddressingExtensionHandler(Map<String, AbstractExtensionHandler> extensionHandlerMap, ErrorReceiver env, boolean extensionModeOn) {
|
||||
super(extensionHandlerMap, env);
|
||||
this.errReceiver = env;
|
||||
this.extensionModeOn = extensionModeOn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNamespaceURI() {
|
||||
return AddressingVersion.MEMBER.wsdlNsUri;
|
||||
}
|
||||
|
||||
protected QName getWSDLExtensionQName() {
|
||||
return AddressingVersion.MEMBER.wsdlExtensionTag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handlePortExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
|
||||
// ignore any extension elements
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleInputExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
|
||||
if (extensionModeOn) {
|
||||
warn(context.getLocation(e));
|
||||
String actionValue = XmlUtil.getAttributeNSOrNull(e, WSA_ACTION_QNAME);
|
||||
if (actionValue == null || actionValue.equals("")) {
|
||||
return warnEmptyAction(parent, context.getLocation(e));
|
||||
}
|
||||
((Input) parent).setAction(actionValue);
|
||||
return true;
|
||||
} else {
|
||||
return fail(context.getLocation(e));
|
||||
}
|
||||
}
|
||||
|
||||
private boolean fail(Locator location) {
|
||||
errReceiver.warning(location,
|
||||
ModelerMessages.WSDLMODELER_INVALID_IGNORING_MEMBER_SUBMISSION_ADDRESSING(
|
||||
AddressingVersion.MEMBER.nsUri, W3CAddressingMetadataConstants.WSAM_NAMESPACE_NAME));
|
||||
return false;
|
||||
}
|
||||
|
||||
private void warn(Locator location) {
|
||||
errReceiver.warning(location,
|
||||
ModelerMessages.WSDLMODELER_WARNING_MEMBER_SUBMISSION_ADDRESSING_USED(
|
||||
AddressingVersion.MEMBER.nsUri, W3CAddressingMetadataConstants.WSAM_NAMESPACE_NAME));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleOutputExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
|
||||
if (extensionModeOn) {
|
||||
warn(context.getLocation(e));
|
||||
String actionValue = XmlUtil.getAttributeNSOrNull(e, WSA_ACTION_QNAME);
|
||||
if (actionValue == null || actionValue.equals("")) {
|
||||
return warnEmptyAction(parent, context.getLocation(e));
|
||||
}
|
||||
((Output) parent).setAction(actionValue);
|
||||
return true;
|
||||
} else {
|
||||
return fail(context.getLocation(e));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleFaultExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
|
||||
if (extensionModeOn) {
|
||||
warn(context.getLocation(e));
|
||||
String actionValue = XmlUtil.getAttributeNSOrNull(e, WSA_ACTION_QNAME);
|
||||
if (actionValue == null || actionValue.equals("")) {
|
||||
errReceiver.warning(context.getLocation(e), WsdlMessages.WARNING_FAULT_EMPTY_ACTION(parent.getNameValue(), parent.getWSDLElementName().getLocalPart(), parent.getParent().getNameValue()));
|
||||
return false; // keep compiler happy
|
||||
}
|
||||
((Fault) parent).setAction(actionValue);
|
||||
return true;
|
||||
} else {
|
||||
return fail(context.getLocation(e));
|
||||
}
|
||||
}
|
||||
|
||||
private boolean warnEmptyAction(TWSDLExtensible parent, Locator pos) {
|
||||
errReceiver.warning(pos, WsdlMessages.WARNING_INPUT_OUTPUT_EMPTY_ACTION(parent.getWSDLElementName().getLocalPart(), parent.getParent().getNameValue()));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,384 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.parser;
|
||||
|
||||
import com.sun.istack.internal.NotNull;
|
||||
import com.sun.istack.internal.Nullable;
|
||||
import com.sun.tools.internal.ws.resources.WscompileMessages;
|
||||
import com.sun.tools.internal.ws.resources.WsdlMessages;
|
||||
import com.sun.tools.internal.ws.wscompile.AbortException;
|
||||
import com.sun.tools.internal.ws.wscompile.ErrorReceiver;
|
||||
import com.sun.tools.internal.ws.wscompile.WsimportOptions;
|
||||
import com.sun.tools.internal.ws.wsdl.document.WSDLConstants;
|
||||
import com.sun.tools.internal.ws.wsdl.document.schema.SchemaConstants;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.ParseException;
|
||||
import com.sun.xml.internal.ws.api.wsdl.parser.MetaDataResolver;
|
||||
import com.sun.xml.internal.ws.api.wsdl.parser.MetadataResolverFactory;
|
||||
import com.sun.xml.internal.ws.api.wsdl.parser.ServiceDescriptor;
|
||||
import com.sun.xml.internal.ws.util.DOMUtil;
|
||||
import com.sun.xml.internal.ws.util.JAXWSUtils;
|
||||
import com.sun.xml.internal.ws.util.ServiceFinder;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.xml.sax.EntityResolver;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.SAXParseException;
|
||||
|
||||
import javax.net.ssl.HostnameVerifier;
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import javax.net.ssl.SSLSession;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Vivek Pandey
|
||||
*/
|
||||
public final class MetadataFinder extends DOMForest{
|
||||
|
||||
public boolean isMexMetadata;
|
||||
private String rootWSDL;
|
||||
private final Set<String> rootWsdls = new HashSet<String>();
|
||||
|
||||
public MetadataFinder(InternalizationLogic logic, WsimportOptions options, ErrorReceiver errReceiver) {
|
||||
super(logic, new WSEntityResolver(options,errReceiver), options, errReceiver);
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("element-type-mismatch")
|
||||
public void parseWSDL(){
|
||||
// parse source grammars
|
||||
for (InputSource value : options.getWSDLs()) {
|
||||
String systemID = value.getSystemId();
|
||||
errorReceiver.pollAbort();
|
||||
|
||||
Document dom;
|
||||
Element doc;
|
||||
|
||||
try {
|
||||
//if there is entity resolver use it
|
||||
if (options.entityResolver != null) {
|
||||
value = options.entityResolver.resolveEntity(null, systemID);
|
||||
}
|
||||
if (value == null) {
|
||||
value = new InputSource(systemID);
|
||||
}
|
||||
dom = parse(value, true);
|
||||
|
||||
doc = dom.getDocumentElement();
|
||||
if (doc == null) {
|
||||
continue;
|
||||
}
|
||||
//if its not a WSDL document, retry with MEX
|
||||
if (doc.getNamespaceURI() == null || !doc.getNamespaceURI().equals(WSDLConstants.NS_WSDL) || !doc.getLocalName().equals("definitions")) {
|
||||
throw new SAXParseException(WsdlMessages.INVALID_WSDL(systemID,
|
||||
com.sun.xml.internal.ws.wsdl.parser.WSDLConstants.QNAME_DEFINITIONS, doc.getNodeName(), locatorTable.getStartLocation(doc).getLineNumber()), locatorTable.getStartLocation(doc));
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
errorReceiver.error(WsdlMessages.FILE_NOT_FOUND(systemID), e);
|
||||
return;
|
||||
} catch (IOException e) {
|
||||
doc = getFromMetadataResolver(systemID, e);
|
||||
} catch (SAXParseException e) {
|
||||
doc = getFromMetadataResolver(systemID, e);
|
||||
} catch (SAXException e) {
|
||||
doc = getFromMetadataResolver(systemID, e);
|
||||
}
|
||||
|
||||
if (doc == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
NodeList schemas = doc.getElementsByTagNameNS(SchemaConstants.NS_XSD, "schema");
|
||||
for (int i = 0; i < schemas.getLength(); i++) {
|
||||
if (!inlinedSchemaElements.contains(schemas.item(i))) {
|
||||
inlinedSchemaElements.add((Element) schemas.item(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
identifyRootWsdls();
|
||||
}
|
||||
|
||||
public static class WSEntityResolver implements EntityResolver {
|
||||
WsimportOptions options;
|
||||
ErrorReceiver errorReceiver;
|
||||
|
||||
private URLConnection c = null;
|
||||
private boolean doReset = false;
|
||||
|
||||
public WSEntityResolver(WsimportOptions options, ErrorReceiver errReceiver) {
|
||||
this.options = options;
|
||||
this.errorReceiver = errReceiver;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
|
||||
InputSource inputSource = null;
|
||||
|
||||
if(options.entityResolver != null ) {
|
||||
inputSource = options.entityResolver.resolveEntity(null, systemId);
|
||||
}
|
||||
if (inputSource == null) {
|
||||
inputSource = new InputSource(systemId);
|
||||
InputStream is = null;
|
||||
int redirects = 0;
|
||||
boolean redirect;
|
||||
URL url = JAXWSUtils.getFileOrURL(inputSource.getSystemId());
|
||||
URLConnection conn = url.openConnection();
|
||||
do {
|
||||
if (conn instanceof HttpsURLConnection) {
|
||||
if (options.disableSSLHostnameVerification) {
|
||||
((HttpsURLConnection) conn).setHostnameVerifier(new HttpClientVerifier());
|
||||
}
|
||||
}
|
||||
redirect = false;
|
||||
if (conn instanceof HttpURLConnection) {
|
||||
((HttpURLConnection) conn).setInstanceFollowRedirects(false);
|
||||
}
|
||||
|
||||
if (conn instanceof JarURLConnection) {
|
||||
if (conn.getUseCaches()) {
|
||||
doReset = true;
|
||||
conn.setDefaultUseCaches(false);
|
||||
c = conn;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
is = conn.getInputStream();
|
||||
//is = sun.net.www.protocol.http.HttpURLConnection.openConnectionCheckRedirects(conn);
|
||||
} catch (IOException e) {
|
||||
if (conn instanceof HttpURLConnection) {
|
||||
HttpURLConnection httpConn = ((HttpURLConnection) conn);
|
||||
int code = httpConn.getResponseCode();
|
||||
if (code == 401) {
|
||||
errorReceiver.error(new SAXParseException(WscompileMessages.WSIMPORT_AUTH_INFO_NEEDED(e.getMessage(),
|
||||
systemId, WsimportOptions.defaultAuthfile), null, e));
|
||||
throw new AbortException();
|
||||
}
|
||||
//FOR other code we will retry with MEX
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
|
||||
//handle 302 or 303, JDK does not seem to handle 302 very well.
|
||||
//Need to redesign this a bit as we need to throw better error message for IOException in this case
|
||||
if (conn instanceof HttpURLConnection) {
|
||||
HttpURLConnection httpConn = ((HttpURLConnection) conn);
|
||||
int code = httpConn.getResponseCode();
|
||||
if (code == 302 || code == 303) {
|
||||
//retry with the value in Location header
|
||||
List<String> seeOther = httpConn.getHeaderFields().get("Location");
|
||||
if (seeOther != null && seeOther.size() > 0) {
|
||||
URL newurl = new URL(url, seeOther.get(0));
|
||||
if (!newurl.equals(url)) {
|
||||
errorReceiver.info(new SAXParseException(WscompileMessages.WSIMPORT_HTTP_REDIRECT(code, seeOther.get(0)), null));
|
||||
url = newurl;
|
||||
httpConn.disconnect();
|
||||
if (redirects >= 5) {
|
||||
errorReceiver.error(new SAXParseException(WscompileMessages.WSIMPORT_MAX_REDIRECT_ATTEMPT(), null));
|
||||
throw new AbortException();
|
||||
}
|
||||
conn = url.openConnection();
|
||||
inputSource.setSystemId(url.toExternalForm());
|
||||
redirects++;
|
||||
redirect = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (redirect);
|
||||
inputSource.setByteStream(is);
|
||||
}
|
||||
|
||||
return inputSource;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
//see http://java.net/jira/browse/JAX_WS-1087
|
||||
if (doReset) {
|
||||
c.setDefaultUseCaches(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// overide default SSL HttpClientVerifier to always return true
|
||||
// effectively overiding Hostname client verification when using SSL
|
||||
private static class HttpClientVerifier implements HostnameVerifier {
|
||||
@Override
|
||||
public boolean verify(String s, SSLSession sslSession) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gives the root wsdl document systemId. A root wsdl document is the one which has wsdl:service.
|
||||
* @return null if there is no root wsdl
|
||||
*/
|
||||
public @Nullable
|
||||
String getRootWSDL(){
|
||||
return rootWSDL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gives all the WSDL documents.
|
||||
*/
|
||||
public @NotNull
|
||||
Set<String> getRootWSDLs(){
|
||||
return rootWsdls;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Identifies WSDL documents from the {@link DOMForest}. Also identifies the root wsdl document.
|
||||
*/
|
||||
private void identifyRootWsdls(){
|
||||
for(String location: rootDocuments){
|
||||
Document doc = get(location);
|
||||
if(doc!=null){
|
||||
Element definition = doc.getDocumentElement();
|
||||
if(definition == null || definition.getLocalName() == null || definition.getNamespaceURI() == null)
|
||||
continue;
|
||||
if(definition.getNamespaceURI().equals(WSDLConstants.NS_WSDL) && definition.getLocalName().equals("definitions")){
|
||||
rootWsdls.add(location);
|
||||
//set the root wsdl at this point. Root wsdl is one which has wsdl:service in it
|
||||
NodeList nl = definition.getElementsByTagNameNS(WSDLConstants.NS_WSDL, "service");
|
||||
|
||||
//TODO:what if there are more than one wsdl with wsdl:service element. Probably such cases
|
||||
//are rare and we will take any one of them, this logic should still work
|
||||
if(nl.getLength() > 0)
|
||||
rootWSDL = location;
|
||||
}
|
||||
}
|
||||
}
|
||||
//no wsdl with wsdl:service found, throw error
|
||||
if(rootWSDL == null){
|
||||
StringBuilder strbuf = new StringBuilder();
|
||||
for(String str : rootWsdls){
|
||||
strbuf.append(str);
|
||||
strbuf.append('\n');
|
||||
}
|
||||
errorReceiver.error(null, WsdlMessages.FAILED_NOSERVICE(strbuf.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If source and target namespace are also passed in,
|
||||
* then if the mex resolver is found and it cannot get
|
||||
* the data, wsimport attempts to add ?wsdl to the
|
||||
* address and retrieve the data with a normal http get.
|
||||
* This behavior should only happen when trying a
|
||||
* mex request first.
|
||||
*/
|
||||
private @Nullable Element getFromMetadataResolver(String systemId, Exception ex) {
|
||||
//try MEX
|
||||
MetaDataResolver resolver;
|
||||
ServiceDescriptor serviceDescriptor = null;
|
||||
for (MetadataResolverFactory resolverFactory : ServiceFinder.find(MetadataResolverFactory.class)) {
|
||||
resolver = resolverFactory.metadataResolver(options.entityResolver);
|
||||
try {
|
||||
serviceDescriptor = resolver.resolve(new URI(systemId));
|
||||
//we got the ServiceDescriptor, now break
|
||||
if (serviceDescriptor != null)
|
||||
break;
|
||||
} catch (URISyntaxException e) {
|
||||
throw new ParseException(e);
|
||||
}
|
||||
}
|
||||
|
||||
if (serviceDescriptor != null) {
|
||||
errorReceiver.warning(new SAXParseException(WsdlMessages.TRY_WITH_MEX(ex.getMessage()), null, ex));
|
||||
return parseMetadata(systemId, serviceDescriptor);
|
||||
} else {
|
||||
errorReceiver.error(null, WsdlMessages.PARSING_UNABLE_TO_GET_METADATA(ex.getMessage(), WscompileMessages.WSIMPORT_NO_WSDL(systemId)), ex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private Element parseMetadata(@NotNull String systemId, @NotNull ServiceDescriptor serviceDescriptor) {
|
||||
List<? extends Source> mexWsdls = serviceDescriptor.getWSDLs();
|
||||
List<? extends Source> mexSchemas = serviceDescriptor.getSchemas();
|
||||
Document root = null;
|
||||
for (Source src : mexWsdls) {
|
||||
if (src instanceof DOMSource) {
|
||||
Node n = ((DOMSource) src).getNode();
|
||||
Document doc;
|
||||
if (n.getNodeType() == Node.ELEMENT_NODE && n.getOwnerDocument() == null) {
|
||||
doc = DOMUtil.createDom();
|
||||
doc.importNode(n, true);
|
||||
} else {
|
||||
doc = n.getOwnerDocument();
|
||||
}
|
||||
|
||||
// Element e = (n.getNodeType() == Node.ELEMENT_NODE)?(Element)n: DOMUtil.getFirstElementChild(n);
|
||||
if (root == null) {
|
||||
//check if its main wsdl, then set it to root
|
||||
NodeList nl = doc.getDocumentElement().getElementsByTagNameNS(WSDLConstants.NS_WSDL, "service");
|
||||
if (nl.getLength() > 0) {
|
||||
root = doc;
|
||||
rootWSDL = src.getSystemId();
|
||||
}
|
||||
}
|
||||
NodeList nl = doc.getDocumentElement().getElementsByTagNameNS(WSDLConstants.NS_WSDL, "import");
|
||||
for(int i = 0; i < nl.getLength(); i++){
|
||||
Element imp = (Element) nl.item(i);
|
||||
String loc = imp.getAttribute("location");
|
||||
if (loc != null) {
|
||||
if (!externalReferences.contains(loc))
|
||||
externalReferences.add(loc);
|
||||
}
|
||||
}
|
||||
if (core.keySet().contains(systemId))
|
||||
core.remove(systemId);
|
||||
core.put(src.getSystemId(), doc);
|
||||
resolvedCache.put(systemId, doc.getDocumentURI());
|
||||
isMexMetadata = true;
|
||||
}
|
||||
|
||||
//TODO:handle SAXSource
|
||||
//TODO:handler StreamSource
|
||||
}
|
||||
|
||||
for (Source src : mexSchemas) {
|
||||
if (src instanceof DOMSource) {
|
||||
Node n = ((DOMSource) src).getNode();
|
||||
Element e = (n.getNodeType() == Node.ELEMENT_NODE) ? (Element) n : DOMUtil.getFirstElementChild(n);
|
||||
inlinedSchemaElements.add(e);
|
||||
}
|
||||
//TODO:handle SAXSource
|
||||
//TODO:handler StreamSource
|
||||
}
|
||||
return root.getDocumentElement();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*
|
||||
* THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC.
|
||||
*/
|
||||
|
||||
package com.sun.tools.internal.ws.wsdl.parser;
|
||||
|
||||
import com.sun.xml.internal.bind.v2.WellKnownNamespace;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import javax.xml.namespace.NamespaceContext;
|
||||
import java.util.Iterator;
|
||||
|
||||
public class NamespaceContextImpl implements NamespaceContext {
|
||||
|
||||
private final Element e;
|
||||
|
||||
public NamespaceContextImpl(Element e) {
|
||||
this.e = e;
|
||||
}
|
||||
|
||||
public String getNamespaceURI(String prefix) {
|
||||
Node parent = e;
|
||||
String namespace = null;
|
||||
|
||||
if (prefix.equals("xml")) {
|
||||
namespace = WellKnownNamespace.XML_NAMESPACE_URI;
|
||||
} else {
|
||||
int type;
|
||||
|
||||
while ((null != parent) && (null == namespace)
|
||||
&& (((type = parent.getNodeType()) == Node.ELEMENT_NODE)
|
||||
|| (type == Node.ENTITY_REFERENCE_NODE))) {
|
||||
if (type == Node.ELEMENT_NODE) {
|
||||
if (parent.getNodeName().indexOf(prefix + ':') == 0)
|
||||
return parent.getNamespaceURI();
|
||||
NamedNodeMap nnm = parent.getAttributes();
|
||||
|
||||
for (int i = 0; i < nnm.getLength(); i++) {
|
||||
Node attr = nnm.item(i);
|
||||
String aname = attr.getNodeName();
|
||||
boolean isPrefix = aname.startsWith("xmlns:");
|
||||
|
||||
if (isPrefix || aname.equals("xmlns")) {
|
||||
int index = aname.indexOf(':');
|
||||
String p = isPrefix ? aname.substring(index + 1) : "";
|
||||
|
||||
if (p.equals(prefix)) {
|
||||
namespace = attr.getNodeValue();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
parent = parent.getParentNode();
|
||||
}
|
||||
}
|
||||
|
||||
return namespace;
|
||||
}
|
||||
|
||||
public String getPrefix(String namespaceURI) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Iterator getPrefixes(String namespaceURI) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.parser;
|
||||
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible;
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensionHandler;
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext;
|
||||
import com.sun.tools.internal.ws.util.xml.XmlUtil;
|
||||
import com.sun.xml.internal.ws.policy.sourcemodel.wspolicy.NamespaceVersion;
|
||||
import com.sun.xml.internal.ws.policy.sourcemodel.wspolicy.XmlToken;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* Policies are evaluated at runtime. This class makes sure that wscompile/wsimport
|
||||
* ignores all policy elements at tooltime.
|
||||
*
|
||||
* @author Jakub Podlesak (jakub.podlesak at sun.com)
|
||||
* @author Fabian Ritzmann
|
||||
*/
|
||||
|
||||
public class Policy12ExtensionHandler extends TWSDLExtensionHandler {
|
||||
|
||||
@Override
|
||||
public String getNamespaceURI() {
|
||||
return NamespaceVersion.v1_2.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handlePortTypeExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
|
||||
return handleExtension(context, parent, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleDefinitionsExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
|
||||
return handleExtension(context, parent, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleBindingExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
|
||||
return handleExtension(context, parent, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleOperationExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
|
||||
return handleExtension(context, parent, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleInputExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
|
||||
return handleExtension(context, parent, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleOutputExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
|
||||
return handleExtension(context, parent, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleFaultExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
|
||||
return handleExtension(context, parent, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleServiceExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
|
||||
return handleExtension(context, parent, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handlePortExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
|
||||
return handleExtension(context, parent, e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Only skip the element if it is a <wsp:Policy/>, <wsp:PolicyReference/> or
|
||||
* <wsp:UsingPolicy> element.
|
||||
*/
|
||||
private boolean handleExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
|
||||
return XmlUtil.matchesTagNS(e, NamespaceVersion.v1_2.asQName(XmlToken.Policy))
|
||||
|| XmlUtil.matchesTagNS(e,NamespaceVersion.v1_2.asQName(XmlToken.PolicyReference))
|
||||
|| XmlUtil.matchesTagNS(e, NamespaceVersion.v1_2.asQName(XmlToken.UsingPolicy));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.parser;
|
||||
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible;
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensionHandler;
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext;
|
||||
import com.sun.tools.internal.ws.util.xml.XmlUtil;
|
||||
import com.sun.xml.internal.ws.policy.sourcemodel.wspolicy.NamespaceVersion;
|
||||
import com.sun.xml.internal.ws.policy.sourcemodel.wspolicy.XmlToken;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* Policies are evaluated at runtime. This class makes sure that wscompile/wsimport
|
||||
* ignores all policy elements at tooltime.
|
||||
*
|
||||
* @author Jakub Podlesak (jakub.podlesak at sun.com)
|
||||
* @author Fabian Ritzmann
|
||||
*/
|
||||
|
||||
public class Policy15ExtensionHandler extends TWSDLExtensionHandler {
|
||||
|
||||
@Override
|
||||
public String getNamespaceURI() {
|
||||
return NamespaceVersion.v1_5.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handlePortTypeExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
|
||||
return handleExtension(context, parent, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleDefinitionsExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
|
||||
return handleExtension(context, parent, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleBindingExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
|
||||
return handleExtension(context, parent, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleOperationExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
|
||||
return handleExtension(context, parent, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleInputExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
|
||||
return handleExtension(context, parent, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleOutputExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
|
||||
return handleExtension(context, parent, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleFaultExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
|
||||
return handleExtension(context, parent, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleServiceExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
|
||||
return handleExtension(context, parent, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handlePortExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
|
||||
return handleExtension(context, parent, e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Only skip the element if it is a <wsp:Policy/>, <wsp:PolicyReference/> or
|
||||
* <wsp:UsingPolicy> element.
|
||||
*/
|
||||
private boolean handleExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
|
||||
return XmlUtil.matchesTagNS(e, NamespaceVersion.v1_5.asQName(XmlToken.Policy))
|
||||
|| XmlUtil.matchesTagNS(e,NamespaceVersion.v1_5.asQName(XmlToken.PolicyReference))
|
||||
|| XmlUtil.matchesTagNS(e, NamespaceVersion.v1_5.asQName(XmlToken.UsingPolicy));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.parser;
|
||||
|
||||
import com.sun.tools.internal.ws.wsdl.document.soap.SOAP12Binding;
|
||||
import com.sun.tools.internal.ws.wsdl.document.soap.SOAP12Constants;
|
||||
import com.sun.tools.internal.ws.wsdl.document.soap.SOAPBinding;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public class SOAP12ExtensionHandler extends SOAPExtensionHandler {
|
||||
public SOAP12ExtensionHandler(Map<String, AbstractExtensionHandler> extensionHandlerMap) {
|
||||
super(extensionHandlerMap);
|
||||
}
|
||||
|
||||
/*
|
||||
* @see SOAPExtensionHandler#getNamespaceURI()
|
||||
*/
|
||||
@Override
|
||||
public String getNamespaceURI() {
|
||||
return Constants.NS_WSDL_SOAP12;
|
||||
}
|
||||
|
||||
/*
|
||||
* @see SOAPExtensionHandler#getAddressQName()
|
||||
*/
|
||||
@Override
|
||||
protected QName getAddressQName() {
|
||||
return SOAP12Constants.QNAME_ADDRESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* @see SOAPExtensionHandler#getBindingQName()
|
||||
*/
|
||||
@Override
|
||||
protected QName getBindingQName() {
|
||||
return SOAP12Constants.QNAME_BINDING;
|
||||
}
|
||||
|
||||
@Override protected SOAPBinding getSOAPBinding(Locator location) {
|
||||
return new SOAP12Binding(location);
|
||||
}
|
||||
|
||||
/*
|
||||
* @see SOAPExtensionHandler#getBodyQName()
|
||||
*/
|
||||
@Override
|
||||
protected QName getBodyQName() {
|
||||
return SOAP12Constants.QNAME_BODY;
|
||||
}
|
||||
|
||||
/*
|
||||
* @see SOAPExtensionHandler#getFaultQName()
|
||||
*/
|
||||
@Override
|
||||
protected QName getFaultQName() {
|
||||
return SOAP12Constants.QNAME_FAULT;
|
||||
}
|
||||
|
||||
/*
|
||||
* @see SOAPExtensionHandler#getHeaderfaultQName()
|
||||
*/
|
||||
@Override
|
||||
protected QName getHeaderfaultQName() {
|
||||
return SOAP12Constants.QNAME_HEADERFAULT;
|
||||
}
|
||||
|
||||
/*
|
||||
* @see SOAPExtensionHandler#getHeaderQName()
|
||||
*/
|
||||
@Override
|
||||
protected QName getHeaderQName() {
|
||||
return SOAP12Constants.QNAME_HEADER;
|
||||
}
|
||||
|
||||
/*
|
||||
* @see SOAPExtensionHandler#getOperationQName()
|
||||
*/
|
||||
@Override
|
||||
protected QName getOperationQName() {
|
||||
return SOAP12Constants.QNAME_OPERATION;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,217 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.parser;
|
||||
|
||||
import com.sun.tools.internal.ws.wsdl.document.schema.SchemaConstants;
|
||||
import com.sun.tools.internal.ws.wsdl.document.schema.SchemaKinds;
|
||||
import com.sun.tools.internal.ws.wsdl.document.soap.SOAPConstants;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.EntityReferenceValidator;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.Kind;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* An interface implemented by a class that is capable of validating
|
||||
* a QName/Kind pair referring to an external entity.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class SOAPEntityReferenceValidator implements EntityReferenceValidator {
|
||||
public SOAPEntityReferenceValidator() {
|
||||
}
|
||||
|
||||
public boolean isValid(Kind kind, QName name) {
|
||||
|
||||
// just let all "xml:" QNames through
|
||||
if (name.getNamespaceURI().equals(Constants.NS_XML))
|
||||
return true;
|
||||
|
||||
if (kind == SchemaKinds.XSD_TYPE) {
|
||||
return _validTypes.contains(name);
|
||||
} else if (kind == SchemaKinds.XSD_ELEMENT) {
|
||||
return _validElements.contains(name);
|
||||
} else if (kind == SchemaKinds.XSD_ATTRIBUTE) {
|
||||
return _validAttributes.contains(name);
|
||||
} else {
|
||||
// no luck
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static final Set _validTypes;
|
||||
private static final Set _validElements;
|
||||
private static final Set _validAttributes;
|
||||
|
||||
static {
|
||||
// add all XML Schema and SOAP types
|
||||
_validTypes = new HashSet();
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_ARRAY);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_STRING);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_NORMALIZED_STRING);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_TOKEN);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_BYTE);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_UNSIGNED_BYTE);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_BASE64_BINARY);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_HEX_BINARY);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_INTEGER);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_POSITIVE_INTEGER);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_NEGATIVE_INTEGER);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_NON_NEGATIVE_INTEGER);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_NON_POSITIVE_INTEGER);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_INT);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_UNSIGNED_INT);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_LONG);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_UNSIGNED_LONG);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_SHORT);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_UNSIGNED_SHORT);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_DECIMAL);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_FLOAT);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_DOUBLE);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_BOOLEAN);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_TIME);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_DATE_TIME);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_DURATION);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_DATE);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_G_MONTH);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_G_YEAR);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_G_YEAR_MONTH);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_G_DAY);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_G_MONTH_DAY);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_NAME);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_QNAME);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_NCNAME);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_ANY_URI);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_ID);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_IDREF);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_IDREFS);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_ENTITY);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_ENTITIES);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_NOTATION);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_NMTOKEN);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_NMTOKENS);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_URTYPE);
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_SIMPLE_URTYPE);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_STRING);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_NORMALIZED_STRING);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_TOKEN);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_BYTE);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_UNSIGNED_BYTE);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_BASE64_BINARY);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_HEX_BINARY);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_INTEGER);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_POSITIVE_INTEGER);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_NEGATIVE_INTEGER);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_NON_NEGATIVE_INTEGER);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_NON_POSITIVE_INTEGER);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_INT);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_UNSIGNED_INT);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_LONG);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_UNSIGNED_LONG);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_SHORT);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_UNSIGNED_SHORT);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_DECIMAL);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_FLOAT);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_DOUBLE);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_BOOLEAN);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_TIME);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_DATE_TIME);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_DURATION);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_DATE);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_G_MONTH);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_G_YEAR);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_G_YEAR_MONTH);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_G_DAY);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_G_MONTH_DAY);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_NAME);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_QNAME);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_NCNAME);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_ANY_URI);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_ID);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_IDREF);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_IDREFS);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_ENTITY);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_ENTITIES);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_NOTATION);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_NMTOKEN);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_NMTOKENS);
|
||||
_validTypes.add(SOAPConstants.QNAME_TYPE_BASE64);
|
||||
// New types 12/3/02
|
||||
_validTypes.add(SchemaConstants.QNAME_TYPE_LANGUAGE);
|
||||
|
||||
// add all SOAP encoding elements
|
||||
_validElements = new HashSet();
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_STRING);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_NORMALIZED_STRING);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_TOKEN);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_BYTE);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_UNSIGNED_BYTE);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_BASE64_BINARY);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_HEX_BINARY);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_INTEGER);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_POSITIVE_INTEGER);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_NEGATIVE_INTEGER);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_NON_NEGATIVE_INTEGER);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_NON_POSITIVE_INTEGER);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_INT);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_UNSIGNED_INT);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_LONG);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_UNSIGNED_LONG);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_SHORT);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_UNSIGNED_SHORT);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_DECIMAL);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_FLOAT);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_DOUBLE);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_BOOLEAN);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_TIME);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_DATE_TIME);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_DURATION);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_DATE);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_G_MONTH);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_G_YEAR);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_G_YEAR_MONTH);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_G_DAY);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_G_MONTH_DAY);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_NAME);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_QNAME);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_NCNAME);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_ANY_URI);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_ID);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_IDREF);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_IDREFS);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_ENTITY);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_ENTITIES);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_NOTATION);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_NMTOKEN);
|
||||
_validElements.add(SOAPConstants.QNAME_ELEMENT_NMTOKENS);
|
||||
|
||||
_validAttributes = new HashSet();
|
||||
_validAttributes.add(SOAPConstants.QNAME_ATTR_ARRAY_TYPE);
|
||||
_validAttributes.add(SOAPConstants.QNAME_ATTR_OFFSET);
|
||||
_validAttributes.add(SOAPConstants.QNAME_ATTR_POSITION);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,471 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.parser;
|
||||
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible;
|
||||
import com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext;
|
||||
import com.sun.tools.internal.ws.util.xml.XmlUtil;
|
||||
import com.sun.tools.internal.ws.wsdl.document.soap.*;
|
||||
import com.sun.tools.internal.ws.wsdl.framework.TWSDLParserContextImpl;
|
||||
import org.w3c.dom.Element;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* The SOAP extension handler for WSDL.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class SOAPExtensionHandler extends AbstractExtensionHandler {
|
||||
|
||||
public SOAPExtensionHandler(Map<String, AbstractExtensionHandler> extensionHandlerMap) {
|
||||
super(extensionHandlerMap);
|
||||
}
|
||||
|
||||
public String getNamespaceURI() {
|
||||
return Constants.NS_WSDL_SOAP;
|
||||
}
|
||||
|
||||
public boolean handleDefinitionsExtension(
|
||||
TWSDLParserContext context,
|
||||
TWSDLExtensible parent,
|
||||
Element e) {
|
||||
Util.fail(
|
||||
"parsing.invalidExtensionElement",
|
||||
e.getTagName(),
|
||||
e.getNamespaceURI());
|
||||
return false; // keep compiler happy
|
||||
}
|
||||
|
||||
public boolean handleTypesExtension(
|
||||
com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext context,
|
||||
TWSDLExtensible parent,
|
||||
Element e) {
|
||||
Util.fail(
|
||||
"parsing.invalidExtensionElement",
|
||||
e.getTagName(),
|
||||
e.getNamespaceURI());
|
||||
return false; // keep compiler happy
|
||||
}
|
||||
|
||||
protected SOAPBinding getSOAPBinding(Locator location){
|
||||
return new SOAPBinding(location);
|
||||
}
|
||||
|
||||
public boolean handleBindingExtension(
|
||||
TWSDLParserContext context,
|
||||
TWSDLExtensible parent,
|
||||
Element e) {
|
||||
if (XmlUtil.matchesTagNS(e, getBindingQName())) {
|
||||
context.push();
|
||||
context.registerNamespaces(e);
|
||||
|
||||
SOAPBinding binding = getSOAPBinding(context.getLocation(e));
|
||||
|
||||
// NOTE - the "transport" attribute is required according to section 3.3 of the WSDL 1.1 spec,
|
||||
// but optional according to the schema in appendix A 4.2 of the same document!
|
||||
String transport =
|
||||
Util.getRequiredAttribute(e, Constants.ATTR_TRANSPORT);
|
||||
binding.setTransport(transport);
|
||||
|
||||
String style = XmlUtil.getAttributeOrNull(e, Constants.ATTR_STYLE);
|
||||
if (style != null) {
|
||||
if (style.equals(Constants.ATTRVALUE_RPC)) {
|
||||
binding.setStyle(SOAPStyle.RPC);
|
||||
} else if (style.equals(Constants.ATTRVALUE_DOCUMENT)) {
|
||||
binding.setStyle(SOAPStyle.DOCUMENT);
|
||||
} else {
|
||||
Util.fail(
|
||||
"parsing.invalidAttributeValue",
|
||||
Constants.ATTR_STYLE,
|
||||
style);
|
||||
}
|
||||
}
|
||||
parent.addExtension(binding);
|
||||
context.pop();
|
||||
// context.fireDoneParsingEntity(getBindingQName(), binding);
|
||||
return true;
|
||||
} else {
|
||||
Util.fail(
|
||||
"parsing.invalidExtensionElement",
|
||||
e.getTagName(),
|
||||
e.getNamespaceURI());
|
||||
return false; // keep compiler happy
|
||||
}
|
||||
}
|
||||
|
||||
public boolean handleOperationExtension(
|
||||
TWSDLParserContext context,
|
||||
TWSDLExtensible parent,
|
||||
Element e) {
|
||||
if (XmlUtil.matchesTagNS(e, getOperationQName())) {
|
||||
context.push();
|
||||
context.registerNamespaces(e);
|
||||
|
||||
SOAPOperation operation = new SOAPOperation(context.getLocation(e));
|
||||
|
||||
String soapAction =
|
||||
XmlUtil.getAttributeOrNull(e, Constants.ATTR_SOAP_ACTION);
|
||||
if (soapAction != null) {
|
||||
operation.setSOAPAction(soapAction);
|
||||
}
|
||||
|
||||
String style = XmlUtil.getAttributeOrNull(e, Constants.ATTR_STYLE);
|
||||
if (style != null) {
|
||||
if (style.equals(Constants.ATTRVALUE_RPC)) {
|
||||
operation.setStyle(SOAPStyle.RPC);
|
||||
} else if (style.equals(Constants.ATTRVALUE_DOCUMENT)) {
|
||||
operation.setStyle(SOAPStyle.DOCUMENT);
|
||||
} else {
|
||||
Util.fail(
|
||||
"parsing.invalidAttributeValue",
|
||||
Constants.ATTR_STYLE,
|
||||
style);
|
||||
}
|
||||
}
|
||||
parent.addExtension(operation);
|
||||
context.pop();
|
||||
// context.fireDoneParsingEntity(
|
||||
// getOperationQName(),
|
||||
// operation);
|
||||
return true;
|
||||
} else {
|
||||
Util.fail(
|
||||
"parsing.invalidExtensionElement",
|
||||
e.getTagName(),
|
||||
e.getNamespaceURI());
|
||||
return false; // keep compiler happy
|
||||
}
|
||||
}
|
||||
|
||||
public boolean handleInputExtension(
|
||||
TWSDLParserContext context,
|
||||
TWSDLExtensible parent,
|
||||
Element e) {
|
||||
return handleInputOutputExtension(context, parent, e);
|
||||
}
|
||||
public boolean handleOutputExtension(
|
||||
TWSDLParserContext context,
|
||||
TWSDLExtensible parent,
|
||||
Element e) {
|
||||
return handleInputOutputExtension(context, parent, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean handleMIMEPartExtension(
|
||||
TWSDLParserContext context,
|
||||
TWSDLExtensible parent,
|
||||
Element e) {
|
||||
return handleInputOutputExtension(context, parent, e);
|
||||
}
|
||||
|
||||
protected boolean handleInputOutputExtension(
|
||||
TWSDLParserContext contextif,
|
||||
TWSDLExtensible parent,
|
||||
Element e) {
|
||||
TWSDLParserContextImpl context = (TWSDLParserContextImpl)contextif;
|
||||
if (XmlUtil.matchesTagNS(e, getBodyQName())) {
|
||||
context.push();
|
||||
context.registerNamespaces(e);
|
||||
|
||||
SOAPBody body = new SOAPBody(context.getLocation(e));
|
||||
|
||||
String use = XmlUtil.getAttributeOrNull(e, Constants.ATTR_USE);
|
||||
if (use != null) {
|
||||
if (use.equals(Constants.ATTRVALUE_LITERAL)) {
|
||||
body.setUse(SOAPUse.LITERAL);
|
||||
} else if (use.equals(Constants.ATTRVALUE_ENCODED)) {
|
||||
body.setUse(SOAPUse.ENCODED);
|
||||
} else {
|
||||
Util.fail(
|
||||
"parsing.invalidAttributeValue",
|
||||
Constants.ATTR_USE,
|
||||
use);
|
||||
}
|
||||
}
|
||||
|
||||
String namespace =
|
||||
XmlUtil.getAttributeOrNull(e, Constants.ATTR_NAMESPACE);
|
||||
if (namespace != null) {
|
||||
body.setNamespace(namespace);
|
||||
}
|
||||
|
||||
String encodingStyle =
|
||||
XmlUtil.getAttributeOrNull(e, Constants.ATTR_ENCODING_STYLE);
|
||||
if (encodingStyle != null) {
|
||||
body.setEncodingStyle(encodingStyle);
|
||||
}
|
||||
|
||||
String parts = XmlUtil.getAttributeOrNull(e, Constants.ATTR_PARTS);
|
||||
if (parts != null) {
|
||||
body.setParts(parts);
|
||||
}
|
||||
|
||||
parent.addExtension(body);
|
||||
context.pop();
|
||||
// context.fireDoneParsingEntity(getBodyQName(), body);
|
||||
return true;
|
||||
} else if (XmlUtil.matchesTagNS(e, getHeaderQName())) {
|
||||
return handleHeaderElement(parent, e, context);
|
||||
} else {
|
||||
Util.fail("parsing.invalidExtensionElement", e.getTagName(), e.getNamespaceURI());
|
||||
return false; // keep compiler happy
|
||||
}
|
||||
}
|
||||
|
||||
private boolean handleHeaderElement(TWSDLExtensible parent, Element e, TWSDLParserContextImpl context) {
|
||||
context.push();
|
||||
context.registerNamespaces(e);
|
||||
|
||||
SOAPHeader header = new SOAPHeader(context.getLocation(e));
|
||||
|
||||
String use = XmlUtil.getAttributeOrNull(e, Constants.ATTR_USE);
|
||||
if (use != null) {
|
||||
if (use.equals(Constants.ATTRVALUE_LITERAL)) {
|
||||
header.setUse(SOAPUse.LITERAL);
|
||||
} else if (use.equals(Constants.ATTRVALUE_ENCODED)) {
|
||||
header.setUse(SOAPUse.ENCODED);
|
||||
} else {
|
||||
Util.fail("parsing.invalidAttributeValue", Constants.ATTR_USE, use);
|
||||
}
|
||||
}
|
||||
|
||||
String namespace = XmlUtil.getAttributeOrNull(e, Constants.ATTR_NAMESPACE);
|
||||
if (namespace != null) {
|
||||
header.setNamespace(namespace);
|
||||
}
|
||||
|
||||
String encodingStyle = XmlUtil.getAttributeOrNull(e, Constants.ATTR_ENCODING_STYLE);
|
||||
if (encodingStyle != null) {
|
||||
header.setEncodingStyle(encodingStyle);
|
||||
}
|
||||
|
||||
String part = XmlUtil.getAttributeOrNull(e, Constants.ATTR_PART);
|
||||
if (part != null) {
|
||||
header.setPart(part);
|
||||
}
|
||||
|
||||
String messageAttr = XmlUtil.getAttributeOrNull(e, Constants.ATTR_MESSAGE);
|
||||
if (messageAttr != null) {
|
||||
header.setMessage(context.translateQualifiedName(context.getLocation(e), messageAttr));
|
||||
}
|
||||
|
||||
for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) {
|
||||
Element e2 = Util.nextElement(iter);
|
||||
if (e2 == null)
|
||||
break;
|
||||
|
||||
if (XmlUtil.matchesTagNS(e2, getHeaderfaultQName())) {
|
||||
handleHeaderFaultElement(e, context, header, use, e2);
|
||||
} else {
|
||||
Util.fail("parsing.invalidElement", e2.getTagName(), e2.getNamespaceURI());
|
||||
}
|
||||
}
|
||||
|
||||
parent.addExtension(header);
|
||||
context.pop();
|
||||
context.fireDoneParsingEntity(getHeaderQName(), header);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void handleHeaderFaultElement(Element e, TWSDLParserContextImpl context, SOAPHeader header, String use, Element e2) {
|
||||
context.push();
|
||||
context.registerNamespaces(e);
|
||||
|
||||
SOAPHeaderFault headerfault = new SOAPHeaderFault(context.getLocation(e));
|
||||
|
||||
String use2 = XmlUtil.getAttributeOrNull(e2, Constants.ATTR_USE);
|
||||
if (use2 != null) {
|
||||
if (use2.equals(Constants.ATTRVALUE_LITERAL)) {
|
||||
headerfault.setUse(SOAPUse.LITERAL);
|
||||
} else if (use.equals(Constants.ATTRVALUE_ENCODED)) {
|
||||
headerfault.setUse(SOAPUse.ENCODED);
|
||||
} else {
|
||||
Util.fail("parsing.invalidAttributeValue", Constants.ATTR_USE, use2);
|
||||
}
|
||||
}
|
||||
|
||||
String namespace2 = XmlUtil.getAttributeOrNull(e2, Constants.ATTR_NAMESPACE);
|
||||
if (namespace2 != null) {
|
||||
headerfault.setNamespace(namespace2);
|
||||
}
|
||||
|
||||
String encodingStyle2 = XmlUtil.getAttributeOrNull(e2, Constants.ATTR_ENCODING_STYLE);
|
||||
if (encodingStyle2 != null) {
|
||||
headerfault.setEncodingStyle(encodingStyle2);
|
||||
}
|
||||
|
||||
String part2 = XmlUtil.getAttributeOrNull(e2, Constants.ATTR_PART);
|
||||
if (part2 != null) {
|
||||
headerfault.setPart(part2);
|
||||
}
|
||||
|
||||
String messageAttr2 = XmlUtil.getAttributeOrNull(e2, Constants.ATTR_MESSAGE);
|
||||
if (messageAttr2 != null) {
|
||||
headerfault.setMessage(
|
||||
context.translateQualifiedName(context.getLocation(e2), messageAttr2));
|
||||
}
|
||||
|
||||
header.add(headerfault);
|
||||
context.pop();
|
||||
}
|
||||
|
||||
public boolean handleFaultExtension(
|
||||
TWSDLParserContext context,
|
||||
TWSDLExtensible parent,
|
||||
Element e) {
|
||||
if (XmlUtil.matchesTagNS(e, getFaultQName())) {
|
||||
context.push();
|
||||
context.registerNamespaces(e);
|
||||
|
||||
SOAPFault fault = new SOAPFault(context.getLocation(e));
|
||||
|
||||
String name = XmlUtil.getAttributeOrNull(e, Constants.ATTR_NAME);
|
||||
if (name != null) {
|
||||
fault.setName(name);
|
||||
}
|
||||
|
||||
String use = XmlUtil.getAttributeOrNull(e, Constants.ATTR_USE);
|
||||
if (use != null) {
|
||||
if (use.equals(Constants.ATTRVALUE_LITERAL)) {
|
||||
fault.setUse(SOAPUse.LITERAL);
|
||||
} else if (use.equals(Constants.ATTRVALUE_ENCODED)) {
|
||||
fault.setUse(SOAPUse.ENCODED);
|
||||
} else {
|
||||
Util.fail(
|
||||
"parsing.invalidAttributeValue",
|
||||
Constants.ATTR_USE,
|
||||
use);
|
||||
}
|
||||
}
|
||||
|
||||
String namespace =
|
||||
XmlUtil.getAttributeOrNull(e, Constants.ATTR_NAMESPACE);
|
||||
if (namespace != null) {
|
||||
fault.setNamespace(namespace);
|
||||
}
|
||||
|
||||
String encodingStyle =
|
||||
XmlUtil.getAttributeOrNull(e, Constants.ATTR_ENCODING_STYLE);
|
||||
if (encodingStyle != null) {
|
||||
fault.setEncodingStyle(encodingStyle);
|
||||
}
|
||||
|
||||
parent.addExtension(fault);
|
||||
context.pop();
|
||||
// context.fireDoneParsingEntity(getFaultQName(), fault);
|
||||
return true;
|
||||
} else if (XmlUtil.matchesTagNS(e, getHeaderQName())) {
|
||||
// although SOAP spec doesn't define meaning of this extension; it is allowed
|
||||
// to be here, so we have to accept it, not fail (bug 13576977)
|
||||
return handleHeaderElement(parent, e, (TWSDLParserContextImpl) context);
|
||||
} else {
|
||||
Util.fail(
|
||||
"parsing.invalidExtensionElement",
|
||||
e.getTagName(),
|
||||
e.getNamespaceURI());
|
||||
return false; // keep compiler happy
|
||||
}
|
||||
}
|
||||
|
||||
public boolean handleServiceExtension(
|
||||
TWSDLParserContext context,
|
||||
TWSDLExtensible parent,
|
||||
Element e) {
|
||||
Util.fail(
|
||||
"parsing.invalidExtensionElement",
|
||||
e.getTagName(),
|
||||
e.getNamespaceURI());
|
||||
return false; // keep compiler happy
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handlePortExtension(
|
||||
TWSDLParserContext context,
|
||||
TWSDLExtensible parent,
|
||||
Element e) {
|
||||
if (XmlUtil.matchesTagNS(e, getAddressQName())) {
|
||||
context.push();
|
||||
context.registerNamespaces(e);
|
||||
|
||||
SOAPAddress address = new SOAPAddress(context.getLocation(e));
|
||||
|
||||
String location =
|
||||
Util.getRequiredAttribute(e, Constants.ATTR_LOCATION);
|
||||
address.setLocation(location);
|
||||
|
||||
parent.addExtension(address);
|
||||
context.pop();
|
||||
// context.fireDoneParsingEntity(getAddressQName(), address);
|
||||
return true;
|
||||
} else {
|
||||
Util.fail(
|
||||
"parsing.invalidExtensionElement",
|
||||
e.getTagName(),
|
||||
e.getNamespaceURI());
|
||||
return false; // keep compiler happy
|
||||
}
|
||||
}
|
||||
|
||||
public boolean handlePortTypeExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
|
||||
Util.fail(
|
||||
"parsing.invalidExtensionElement",
|
||||
e.getTagName(),
|
||||
e.getNamespaceURI());
|
||||
return false; // keep compiler happy
|
||||
}
|
||||
|
||||
protected QName getBodyQName(){
|
||||
return SOAPConstants.QNAME_BODY;
|
||||
}
|
||||
|
||||
protected QName getHeaderQName(){
|
||||
return SOAPConstants.QNAME_HEADER;
|
||||
}
|
||||
|
||||
protected QName getHeaderfaultQName(){
|
||||
return SOAPConstants.QNAME_HEADERFAULT;
|
||||
}
|
||||
|
||||
protected QName getOperationQName(){
|
||||
return SOAPConstants.QNAME_OPERATION;
|
||||
}
|
||||
|
||||
protected QName getFaultQName(){
|
||||
return SOAPConstants.QNAME_FAULT;
|
||||
}
|
||||
|
||||
protected QName getAddressQName(){
|
||||
return SOAPConstants.QNAME_ADDRESS;
|
||||
}
|
||||
|
||||
protected QName getBindingQName(){
|
||||
return SOAPConstants.QNAME_BINDING;
|
||||
}
|
||||
}
|
||||
181
jdkSrc/jdk8/com/sun/tools/internal/ws/wsdl/parser/Util.java
Normal file
181
jdkSrc/jdk8/com/sun/tools/internal/ws/wsdl/parser/Util.java
Normal file
@@ -0,0 +1,181 @@
|
||||
/*
|
||||
* 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.tools.internal.ws.wsdl.parser;
|
||||
|
||||
import com.sun.tools.internal.ws.wsdl.framework.ParseException;
|
||||
import com.sun.xml.internal.ws.util.xml.XmlUtil;
|
||||
import org.w3c.dom.Comment;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.Text;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.Iterator;
|
||||
|
||||
/**2
|
||||
* Defines various utility methods.
|
||||
*
|
||||
* @author WS Development Team
|
||||
*/
|
||||
public class Util {
|
||||
|
||||
public static String getRequiredAttribute(Element element, String name) {
|
||||
String result = XmlUtil.getAttributeOrNull(element, name);
|
||||
if (result == null)
|
||||
fail(
|
||||
"parsing.missingRequiredAttribute",
|
||||
element.getTagName(),
|
||||
name);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void verifyTag(Element element, String tag) {
|
||||
if (!element.getLocalName().equals(tag))
|
||||
fail("parsing.invalidTag", element.getTagName(), tag);
|
||||
}
|
||||
|
||||
public static void verifyTagNS(Element element, String tag, String nsURI) {
|
||||
if (!element.getLocalName().equals(tag)
|
||||
|| (element.getNamespaceURI() != null
|
||||
&& !element.getNamespaceURI().equals(nsURI)))
|
||||
fail(
|
||||
"parsing.invalidTagNS",
|
||||
new Object[] {
|
||||
element.getTagName(),
|
||||
element.getNamespaceURI(),
|
||||
tag,
|
||||
nsURI });
|
||||
}
|
||||
|
||||
public static void verifyTagNS(Element element, QName name) {
|
||||
if (!isTagName(element, name))
|
||||
fail(
|
||||
"parsing.invalidTagNS",
|
||||
new Object[] {
|
||||
element.getTagName(),
|
||||
element.getNamespaceURI(),
|
||||
name.getLocalPart(),
|
||||
name.getNamespaceURI()});
|
||||
}
|
||||
|
||||
public static boolean isTagName(Element element, QName name){
|
||||
return (element.getLocalName().equals(name.getLocalPart())
|
||||
&& (element.getNamespaceURI() != null
|
||||
&& element.getNamespaceURI().equals(name.getNamespaceURI())));
|
||||
|
||||
}
|
||||
|
||||
public static void verifyTagNSRootElement(Element element, QName name) {
|
||||
if (!element.getLocalName().equals(name.getLocalPart())
|
||||
|| (element.getNamespaceURI() != null
|
||||
&& !element.getNamespaceURI().equals(name.getNamespaceURI())))
|
||||
fail(
|
||||
"parsing.incorrectRootElement",
|
||||
new Object[] {
|
||||
element.getTagName(),
|
||||
element.getNamespaceURI(),
|
||||
name.getLocalPart(),
|
||||
name.getNamespaceURI()});
|
||||
}
|
||||
|
||||
public static Element nextElementIgnoringCharacterContent(Iterator iter) {
|
||||
while (iter.hasNext()) {
|
||||
Node n = (Node) iter.next();
|
||||
if (n instanceof Text)
|
||||
continue;
|
||||
if (n instanceof Comment)
|
||||
continue;
|
||||
if (!(n instanceof Element))
|
||||
fail("parsing.elementExpected");
|
||||
return (Element) n;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Element nextElement(Iterator iter) {
|
||||
while (iter.hasNext()) {
|
||||
Node n = (Node) iter.next();
|
||||
if (n instanceof Text) {
|
||||
Text t = (Text) n;
|
||||
if (t.getData().trim().length() == 0)
|
||||
continue;
|
||||
fail("parsing.nonWhitespaceTextFound", t.getData().trim());
|
||||
}
|
||||
if (n instanceof Comment)
|
||||
continue;
|
||||
if (!(n instanceof Element))
|
||||
fail("parsing.elementExpected");
|
||||
return (Element) n;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String processSystemIdWithBase(
|
||||
String baseSystemId,
|
||||
String systemId) {
|
||||
try {
|
||||
URL base = null;
|
||||
try {
|
||||
base = new URL(baseSystemId);
|
||||
} catch (MalformedURLException e) {
|
||||
base = new File(baseSystemId).toURL();
|
||||
}
|
||||
|
||||
try {
|
||||
URL url = new URL(base, systemId);
|
||||
return url.toString();
|
||||
} catch (MalformedURLException e) {
|
||||
fail("parsing.invalidURI", systemId);
|
||||
}
|
||||
|
||||
} catch (MalformedURLException e) {
|
||||
fail("parsing.invalidURI", baseSystemId);
|
||||
}
|
||||
|
||||
return null; // keep compiler happy
|
||||
}
|
||||
|
||||
public static void fail(String key) {
|
||||
throw new ParseException(key);
|
||||
}
|
||||
|
||||
public static void fail(String key, String arg) {
|
||||
throw new ParseException(key, arg);
|
||||
}
|
||||
|
||||
public static void fail(String key, String arg1, String arg2) {
|
||||
throw new ParseException(key, new Object[] { arg1, arg2 });
|
||||
}
|
||||
|
||||
public static void fail(String key, Object[] args) {
|
||||
throw new ParseException(key, args);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user