Author: rr
Date: Thu Nov 26 10:55:17 2009
New Revision: 884500
URL: http://svn.apache.org/viewvc?rev=884500&view=rev
Log:
ODE-712: Implement classpath resolved xsd & wsdl imports
Added:
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/common/src/main/resources/Ping.xsd
(with props)
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/common/src/main/resources/Pong.xsd
(with props)
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/common/src/main/resources/common.wsdl
(with props)
ode/branches/APACHE_ODE_1.X/utils/src/test/resources/log4j.properties
(with props)
Removed:
ode/branches/APACHE_ODE_1.X/utils/src/main/java/org/apache/ode/utils/xsd/DefaultXMLEntityResolver.java
Modified:
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/DefaultResourceFinder.java
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ResourceFinder.java
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WSDLRegistry.java
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WsdlFinderXMLEntityResolver.java
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/wsdl/XMLSchemaType.java
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/wsdl/XMLSchemaTypeSerializer.java
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/common/src/main/resources/Ping.wsdl
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/common/src/main/resources/Pong.wsdl
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/http-su/pom.xml
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/ode-su/src/main/resources/Ping.bpel
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/ode-su/src/main/resources/Pong.bpel
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/pom.xml
ode/branches/APACHE_ODE_1.X/utils/src/main/java/org/apache/ode/utils/xsd/XSUtils.java
ode/branches/APACHE_ODE_1.X/utils/src/test/java/org/apache/ode/utils/xsd/SchemaCaptureTest.java
Modified:
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java
URL:
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java?rev=884500&r1=884499&r2=884500&view=diff
==============================================================================
---
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java
(original)
+++
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java
Thu Nov 26 10:55:17 2009
@@ -192,7 +192,7 @@
Definition4BPEL def;
try {
WSDLReader r = _wsdlFactory.newWSDLReader();
- WSDLLocatorImpl locator = new WSDLLocatorImpl(_resourceFinder,
from.resolve(wsdlImport));
+ WSDLLocatorImpl locator = new WSDLLocatorImpl(_resourceFinder,
_resourceFinder.resolve(from, wsdlImport));
def = (Definition4BPEL) r.readWSDL(locator);
} catch (WSDLException e) {
recoveredFromError(sloc, new
CompilationException(__cmsgs.errWsdlParseError(e
@@ -202,7 +202,7 @@
}
try {
- _wsdlRegistry.addDefinition(def, _resourceFinder,
from.resolve(wsdlImport));
+ _wsdlRegistry.addDefinition(def, _resourceFinder,
_resourceFinder.resolve(from, wsdlImport));
if (__log.isDebugEnabled())
__log.debug("Added WSDL Definition: " + wsdlImport);
} catch (CompilationException ce) {
@@ -211,13 +211,12 @@
}
public void addXsdImport(URI from, URI location, SourceLocation sloc) {
- URI resFrom = from.resolve(location);
+ URI resFrom = _resourceFinder.resolve(from, location);
if (__log.isDebugEnabled())
__log.debug("Adding XSD import from " + resFrom + " location " +
location);
XMLEntityResolver resolver = new
WsdlFinderXMLEntityResolver(_resourceFinder,
- location, new HashMap<URI,String>(), true);
+ location, new HashMap<URI,byte[]>(), true);
try {
- Map<URI, byte[]> schemas =
XSUtils.captureSchema(resFrom.toString(), resolver);
InputStream xsdStream = _resourceFinder.openResource(resFrom);
byte[] data;
try {
@@ -225,7 +224,8 @@
} finally {
xsdStream.close();
}
- schemas.put(resFrom, data);
+
+ Map<URI, byte[]> schemas = XSUtils.captureSchema(resFrom, data,
resolver);
_wsdlRegistry.addSchemas(schemas);
} catch (XsdException e) {
CompilationException ce = new
CompilationException(__cmsgs.errInvalidImport(location.toString()));
Modified:
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/DefaultResourceFinder.java
URL:
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/DefaultResourceFinder.java?rev=884500&r1=884499&r2=884500&view=diff
==============================================================================
---
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/DefaultResourceFinder.java
(original)
+++
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/DefaultResourceFinder.java
Thu Nov 26 10:55:17 2009
@@ -59,7 +59,7 @@
checkDir("absoluteDir", absoluteDir);
_relativeDir = relativeDir;
_absoluteDir = absoluteDir;
- }
+ }
private void checkDir(String arg, File dir) {
if (dir == null) {
@@ -71,6 +71,28 @@
}
public InputStream openResource(URI uri) throws MalformedURLException,
IOException {
+ InputStream r = openFileResource(uri);
+ if (r != null) {
+ return r;
+ }
+
+ if (__log.isDebugEnabled()) {
+ __log.debug("trying classpath resource for " + uri);
+ }
+
+ r =
Thread.currentThread().getContextClassLoader().getResourceAsStream(uri.getPath());
+ if (r != null) {
+ return r;
+ } else {
+ if (__log.isDebugEnabled()) {
+ __log.debug("classpath resource not found " + uri);
+ }
+ return null;
+ }
+
+ }
+
+ private InputStream openFileResource(URI uri) throws
MalformedURLException, IOException {
URI absolute = _absoluteDir.toURI();
if (__log.isDebugEnabled()) {
__log.debug("openResource: uri="+uri+"
relativeDir="+_relativeDir+" absoluteDir="+_absoluteDir);
@@ -80,7 +102,7 @@
try {
return uri.toURL().openStream();
} catch (Exception except) {
- __log.fatal("openResource: unable to open file URL " + uri +
"; " + except.toString());
+ __log.debug("openResource: unable to open file URL " + uri +
"; " + except.toString());
return null;
}
}
@@ -88,25 +110,19 @@
// Note that if we get an absolute URI, the relativize operation will
simply
// return the absolute URI.
URI relative = _relativeDir.toURI().relativize(uri);
- if (relative.isAbsolute() && relative.getScheme().equals("classpath"))
{
- InputStream r =
Thread.currentThread().getContextClassLoader().getResourceAsStream(relative.getSchemeSpecificPart());
- if (r == null) {
- __log.error("classpath resource not found " + absolute);
- }
- return r;
- } else {
- if (relative.isAbsolute() &&
!(relative.getScheme().equals("urn"))) {
- __log.fatal("openResource: invalid scheme (should be urn: or
classpath:) " + uri);
- return null;
- }
+ if (relative.isAbsolute() && !(relative.getScheme().equals("urn"))) {
+ __log.fatal("openResource: invalid scheme (should be urn:) " +
uri);
+ return null;
+ }
- File f = new File(absolute.getPath(), relative.getPath());
- if (!f.exists()) {
+ File f = new File(absolute.getPath(), relative.getPath());
+ if (f.exists()) {
+ return new FileInputStream(f);
+ } else {
+ if (__log.isDebugEnabled()) {
__log.debug("fileNotFound: " + f);
- return null;
}
-
- return new FileInputStream(f);
+ return null;
}
}
@@ -114,4 +130,15 @@
return _absoluteDir.toURI();
}
+ public URI resolve(URI parent, URI child) {
+ if (parent.isAbsolute()) {
+ parent = _absoluteDir.toURI().relativize(parent);
+ }
+ URI result = parent.resolve(child);
+ if (__log.isDebugEnabled()) {
+ __log.debug("resolving URI: parent " + parent + " child " + child
+ " result " + result);
+ }
+ return result;
+ }
+
}
Modified:
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ResourceFinder.java
URL:
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ResourceFinder.java?rev=884500&r1=884499&r2=884500&view=diff
==============================================================================
---
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ResourceFinder.java
(original)
+++
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ResourceFinder.java
Thu Nov 26 10:55:17 2009
@@ -40,5 +40,7 @@
InputStream openResource(URI uri) throws MalformedURLException,
IOException;
URI getBaseResourceURI();
+
+ URI resolve(URI parent, URI child);
}
Modified:
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WSDLRegistry.java
URL:
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WSDLRegistry.java?rev=884500&r1=884499&r2=884500&view=diff
==============================================================================
---
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WSDLRegistry.java
(original)
+++
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WSDLRegistry.java
Thu Nov 26 10:55:17 2009
@@ -63,7 +63,7 @@
private final HashMap<String, ArrayList<Definition4BPEL>> _definitions =
new HashMap<String, ArrayList<Definition4BPEL>>();
private final Map<URI, byte[]> _schemas = new HashMap<URI,byte[]>();
- private final Map<URI, String> _internalSchemas = new HashMap<URI,
String>();
+ private final Map<URI, byte[]> _internalSchemas = new HashMap<URI,
byte[]>();
private final Map<URI, Document> _documentSchemas = new HashMap<URI,
Document>();
private SchemaModel _model;
@@ -205,14 +205,14 @@
ExtensibilityElement ee = iter.next();
if (ee instanceof XMLSchemaType) {
- String schema = ((XMLSchemaType)ee).getXMLSchema();
+ byte[] schema = ((XMLSchemaType)ee).getXMLSchema();
WsdlFinderXMLEntityResolver resolver = new
WsdlFinderXMLEntityResolver(rf, defuri, _internalSchemas, false);
try {
Map<URI, byte[]> capture =
XSUtils.captureSchema(defuri, schema, resolver);
_schemas.putAll(capture);
try {
- Document doc = DOMUtils.parse(new InputSource(new
StringReader(schema)));
+ Document doc = DOMUtils.parse(new InputSource(new
ByteArrayInputStream(schema)));
String schemaTargetNS =
doc.getDocumentElement().getAttribute("targetNamespace");
if (schemaTargetNS != null &&
schemaTargetNS.length() > 0) {
_internalSchemas.put(new URI(schemaTargetNS),
schema);
Modified:
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WsdlFinderXMLEntityResolver.java
URL:
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WsdlFinderXMLEntityResolver.java?rev=884500&r1=884499&r2=884500&view=diff
==============================================================================
---
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WsdlFinderXMLEntityResolver.java
(original)
+++
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WsdlFinderXMLEntityResolver.java
Thu Nov 26 10:55:17 2009
@@ -55,7 +55,7 @@
private boolean _failIfNotFound = true;
private ResourceFinder _wsdlFinder;
- private Map<URI, String> _internalSchemas = new HashMap<URI, String>();
+ private Map<URI, byte[]> _internalSchemas = new HashMap<URI, byte[]>();
private URI _baseURI;
/**
@@ -65,7 +65,7 @@
* typically this is the system URI of the WSDL containing
an
* embedded schema
*/
- public WsdlFinderXMLEntityResolver(ResourceFinder finder, URI baseURI,
Map<URI, String> internalSchemas,
+ public WsdlFinderXMLEntityResolver(ResourceFinder finder, URI baseURI,
Map<URI, byte[]> internalSchemas,
boolean failIfNotFound) {
_wsdlFinder = finder;
_baseURI = baseURI;
@@ -87,18 +87,15 @@
if (__log.isDebugEnabled()) __log.debug("resolveEntity: no schema
location for "+resourceIdentifier.getNamespace());
try {
if (_internalSchemas.get(new
URI(resourceIdentifier.getNamespace())) != null) {
- src.setByteStream(new
ByteArrayInputStream(_internalSchemas.get(new
URI(resourceIdentifier.getNamespace())).getBytes()));
+ src.setByteStream(new
ByteArrayInputStream(_internalSchemas.get(new
URI(resourceIdentifier.getNamespace()))));
return src;
}
} catch (URISyntaxException e) {
__log.debug("resolveEntity: no schema location an no known
namespace for: " + resourceIdentifier.getNamespace());
}
return null;
- } else if (resourceIdentifier.getExpandedSystemId() != null) {
- // schema imported by other schema
- location =
_baseURI.resolve(resourceIdentifier.getExpandedSystemId());
} else {
- location =
_baseURI.resolve(resourceIdentifier.getLiteralSystemId());
+ location = _wsdlFinder.resolve(_baseURI,
URI.create(resourceIdentifier.getLiteralSystemId()));
}
if (__log.isDebugEnabled())
@@ -106,7 +103,7 @@
+ " at " + location);
if (_internalSchemas.get(location) != null) {
- src.setByteStream(new
ByteArrayInputStream(_internalSchemas.get(location).getBytes()));
+ src.setByteStream(new
ByteArrayInputStream(_internalSchemas.get(location)));
return src;
}
Modified:
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/wsdl/XMLSchemaType.java
URL:
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/wsdl/XMLSchemaType.java?rev=884500&r1=884499&r2=884500&view=diff
==============================================================================
---
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/wsdl/XMLSchemaType.java
(original)
+++
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/wsdl/XMLSchemaType.java
Thu Nov 26 10:55:17 2009
@@ -38,9 +38,9 @@
/** For compatibility with some older classes. */
public static final QName qname = QNAME;
- private String _xmlSchema;
+ private byte[] _xmlSchema;
- public XMLSchemaType(String xmlSchema) {
+ public XMLSchemaType(byte[] xmlSchema) {
super();
_xmlSchema = xmlSchema;
}
@@ -71,12 +71,7 @@
return Boolean.FALSE;
}
- /**
- * Returns the schema content as string.
- *
- * @return
- */
- public String getXMLSchema() {
+ public byte[] getXMLSchema() {
return _xmlSchema;
}
}
Modified:
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/wsdl/XMLSchemaTypeSerializer.java
URL:
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/wsdl/XMLSchemaTypeSerializer.java?rev=884500&r1=884499&r2=884500&view=diff
==============================================================================
---
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/wsdl/XMLSchemaTypeSerializer.java
(original)
+++
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/wsdl/XMLSchemaTypeSerializer.java
Thu Nov 26 10:55:17 2009
@@ -76,6 +76,6 @@
ExtensionRegistry extensionRegistry)
throws WSDLException {
DOMUtils.pancakeNamespaces(element);
- return new XMLSchemaType(DOMUtils.domToString(element));
+ return new XMLSchemaType(DOMUtils.domToString(element).getBytes());
}
}
Modified:
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/common/src/main/resources/Ping.wsdl
URL:
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/common/src/main/resources/Ping.wsdl?rev=884500&r1=884499&r2=884500&view=diff
==============================================================================
---
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/common/src/main/resources/Ping.wsdl
(original)
+++
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/common/src/main/resources/Ping.wsdl
Thu Nov 26 10:55:17 2009
@@ -25,22 +25,8 @@
xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
- <schema targetNamespace="urn:/Ping.wsdl"
- xmlns="http://www.w3.org/2000/10/XMLSchema">
- <element name="PingRequest">
- <complexType>
- <all>
- <element name="text" type="string"/>
- </all>
- </complexType>
- </element>
- <element name="PingResponse">
- <complexType>
- <all>
- <element name="text" type="string"/>
- </all>
- </complexType>
- </element>
+ <schema xmlns="http://www.w3.org/2001/XMLSchema">
+ <import namespace="urn:/Ping.wsdl"
schemaLocation="Ping.xsd"></import>
</schema>
</types>
Added:
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/common/src/main/resources/Ping.xsd
URL:
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/common/src/main/resources/Ping.xsd?rev=884500&view=auto
==============================================================================
---
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/common/src/main/resources/Ping.xsd
(added)
+++
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/common/src/main/resources/Ping.xsd
Thu Nov 26 10:55:17 2009
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:/Ping.wsdl" xmlns:tns="urn:/Ping.wsdl"
elementFormDefault="qualified">
+ <element name="PingRequest">
+ <complexType>
+ <all>
+ <element name="text" type="string"/>
+ </all>
+ </complexType>
+ </element>
+ <element name="PingResponse">
+ <complexType>
+ <all>
+ <element name="text" type="string"/>
+ </all>
+ </complexType>
+ </element>
+</schema>
Propchange:
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/common/src/main/resources/Ping.xsd
------------------------------------------------------------------------------
svn:eol-style = native
Modified:
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/common/src/main/resources/Pong.wsdl
URL:
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/common/src/main/resources/Pong.wsdl?rev=884500&r1=884499&r2=884500&view=diff
==============================================================================
---
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/common/src/main/resources/Pong.wsdl
(original)
+++
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/common/src/main/resources/Pong.wsdl
Thu Nov 26 10:55:17 2009
@@ -25,22 +25,8 @@
xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
- <schema targetNamespace="urn:/Pong.wsdl"
- xmlns="http://www.w3.org/2000/10/XMLSchema">
- <element name="PongRequest">
- <complexType>
- <all>
- <element name="text" type="string"/>
- </all>
- </complexType>
- </element>
- <element name="PongResponse">
- <complexType>
- <all>
- <element name="text" type="string"/>
- </all>
- </complexType>
- </element>
+ <schema xmlns="http://www.w3.org/2001/XMLSchema">
+ <import namespace="urn:/Pong.wsdl"
schemaLocation="Pong.xsd"></import>
</schema>
</types>
Added:
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/common/src/main/resources/Pong.xsd
URL:
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/common/src/main/resources/Pong.xsd?rev=884500&view=auto
==============================================================================
---
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/common/src/main/resources/Pong.xsd
(added)
+++
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/common/src/main/resources/Pong.xsd
Thu Nov 26 10:55:17 2009
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<schema targetNamespace="urn:/Pong.wsdl"
xmlns="http://www.w3.org/2001/XMLSchema">
+ <element name="PongRequest">
+ <complexType>
+ <all>
+ <element name="text" type="string"/>
+ </all>
+ </complexType>
+ </element>
+ <element name="PongResponse">
+ <complexType>
+ <all>
+ <element name="text" type="string"/>
+ </all>
+ </complexType>
+ </element>
+</schema>
Propchange:
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/common/src/main/resources/Pong.xsd
------------------------------------------------------------------------------
svn:eol-style = native
Added:
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/common/src/main/resources/common.wsdl
URL:
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/common/src/main/resources/common.wsdl?rev=884500&view=auto
==============================================================================
---
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/common/src/main/resources/common.wsdl
(added)
+++
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/common/src/main/resources/common.wsdl
Thu Nov 26 10:55:17 2009
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://www.example.org/common/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="common"
targetNamespace="http://www.example.org/common/">
+ <wsdl:import location="Ping.wsdl" namespace="urn:/Ping.wsdl"/>
+ <wsdl:import location="Pong.wsdl" namespace="urn:/Pong.wsdl"/>
+</wsdl:definitions>
Propchange:
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/common/src/main/resources/common.wsdl
------------------------------------------------------------------------------
svn:eol-style = native
Modified:
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/http-su/pom.xml
URL:
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/http-su/pom.xml?rev=884500&r1=884499&r2=884500&view=diff
==============================================================================
---
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/http-su/pom.xml
(original)
+++
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/http-su/pom.xml
Thu Nov 26 10:55:17 2009
@@ -40,36 +40,4 @@
<properties>
<componentName>servicemix-http</componentName>
</properties>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>unpack</id>
- <phase>generate-resources</phase>
- <goals>
- <goal>unpack</goal>
- </goals>
- <configuration>
- <artifactItems>
- <artifactItem>
- <groupId>${project.groupId}</groupId>
- <artifactId>common</artifactId>
- <version>${project.version}</version>
- <type>jar</type>
- <overWrite>true</overWrite>
-
<outputDirectory>${project.build.directory}/classes</outputDirectory>
- <includes>**/*.*</includes>
- </artifactItem>
- </artifactItems>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
</project>
Modified:
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/ode-su/src/main/resources/Ping.bpel
URL:
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/ode-su/src/main/resources/Ping.bpel?rev=884500&r1=884499&r2=884500&view=diff
==============================================================================
---
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/ode-su/src/main/resources/Ping.bpel
(original)
+++
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/ode-su/src/main/resources/Ping.bpel
Thu Nov 26 10:55:17 2009
@@ -28,12 +28,8 @@
xmlns:fun="java:org.apache.ode.ping.AttachPing"
expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
- <import location="classpath:Ping.wsdl"
- namespace="urn:/Ping.wsdl"
- importType="http://schemas.xmlsoap.org/wsdl/" />
-
- <import location="classpath:Pong.wsdl"
- namespace="urn:/Pong.wsdl"
+ <import location="common.wsdl"
+ namespace="http://www.example.org/common/"
importType="http://schemas.xmlsoap.org/wsdl/" />
<partnerLinks>
Modified:
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/ode-su/src/main/resources/Pong.bpel
URL:
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/ode-su/src/main/resources/Pong.bpel?rev=884500&r1=884499&r2=884500&view=diff
==============================================================================
---
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/ode-su/src/main/resources/Pong.bpel
(original)
+++
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/ode-su/src/main/resources/Pong.bpel
Thu Nov 26 10:55:17 2009
@@ -26,8 +26,8 @@
xmlns:pong="urn:/Pong.wsdl"
expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">
- <import location="classpath:Pong.wsdl"
- namespace="urn:/Pong.wsdl"
+ <import location="common.wsdl"
+ namespace="http://www.example.org/common/"
importType="http://schemas.xmlsoap.org/wsdl/" />
<partnerLinks>
Modified:
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/pom.xml
URL:
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/pom.xml?rev=884500&r1=884499&r2=884500&view=diff
==============================================================================
---
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/pom.xml
(original)
+++
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong/pom.xml
Thu Nov 26 10:55:17 2009
@@ -37,6 +37,11 @@
<version>${jbi-maven-plugin-version}</version>
<extensions>true</extensions>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-eclipse-plugin</artifactId>
+ <version>2.7</version>
+ </plugin>
</plugins>
</build>
Modified:
ode/branches/APACHE_ODE_1.X/utils/src/main/java/org/apache/ode/utils/xsd/XSUtils.java
URL:
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/utils/src/main/java/org/apache/ode/utils/xsd/XSUtils.java?rev=884500&r1=884499&r2=884500&view=diff
==============================================================================
---
ode/branches/APACHE_ODE_1.X/utils/src/main/java/org/apache/ode/utils/xsd/XSUtils.java
(original)
+++
ode/branches/APACHE_ODE_1.X/utils/src/main/java/org/apache/ode/utils/xsd/XSUtils.java
Thu Nov 26 10:55:17 2009
@@ -30,6 +30,7 @@
import org.apache.xerces.xs.XSModel;
import org.w3c.dom.ls.LSInput;
+import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.util.ArrayList;
@@ -47,26 +48,6 @@
private static final XsdMessages __msgs =
MessageBundle.getMessages(XsdMessages.class);
/**
- * Recursively "capture" XSD documents starting at the given URI and
- * using an {...@link XMLEntityResolver} to obtain document streams. The
- * result is a mapping from the XSD URI to a byte array containing the
- * "captured" document stream.
- *
- * @param initialUri URI of the schema
- * @param resolver {...@link XMLEntityResolver} used to obtain XSD
document streams
- *
- * @return mapping between schema URI and the "captured" schema text (in
byte form)
- */
- public static Map<URI, byte[]> captureSchema(String initialUri,
XMLEntityResolver resolver)
- throws XsdException {
- DOMInputImpl input = new DOMInputImpl();
- input.setSystemId(initialUri);
- Map<URI, byte[]> ret = captureSchema(input, resolver);
-
- return ret;
- }
-
- /**
* Capture the schemas supplied by the reader. <code>systemURI</code> is
* required to resolve any relative uris encountered during the parse.
*
@@ -76,25 +57,17 @@
*
* @return
*/
- public static Map<URI, byte[]> captureSchema(URI systemURI, String
schemaData,
+ public static Map<URI, byte[]> captureSchema(URI systemURI, byte[]
schemaData,
XMLEntityResolver resolver)
throws XsdException {
if (__log.isDebugEnabled())
__log.debug("captureSchema(URI,Text,...): systemURI=" + systemURI);
DOMInputImpl input = new DOMInputImpl();
input.setSystemId(systemURI.toString());
- input.setStringData(schemaData);
+ input.setStringData(new String(schemaData));
Map<URI, byte[]> ret = captureSchema(input, resolver);
- // Let's not forget the root schema.
- try {
- // TODO don't assume UTF-8 - but which encoding is required?
- // either we need another parameter or the entire idea of
- // passing in a String needs to be revised.
- ret.put(systemURI, schemaData.getBytes("UTF-8"));
- } catch (UnsupportedEncodingException uenc) {
- throw new RuntimeException(uenc);
- }
+ ret.put(systemURI, schemaData);
return ret;
}
@@ -106,7 +79,7 @@
Map<URI, byte[]> captured = new HashMap<URI, byte[]>();
if (resolver == null) {
- resolver = new DefaultXMLEntityResolver();
+ throw new IllegalStateException("no resolver set");
}
CapturingXMLEntityResolver cr = new
CapturingXMLEntityResolver(captured, resolver);
Modified:
ode/branches/APACHE_ODE_1.X/utils/src/test/java/org/apache/ode/utils/xsd/SchemaCaptureTest.java
URL:
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/utils/src/test/java/org/apache/ode/utils/xsd/SchemaCaptureTest.java?rev=884500&r1=884499&r2=884500&view=diff
==============================================================================
---
ode/branches/APACHE_ODE_1.X/utils/src/test/java/org/apache/ode/utils/xsd/SchemaCaptureTest.java
(original)
+++
ode/branches/APACHE_ODE_1.X/utils/src/test/java/org/apache/ode/utils/xsd/SchemaCaptureTest.java
Thu Nov 26 10:55:17 2009
@@ -18,8 +18,18 @@
*/
package org.apache.ode.utils.xsd;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ode.utils.StreamUtils;
import org.apache.ode.utils.TestResources;
-
+import org.apache.xerces.xni.XMLResourceIdentifier;
+import org.apache.xerces.xni.XNIException;
+import org.apache.xerces.xni.parser.XMLEntityResolver;
+import org.apache.xerces.xni.parser.XMLInputSource;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
import java.net.URI;
import java.util.Map;
@@ -29,13 +39,33 @@
* Test schema capture functionality.
*/
public class SchemaCaptureTest extends TestCase {
+ private static Log __log = LogFactory.getLog(SchemaCaptureTest.class);
public void testSchemaCapture() throws Exception {
- System.out.println("GETTING RESOURCE " +
TestResources.getRetailerSchema());
- String initialURI = TestResources.getRetailerSchema().toExternalForm();
- Map<URI, byte[]> s = XSUtils.captureSchema(initialURI, new
DefaultXMLEntityResolver());
+ __log.debug("GETTING RESOURCE " + TestResources.getRetailerSchema());
+ InputStream xsdStream = new
FileInputStream(TestResources.getRetailerSchema().getFile());
+ byte[] data;
+ try {
+ data = StreamUtils.read(xsdStream);
+ } finally {
+ xsdStream.close();
+ }
+
+ Map<URI, byte[]> s = XSUtils.captureSchema(URI.create("schema.xsd"), data,
new XMLEntityResolver() {
+ public XMLInputSource resolveEntity(XMLResourceIdentifier
resourceIdentifier) throws XNIException, IOException {
+ XMLInputSource src = new XMLInputSource(resourceIdentifier);
+ String literalUri = resourceIdentifier.getLiteralSystemId();
+
+ if (literalUri != null) {
+
src.setByteStream(getClass().getClassLoader().getResourceAsStream(literalUri));
+ }
+
+ return src;
+ }
+ });
// we expect the root schema and three includes
- assertEquals(4, s.size());
+ __log.debug("loaded " + s.keySet());
+ assertEquals(5, s.size());
}
}
Added: ode/branches/APACHE_ODE_1.X/utils/src/test/resources/log4j.properties
URL:
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/utils/src/test/resources/log4j.properties?rev=884500&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.X/utils/src/test/resources/log4j.properties
(added)
+++ ode/branches/APACHE_ODE_1.X/utils/src/test/resources/log4j.properties Thu
Nov 26 10:55:17 2009
@@ -0,0 +1,34 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Set root logger level to WARN and its only appender to CONSOLE
+log4j.rootLogger=WARN, FILE
+
+# log4j properties to work with commandline tools.
+log4j.category.org.apache.ode=DEBUG
+
+# Console appender
+#log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+#log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+#log4j.appender.CONSOLE.layout.ConversionPattern=%p - %C{1}.%M(%L) | %m%n
+
+log4j.appender.FILE=org.apache.log4j.FileAppender
+log4j.appender.FILE.File=target/test.log
+log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.conversionpattern=%d{mm...@hh:mm:ss} %-5p (%13F:%L)
%3x - %m%n
+log4j.appender.FILE.append=false
+
Propchange:
ode/branches/APACHE_ODE_1.X/utils/src/test/resources/log4j.properties
------------------------------------------------------------------------------
svn:eol-style = native