You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by bi...@apache.org on 2007/11/12 18:23:54 UTC
svn commit: r594221 - in /incubator/cxf/trunk:
api/src/main/java/org/apache/cxf/service/model/
api/src/main/java/org/apache/cxf/wsdl/
rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/
rt/core/src/main/java/org/apache/cxf/databinding/source/ r...
Author: bimargulies
Date: Mon Nov 12 09:23:50 2007
New Revision: 594221
URL: http://svn.apache.org/viewvc?rev=594221&view=rev
Log:
First piece of making it harder to create invalid XML Schema models. Wrap
XmlSchemaCollection in our own class.
Modified:
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceInfo.java
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java
incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/AbstractDataBinding.java
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/SchemaUtil.java
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLServiceBuilderTest.java
incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
incubator/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/XmlBeansDataBinding.java
incubator/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/XmlBeansSchemaInitializer.java
incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptUtils.java
incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/XmlSchemaUtils.java
incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java
incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/ValidatorUtil.java
incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java
incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtil.java
Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceInfo.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceInfo.java?rev=594221&r1=594220&r2=594221&view=diff
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceInfo.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceInfo.java Mon Nov 12 09:23:50 2007
@@ -27,7 +27,8 @@
import java.util.concurrent.ConcurrentHashMap;
import javax.xml.namespace.QName;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
+
+import org.apache.cxf.common.xmlschema.SchemaCollection;
public class ServiceInfo extends AbstractDescriptionElement {
QName name;
@@ -37,10 +38,10 @@
Map<QName, EndpointInfo> endpoints = new ConcurrentHashMap<QName, EndpointInfo>(2);
Map<QName, MessageInfo> messages;
List<SchemaInfo> schemas = new ArrayList<SchemaInfo>(4);
- private XmlSchemaCollection xmlSchemaCollection;
+ private SchemaCollection xmlSchemaCollection;
public ServiceInfo() {
- xmlSchemaCollection = new XmlSchemaCollection();
+ xmlSchemaCollection = new SchemaCollection();
}
public String getTargetNamespace() {
@@ -141,7 +142,7 @@
return Collections.unmodifiableCollection(schemas);
}
- public XmlSchemaCollection getXmlSchemaCollection() {
+ public SchemaCollection getXmlSchemaCollection() {
return xmlSchemaCollection;
}
}
Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java?rev=594221&r1=594220&r2=594221&view=diff
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java Mon Nov 12 09:23:50 2007
@@ -58,6 +58,7 @@
import org.apache.cxf.common.i18n.Message;
import org.apache.cxf.common.logging.LogUtils;
import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.common.xmlschema.SchemaCollection;
import org.apache.cxf.endpoint.EndpointResolverRegistry;
import org.apache.cxf.endpoint.Server;
import org.apache.cxf.endpoint.ServerRegistry;
@@ -72,8 +73,6 @@
import org.apache.cxf.ws.addressing.wsdl.AttributedQNameType;
import org.apache.cxf.ws.addressing.wsdl.ServiceNameType;
import org.apache.ws.commons.schema.XmlSchema;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
-
/**
* Provides utility methods for obtaining endpoint references, wsdl definitions, etc.
@@ -448,7 +447,7 @@
SchemaFactory factory = SchemaFactory.newInstance(
XMLConstants.W3C_XML_SCHEMA_NS_URI);
List<Source> schemaSources = new ArrayList<Source>();
- final XmlSchemaCollection sc = serviceInfo.getXmlSchemaCollection();
+ final SchemaCollection sc = serviceInfo.getXmlSchemaCollection();
for (SchemaInfo schemaInfo : serviceInfo.getSchemas()) {
Source source = new DOMSource(schemaInfo.getElement());
if (source != null) {
Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java?rev=594221&r1=594220&r2=594221&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java (original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java Mon Nov 12 09:23:50 2007
@@ -58,6 +58,7 @@
import org.apache.cxf.binding.soap.model.SoapHeaderInfo;
import org.apache.cxf.binding.soap.model.SoapOperationInfo;
import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.common.xmlschema.SchemaCollection;
import org.apache.cxf.endpoint.Endpoint;
import org.apache.cxf.interceptor.AttachmentInInterceptor;
import org.apache.cxf.interceptor.AttachmentOutInterceptor;
@@ -89,7 +90,6 @@
import org.apache.cxf.wsdl.WSDLConstants;
import org.apache.cxf.wsdl.WSDLManager;
import org.apache.cxf.wsdl11.WSDLServiceBuilder;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
import static org.apache.cxf.helpers.CastUtils.cast;
@@ -389,7 +389,7 @@
if (header != null && serviceInfo.getMessage(header.getMessage()) == null) {
Definition def = (Definition)serviceInfo.getProperty(WSDLServiceBuilder.WSDL_DEFINITION);
- XmlSchemaCollection schemas = serviceInfo.getXmlSchemaCollection();
+ SchemaCollection schemas = serviceInfo.getXmlSchemaCollection();
if (def != null && schemas != null) {
javax.wsdl.Message msg = def.getMessage(header.getMessage());
@@ -397,14 +397,14 @@
addOutOfBandParts(bop, msg, schemas, isInput);
serviceInfo.refresh();
} else {
- //TODO: The header message is not defined in this wsdl, what to do
+ throw new RuntimeException("Header message not defined in service model.");
}
}
}
}
private void addOutOfBandParts(final BindingOperationInfo bop, final javax.wsdl.Message msg,
- final XmlSchemaCollection schemas, boolean isInput) {
+ final SchemaCollection schemas, boolean isInput) {
MessageInfo minfo = null;
if (isInput) {
minfo = bop.getOperationInfo().getInput();
@@ -435,7 +435,7 @@
}
private void buildMessage(MessageInfo minfo, javax.wsdl.Message msg,
- XmlSchemaCollection schemas) {
+ SchemaCollection schemas) {
for (Part part : cast(msg.getParts().values(), Part.class)) {
MessagePartInfo pi = minfo.addMessagePart(new QName(minfo.getName().getNamespaceURI(), part
.getName()));
Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/AbstractDataBinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/AbstractDataBinding.java?rev=594221&r1=594220&r2=594221&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/AbstractDataBinding.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/AbstractDataBinding.java Mon Nov 12 09:23:50 2007
@@ -30,10 +30,10 @@
import org.apache.cxf.common.util.FixedExtensionDeserializer;
import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.common.xmlschema.SchemaCollection;
import org.apache.cxf.service.model.SchemaInfo;
import org.apache.cxf.service.model.ServiceInfo;
import org.apache.ws.commons.schema.XmlSchema;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
public class AbstractDataBinding {
private Collection<DOMSource> schemas;
@@ -45,23 +45,20 @@
public void setSchemas(Collection<DOMSource> schemas) {
this.schemas = schemas;
}
-
- protected XmlSchema addSchemaDocument(ServiceInfo serviceInfo,
- XmlSchemaCollection col,
- Document d,
- String systemId) {
+ protected XmlSchema addSchemaDocument(ServiceInfo serviceInfo, SchemaCollection col, Document d,
+ String systemId) {
String ns = d.getDocumentElement().getAttribute("targetNamespace");
if (StringUtils.isEmpty(ns)) {
ns = serviceInfo.getInterface().getName().getNamespaceURI();
d.getDocumentElement().setAttribute("targetNamespace", ns);
}
-
+
NodeList nodes = d.getDocumentElement().getChildNodes();
for (int i = 0; i < nodes.getLength(); i++) {
Node n = nodes.item(i);
if (n instanceof Element) {
- Element e = (Element) n;
+ Element e = (Element)n;
if (e.getLocalName().equals("import")) {
e.removeAttribute("schemaLocation");
}
Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/SchemaUtil.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/SchemaUtil.java?rev=594221&r1=594220&r2=594221&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/SchemaUtil.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/SchemaUtil.java Mon Nov 12 09:23:50 2007
@@ -1,205 +1,205 @@
-/**
- * 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.
- */
-
-package org.apache.cxf.wsdl11;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import javax.wsdl.Definition;
-import javax.wsdl.Import;
-import javax.wsdl.Types;
-import javax.wsdl.extensions.UnknownExtensibilityElement;
-import javax.wsdl.extensions.schema.Schema;
-import javax.wsdl.extensions.schema.SchemaImport;
-
-import org.w3c.dom.Element;
-
-import org.apache.cxf.Bus;
-import org.apache.cxf.catalog.CatalogXmlSchemaURIResolver;
-import org.apache.cxf.catalog.OASISCatalogManager;
-import org.apache.cxf.common.util.FixedExtensionDeserializer;
-import org.apache.cxf.helpers.CastUtils;
-import org.apache.cxf.service.model.SchemaInfo;
-import org.apache.cxf.service.model.ServiceInfo;
-import org.apache.ws.commons.schema.XmlSchema;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
-
-import static org.apache.cxf.helpers.CastUtils.cast;
-
-public final class SchemaUtil {
- private final Map<String, Element> schemaList;
- private final Bus bus;
- private Map<String, String> catalogResolvedMap;
-
-
- public SchemaUtil(final Bus b, final Map<String, Element> s) {
- this.bus = b;
- this.schemaList = s;
- }
-
- public void getSchemas(final Definition def, final ServiceInfo serviceInfo) {
- XmlSchemaCollection schemaCol = serviceInfo.getXmlSchemaCollection();
- schemaCol.getExtReg().setDefaultExtensionDeserializer(
- new FixedExtensionDeserializer());
-
- List<Definition> defList = new ArrayList<Definition>();
- parseImports(def, defList);
- extractSchema(def, schemaCol, serviceInfo);
- // added
- getSchemaList(def);
- for (Definition def2 : defList) {
- extractSchema(def2, schemaCol, serviceInfo);
- // added
- getSchemaList(def2);
- }
- }
-
- private void extractSchema(Definition def, XmlSchemaCollection schemaCol, ServiceInfo serviceInfo) {
- Types typesElement = def.getTypes();
- if (typesElement != null) {
- int schemaCount = 1;
- for (Object obj : typesElement.getExtensibilityElements()) {
- org.w3c.dom.Element schemaElem = null;
- if (obj instanceof Schema) {
- Schema schema = (Schema)obj;
- schemaElem = schema.getElement();
- } else if (obj instanceof UnknownExtensibilityElement) {
- org.w3c.dom.Element elem = ((UnknownExtensibilityElement)obj).getElement();
- if (elem.getLocalName().equals("schema")) {
- schemaElem = elem;
- }
- }
- if (schemaElem != null) {
- for (Object prefix : def.getNamespaces().keySet()) {
- String ns = (String)def.getNamespaces().get(prefix);
- if (!"".equals(prefix) && !schemaElem.hasAttribute("xmlns:" + prefix)) {
- schemaElem.setAttributeNS(javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI,
- "xmlns:" + prefix, ns);
- }
- }
- String systemId = def.getDocumentBaseURI() + "#types" + schemaCount;
-
- schemaCol.setBaseUri(def.getDocumentBaseURI());
- CatalogXmlSchemaURIResolver schemaResolver =
- new CatalogXmlSchemaURIResolver(OASISCatalogManager.getCatalogManager(bus));
- schemaCol.setSchemaResolver(schemaResolver);
-
- XmlSchema xmlSchema = schemaCol.read(schemaElem, systemId);
- SchemaInfo schemaInfo = new SchemaInfo(serviceInfo, xmlSchema.getTargetNamespace());
- schemaInfo.setElement(schemaElem);
- schemaInfo.setSchema(xmlSchema);
- schemaInfo.setSystemId(systemId);
- serviceInfo.addSchema(schemaInfo);
- schemaCount++;
- }
- }
- }
- }
-
- private void parseImports(Definition def, List<Definition> defList) {
- List<Import> importList = new ArrayList<Import>();
-
- Collection<List<Import>> ilist = cast(def.getImports().values());
- for (List<Import> list : ilist) {
- importList.addAll(list);
- }
- for (Import impt : importList) {
- if (!defList.contains(impt.getDefinition())) {
- defList.add(impt.getDefinition());
- parseImports(impt.getDefinition(), defList);
- }
- }
- }
-
- // Workaround for getting the elements
- private void getSchemaList(Definition def) {
- Types typesElement = def.getTypes();
- if (typesElement != null) {
- Iterator ite = typesElement.getExtensibilityElements().iterator();
- while (ite.hasNext()) {
- Object obj = ite.next();
- if (obj instanceof Schema) {
- Schema schema = (Schema)obj;
- addSchema(schema.getDocumentBaseURI(), schema);
- }
- }
- }
- }
-
- private void addSchema(String docBaseURI, Schema schema) {
- //String docBaseURI = schema.getDocumentBaseURI();
- Element schemaEle = schema.getElement();
- if (schemaList.get(docBaseURI) == null) {
- schemaList.put(docBaseURI, schemaEle);
- } else if (schemaList.get(docBaseURI) != null && schemaList.containsValue(schemaEle)) {
- // do nothing
- } else {
- String tns = schema.getDocumentBaseURI() + "#"
- + schema.getElement().getAttribute("targetNamespace");
- if (schemaList.get(tns) == null) {
- schemaList.put(tns, schema.getElement());
- }
- }
-
- Map<String, List> imports = CastUtils.cast(schema.getImports());
- if (imports != null && imports.size() > 0) {
- Collection<String> importKeys = imports.keySet();
- for (String importNamespace : importKeys) {
-
- List<SchemaImport> schemaImports = CastUtils.cast(imports.get(importNamespace));
-
- for (SchemaImport schemaImport : schemaImports) {
- 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(key, importNamespace)
- && !schemaList.containsValue(tempImport.getElement())) {
- addSchema(key, tempImport);
- }
- }
-
- }
- }
- }
-
- private boolean isSchemaParsed(String baseUri, String ns) {
- if (schemaList.get(baseUri) != null) {
- Element ele = schemaList.get(baseUri);
- String tns = ele.getAttribute("targetNamespace");
- if (ns.equals(tns)) {
- return true;
- }
- }
- return false;
- }
-
- public void setCatalogResolvedMap(Map<String, String> resolvedMap) {
- catalogResolvedMap = resolvedMap;
- }
-}
+/**
+ * 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.
+ */
+
+package org.apache.cxf.wsdl11;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import javax.wsdl.Definition;
+import javax.wsdl.Import;
+import javax.wsdl.Types;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+import javax.wsdl.extensions.schema.Schema;
+import javax.wsdl.extensions.schema.SchemaImport;
+
+import org.w3c.dom.Element;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.catalog.CatalogXmlSchemaURIResolver;
+import org.apache.cxf.catalog.OASISCatalogManager;
+import org.apache.cxf.common.util.FixedExtensionDeserializer;
+import org.apache.cxf.common.xmlschema.SchemaCollection;
+import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.service.model.SchemaInfo;
+import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.ws.commons.schema.XmlSchema;
+
+import static org.apache.cxf.helpers.CastUtils.cast;
+
+public final class SchemaUtil {
+ private final Map<String, Element> schemaList;
+ private final Bus bus;
+ private Map<String, String> catalogResolvedMap;
+
+
+ public SchemaUtil(final Bus b, final Map<String, Element> s) {
+ this.bus = b;
+ this.schemaList = s;
+ }
+
+ public void getSchemas(final Definition def, final ServiceInfo serviceInfo) {
+ SchemaCollection schemaCol = serviceInfo.getXmlSchemaCollection();
+ schemaCol.getExtReg().setDefaultExtensionDeserializer(
+ new FixedExtensionDeserializer());
+
+ List<Definition> defList = new ArrayList<Definition>();
+ parseImports(def, defList);
+ extractSchema(def, schemaCol, serviceInfo);
+ // added
+ getSchemaList(def);
+ for (Definition def2 : defList) {
+ extractSchema(def2, schemaCol, serviceInfo);
+ // added
+ getSchemaList(def2);
+ }
+ }
+
+ private void extractSchema(Definition def, SchemaCollection schemaCol, ServiceInfo serviceInfo) {
+ Types typesElement = def.getTypes();
+ if (typesElement != null) {
+ int schemaCount = 1;
+ for (Object obj : typesElement.getExtensibilityElements()) {
+ org.w3c.dom.Element schemaElem = null;
+ if (obj instanceof Schema) {
+ Schema schema = (Schema)obj;
+ schemaElem = schema.getElement();
+ } else if (obj instanceof UnknownExtensibilityElement) {
+ org.w3c.dom.Element elem = ((UnknownExtensibilityElement)obj).getElement();
+ if (elem.getLocalName().equals("schema")) {
+ schemaElem = elem;
+ }
+ }
+ if (schemaElem != null) {
+ for (Object prefix : def.getNamespaces().keySet()) {
+ String ns = (String)def.getNamespaces().get(prefix);
+ if (!"".equals(prefix) && !schemaElem.hasAttribute("xmlns:" + prefix)) {
+ schemaElem.setAttributeNS(javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI,
+ "xmlns:" + prefix, ns);
+ }
+ }
+ String systemId = def.getDocumentBaseURI() + "#types" + schemaCount;
+
+ schemaCol.setBaseUri(def.getDocumentBaseURI());
+ CatalogXmlSchemaURIResolver schemaResolver =
+ new CatalogXmlSchemaURIResolver(OASISCatalogManager.getCatalogManager(bus));
+ schemaCol.setSchemaResolver(schemaResolver);
+
+ XmlSchema xmlSchema = schemaCol.read(schemaElem, systemId);
+ SchemaInfo schemaInfo = new SchemaInfo(serviceInfo, xmlSchema.getTargetNamespace());
+ schemaInfo.setElement(schemaElem);
+ schemaInfo.setSchema(xmlSchema);
+ schemaInfo.setSystemId(systemId);
+ serviceInfo.addSchema(schemaInfo);
+ schemaCount++;
+ }
+ }
+ }
+ }
+
+ private void parseImports(Definition def, List<Definition> defList) {
+ List<Import> importList = new ArrayList<Import>();
+
+ Collection<List<Import>> ilist = cast(def.getImports().values());
+ for (List<Import> list : ilist) {
+ importList.addAll(list);
+ }
+ for (Import impt : importList) {
+ if (!defList.contains(impt.getDefinition())) {
+ defList.add(impt.getDefinition());
+ parseImports(impt.getDefinition(), defList);
+ }
+ }
+ }
+
+ // Workaround for getting the elements
+ private void getSchemaList(Definition def) {
+ Types typesElement = def.getTypes();
+ if (typesElement != null) {
+ Iterator ite = typesElement.getExtensibilityElements().iterator();
+ while (ite.hasNext()) {
+ Object obj = ite.next();
+ if (obj instanceof Schema) {
+ Schema schema = (Schema)obj;
+ addSchema(schema.getDocumentBaseURI(), schema);
+ }
+ }
+ }
+ }
+
+ private void addSchema(String docBaseURI, Schema schema) {
+ //String docBaseURI = schema.getDocumentBaseURI();
+ Element schemaEle = schema.getElement();
+ if (schemaList.get(docBaseURI) == null) {
+ schemaList.put(docBaseURI, schemaEle);
+ } else if (schemaList.get(docBaseURI) != null && schemaList.containsValue(schemaEle)) {
+ // do nothing
+ } else {
+ String tns = schema.getDocumentBaseURI() + "#"
+ + schema.getElement().getAttribute("targetNamespace");
+ if (schemaList.get(tns) == null) {
+ schemaList.put(tns, schema.getElement());
+ }
+ }
+
+ Map<String, List> imports = CastUtils.cast(schema.getImports());
+ if (imports != null && imports.size() > 0) {
+ Collection<String> importKeys = imports.keySet();
+ for (String importNamespace : importKeys) {
+
+ List<SchemaImport> schemaImports = CastUtils.cast(imports.get(importNamespace));
+
+ for (SchemaImport schemaImport : schemaImports) {
+ 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(key, importNamespace)
+ && !schemaList.containsValue(tempImport.getElement())) {
+ addSchema(key, tempImport);
+ }
+ }
+
+ }
+ }
+ }
+
+ private boolean isSchemaParsed(String baseUri, String ns) {
+ if (schemaList.get(baseUri) != null) {
+ Element ele = schemaList.get(baseUri);
+ String tns = ele.getAttribute("targetNamespace");
+ if (ns.equals(tns)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public void setCatalogResolvedMap(Map<String, String> resolvedMap) {
+ catalogResolvedMap = resolvedMap;
+ }
+}
Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java?rev=594221&r1=594220&r2=594221&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java Mon Nov 12 09:23:50 2007
@@ -54,6 +54,7 @@
import org.apache.cxf.BusException;
import org.apache.cxf.binding.BindingFactory;
import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.xmlschema.SchemaCollection;
import org.apache.cxf.helpers.CastUtils;
import org.apache.cxf.service.model.AbstractMessageContainer;
import org.apache.cxf.service.model.AbstractPropertiesHolder;
@@ -72,7 +73,6 @@
import org.apache.cxf.service.model.UnwrappedOperationInfo;
import org.apache.cxf.transport.DestinationFactory;
import org.apache.cxf.transport.DestinationFactoryManager;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
import org.apache.ws.commons.schema.XmlSchemaComplexType;
import org.apache.ws.commons.schema.XmlSchemaElement;
import org.apache.ws.commons.schema.XmlSchemaObject;
@@ -500,7 +500,7 @@
if (!passedRule) {
return;
}
- XmlSchemaCollection schemas = opInfo.getInterface().getService().getXmlSchemaCollection();
+ SchemaCollection schemas = opInfo.getInterface().getService().getXmlSchemaCollection();
XmlSchemaElement inputEl = null;
XmlSchemaElement outputEl = null;
@@ -653,7 +653,7 @@
}
private void buildMessage(AbstractMessageContainer minfo, Message msg) {
- XmlSchemaCollection schemas = minfo.getOperation().getInterface().getService()
+ SchemaCollection schemas = minfo.getOperation().getInterface().getService()
.getXmlSchemaCollection();
List orderedParam = msg.getOrderedParts(null);
for (Part part : cast(orderedParam, Part.class)) {
Modified: incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLServiceBuilderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLServiceBuilderTest.java?rev=594221&r1=594220&r2=594221&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLServiceBuilderTest.java (original)
+++ incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLServiceBuilderTest.java Mon Nov 12 09:23:50 2007
@@ -45,6 +45,7 @@
import org.apache.cxf.Bus;
import org.apache.cxf.binding.BindingFactoryManager;
import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.xmlschema.SchemaCollection;
import org.apache.cxf.helpers.CastUtils;
import org.apache.cxf.helpers.XMLUtils;
import org.apache.cxf.service.model.BindingFaultInfo;
@@ -62,7 +63,6 @@
import org.apache.cxf.transport.DestinationFactory;
import org.apache.cxf.transport.DestinationFactoryManager;
import org.apache.cxf.wsdl.EndpointReferenceUtils;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
import org.apache.ws.commons.schema.XmlSchemaElement;
import org.easymock.classextension.EasyMock;
import org.easymock.classextension.IMocksControl;
@@ -363,7 +363,7 @@
@Test
public void testSchema() {
- XmlSchemaCollection schemas = serviceInfo.getXmlSchemaCollection();
+ SchemaCollection schemas = serviceInfo.getXmlSchemaCollection();
assertNotNull(schemas);
assertEquals(serviceInfo.getSchemas().size(), 1);
SchemaInfo schemaInfo = serviceInfo.getSchemas().iterator().next();
Modified: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java?rev=594221&r1=594220&r2=594221&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java (original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java Mon Nov 12 09:23:50 2007
@@ -45,6 +45,7 @@
import org.apache.cxf.aegis.type.basic.BeanType;
import org.apache.cxf.common.classloader.ClassLoaderUtils;
import org.apache.cxf.common.util.SOAPConstants;
+import org.apache.cxf.common.xmlschema.SchemaCollection;
import org.apache.cxf.databinding.DataBinding;
import org.apache.cxf.databinding.DataReader;
import org.apache.cxf.databinding.DataWriter;
@@ -61,7 +62,6 @@
import org.apache.cxf.wsdl.WSDLConstants;
import org.apache.ws.commons.schema.XmlSchema;
import org.apache.ws.commons.schema.XmlSchemaAnnotated;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
import org.apache.ws.commons.schema.utils.NamespaceMap;
import org.jdom.Attribute;
import org.jdom.Document;
@@ -274,7 +274,7 @@
protected void initializeMessageTypes(ServiceInfo s,
AbstractMessageContainer container,
int partType) {
- XmlSchemaCollection col = s.getXmlSchemaCollection();
+ SchemaCollection col = s.getXmlSchemaCollection();
for (Iterator itr = container.getMessageParts().iterator(); itr.hasNext();) {
MessagePartInfo part = (MessagePartInfo)itr.next();
if (part.isElement()) {
@@ -311,7 +311,7 @@
types.add(t);
}
for (ServiceInfo si : s.getServiceInfos()) {
- XmlSchemaCollection col = si.getXmlSchemaCollection();
+ SchemaCollection col = si.getXmlSchemaCollection();
if (col.getXmlSchemas().length > 1) {
// someone has already filled in the types
continue;
@@ -371,7 +371,7 @@
org.w3c.dom.Document schema = new DOMOutputter().output(new Document(e));
for (ServiceInfo si : s.getServiceInfos()) {
- XmlSchemaCollection col = si.getXmlSchemaCollection();
+ SchemaCollection col = si.getXmlSchemaCollection();
col.setNamespaceContext(nsMap);
XmlSchema xmlSchema = addSchemaDocument(si, col, schema, entry.getKey());
// Work around bug in JDOM DOMOutputter which fails to correctly
Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java?rev=594221&r1=594220&r2=594221&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java (original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java Mon Nov 12 09:23:50 2007
@@ -59,6 +59,7 @@
import org.apache.cxf.common.util.CacheMap;
import org.apache.cxf.common.util.PackageUtils;
import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.common.xmlschema.SchemaCollection;
import org.apache.cxf.databinding.DataBinding;
import org.apache.cxf.databinding.DataReader;
import org.apache.cxf.databinding.DataWriter;
@@ -69,7 +70,6 @@
import org.apache.cxf.service.factory.ServiceConstructionException;
import org.apache.cxf.service.model.ServiceInfo;
import org.apache.cxf.ws.addressing.ObjectFactory;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
public final class JAXBDataBinding extends AbstractDataBinding implements DataBinding {
public static final String SCHEMA_RESOURCE = "SCHEMRESOURCE";
@@ -205,7 +205,7 @@
for (ServiceInfo serviceInfo : service.getServiceInfos()) {
- XmlSchemaCollection col = serviceInfo.getXmlSchemaCollection();
+ SchemaCollection col = serviceInfo.getXmlSchemaCollection();
if (col.getXmlSchemas().length > 1) {
// someone has already filled in the types
Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java?rev=594221&r1=594220&r2=594221&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java (original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java Mon Nov 12 09:23:50 2007
@@ -33,6 +33,7 @@
import org.apache.cxf.common.i18n.Message;
import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.xmlschema.SchemaCollection;
import org.apache.cxf.interceptor.Fault;
import org.apache.cxf.service.ServiceModelVisitor;
import org.apache.cxf.service.model.FaultInfo;
@@ -41,7 +42,6 @@
import org.apache.cxf.service.model.ServiceInfo;
import org.apache.cxf.wsdl.WSDLConstants;
import org.apache.ws.commons.schema.XmlSchema;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
import org.apache.ws.commons.schema.XmlSchemaComplexType;
import org.apache.ws.commons.schema.XmlSchemaElement;
import org.apache.ws.commons.schema.XmlSchemaForm;
@@ -55,10 +55,10 @@
class JAXBSchemaInitializer extends ServiceModelVisitor {
private static final Logger LOG = LogUtils.getLogger(JAXBSchemaInitializer.class);
- private XmlSchemaCollection schemas;
+ private SchemaCollection schemas;
private JAXBContextImpl context;
- public JAXBSchemaInitializer(ServiceInfo serviceInfo, XmlSchemaCollection col, JAXBContextImpl context) {
+ public JAXBSchemaInitializer(ServiceInfo serviceInfo, SchemaCollection col, JAXBContextImpl context) {
super(serviceInfo);
schemas = col;
this.context = context;
@@ -175,7 +175,7 @@
schemaInfo = new SchemaInfo(serviceInfo, qn.getNamespaceURI());
el = createXsElement(part, typeName, schemaInfo);
- XmlSchema schema = new XmlSchema(qn.getNamespaceURI(), schemas);
+ XmlSchema schema = schemas.newXmlSchemaInCollection(qn.getNamespaceURI());
schemaInfo.setSchema(schema);
schema.getElements().add(el.getQName(), el);
schema.getItems().add(el);
@@ -308,7 +308,7 @@
}
XmlSchema schema;
if (schemaInfo == null) {
- schema = new XmlSchema(part.getElementQName().getNamespaceURI(), schemas);
+ schema = schemas.newXmlSchemaInCollection(part.getElementQName().getNamespaceURI());
schema.setElementFormDefault(new XmlSchemaForm(XmlSchemaForm.QUALIFIED));
NamespaceMap nsMap = new NamespaceMap();
Modified: incubator/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/XmlBeansDataBinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/XmlBeansDataBinding.java?rev=594221&r1=594220&r2=594221&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/XmlBeansDataBinding.java (original)
+++ incubator/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/XmlBeansDataBinding.java Mon Nov 12 09:23:50 2007
@@ -29,6 +29,7 @@
import org.w3c.dom.Document;
import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.xmlschema.SchemaCollection;
import org.apache.cxf.databinding.DataBinding;
import org.apache.cxf.databinding.DataReader;
import org.apache.cxf.databinding.DataWriter;
@@ -36,7 +37,7 @@
import org.apache.cxf.service.Service;
import org.apache.cxf.service.model.ServiceInfo;
import org.apache.ws.commons.schema.XmlSchema;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
+
/**
*
@@ -87,7 +88,7 @@
LOG.log(Level.FINER, "Creating XmlBeansDatabinding for " + service.getName());
}
for (ServiceInfo serviceInfo : service.getServiceInfos()) {
- XmlSchemaCollection col = serviceInfo.getXmlSchemaCollection();
+ SchemaCollection col = serviceInfo.getXmlSchemaCollection();
if (col.getXmlSchemas().length > 1) {
// someone has already filled in the types
@@ -101,7 +102,7 @@
}
public XmlSchema addSchemaDocument(ServiceInfo serviceInfo,
- XmlSchemaCollection col,
+ SchemaCollection col,
Document d,
String systemId) {
return super.addSchemaDocument(serviceInfo, col, d, systemId);
Modified: incubator/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/XmlBeansSchemaInitializer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/XmlBeansSchemaInitializer.java?rev=594221&r1=594220&r2=594221&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/XmlBeansSchemaInitializer.java (original)
+++ incubator/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/XmlBeansSchemaInitializer.java Mon Nov 12 09:23:50 2007
@@ -32,12 +32,12 @@
import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.xmlschema.SchemaCollection;
import org.apache.cxf.helpers.XMLUtils;
import org.apache.cxf.service.ServiceModelVisitor;
import org.apache.cxf.service.model.MessagePartInfo;
import org.apache.cxf.service.model.ServiceInfo;
import org.apache.ws.commons.schema.XmlSchema;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
import org.apache.ws.commons.schema.XmlSchemaElement;
import org.apache.ws.commons.schema.XmlSchemaType;
import org.apache.xmlbeans.SchemaType;
@@ -48,13 +48,13 @@
*/
class XmlBeansSchemaInitializer extends ServiceModelVisitor {
private static final Logger LOG = LogUtils.getLogger(XmlBeansSchemaInitializer.class);
- private XmlSchemaCollection schemas;
+ private SchemaCollection schemas;
private XmlBeansDataBinding dataBinding;
private Map<String, XmlSchema> schemaMap
= new HashMap<String, XmlSchema>();
public XmlBeansSchemaInitializer(ServiceInfo serviceInfo,
- XmlSchemaCollection col,
+ SchemaCollection col,
XmlBeansDataBinding db) {
super(serviceInfo);
schemas = col;
@@ -76,9 +76,7 @@
schemaMap.put(file, schema);
return schema;
} catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- return null;
+ throw new RuntimeException("Failed to find schema for: " + file, e);
}
}
Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?rev=594221&r1=594220&r2=594221&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java (original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java Mon Nov 12 09:23:50 2007
@@ -19,7 +19,6 @@
package org.apache.cxf.service.factory;
-import java.io.StringReader;
import java.lang.annotation.Annotation;
import java.lang.reflect.Array;
import java.lang.reflect.Field;
@@ -49,6 +48,7 @@
import org.apache.cxf.binding.BindingFactoryManager;
import org.apache.cxf.common.i18n.Message;
import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.xmlschema.SchemaCollection;
import org.apache.cxf.databinding.source.mime.MimeAttribute;
import org.apache.cxf.databinding.source.mime.MimeSerializer;
import org.apache.cxf.endpoint.Endpoint;
@@ -82,9 +82,7 @@
import org.apache.cxf.service.model.UnwrappedOperationInfo;
import org.apache.cxf.wsdl.WSDLConstants;
import org.apache.cxf.wsdl11.WSDLServiceFactory;
-import org.apache.ws.commons.schema.ValidationEventHandler;
import org.apache.ws.commons.schema.XmlSchema;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
import org.apache.ws.commons.schema.XmlSchemaComplexType;
import org.apache.ws.commons.schema.XmlSchemaElement;
import org.apache.ws.commons.schema.XmlSchemaForm;
@@ -197,7 +195,7 @@
private void fillInSchemaCrossreferences() {
Service service = getService();
for (ServiceInfo serviceInfo : service.getServiceInfos()) {
- XmlSchemaCollection schemaCollection = serviceInfo.getXmlSchemaCollection();
+ SchemaCollection schemaCollection = serviceInfo.getXmlSchemaCollection();
// First pass, fill in any types for which we have a name but no type.
for (SchemaInfo schemaInfo : serviceInfo.getSchemas()) {
@@ -286,7 +284,7 @@
}
ServiceInfo serviceInfo = new ServiceInfo();
- XmlSchemaCollection col = serviceInfo.getXmlSchemaCollection();
+ SchemaCollection col = serviceInfo.getXmlSchemaCollection();
col.getExtReg().registerSerializer(MimeAttribute.class, new MimeSerializer());
ServiceImpl service = new ServiceImpl(serviceInfo);
@@ -976,21 +974,6 @@
}
- /**
- * This is a really ugly trick to get around a bug or oversight in XmlSchema, which is that
- * there is no way to programmatically construct an XmlSchema instance that ends up cataloged
- * in a collection. If there is a fix to WSCOMMONS-272, this can go away.
- * @param collection collection to contain new schema
- * @return new schema
- */
- private XmlSchema newXmlSchemaInCollection(XmlSchemaCollection collection, String namespaceURI) {
- StringBuffer tinyXmlSchemaDocument = new StringBuffer();
- tinyXmlSchemaDocument.append("<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' ");
- tinyXmlSchemaDocument.append("targetNamespace='" + namespaceURI + "'/>");
- StringReader reader = new StringReader(tinyXmlSchemaDocument.toString());
- return collection.read(reader, new ValidationEventHandler() { });
- }
-
private SchemaInfo getOrCreateSchema(ServiceInfo serviceInfo,
String namespaceURI,
boolean qualified) {
@@ -1001,9 +984,9 @@
}
SchemaInfo schemaInfo = new SchemaInfo(serviceInfo, namespaceURI);
- XmlSchemaCollection col = serviceInfo.getXmlSchemaCollection();
+ SchemaCollection col = serviceInfo.getXmlSchemaCollection();
- XmlSchema schema = newXmlSchemaInCollection(col, namespaceURI);
+ XmlSchema schema = col.newXmlSchemaInCollection(namespaceURI);
if (qualified) {
schema.setElementFormDefault(new XmlSchemaForm(XmlSchemaForm.QUALIFIED));
}
Modified: incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptUtils.java?rev=594221&r1=594220&r2=594221&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptUtils.java (original)
+++ incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptUtils.java Mon Nov 12 09:23:50 2007
@@ -27,8 +27,8 @@
import javax.xml.namespace.QName;
+import org.apache.cxf.common.xmlschema.SchemaCollection;
import org.apache.cxf.wsdl.WSDLConstants;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
import org.apache.ws.commons.schema.XmlSchemaComplexType;
import org.apache.ws.commons.schema.XmlSchemaElement;
import org.apache.ws.commons.schema.XmlSchemaSimpleType;
@@ -196,7 +196,7 @@
XmlSchemaElement element,
String elementJavascriptName,
String elementXmlName,
- XmlSchemaCollection xmlSchemaCollection,
+ SchemaCollection xmlSchemaCollection,
String referencingURI,
XmlSchemaType containingType) {
boolean nillable = element.isNillable();
Modified: incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/XmlSchemaUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/XmlSchemaUtils.java?rev=594221&r1=594220&r2=594221&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/XmlSchemaUtils.java (original)
+++ incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/XmlSchemaUtils.java Mon Nov 12 09:23:50 2007
@@ -1,199 +1,199 @@
-/**
- * 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.
- */
-
-package org.apache.cxf.javascript;
-
-import java.util.logging.Logger;
-
-import javax.xml.namespace.QName;
-
-import org.apache.cxf.common.i18n.Message;
-import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.service.model.SchemaInfo;
-import org.apache.cxf.wsdl.WSDLConstants;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
-import org.apache.ws.commons.schema.XmlSchemaComplexType;
-import org.apache.ws.commons.schema.XmlSchemaElement;
-import org.apache.ws.commons.schema.XmlSchemaForm;
-import org.apache.ws.commons.schema.XmlSchemaParticle;
-import org.apache.ws.commons.schema.XmlSchemaSequence;
-import org.apache.ws.commons.schema.XmlSchemaType;
-
-/**
- *
- */
-public final class XmlSchemaUtils {
- public static final XmlSchemaForm QUALIFIED = new XmlSchemaForm(XmlSchemaForm.QUALIFIED);
- public static final XmlSchemaForm UNQUALIFIED = new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED);
-
- public static final String XSI_NS_ATTR = WSDLConstants.NP_XMLNS + ":"
- + WSDLConstants.NP_SCHEMA_XSI + "='" + WSDLConstants.NS_SCHEMA_XSI + "'";
- public static final String NIL_ATTRIBUTES = XSI_NS_ATTR + " xsi:nil='true'";
-
- private static final Logger LOG = LogUtils.getL7dLogger(XmlSchemaUtils.class);
-
- private XmlSchemaUtils() {
- }
-
- private static String cleanedUpSchemaSource(XmlSchemaType subject) {
- if (subject.getSourceURI() == null) {
- return "";
- } else {
- return subject.getSourceURI() + ":" + subject.getLineNumber();
- }
- }
-
- public static void unsupportedConstruct(String messageKey, XmlSchemaType subject) {
- Message message = new Message(messageKey, LOG, subject.getQName(),
- cleanedUpSchemaSource(subject));
- throw new UnsupportedConstruct(message);
-
- }
-
- public static void unsupportedConstruct(String messageKey, String what, XmlSchemaType subject) {
- Message message = new Message(messageKey, LOG, what, subject.getQName(),
- subject == null ? "(global)"
- : cleanedUpSchemaSource(subject));
- LOG.severe(message.toString());
- throw new UnsupportedConstruct(message);
-
- }
-
-
- public static XmlSchemaSequence getSequence(XmlSchemaComplexType type) {
- XmlSchemaParticle particle = type.getParticle();
- XmlSchemaSequence sequence = null;
-
- if (particle == null) {
- unsupportedConstruct("NULL_PARTICLE", type);
- }
-
- try {
- sequence = (XmlSchemaSequence) particle;
- } catch (ClassCastException cce) {
- unsupportedConstruct("NON_SEQUENCE_PARTICLE", type);
- }
-
- return sequence;
- }
-
- /**
- * This copes with an observed phenomenon in the schema built by the ReflectionServiceFactoryBean. It
- * is creating element such that: (a) the type is not set. (b) the refName is set.
- * (c) the namespaceURI in the refName is set empty. This apparently indicates
- * 'same Schema' to everyone else, so thus function implements
- * that convention here. It is unclear if that is a correct structure,
- * and it if changes, we can simplify or eliminate this function.
- * @param name
- * @param referencingURI
- * @return
- */
- public static XmlSchemaElement findElementByRefName(XmlSchemaCollection xmlSchemaCollection,
- QName name,
- String referencingURI) {
- String uri = name.getNamespaceURI();
- if ("".equals(uri)) {
- uri = referencingURI;
- }
- QName copyName = new QName(uri, name.getLocalPart());
- XmlSchemaElement target = xmlSchemaCollection.getElementByQName(copyName);
- assert target != null;
- return target;
- }
-
-
- /**
- * Follow a chain of references from element to element until we can obtain a type.
- * @param element
- * @return
- */
- public static XmlSchemaType getElementType(XmlSchemaCollection xmlSchemaCollection,
- String referencingURI,
- XmlSchemaElement element,
- XmlSchemaType containingType) {
- assert element != null;
- if (referencingURI == null && containingType != null) {
- referencingURI = containingType.getQName().getNamespaceURI();
- }
- XmlSchemaElement originalElement = element;
- while (element.getSchemaType() == null && element.getRefName() != null) {
- XmlSchemaElement nextElement = findElementByRefName(xmlSchemaCollection,
- element.getRefName(),
- referencingURI);
- assert nextElement != null;
- element = nextElement;
- }
- if (element.getSchemaType() == null) {
- XmlSchemaUtils.unsupportedConstruct("ELEMENT_HAS_NO_TYPE", originalElement.getName(),
- containingType);
- }
- return element.getSchemaType();
- }
-
- public static boolean isComplexType(XmlSchemaType type) {
- return type instanceof XmlSchemaComplexType;
- }
-
- public static boolean isElementNameQualified(XmlSchemaElement element, SchemaInfo schemaInfo) {
- if (element.getForm().equals(QUALIFIED)) {
- return true;
- }
- if (element.getForm().equals(UNQUALIFIED)) {
- return false;
- }
- return schemaInfo.getSchema().getElementFormDefault().equals(QUALIFIED);
- }
-
- /**
- * Return an empty string if this element should be unqualified in XML
- * or the namespace URI if it should be qualified.
- * @param element
- * @return
- */
- public static String getElementQualifier(SchemaInfo schemaInfo, XmlSchemaElement element) {
- QName qname;
- boolean forceQualification = false;
- // JAXB ends up with no form='qualified', but we qualify anyway if the namespace don't
- // match.
- if (element.getRefName() != null) {
- qname = element.getRefName();
- forceQualification = !qname.getNamespaceURI().equals(schemaInfo.getNamespaceURI());
- } else {
- qname = element.getQName();
- }
- // some elements don't have qnames, only local names.
- // one hopes that we aren't called upon to produce a qualified form for such an element, though
- // perhaps we're supposed to pull the TNS out of a hat.
- if (forceQualification || isElementNameQualified(element, schemaInfo)) {
- return qname.getNamespaceURI();
- } else {
- return "";
- }
- }
-
- public static boolean isParticleArray(XmlSchemaParticle particle) {
- return particle.getMaxOccurs() > 1;
- }
-
- public static boolean isParticleOptional(XmlSchemaParticle particle) {
- return particle.getMinOccurs() == 0 && particle.getMaxOccurs() == 1;
- }
-
-
-}
+/**
+ * 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.
+ */
+
+package org.apache.cxf.javascript;
+
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.xmlschema.SchemaCollection;
+import org.apache.cxf.service.model.SchemaInfo;
+import org.apache.cxf.wsdl.WSDLConstants;
+import org.apache.ws.commons.schema.XmlSchemaComplexType;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaForm;
+import org.apache.ws.commons.schema.XmlSchemaParticle;
+import org.apache.ws.commons.schema.XmlSchemaSequence;
+import org.apache.ws.commons.schema.XmlSchemaType;
+
+/**
+ *
+ */
+public final class XmlSchemaUtils {
+ public static final XmlSchemaForm QUALIFIED = new XmlSchemaForm(XmlSchemaForm.QUALIFIED);
+ public static final XmlSchemaForm UNQUALIFIED = new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED);
+
+ public static final String XSI_NS_ATTR = WSDLConstants.NP_XMLNS + ":"
+ + WSDLConstants.NP_SCHEMA_XSI + "='" + WSDLConstants.NS_SCHEMA_XSI + "'";
+ public static final String NIL_ATTRIBUTES = XSI_NS_ATTR + " xsi:nil='true'";
+
+ private static final Logger LOG = LogUtils.getL7dLogger(XmlSchemaUtils.class);
+
+ private XmlSchemaUtils() {
+ }
+
+ private static String cleanedUpSchemaSource(XmlSchemaType subject) {
+ if (subject.getSourceURI() == null) {
+ return "";
+ } else {
+ return subject.getSourceURI() + ":" + subject.getLineNumber();
+ }
+ }
+
+ public static void unsupportedConstruct(String messageKey, XmlSchemaType subject) {
+ Message message = new Message(messageKey, LOG, subject.getQName(),
+ cleanedUpSchemaSource(subject));
+ throw new UnsupportedConstruct(message);
+
+ }
+
+ public static void unsupportedConstruct(String messageKey, String what, XmlSchemaType subject) {
+ Message message = new Message(messageKey, LOG, what, subject.getQName(),
+ subject == null ? "(global)"
+ : cleanedUpSchemaSource(subject));
+ LOG.severe(message.toString());
+ throw new UnsupportedConstruct(message);
+
+ }
+
+
+ public static XmlSchemaSequence getSequence(XmlSchemaComplexType type) {
+ XmlSchemaParticle particle = type.getParticle();
+ XmlSchemaSequence sequence = null;
+
+ if (particle == null) {
+ unsupportedConstruct("NULL_PARTICLE", type);
+ }
+
+ try {
+ sequence = (XmlSchemaSequence) particle;
+ } catch (ClassCastException cce) {
+ unsupportedConstruct("NON_SEQUENCE_PARTICLE", type);
+ }
+
+ return sequence;
+ }
+
+ /**
+ * This copes with an observed phenomenon in the schema built by the ReflectionServiceFactoryBean. It
+ * is creating element such that: (a) the type is not set. (b) the refName is set.
+ * (c) the namespaceURI in the refName is set empty. This apparently indicates
+ * 'same Schema' to everyone else, so thus function implements
+ * that convention here. It is unclear if that is a correct structure,
+ * and it if changes, we can simplify or eliminate this function.
+ * @param name
+ * @param referencingURI
+ * @return
+ */
+ public static XmlSchemaElement findElementByRefName(SchemaCollection xmlSchemaCollection,
+ QName name,
+ String referencingURI) {
+ String uri = name.getNamespaceURI();
+ if ("".equals(uri)) {
+ uri = referencingURI;
+ }
+ QName copyName = new QName(uri, name.getLocalPart());
+ XmlSchemaElement target = xmlSchemaCollection.getElementByQName(copyName);
+ assert target != null;
+ return target;
+ }
+
+
+ /**
+ * Follow a chain of references from element to element until we can obtain a type.
+ * @param element
+ * @return
+ */
+ public static XmlSchemaType getElementType(SchemaCollection xmlSchemaCollection,
+ String referencingURI,
+ XmlSchemaElement element,
+ XmlSchemaType containingType) {
+ assert element != null;
+ if (referencingURI == null && containingType != null) {
+ referencingURI = containingType.getQName().getNamespaceURI();
+ }
+ XmlSchemaElement originalElement = element;
+ while (element.getSchemaType() == null && element.getRefName() != null) {
+ XmlSchemaElement nextElement = findElementByRefName(xmlSchemaCollection,
+ element.getRefName(),
+ referencingURI);
+ assert nextElement != null;
+ element = nextElement;
+ }
+ if (element.getSchemaType() == null) {
+ XmlSchemaUtils.unsupportedConstruct("ELEMENT_HAS_NO_TYPE", originalElement.getName(),
+ containingType);
+ }
+ return element.getSchemaType();
+ }
+
+ public static boolean isComplexType(XmlSchemaType type) {
+ return type instanceof XmlSchemaComplexType;
+ }
+
+ public static boolean isElementNameQualified(XmlSchemaElement element, SchemaInfo schemaInfo) {
+ if (element.getForm().equals(QUALIFIED)) {
+ return true;
+ }
+ if (element.getForm().equals(UNQUALIFIED)) {
+ return false;
+ }
+ return schemaInfo.getSchema().getElementFormDefault().equals(QUALIFIED);
+ }
+
+ /**
+ * Return an empty string if this element should be unqualified in XML
+ * or the namespace URI if it should be qualified.
+ * @param element
+ * @return
+ */
+ public static String getElementQualifier(SchemaInfo schemaInfo, XmlSchemaElement element) {
+ QName qname;
+ boolean forceQualification = false;
+ // JAXB ends up with no form='qualified', but we qualify anyway if the namespace don't
+ // match.
+ if (element.getRefName() != null) {
+ qname = element.getRefName();
+ forceQualification = !qname.getNamespaceURI().equals(schemaInfo.getNamespaceURI());
+ } else {
+ qname = element.getQName();
+ }
+ // some elements don't have qnames, only local names.
+ // one hopes that we aren't called upon to produce a qualified form for such an element, though
+ // perhaps we're supposed to pull the TNS out of a hat.
+ if (forceQualification || isElementNameQualified(element, schemaInfo)) {
+ return qname.getNamespaceURI();
+ } else {
+ return "";
+ }
+ }
+
+ public static boolean isParticleArray(XmlSchemaParticle particle) {
+ return particle.getMaxOccurs() > 1;
+ }
+
+ public static boolean isParticleOptional(XmlSchemaParticle particle) {
+ return particle.getMinOccurs() == 0 && particle.getMaxOccurs() == 1;
+ }
+
+
+}
Modified: incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java?rev=594221&r1=594220&r2=594221&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java (original)
+++ incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java Mon Nov 12 09:23:50 2007
@@ -33,6 +33,7 @@
import org.apache.cxf.common.i18n.Message;
import org.apache.cxf.common.logging.LogUtils;
import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.common.xmlschema.SchemaCollection;
import org.apache.cxf.javascript.JavascriptUtils;
import org.apache.cxf.javascript.NameManager;
import org.apache.cxf.javascript.NamespacePrefixAccumulator;
@@ -49,7 +50,6 @@
import org.apache.cxf.service.model.ServiceInfo;
import org.apache.cxf.transport.local.LocalTransportFactory;
import org.apache.cxf.wsdl.WSDLConstants;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
import org.apache.ws.commons.schema.XmlSchemaComplexType;
import org.apache.ws.commons.schema.XmlSchemaElement;
import org.apache.ws.commons.schema.XmlSchemaObject;
@@ -65,7 +65,7 @@
private StringBuilder code;
private String currentInterfaceClassName;
private Set<OperationInfo> operationsWithNameConflicts;
- private XmlSchemaCollection xmlSchemaCollection;
+ private SchemaCollection xmlSchemaCollection;
private SchemaInfo serviceSchemaInfo;
private XmlSchemaElement wrapperElement;
Modified: incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java?rev=594221&r1=594220&r2=594221&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java (original)
+++ incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java Mon Nov 12 09:23:50 2007
@@ -26,13 +26,13 @@
import org.apache.cxf.common.logging.LogUtils;
import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.common.xmlschema.SchemaCollection;
import org.apache.cxf.javascript.JavascriptUtils;
import org.apache.cxf.javascript.NameManager;
import org.apache.cxf.javascript.NamespacePrefixAccumulator;
import org.apache.cxf.javascript.UnsupportedConstruct;
import org.apache.cxf.javascript.XmlSchemaUtils;
import org.apache.cxf.service.model.SchemaInfo;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
import org.apache.ws.commons.schema.XmlSchemaComplexType;
import org.apache.ws.commons.schema.XmlSchemaElement;
import org.apache.ws.commons.schema.XmlSchemaObject;
@@ -51,11 +51,11 @@
private static final Logger LOG = LogUtils.getL7dLogger(SchemaJavascriptBuilder.class);
- private XmlSchemaCollection xmlSchemaCollection;
+ private SchemaCollection xmlSchemaCollection;
private NameManager nameManager;
private SchemaInfo schemaInfo;
- public SchemaJavascriptBuilder(XmlSchemaCollection schemaCollection,
+ public SchemaJavascriptBuilder(SchemaCollection schemaCollection,
NameManager nameManager,
SchemaInfo schemaInfo) {
this.xmlSchemaCollection = schemaCollection;
Modified: incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/ValidatorUtil.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/ValidatorUtil.java?rev=594221&r1=594220&r2=594221&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/ValidatorUtil.java (original)
+++ incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/ValidatorUtil.java Mon Nov 12 09:23:50 2007
@@ -23,6 +23,7 @@
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
+import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -44,12 +45,12 @@
import org.apache.cxf.BusFactory;
import org.apache.cxf.common.i18n.Message;
import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.xmlschema.SchemaCollection;
import org.apache.cxf.helpers.DOMUtils;
import org.apache.cxf.service.model.ServiceInfo;
import org.apache.cxf.tools.common.ToolException;
import org.apache.cxf.wsdl.WSDLConstants;
import org.apache.cxf.wsdl11.SchemaUtil;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
public final class ValidatorUtil {
private static final Logger LOG = LogUtils.getL7dLogger(ValidatorUtil.class);
@@ -58,7 +59,7 @@
}
- public static XmlSchemaCollection getSchema(final Definition def) {
+ public static SchemaCollection getSchema(final Definition def) {
ServiceInfo serviceInfo = new ServiceInfo();
new SchemaUtil(BusFactory.getDefaultBus(),
new HashMap<String, Element>()).getSchemas(def,
@@ -77,18 +78,15 @@
* @throws IOException
* @throws SAXException
*/
- public static List<XmlSchemaCollection> getSchemaList(Document document,
+ public static List<SchemaCollection> getSchemaList(Document document,
String baseURI) throws IOException, SAXException {
- List<XmlSchemaCollection> schemaList = new ArrayList<XmlSchemaCollection>();
+ List<SchemaCollection> schemaList = new ArrayList<SchemaCollection>();
if (document == null) {
return schemaList;
}
- //
- // If we are on windows we may have spaces in the uri
- // which need to be escaped.
- //
- baseURI = baseURI.replaceAll(" ", "%20");
- XmlSchemaCollection schemaCol = new XmlSchemaCollection();
+ // URL might need encoding for special characters.
+ baseURI = URLEncoder.encode(baseURI, "utf-8");
+ SchemaCollection schemaCol = new SchemaCollection();
schemaCol.setBaseUri(baseURI);
NodeList nodes = document.getElementsByTagNameNS(
WSDLConstants.NS_SCHEMA_XSD, "schema");
Modified: incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java?rev=594221&r1=594220&r2=594221&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java (original)
+++ incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java Mon Nov 12 09:23:50 2007
@@ -52,6 +52,7 @@
import org.apache.cxf.common.i18n.Message;
import org.apache.cxf.common.logging.LogUtils;
import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.common.xmlschema.SchemaCollection;
import org.apache.cxf.helpers.XPathUtils;
import org.apache.cxf.tools.common.ToolException;
import org.apache.cxf.tools.validator.internal.model.FailureLocation;
@@ -68,7 +69,6 @@
import org.apache.cxf.tools.validator.internal.model.XService;
import org.apache.cxf.wsdl.WSDLConstants;
import org.apache.cxf.wsdl11.WSDLDefinitionBuilder;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
import org.apache.ws.commons.schema.XmlSchemaElement;
import org.apache.ws.commons.schema.XmlSchemaType;
@@ -85,8 +85,8 @@
private Definition definition;
private List<Definition> importedDefinitions;
- private List<XmlSchemaCollection> schemas = new ArrayList<XmlSchemaCollection>();
- private XmlSchemaCollection schemaCollection = new XmlSchemaCollection();
+ private List<SchemaCollection> schemas = new ArrayList<SchemaCollection>();
+ private SchemaCollection schemaCollection = new SchemaCollection();
private boolean suppressWarnings;
@@ -566,7 +566,7 @@
} else {
if (isElement) {
- for (XmlSchemaCollection schema : schemas) {
+ for (SchemaCollection schema : schemas) {
if (schema != null && schema.getElementByQName(
new QName(namespace, name)) != null) {
partvalid = true;
@@ -574,7 +574,7 @@
}
}
} else {
- for (XmlSchemaCollection schema : schemas) {
+ for (SchemaCollection schema : schemas) {
if (schema != null && schema.getTypeByQName(
new QName(namespace, name)) != null) {
partvalid = true;
Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtil.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtil.java?rev=594221&r1=594220&r2=594221&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtil.java (original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtil.java Mon Nov 12 09:23:50 2007
@@ -37,6 +37,7 @@
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
+import org.apache.cxf.common.xmlschema.SchemaCollection;
import org.apache.cxf.helpers.CastUtils;
import org.apache.cxf.helpers.JavaUtils;
import org.apache.cxf.jaxb.JAXBUtils;
@@ -50,7 +51,6 @@
import org.apache.cxf.tools.util.URIParserUtil;
import org.apache.cxf.tools.wsdlto.core.DataBindingProfile;
import org.apache.ws.commons.schema.XmlSchema;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
import org.apache.ws.commons.schema.XmlSchemaComplexType;
import org.apache.ws.commons.schema.XmlSchemaElement;
import org.apache.ws.commons.schema.XmlSchemaForm;
@@ -354,7 +354,7 @@
List<WrapperElement> qnames = new ArrayList<WrapperElement>();
ServiceInfo serviceInfo = (ServiceInfo)context.get(ServiceInfo.class);
- XmlSchemaCollection schema = serviceInfo.getXmlSchemaCollection();
+ SchemaCollection schema = serviceInfo.getXmlSchemaCollection();
XmlSchemaElement elementByName = schema.getElementByQName(partElement);
@@ -395,7 +395,7 @@
public static boolean isSchemaFormQualified(ToolContext context, QName partElement) {
ServiceInfo serviceInfo = (ServiceInfo)context.get(ServiceInfo.class);
- XmlSchemaCollection schemaCol = serviceInfo.getXmlSchemaCollection();
+ SchemaCollection schemaCol = serviceInfo.getXmlSchemaCollection();
for (int i = 0; i < schemaCol.getXmlSchemas().length; i++) {
XmlSchema schema = schemaCol.getXmlSchemas().clone()[i];