Author: dkulp
Date: Fri Sep 21 11:02:19 2007
New Revision: 578217
URL: http://svn.apache.org/viewvc?rev=578217&view=rev
Log:
[CXF-1053] Support URI and public types of catalog substitution as well as
System
Modified:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/catalog/CatalogWSDLLocator.java
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/catalog/CatalogXmlSchemaURIResolver.java
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/catalog/OASISCatalogManager.java
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLLocatorImpl.java
Modified:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/catalog/CatalogWSDLLocator.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/catalog/CatalogWSDLLocator.java?rev=578217&r1=578216&r2=578217&view=diff
==============================================================================
---
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/catalog/CatalogWSDLLocator.java
(original)
+++
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/catalog/CatalogWSDLLocator.java
Fri Sep 21 11:02:19 2007
@@ -77,6 +77,13 @@
String resolvedImportLocation = null;
try {
resolvedImportLocation =
this.catalogResolver.resolveSystem(importLocation);
+ if (resolvedImportLocation == null) {
+ resolvedImportLocation =
catalogResolver.resolveURI(importLocation);
+ }
+ if (resolvedImportLocation == null) {
+ resolvedImportLocation =
catalogResolver.resolvePublic(importLocation, parent);
+ }
+
} catch (IOException e) {
throw new RuntimeException("Catalog resolution failed", e);
}
Modified:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/catalog/CatalogXmlSchemaURIResolver.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/catalog/CatalogXmlSchemaURIResolver.java?rev=578217&r1=578216&r2=578217&view=diff
==============================================================================
---
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/catalog/CatalogXmlSchemaURIResolver.java
(original)
+++
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/catalog/CatalogXmlSchemaURIResolver.java
Fri Sep 21 11:02:19 2007
@@ -44,6 +44,13 @@
String resolvedSchemaLocation = null;
try {
resolvedSchemaLocation =
this.catalogResolver.resolveSystem(schemaLocation);
+
+ if (resolvedSchemaLocation == null) {
+ resolvedSchemaLocation =
catalogResolver.resolveURI(schemaLocation);
+ }
+ if (resolvedSchemaLocation == null) {
+ resolvedSchemaLocation =
catalogResolver.resolvePublic(schemaLocation, baseUri);
+ }
} catch (IOException e) {
throw new RuntimeException("Catalog resolution failed", e);
}
Modified:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/catalog/OASISCatalogManager.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/catalog/OASISCatalogManager.java?rev=578217&r1=578216&r2=578217&view=diff
==============================================================================
---
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/catalog/OASISCatalogManager.java
(original)
+++
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/catalog/OASISCatalogManager.java
Fri Sep 21 11:02:19 2007
@@ -18,7 +18,10 @@
*/
package org.apache.cxf.catalog;
+import java.io.File;
+import java.io.FileNotFoundException;
import java.io.IOException;
+import java.net.URISyntaxException;
import java.net.URL;
import java.util.Collections;
import java.util.Enumeration;
@@ -38,9 +41,13 @@
public class OASISCatalogManager {
public static final String DEFAULT_CATALOG_NAME =
"META-INF/jax-ws-catalog.xml";
+ public static final String CATALOG_DEBUG_KEY =
"OASISCatalogManager.catalog.debug.level";
private static final Logger LOG =
LogUtils.getL7dLogger(OASISCatalogManager.class);
+ private static final String DEBUG_LEVEL =
System.getProperty(CATALOG_DEBUG_KEY);
+
+
private Catalog resolver;
private Set<URL> loadedCatalogs = Collections.synchronizedSet(new
HashSet<URL>());
@@ -51,6 +58,9 @@
catalogManager.setUseStaticCatalog(false);
catalogManager.setIgnoreMissingProperties(true);
CatalogResolver catalogResolver = new CatalogResolver(catalogManager);
+ if (DEBUG_LEVEL != null) {
+ catalogManager.debug.setDebug(Integer.parseInt(DEBUG_LEVEL));
+ }
this.resolver = catalogResolver.getCatalog();
}
@@ -103,7 +113,21 @@
public void loadCatalog(URL catalogURL) throws IOException {
if (!loadedCatalogs.contains(catalogURL)) {
- this.resolver.parseCatalog(catalogURL);
+ if ("file".equals(catalogURL.getProtocol())) {
+ try {
+ File file = new File(catalogURL.toURI());
+ if (file.exists()) {
+ this.resolver.parseCatalog(file.getAbsolutePath());
+ } else {
+ throw new
FileNotFoundException(file.getAbsolutePath());
+ }
+ } catch (URISyntaxException e) {
+ //just process as is
+ this.resolver.parseCatalog(catalogURL);
+ }
+ } else {
+ this.resolver.parseCatalog(catalogURL);
+ }
loadedCatalogs.add(catalogURL);
}
}
Modified:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLLocatorImpl.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLLocatorImpl.java?rev=578217&r1=578216&r2=578217&view=diff
==============================================================================
---
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLLocatorImpl.java
(original)
+++
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLLocatorImpl.java
Fri Sep 21 11:02:19 2007
@@ -51,6 +51,13 @@
String resolvedLocation = null;
if (catalogResolver != null) {
resolvedLocation = catalogResolver.resolveSystem(target);
+
+ if (resolvedLocation == null) {
+ resolvedLocation = catalogResolver.resolveURI(target);
+ }
+ if (resolvedLocation == null) {
+ resolvedLocation = catalogResolver.resolvePublic(target,
base);
+ }
}
if (resolvedLocation == null) {
return this.resolver.resolve(target, base);