1 /* |
1 /* |
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
23 * questions. |
23 * questions. |
24 */ |
24 */ |
25 |
25 |
26 package com.sun.tools.internal.ws.wsdl.parser; |
26 package com.sun.tools.internal.ws.wsdl.parser; |
27 |
27 |
28 import com.sun.tools.internal.ws.wscompile.WsimportOptions; |
|
29 import com.sun.tools.internal.ws.wsdl.document.WSDLConstants; |
28 import com.sun.tools.internal.ws.wsdl.document.WSDLConstants; |
30 import com.sun.tools.internal.ws.wsdl.document.jaxws.JAXWSBindingsConstants; |
29 import com.sun.tools.internal.ws.wsdl.document.jaxws.JAXWSBindingsConstants; |
31 import com.sun.tools.internal.ws.wsdl.document.schema.SchemaConstants; |
30 import com.sun.tools.internal.ws.wsdl.document.schema.SchemaConstants; |
32 import com.sun.tools.internal.xjc.util.DOMUtils; |
31 import com.sun.tools.internal.xjc.util.DOMUtils; |
33 import org.w3c.dom.Element; |
32 import org.w3c.dom.Element; |
47 private static final class ReferenceFinder extends AbstractReferenceFinderImpl { |
46 private static final class ReferenceFinder extends AbstractReferenceFinderImpl { |
48 ReferenceFinder( DOMForest parent) { |
47 ReferenceFinder( DOMForest parent) { |
49 super(parent); |
48 super(parent); |
50 } |
49 } |
51 |
50 |
|
51 @Override |
52 protected String findExternalResource( String nsURI, String localName, Attributes atts) { |
52 protected String findExternalResource( String nsURI, String localName, Attributes atts) { |
53 if(WSDLConstants.NS_WSDL.equals(nsURI) && "import".equals(localName)){ |
53 if(WSDLConstants.NS_WSDL.equals(nsURI) && "import".equals(localName)){ |
54 if(parent.isExtensionMode()){ |
54 // if(parent.isExtensionMode()){ |
55 //TODO: add support for importing schema using wsdl:import |
55 // //TODO: add support for importing schema using wsdl:import |
56 } |
56 // } |
57 return atts.getValue("location"); |
57 return atts.getValue("location"); |
58 } |
58 } |
59 |
59 |
60 // We don't need to do this anymore, JAXB handles the schema imports, includes etc., but this is useful for the clientJar option in |
60 // We don't need to do this anymore, JAXB handles the schema imports, includes etc., but this is useful for the clientJar option in |
61 // fetching the imported schemas to package in the jar.. |
61 // fetching the imported schemas to package in the jar.. |
65 } |
65 } |
66 } |
66 } |
67 return null; |
67 return null; |
68 } |
68 } |
69 } |
69 } |
|
70 @Override |
70 public XMLFilterImpl createExternalReferenceFinder(DOMForest parent) { |
71 public XMLFilterImpl createExternalReferenceFinder(DOMForest parent) { |
71 return new ReferenceFinder(parent); |
72 return new ReferenceFinder(parent); |
72 } |
73 } |
73 |
74 |
|
75 @Override |
74 public boolean checkIfValidTargetNode(DOMForest parent, Element bindings, Element target) { |
76 public boolean checkIfValidTargetNode(DOMForest parent, Element bindings, Element target) { |
75 return false; |
77 return false; |
76 } |
78 } |
77 |
79 |
|
80 @Override |
78 public Element refineSchemaTarget(Element target) { |
81 public Element refineSchemaTarget(Element target) { |
79 // look for existing xs:annotation |
82 // look for existing xs:annotation |
80 Element annotation = DOMUtils.getFirstChildElement(target, Constants.NS_XSD, "annotation"); |
83 Element annotation = DOMUtils.getFirstChildElement(target, Constants.NS_XSD, "annotation"); |
81 if(annotation==null) |
84 if(annotation==null) |
82 // none exists. need to make one |
85 // none exists. need to make one |
90 |
93 |
91 return appinfo; |
94 return appinfo; |
92 |
95 |
93 } |
96 } |
94 |
97 |
|
98 @Override |
95 public Element refineWSDLTarget(Element target){ |
99 public Element refineWSDLTarget(Element target){ |
96 // look for existing xs:annotation |
100 // look for existing xs:annotation |
97 Element JAXWSBindings = DOMUtils.getFirstChildElement(target, JAXWSBindingsConstants.NS_JAXWS_BINDINGS, "bindings"); |
101 Element JAXWSBindings = DOMUtils.getFirstChildElement(target, JAXWSBindingsConstants.NS_JAXWS_BINDINGS, "bindings"); |
98 if(JAXWSBindings==null) |
102 if(JAXWSBindings==null) |
99 // none exists. need to make one |
103 // none exists. need to make one |