You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2007/10/29 17:13:01 UTC
svn commit: r589710 - in /incubator/cxf/branches/2.0.x-fixes: ./
rt/core/src/main/java/org/apache/cxf/wsdl11/
tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/
tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/
tools/wsdlto/da...
Author: dkulp
Date: Mon Oct 29 09:12:59 2007
New Revision: 589710
URL: http://svn.apache.org/viewvc?rev=589710&view=rev
Log:
Merged revisions 589462 via svnmerge from
https://svn.apache.org/repos/asf/incubator/cxf/trunk
........
r589462 | ema | 2007-10-28 21:26:48 -0400 (Sun, 28 Oct 2007) | 1 line
Fixed issue CXF-1141
........
Added:
incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1141/
- copied from r589462, incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1141/
incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1141/jaxb.xml
- copied unchanged from r589462, incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1141/jaxb.xml
incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1141/jaxws.xml
- copied unchanged from r589462, incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1141/jaxws.xml
Modified:
incubator/cxf/branches/2.0.x-fixes/ (props changed)
incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/AbstractWSDLBuilder.java
incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java
incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/CustomizedWSDLLocator.java
incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java
incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/InvoiceServer.wsdl
Propchange: incubator/cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java?rev=589710&r1=589709&r2=589710&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java Mon Oct 29 09:12:59 2007
@@ -109,6 +109,7 @@
private static final Logger LOG = LogUtils.getL7dLogger(WSDLServiceBuilder.class);
private Bus bus;
private Map<String, Element> schemaList = new HashMap<String, Element>();
+ private Map<String, String> catalogResolvedMap;
public WSDLServiceBuilder(Bus bus) {
this.bus = bus;
@@ -357,14 +358,14 @@
Object obj = ite.next();
if (obj instanceof Schema) {
Schema schema = (Schema)obj;
- addSchema(schema);
+ addSchema(schema.getDocumentBaseURI(), schema);
}
}
}
}
- private void addSchema(Schema schema) {
- String docBaseURI = schema.getDocumentBaseURI();
+ private void addSchema(String docBaseURI, Schema schema) {
+ //String docBaseURI = schema.getDocumentBaseURI();
Element schemaEle = schema.getElement();
if (schemaList.get(docBaseURI) == null) {
schemaList.put(docBaseURI, schemaEle);
@@ -384,16 +385,21 @@
for (String importNamespace : importKeys) {
List<SchemaImport> schemaImports = CastUtils.cast(imports.get(importNamespace));
-
+
for (SchemaImport schemaImport : schemaImports) {
- Schema tempImport = schemaImport.getReferencedSchema();
- if (importNamespace == null) {
+ Schema tempImport = schemaImport.getReferencedSchema();
+ String key = schemaImport.getSchemaLocationURI();
+ if (importNamespace == null && tempImport != null) {
importNamespace = tempImport.getDocumentBaseURI();
}
+ if ((catalogResolvedMap == null || !catalogResolvedMap.containsKey(key))
+ && tempImport != null) {
+ key = tempImport.getDocumentBaseURI();
+ }
if (tempImport != null
- && !isSchemaParsed(tempImport.getDocumentBaseURI(), importNamespace)
+ && !isSchemaParsed(key, importNamespace)
&& !schemaList.containsValue(tempImport.getElement())) {
- addSchema(tempImport);
+ addSchema(key, tempImport);
}
}
@@ -797,6 +803,10 @@
pi.setXmlSchema(schemas.getElementByQName(part.getElementName()));
}
}
+ }
+
+ public void setCatalogResolvedMap(Map<String, String> resolvedMap) {
+ catalogResolvedMap = resolvedMap;
}
}
Modified: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java?rev=589710&r1=589709&r2=589710&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java Mon Oct 29 09:12:59 2007
@@ -102,7 +102,7 @@
Bus bus = BusFactory.getDefaultBus();
OASISCatalogManager catalogManager = bus.getExtension(OASISCatalogManager.class);
-
+
String catalogLocation = getCatalogURL();
if (!StringUtils.isEmpty(catalogLocation)) {
try {
@@ -147,7 +147,7 @@
.getWSDLBuilder();
builder.setContext(context);
builder.setBus(getBus());
-
+ context.put(Bus.class, getBus());
builder.build(URIParserUtil.getAbsoluteURI(wsdlURL));
builder.customize();
Definition definition = builder.getWSDLModel();
@@ -158,7 +158,7 @@
}
WSDLServiceBuilder serviceBuilder = new WSDLServiceBuilder(getBus());
-
+ serviceBuilder.setCatalogResolvedMap(builder.getCataLogResovedMap());
String serviceName = (String)context.get(ToolConstants.CFG_SERVICENAME);
if (serviceName != null) {
Modified: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/AbstractWSDLBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/AbstractWSDLBuilder.java?rev=589710&r1=589709&r2=589710&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/AbstractWSDLBuilder.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/AbstractWSDLBuilder.java Mon Oct 29 09:12:59 2007
@@ -19,6 +19,8 @@
package org.apache.cxf.tools.wsdlto.core;
+import java.util.Map;
+
import org.apache.cxf.Bus;
import org.apache.cxf.tools.common.ToolContext;
import org.apache.cxf.tools.common.ToolException;
@@ -41,4 +43,6 @@
public abstract boolean validate(T t) throws ToolException;
public abstract T getWSDLModel();
+
+ public abstract Map<String, String> getCataLogResovedMap();
}
Modified: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java?rev=589710&r1=589709&r2=589710&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java Mon Oct 29 09:12:59 2007
@@ -17,7 +17,6 @@
* under the License.
*/
package org.apache.cxf.tools.wsdlto.databinding.jaxb;
-
import java.io.File;
import java.io.IOException;
import java.io.Writer;
@@ -39,6 +38,7 @@
import javax.xml.transform.dom.DOMSource;
import javax.xml.validation.SchemaFactory;
+
import org.w3c.dom.DOMException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -65,6 +65,7 @@
import com.sun.tools.xjc.api.XJC;
import com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl;
+
import org.apache.cxf.common.i18n.Message;
import org.apache.cxf.common.logging.LogUtils;
import org.apache.cxf.common.util.StringUtils;
@@ -80,6 +81,8 @@
import org.apache.cxf.tools.wsdlto.core.DefaultValueProvider;
import org.apache.cxf.tools.wsdlto.core.RandomValueProvider;
+
+
public class JAXBDataBinding implements DataBindingProfile {
private static final Logger LOG = LogUtils.getL7dLogger(JAXBDataBinding.class);
@@ -146,7 +149,7 @@
}
if (context.get(ToolConstants.CFG_VALIDATE_WSDL) != null) {
validateSchema(ele);
- }
+ }
schemaCompiler.parseSchema(key, ele);
}
@@ -155,11 +158,7 @@
schemaCompiler.parseSchema(binding);
}
- /*if (context.getPackageName() != null) {
- schemaCompiler.forcePackageName(context.getPackageName());
- } else {*/
-
-
+
Map<String, String> nsPkgMap = context.getNamespacePackageMap();
for (String ns : nsPkgMap.keySet()) {
File file = JAXBUtils.getPackageMappingSchemaBindingFile(ns, context.mapPackageName(ns));
Modified: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java?rev=589710&r1=589709&r2=589710&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java Mon Oct 29 09:12:59 2007
@@ -409,7 +409,18 @@
} else if (isValidJaxbBindingFile(reader)) {
String schemaLocation = root.getAttribute("schemaLocation");
- if (StringUtils.isEmpty(schemaLocation)) {
+ boolean hasJaxbBindingChild = false;
+ NodeList nlist = root.getElementsByTagNameNS(ToolConstants.JAXB_BINDINGS.getNamespaceURI(),
+ ToolConstants.JAXB_BINDINGS.getLocalPart());
+ for (int i = 0; i < nlist.getLength(); i++) {
+ Node node = nlist.item(i);
+ if (node instanceof Element) {
+ hasJaxbBindingChild = true;
+ break;
+ }
+ }
+
+ if (StringUtils.isEmpty(schemaLocation) && !hasJaxbBindingChild) {
InputSource tmpIns = null;
try {
tmpIns = convertToTmpInputSource(root, wsdlURL);
@@ -419,30 +430,7 @@
}
jaxbBindings.add(tmpIns);
} else {
- String schemeURI = this.getAbsoluteURI(schemaLocation, bindingFile);
- Element ele = getTargetNode(schemeURI);
- if (ele != null) {
- jaxbBindings.add(is);
- } else {
- // try to resolve it with CatalogReslover
- String resolvedLocation = null;
- if (env.get(ToolConstants.CFG_CATALOG) != null) {
- resolvedLocation = resolveByCatalog(schemaLocation);
- }
- if (resolvedLocation == null) {
- Message msg = new Message("POINT_TO_XSD_DOES_NOT_EXIST", LOG, schemaLocation);
- throw new ToolException(msg);
- } else {
- InputSource tmpIns = null;
- try {
- tmpIns = convertToTmpInputSource(root, resolvedLocation);
- } catch (Exception e1) {
- Message msg = new Message("FAILED_TO_ADD_SCHEMALOCATION", LOG, bindingFile);
- throw new ToolException(msg, e1);
- }
- jaxbBindings.add(tmpIns);
- }
- }
+ jaxbBindings.add(is);
}
} else {
Modified: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/CustomizedWSDLLocator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/CustomizedWSDLLocator.java?rev=589710&r1=589709&r2=589710&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/CustomizedWSDLLocator.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/CustomizedWSDLLocator.java Mon Oct 29 09:12:59 2007
@@ -21,6 +21,7 @@
import java.io.StringReader;
import java.net.URI;
import java.net.URISyntaxException;
+import java.util.HashMap;
import java.util.Map;
import org.w3c.dom.Element;
@@ -42,6 +43,7 @@
private Map<String, Element> elementMap;
private String latestImportURI;
+ private Map<String, String> resolvedMap = new HashMap<String, String>();
private boolean resolveFromMap;
public CustomizedWSDLLocator(String wsdlUrl, Map<String, Element> map) {
@@ -71,6 +73,7 @@
if (resolvedLocation == null) {
return this.resolver.resolve(target, base);
} else {
+ resolvedMap.put(target, resolvedLocation);
return this.resolver.resolve(resolvedLocation, base);
}
} catch (Exception e) {
@@ -130,6 +133,10 @@
}
public void close() {
resolver.close();
+ }
+
+ public Map<String, String> getResolvedMap() {
+ return resolvedMap;
}
}
Modified: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java?rev=589710&r1=589709&r2=589710&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java Mon Oct 29 09:12:59 2007
@@ -20,6 +20,7 @@
package org.apache.cxf.tools.wsdlto.frontend.jaxws.wsdl11;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -68,6 +69,7 @@
private List<InputSource> jaxbBindings;
private Element handlerChain;
+ private Map<String, String> cataLogResovedMap = new HashMap<String, String>();
public JAXWSDefinitionBuilder() {
builder = new WSDLDefinitionBuilder();
@@ -173,7 +175,9 @@
String wsdlUrl = URIParserUtil.getAbsoluteURI((String)context.get(ToolConstants.CFG_WSDLURL));
CustomizedWSDLLocator wsdlLocator = new CustomizedWSDLLocator(wsdlUrl, eleMap);
wsdlLocator.setCatalogResolver(OASISCatalogManager.getCatalogManager(bus).getCatalog());
- return wsdlReader.readWSDL(wsdlLocator);
+ Definition def = wsdlReader.readWSDL(wsdlLocator);
+ cataLogResovedMap.putAll(wsdlLocator.getResolvedMap());
+ return def;
}
@@ -192,5 +196,10 @@
public boolean validate(Definition def) throws ToolException {
return new WSDL11Validator(def, context).isValid();
+ }
+
+
+ public Map<String, String> getCataLogResovedMap() {
+ return this.cataLogResovedMap;
}
}
Modified: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java?rev=589710&r1=589709&r2=589710&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java Mon Oct 29 09:12:59 2007
@@ -40,6 +40,7 @@
import org.apache.cxf.tools.wsdlto.frontend.jaxws.validator.UniqueBodyValidator;
import org.junit.After;
import org.junit.Before;
+
import org.junit.Test;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.handler.ResourceHandler;
@@ -816,13 +817,14 @@
@Test
- public void testCatalog() throws Exception {
- env.put(ToolConstants.CFG_WSDLURL,
- getLocation("/wsdl2java_wsdl/cxf1112/myservice.wsdl"));
+ public void testJaxbCatalog() throws Exception {
+ env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/cxf1112/myservice.wsdl"));
env.put(ToolConstants.CFG_CATALOG, getLocation("/wsdl2java_wsdl/cxf1112/catalog.xml"));
env.put(ToolConstants.CFG_BINDING, getLocation("/wsdl2java_wsdl/cxf1112/jaxbbinding.xml"));
processor.setContext(env);
processor.execute();
+ Class clz = classLoader.loadClass("org.mytest.ObjectFactory");
+ assertNotNull("Customization types class should be generated", clz);
}
@@ -843,6 +845,25 @@
processor.setContext(env);
processor.execute();
}
+
+ @Test
+ public void testServer() throws Exception {
+ env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/InvoiceServer.wsdl"));
+ env.put(ToolConstants.CFG_BINDING, new String[] {getLocation("/wsdl2java_wsdl/cxf1141/jaxws.xml"),
+ getLocation("/wsdl2java_wsdl/cxf1141/jaxb.xml")});
+ processor.setContext(env);
+ processor.execute();
+
+ File file = new File(output, "org/mytest");
+ assertEquals(13, file.list().length);
+
+ }
+
+
+
+
+
+
}
Modified: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/InvoiceServer.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/InvoiceServer.wsdl?rev=589710&r1=589709&r2=589710&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/InvoiceServer.wsdl (original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/InvoiceServer.wsdl Mon Oct 29 09:12:59 2007
@@ -17,8 +17,6 @@
specific language governing permissions and limitations
under the License.
-->
-<!--WSDL file template-->
-<!--(c) 2005, IONA Technologies, Inc.-->
<definitions name="InvoiceServer.wsdl"
targetNamespace="http://apache.org/InvoiceServer"
xmlns="http://schemas.xmlsoap.org/wsdl/"