You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ga...@apache.org on 2008/09/19 03:38:58 UTC
svn commit: r696895 -
/geronimo/server/branches/2.1/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/EndpointInfoBuilder.java
Author: gawor
Date: Thu Sep 18 18:38:58 2008
New Revision: 696895
URL: http://svn.apache.org/viewvc?rev=696895&view=rev
Log:
handle external wsdl/xsd imports in service-ref wsdl (GERONIMO-4311)
Modified:
geronimo/server/branches/2.1/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/EndpointInfoBuilder.java
Modified: geronimo/server/branches/2.1/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/EndpointInfoBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/EndpointInfoBuilder.java?rev=696895&r1=696894&r2=696895&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/EndpointInfoBuilder.java (original)
+++ geronimo/server/branches/2.1/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/EndpointInfoBuilder.java Thu Sep 18 18:38:58 2008
@@ -362,19 +362,8 @@
}
public InputSource getBaseInputSource() {
- InputStream wsdlInputStream;
- ZipEntry entry = moduleFile.getEntry(wsdlURI.toString());
- if (entry == null) {
- throw new RuntimeException(
- "WSDL file does not exist in the module " + wsdlURI.toString());
- }
- try {
- wsdlInputStream = moduleFile.getInputStream(entry);
- streams.add(wsdlInputStream);
- } catch (Exception e) {
- throw new RuntimeException(
- "Could not open stream to wsdl file", e);
- }
+ InputStream wsdlInputStream = getModuleFile(wsdlURI);
+ streams.add(wsdlInputStream);
return new InputSource(wsdlInputStream);
}
@@ -385,20 +374,19 @@
public InputSource getImportInputSource(String parentLocation,
String relativeLocation) {
URI parentURI = URI.create(parentLocation);
- latestImportURI = parentURI.resolve(relativeLocation);
+ URI relativeURI = URI.create(relativeLocation);
InputStream importInputStream;
- ZipEntry entry = moduleFile.getEntry(latestImportURI.toString());
- if (entry == null) {
- throw new RuntimeException(
- "File does not exist in the module " + latestImportURI.toString());
- }
- try {
- importInputStream = moduleFile.getInputStream(entry);
- streams.add(importInputStream);
- } catch (Exception e) {
- throw new RuntimeException(
- "Could not open stream to import file", e);
+ if (relativeURI.isAbsolute()) {
+ latestImportURI = relativeURI;
+ importInputStream = getExternalFile(latestImportURI);
+ } else if (parentURI.isAbsolute()) {
+ latestImportURI = parentURI.resolve(relativeLocation);
+ importInputStream = getExternalFile(latestImportURI);
+ } else {
+ latestImportURI = parentURI.resolve(relativeLocation);
+ importInputStream = getModuleFile(latestImportURI);
}
+ streams.add(importInputStream);
InputSource inputSource = new InputSource(importInputStream);
inputSource.setSystemId(getLatestImportURI());
return inputSource;
@@ -408,6 +396,29 @@
return latestImportURI.toString();
}
+ private InputStream getExternalFile(URI file) {
+ try {
+ return file.toURL().openStream();
+ } catch (Exception e) {
+ throw new RuntimeException(
+ "Failed to import external file: " + latestImportURI, e);
+ }
+ }
+
+ private InputStream getModuleFile(URI file) {
+ ZipEntry entry = moduleFile.getEntry(file.toString());
+ if (entry == null) {
+ throw new RuntimeException(
+ "File does not exist in the module: " + file);
+ }
+ try {
+ return moduleFile.getInputStream(entry);
+ } catch (Exception e) {
+ throw new RuntimeException(
+ "Could not open stream to import file", e);
+ }
+ }
+
public void close() {
for (InputStream inputStream : this.streams) {
try {