4 import javax.wsdl.xml.WSDLLocator;
5 import org.xml.sax.InputSource;
8 import java.util.HashMap;
10 import java.util.Iterator;
13 import java.net.MalformedURLException;
14 import java.net.URISyntaxException;
16 import java.io.InputStream;
17 import java.io.IOException;
27 this.urlMap =
new HashMap<String,URL>();
28 this.inputStreamMap =
new HashMap<String,InputStream>();
32 Set<Map.Entry<String,InputStream>> isms = inputStreamMap.entrySet();
33 Iterator<Map.Entry<String,InputStream>> isi = isms.iterator();
34 while (isi.hasNext()) {
35 Map.Entry<String,InputStream> me = isi.next();
37 me.getValue().close();
39 catch (Exception ex) { }
42 inputStreamMap.clear();
44 lastImportedURL = null;
48 InputSource newInputSource = null;
49 InputStream is = inputStreamMap.get(url.toString());
51 return new InputSource(is);
54 is = url.openStream();
56 catch (IOException ex) {
60 newInputSource =
new InputSource(is);
61 urlMap.put(url.toString(),
url);
62 inputStreamMap.put(url.toString(),is);
63 return newInputSource;
71 uri = url.toURI().toString();
73 catch (URISyntaxException ex) {
80 String importLocation) {
81 URL newImportedURL = null;
83 URL parentLocationURL =
new URL(parentLocation);
85 newImportedURL =
new URL(parentLocationURL,importLocation);
87 catch (MalformedURLException ex) {
92 InputStream newInputStream = inputStreamMap.get(newImportedURL.toString());
93 if (newInputStream != null) {
94 lastImportedURL = newImportedURL;
95 return new InputSource(newInputStream);
99 newInputStream = newImportedURL.openStream();
101 catch (IOException ex) {
102 ex.printStackTrace();
105 InputSource newInputSource =
new InputSource(newInputStream);
107 urlMap.put(newImportedURL.toString(),newImportedURL);
108 inputStreamMap.put(newImportedURL.toString(),newInputStream);
110 lastImportedURL = newImportedURL;
112 return newInputSource;
117 if (lastImportedURL != null)
118 return lastImportedURL.toString();
InputSource getImportInputSource(String parentLocation, String importLocation)
String getLatestImportURI()
Map< String, InputStream > inputStreamMap
Map< String, URL > urlMap
InputSource getBaseInputSource()