[jboss-svn-commits] JBossWS SVN: r600 - in trunk/src: main/java/org/jboss/ws/deployment main/java/org/jboss/ws/metadata main/java/org/jboss/ws/metadata/wsdl main/java/org/jboss/ws/tools main/java/org/jboss/ws/tools/helpers test/java/org/jboss/test/ws/tools/config/globalconfig test/java/org/jboss/test/ws/tools/validation test/java/org/jboss/test/ws/tools/xmlschema test/java/org/jboss/test/ws/wsdl11
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Jul 13 22:53:33 EDT 2006
Author: jason.greene at jboss.com
Date: 2006-07-13 22:53:23 -0400 (Thu, 13 Jul 2006)
New Revision: 600
Added:
trunk/src/main/java/org/jboss/ws/metadata/wsdl/DOMTypes.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/XSModelTypes.java
Modified:
trunk/src/main/java/org/jboss/ws/deployment/JSR109MetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/ServiceMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDL11Reader.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDL20Reader.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLDefinitions.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLTypes.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLUtils.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLWriter.java
trunk/src/main/java/org/jboss/ws/tools/JavaToWSDL11.java
trunk/src/main/java/org/jboss/ws/tools/WSDLToJava.java
trunk/src/main/java/org/jboss/ws/tools/helpers/JavaToWSDLHelper.java
trunk/src/main/java/org/jboss/ws/tools/helpers/MappingFileGeneratorHelper.java
trunk/src/main/java/org/jboss/ws/tools/helpers/ToolsHelper.java
trunk/src/test/java/org/jboss/test/ws/tools/config/globalconfig/GlobalConfigTestCase.java
trunk/src/test/java/org/jboss/test/ws/tools/validation/WSDL11Validator.java
trunk/src/test/java/org/jboss/test/ws/tools/validation/WSDLValidator.java
trunk/src/test/java/org/jboss/test/ws/tools/xmlschema/WSDLTypesTestCase.java
trunk/src/test/java/org/jboss/test/ws/wsdl11/MicrosoftGeneratedWSDLTestCase.java
trunk/src/test/java/org/jboss/test/ws/wsdl11/MultiSchemaTestCase.java
trunk/src/test/java/org/jboss/test/ws/wsdl11/WSDL11TestCase.java
trunk/src/test/java/org/jboss/test/ws/wsdl11/WSDLTypesTestCase.java
trunk/src/test/java/org/jboss/test/ws/wsdl11/WSDLWithAnonTypesTestCase.java
Log:
Weaken JBossXSModel dependency on WSDL object model
Add DOM based type definition
Modified: trunk/src/main/java/org/jboss/ws/deployment/JSR109MetaDataBuilder.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/deployment/JSR109MetaDataBuilder.java 2006-07-13 13:30:04 UTC (rev 599)
+++ trunk/src/main/java/org/jboss/ws/deployment/JSR109MetaDataBuilder.java 2006-07-14 02:53:23 UTC (rev 600)
@@ -71,6 +71,7 @@
import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationPart;
import org.jboss.ws.metadata.wsdl.WSDLProperty;
import org.jboss.ws.metadata.wsdl.WSDLTypes;
+import org.jboss.ws.metadata.wsdl.WSDLUtils;
import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
import org.jboss.ws.utils.JavaUtils;
@@ -97,7 +98,7 @@
if (wsdlDefinitions != null)
{
WSDLTypes wsdlTypes = wsdlDefinitions.getWsdlTypes();
- typesMetaData.setSchemaModel(wsdlTypes.getSchemaModel());
+ typesMetaData.setSchemaModel(WSDLUtils.getSchemaModel(wsdlTypes));
}
// Copy the type mappings to the types meta data
@@ -360,7 +361,7 @@
// An XOP parameter is detected if it is a complex type that derives from xsd:base64Binary
WSDLInterfaceOperation wsdlOperation = wsdlOperationPart.getWsdlOperation();
WSDLTypes wsdlTypes = wsdlOperation.getWsdlInterface().getWsdlDefinitions().getWsdlTypes();
- JBossXSModel schemaModel = wsdlTypes.getSchemaModel();
+ JBossXSModel schemaModel = WSDLUtils.getSchemaModel(wsdlTypes);
XSTypeDefinition xsType = schemaModel.getTypeDefinition(xmlType.getLocalPart(), xmlType.getNamespaceURI());
if (xsType instanceof XSComplexTypeDefinition
&& xsType.getNamespace().equals(Constants.NS_XML_MIME) )
Modified: trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilder.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilder.java 2006-07-13 13:30:04 UTC (rev 599)
+++ trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilder.java 2006-07-14 02:53:23 UTC (rev 600)
@@ -204,7 +204,7 @@
// Read the generated WSDL and initialize the schema model
WSDLDefinitions wsdlDefinitions = serviceMetaData.getWsdlDefinitions();
- JBossXSModel schemaModel = wsdlDefinitions.getWsdlTypes().getSchemaModel();
+ JBossXSModel schemaModel = WSDLUtils.getSchemaModel(wsdlDefinitions.getWsdlTypes());
serviceMetaData.getTypesMetaData().setSchemaModel(schemaModel);
// Set the endpoint address
Modified: trunk/src/main/java/org/jboss/ws/metadata/ServiceMetaData.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/ServiceMetaData.java 2006-07-13 13:30:04 UTC (rev 599)
+++ trunk/src/main/java/org/jboss/ws/metadata/ServiceMetaData.java 2006-07-14 02:53:23 UTC (rev 600)
@@ -50,6 +50,7 @@
import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
import org.jboss.ws.metadata.wsdl.WSDLDefinitionsFactory;
import org.jboss.ws.metadata.wsdl.WSDLTypes;
+import org.jboss.ws.metadata.wsdl.WSDLUtils;
import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
import org.jboss.ws.utils.JavaUtils;
@@ -85,7 +86,7 @@
// Arbitrary properties given by <call-property>
private Properties properties;
-
+
// derived cached encoding style
private Use encStyle;
@@ -281,7 +282,7 @@
{
wsdlLocation = wsMetaData.getResourceLoader().getResource(wsdlFile);
}
- }
+ }
return wsdlLocation;
}
@@ -327,7 +328,7 @@
{
encStyle = Use.getDefaultUse();
}
- }
+ }
return encStyle;
}
@@ -355,7 +356,7 @@
WSDLTypes types = definitions.getWsdlTypes();
if (types != null)
{
- JBossXSModel model = types.getSchemaModel();
+ JBossXSModel model = WSDLUtils.getSchemaModel(types);;
if (model != null)
model.eagerInitialize();
}
Added: trunk/src/main/java/org/jboss/ws/metadata/wsdl/DOMTypes.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/wsdl/DOMTypes.java 2006-07-13 13:30:04 UTC (rev 599)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/DOMTypes.java 2006-07-14 02:53:23 UTC (rev 600)
@@ -0,0 +1,56 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.ws.metadata.wsdl;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.util.NotImplementedException;
+import org.jboss.util.xml.DOMWriter;
+import org.w3c.dom.Element;
+
+/**
+ * A DOM Element based schema representation. Care should be taken to ensure
+ * thread safety.
+ *
+ * @author <a href="mailto:jason.greene at jboss.com">Jason T. Greene</a>
+ * @version $Revision:$
+ */
+public class DOMTypes extends WSDLTypes
+{
+ private Element element;
+
+ public DOMTypes(Element element)
+ {
+ this.element = element;
+ }
+
+ public String toString()
+ {
+ return DOMWriter.printNode(element, true);
+ }
+
+ @Override
+ public QName getXMLType(QName name)
+ {
+ throw new NotImplementedException();
+ }
+}
Property changes on: trunk/src/main/java/org/jboss/ws/metadata/wsdl/DOMTypes.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDL11Reader.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDL11Reader.java 2006-07-13 13:30:04 UTC (rev 599)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDL11Reader.java 2006-07-14 02:53:23 UTC (rev 600)
@@ -110,9 +110,10 @@
{
log.trace("processDefinition: " + wsdlLoc);
- this.destWsdl = new WSDLDefinitions();
- this.destWsdl.setWsdlOneOneDefinition(srcWsdl);
- this.destWsdl.setWsdlNamespace(Constants.NS_WSDL11);
+ destWsdl = new WSDLDefinitions();
+ destWsdl.setWsdlTypes(new XSModelTypes());
+ destWsdl.setWsdlOneOneDefinition(srcWsdl);
+ destWsdl.setWsdlNamespace(Constants.NS_WSDL11);
processNamespaces(srcWsdl);
processTypes(srcWsdl, wsdlLoc);
@@ -128,7 +129,7 @@
private void processUnreachableBindings(Definition srcWsdl)
{
log.trace("processUnreachableBindings");
-
+
Iterator it = getAllDefinedBindings(srcWsdl).values().iterator();
while (it.hasNext())
{
@@ -225,7 +226,7 @@
strlist.add(uri.toExternalForm());
}
JBossXSModel xsmodel = jxsd.parseSchema(schemaLocationsMap);
- destTypes.addSchemaModel(destWsdl.getTargetNamespace(), xsmodel);
+ WSDLUtils.addSchemaModel(destTypes, destWsdl.getTargetNamespace(), xsmodel);
}
}
else
@@ -377,7 +378,7 @@
}
}
}
-
+
private URL getLocationURL(URL parentURL, String location) throws MalformedURLException
{
log.trace("getLocationURL: [location=" + location + ",parent=" + parentURL + "]");
@@ -425,7 +426,7 @@
private void processPortType(Definition srcWsdl, PortType srcPortType)
{
log.trace("processPortType: " + srcPortType.getQName());
-
+
QName qname = srcPortType.getQName();
NCName ncName = new NCName(qname);
if (destWsdl.getInterface(ncName) == null)
@@ -472,11 +473,11 @@
{
Message srcMessage = srcInput.getMessage();
log.trace("processOperationInput: " + srcMessage.getQName());
-
+
QName wsaAction = (QName)srcInput.getExtensionAttribute(Constants.WSDL_ATTRIBUTE_WSA_ACTION);
if (wsaAction != null)
destOperation.addProperty(new WSDLProperty(Constants.WSDL_PROPERTY_ACTION_IN, wsaAction.getLocalPart()));
-
+
List paramOrder = srcOperation.getParameterOrdering();
Iterator itMessageParts = srcMessage.getOrderedParts(paramOrder).iterator();
while (itMessageParts.hasNext())
@@ -518,7 +519,7 @@
{
Message srcMessage = srcOutput.getMessage();
log.trace("processOperationOutput: " + srcMessage.getQName());
-
+
destOperation.setPattern(Constants.WSDL20_PATTERN_IN_OUT);
QName wsaAction = (QName)srcOutput.getExtensionAttribute(Constants.WSDL_ATTRIBUTE_WSA_ACTION);
if (wsaAction != null)
@@ -577,7 +578,7 @@
{
String faultName = srcFault.getName();
log.trace("processOperationFault: " + faultName);
-
+
WSDLInterfaceFault destFault = new WSDLInterfaceFault(destInterface);
NCName ncName = new NCName(faultName);
destFault.setName(ncName);
@@ -750,12 +751,12 @@
Map<QName, Binding> retMap = new LinkedHashMap<QName, Binding>();
Map srcBindings = srcWsdl.getBindings();
Iterator itBinding = srcBindings.values().iterator();
- while (itBinding.hasNext())
+ while (itBinding.hasNext())
{
Binding srcBinding = (Binding)itBinding.next();
retMap.put(srcBinding.getQName(), srcBinding);
}
-
+
// Bindings not available when pulled in through <wsdl:import>
// http://sourceforge.net/tracker/index.php?func=detail&aid=1240323&group_id=128811&atid=712792
Iterator itService = srcWsdl.getServices().values().iterator();
@@ -787,7 +788,7 @@
{
String srcBindingName = srcBindingOperation.getName();
log.trace("processBindingOperation: " + srcBindingName);
-
+
WSDLInterface destInterface = destBinding.getInterface();
String namespaceURI = destInterface.getQName().getNamespaceURI();
@@ -830,7 +831,7 @@
private void processBindingInput(WSDLBindingOperation destBindingOperation, WSDLInterfaceOperation destIntfOperation, BindingInput srcBindingInput)
{
log.trace("processBindingInput");
-
+
Iterator itExt = srcBindingInput.getExtensibilityElements().iterator();
while (itExt.hasNext())
{
@@ -908,7 +909,7 @@
private void processBindingOutput(WSDLBindingOperation destBindingOperation, WSDLInterfaceOperation destIntfOperation, BindingOutput srcBindingOutput)
{
log.trace("processBindingOutput");
-
+
Iterator itExt = srcBindingOutput.getExtensibilityElements().iterator();
while (itExt.hasNext())
{
@@ -986,7 +987,7 @@
private void processEncodingStyle(SOAPBody body, WSDLBindingOperation destBindingOperation)
{
log.trace("processEncodingStyle");
-
+
List encStyleList = body.getEncodingStyles();
if (encStyleList != null)
{
@@ -1055,7 +1056,7 @@
private void processPort(Definition srcWsdl, WSDLService destService, Port srcPort)
{
log.trace("processPort: " + srcPort.getName());
-
+
Binding srcBinding = srcPort.getBinding();
WSDLEndpoint destEndpoint = new WSDLEndpoint(destService);
Modified: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDL20Reader.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDL20Reader.java 2006-07-13 13:30:04 UTC (rev 599)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDL20Reader.java 2006-07-14 02:53:23 UTC (rev 600)
@@ -340,7 +340,7 @@
{
if ("types".equals(localName))
{
- WSDLTypes wsdlTypes = new WSDLTypes(wsdl20);
+ WSDLTypes wsdlTypes = new XSModelTypes();
wsdl20.setWsdlTypes(wsdlTypes);
return wsdlTypes;
}
Modified: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLDefinitions.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLDefinitions.java 2006-07-13 13:30:04 UTC (rev 599)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLDefinitions.java 2006-07-14 02:53:23 UTC (rev 600)
@@ -45,7 +45,7 @@
* The top level Definitions component is just a container for two categories of components;
* WSDL components and type system components. WSDL components are interfaces, bindings and services.
*
- * Type system components describe the constraints on a messages content.
+ * Type system components describe the constraints on a message�s content.
*
* @author Thomas.Diesler at jboss.org
* @since 10-Oct-2004
@@ -68,7 +68,7 @@
private List<WSDLImport> imports = new ArrayList<WSDLImport>();
/** Zero or more include element information items */
private List<WSDLInclude> includes = new ArrayList<WSDLInclude>();
- /** An OPTIONAL types element information item */
+ /** Types element information item */
private WSDLTypes types;
/** Zero or more interface element information items */
private Map<NCName, WSDLInterface> interfaces = new LinkedHashMap<NCName, WSDLInterface>();
@@ -86,6 +86,8 @@
// The WSDL document
private Document wsdlDocument;
+ public WSDLDefinitions() {}
+
/** Set the wsdl4j definition if we have wsdl-1.1 */
public void setWsdlOneOneDefinition(Definition wsdlDefinition)
{
@@ -102,7 +104,6 @@
return wsdlOneOneDefinition;
}
-
public Document getWsdlDocument()
{
return wsdlDocument;
@@ -214,15 +215,13 @@
public WSDLTypes getWsdlTypes()
{
- if (types == null)
- types = new WSDLTypes(this);
-
return types;
}
public void setWsdlTypes(WSDLTypes types)
{
this.types = types;
+ this.types.setWSDLDefintiions(this);
}
public WSDLInterface getInterface(NCName ncName)
Modified: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLTypes.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLTypes.java 2006-07-13 13:30:04 UTC (rev 599)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLTypes.java 2006-07-14 02:53:23 UTC (rev 600)
@@ -27,11 +27,7 @@
import javax.xml.namespace.QName;
-import org.apache.xerces.xs.XSElementDeclaration;
-import org.apache.xerces.xs.XSTypeDefinition;
import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
/**
* WSDL types.
@@ -40,88 +36,24 @@
* @author Anil.Saldhana at jboss.org
* @since 10-Oct-2004
*/
-public class WSDLTypes implements Serializable
+public abstract class WSDLTypes implements Serializable
{
private static final long serialVersionUID = 7919937323521372194L;
// provide logging
- private static final Logger log = Logger.getLogger(WSDLTypes.class);
+ static private final Logger log = Logger.getLogger(WSDLTypes.class);
private WSDLDefinitions wsdlDefinitions;
- // The Schema Model
- private JBossXSModel schemaModel;
+ public abstract QName getXMLType(QName name);
- public WSDLTypes(WSDLDefinitions wsdlDefinitions)
- {
- this.wsdlDefinitions = wsdlDefinitions;
- this.schemaModel = new JBossXSModel();
- }
-
public WSDLDefinitions getWsdlDefinitions()
{
return wsdlDefinitions;
}
- /**
- * Add a schema model for a given namespaceURI
- * @param nsURI the namespaceURI under which the model has been generated
- * @param schema the Schema Model that needs to be added to existing schema
- * model in WSDLTypes
- * <dt>Warning:</dd>
- * <p>Passing a null nsURI will replace the internal schema model
- * held by WSDLTypes by the model passed as an argument.</p>
- */
- public void addSchemaModel(String nsURI, JBossXSModel schema)
+ void setWSDLDefintiions(WSDLDefinitions parent)
{
- if(nsURI == null)
- {
- log.debug("nsURI passed to addSchemaModel is null. Replacing Schema Model");
- schemaModel = schema;
- }
- else
- schemaModel.merge(schema);
+ wsdlDefinitions = parent;
}
-
- /**
- * Return the global Schema Model
- * @return
- */
- public JBossXSModel getSchemaModel()
- {
- return schemaModel;
- }
-
- /** Get the xmlType from a given element xmlName
- */
- public QName getXMLType(QName xmlName)
- {
- QName xmlType = null;
- String nsURI = xmlName.getNamespaceURI();
- String localPart = xmlName.getLocalPart();
- XSElementDeclaration xsel = schemaModel.getElementDeclaration(localPart, nsURI);
- if (xsel != null)
- {
- XSTypeDefinition xstype = xsel.getTypeDefinition();
- if (xstype == null)
- throw new WSException("Cannot obtain XSTypeDefinition for: " + xmlName);
-
- if (xstype.getAnonymous() == false)
- {
- xmlType = new QName(xstype.getNamespace(), xstype.getName());
- }
- else
- {
- xmlType = new QName(xstype.getNamespace(), ">" + localPart);
- }
- }
- return xmlType;
- }
-
- public String toString()
- {
- StringBuilder buffer = new StringBuilder("WSDLTypes:\n");
- buffer.append(schemaModel != null ? schemaModel.serialize() : "<schema/>");
- return buffer.toString();
- }
}
Modified: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLUtils.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLUtils.java 2006-07-13 13:30:04 UTC (rev 599)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLUtils.java 2006-07-14 02:53:23 UTC (rev 600)
@@ -67,10 +67,12 @@
import javax.xml.rpc.holders.StringHolder;
import org.apache.xerces.xs.XSComplexTypeDefinition;
+import org.apache.xerces.xs.XSModel;
import org.apache.xerces.xs.XSTypeDefinition;
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
import org.jboss.ws.jaxrpc.ParameterWrapping;
+import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
import org.jboss.ws.utils.HolderUtils;
import org.jboss.xb.binding.Util;
@@ -766,6 +768,23 @@
return Constants.DOCUMENT_LITERAL;
}
+ public static JBossXSModel getSchemaModel(WSDLTypes types)
+ {
+ if (types instanceof XSModelTypes)
+ return ((XSModelTypes) types).getSchemaModel();
+
+ throw new WSException("WSDLTypes is not an XSModelTypes");
+ }
+
+ public static void addSchemaModel(WSDLTypes types, String namespace, JBossXSModel model)
+ {
+ if (! (types instanceof XSModelTypes))
+ throw new WSException("WSDLTypes is not an XSModelTypes");
+
+ XSModelTypes modelTypes = (XSModelTypes) types;
+ modelTypes.addSchemaModel(namespace, model);
+ }
+
/**
* Checks whether the class is a standard jaxrpc holder
*
Modified: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLWriter.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLWriter.java 2006-07-13 13:30:04 UTC (rev 599)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLWriter.java 2006-07-14 02:53:23 UTC (rev 600)
@@ -109,7 +109,7 @@
protected void appendTypes(StringBuilder buffer)
{
buffer.append("<types>");
- JBossXSModel xsM = wsdl.getWsdlTypes().getSchemaModel();
+ JBossXSModel xsM = WSDLUtils.getSchemaModel(wsdl.getWsdlTypes());
String schema = xsM.serialize();
buffer.append(schema);
buffer.append("</types>");
Added: trunk/src/main/java/org/jboss/ws/metadata/wsdl/XSModelTypes.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/wsdl/XSModelTypes.java 2006-07-13 13:30:04 UTC (rev 599)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/XSModelTypes.java 2006-07-14 02:53:23 UTC (rev 600)
@@ -0,0 +1,110 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.ws.metadata.wsdl;
+
+import javax.xml.namespace.QName;
+
+import org.apache.xerces.xs.XSElementDeclaration;
+import org.apache.xerces.xs.XSTypeDefinition;
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
+
+/**
+ * A JBossXSModel based type definition.
+ *
+ * @author <a href="mailto:jason.greene at jboss.com">Jason T. Greene</a>
+ * @version $Revision:$
+ */
+public class XSModelTypes extends WSDLTypes
+{
+ private static final Logger log = Logger.getLogger(XSModelTypes.class);
+
+ private JBossXSModel schemaModel;
+
+ public XSModelTypes()
+ {
+ this.schemaModel = new JBossXSModel();
+ }
+
+ /**
+ * Add a schema model for a given namespaceURI
+ * @param nsURI the namespaceURI under which the model has been generated
+ * @param schema the Schema Model that needs to be added to existing schema
+ * model in WSDLTypes
+ * <dt>Warning:</dd>
+ * <p>Passing a null nsURI will replace the internal schema model
+ * held by WSDLTypes by the model passed as an argument.</p>
+ */
+ public void addSchemaModel(String nsURI, JBossXSModel schema)
+ {
+ if(nsURI == null)
+ {
+ log.debug("nsURI passed to addSchemaModel is null. Replacing Schema Model");
+ schemaModel = schema;
+ }
+ else
+ schemaModel.merge(schema);
+ }
+
+ /**
+ * Return the global Schema Model
+ * @return
+ */
+ public JBossXSModel getSchemaModel()
+ {
+ return schemaModel;
+ }
+
+ /** Get the xmlType from a given element xmlName
+ */
+ public QName getXMLType(QName xmlName)
+ {
+ QName xmlType = null;
+ String nsURI = xmlName.getNamespaceURI();
+ String localPart = xmlName.getLocalPart();
+ XSElementDeclaration xsel = schemaModel.getElementDeclaration(localPart, nsURI);
+ if (xsel != null)
+ {
+ XSTypeDefinition xstype = xsel.getTypeDefinition();
+ if (xstype == null)
+ throw new WSException("Cannot obtain XSTypeDefinition for: " + xmlName);
+
+ if (xstype.getAnonymous() == false)
+ {
+ xmlType = new QName(xstype.getNamespace(), xstype.getName());
+ }
+ else
+ {
+ xmlType = new QName(xstype.getNamespace(), ">" + localPart);
+ }
+ }
+ return xmlType;
+ }
+
+ public String toString()
+ {
+ StringBuilder buffer = new StringBuilder("WSDLTypes:\n");
+ buffer.append(schemaModel != null ? schemaModel.serialize() : "<schema/>");
+ return buffer.toString();
+ }
+}
Property changes on: trunk/src/main/java/org/jboss/ws/metadata/wsdl/XSModelTypes.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: trunk/src/main/java/org/jboss/ws/tools/JavaToWSDL11.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/tools/JavaToWSDL11.java 2006-07-13 13:30:04 UTC (rev 599)
+++ trunk/src/main/java/org/jboss/ws/tools/JavaToWSDL11.java 2006-07-14 02:53:23 UTC (rev 600)
@@ -40,6 +40,8 @@
import org.jboss.ws.metadata.UnifiedMetaData;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.metadata.wsdl.WSDLUtils;
+import org.jboss.ws.metadata.wsdl.XSModelTypes;
import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
import org.jboss.ws.tools.helpers.JavaToWSDLHelper;
@@ -155,6 +157,7 @@
public WSDLDefinitions generate(Class endpoint)
{
WSDLDefinitions wsdl = new WSDLDefinitions();
+ wsdl.setWsdlTypes(new XSModelTypes());
wsdl.setWsdlNamespace(this.wsdlNamespace);
if(umd != null)
@@ -177,7 +180,7 @@
// This is somewhat of a hack
if (qualifiedElements)
{
- JBossXSModel schemaModel = wsdl.getWsdlTypes().getSchemaModel();
+ JBossXSModel schemaModel = WSDLUtils.getSchemaModel(wsdl.getWsdlTypes());
if (schemaModel != null)
schemaModel.setQualifiedElements(true);
}
Modified: trunk/src/main/java/org/jboss/ws/tools/WSDLToJava.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/tools/WSDLToJava.java 2006-07-13 13:30:04 UTC (rev 599)
+++ trunk/src/main/java/org/jboss/ws/tools/WSDLToJava.java 2006-07-14 02:53:23 UTC (rev 600)
@@ -270,7 +270,7 @@
WSDLInterfaceOperationInput in = ins[j];
QName xmlName = in.getElement();
QName xmlType = in.getXMLType();
- JBossXSModel xsmodel = wsdl.getWsdlTypes().getSchemaModel();
+ JBossXSModel xsmodel = WSDLUtils.getSchemaModel(wsdl.getWsdlTypes());
XSTypeDefinition xt = xsmodel.getTypeDefinition(xmlType.getLocalPart(),xmlType.getNamespaceURI());
boolean primitive = true;
@@ -317,7 +317,7 @@
buf.append(",");
QName xmlName = outs[m].getElement();
QName xmlType = outs[m].getXMLType();
- JBossXSModel xsmodel = wsdl.getWsdlTypes().getSchemaModel();
+ JBossXSModel xsmodel = WSDLUtils.getSchemaModel(wsdl.getWsdlTypes());
XSTypeDefinition xt = xsmodel.getTypeDefinition(xmlType.getLocalPart(),xmlType.getNamespaceURI());
boolean primitive = true;
@@ -349,7 +349,7 @@
//Get the main fault from the wsdlInterface
WSDLInterfaceFault intfFault = fault.getWsdlInterfaceOperation().getWsdlInterface().getFault(new NCName(faultqname.getLocalPart()));
- JBossXSModel xsmodel = wsdl.getWsdlTypes().getSchemaModel();
+ JBossXSModel xsmodel = WSDLUtils.getSchemaModel(wsdl.getWsdlTypes());
QName faultXMLName = intfFault.getXmlName();
QName faultXMLType = intfFault.getXmlType();
@@ -423,7 +423,7 @@
QName xmlType = out.getXMLType();
QName xmlName = out.getElement();
- JBossXSModel xsmodel = wsdl.getWsdlTypes().getSchemaModel();
+ JBossXSModel xsmodel = WSDLUtils.getSchemaModel(wsdl.getWsdlTypes());
XSTypeDefinition xt = xsmodel.getTypeDefinition(xmlType.getLocalPart(),xmlType.getNamespaceURI());
boolean primitive = true;
Modified: trunk/src/main/java/org/jboss/ws/tools/helpers/JavaToWSDLHelper.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/tools/helpers/JavaToWSDLHelper.java 2006-07-13 13:30:04 UTC (rev 599)
+++ trunk/src/main/java/org/jboss/ws/tools/helpers/JavaToWSDLHelper.java 2006-07-14 02:53:23 UTC (rev 600)
@@ -560,7 +560,7 @@
throw new WSException("XSModel is null");
WSDLTypes wsdlTypes = wsdl.getWsdlTypes();
- wsdlTypes.addSchemaModel(xmlType.getNamespaceURI(), xsModel);
+ WSDLUtils.addSchemaModel(wsdlTypes, xmlType.getNamespaceURI(), xsModel);
wsdl.registerNamespaceURI(xmlType.getNamespaceURI(), null);
//Also get any custom namespaces
@@ -640,7 +640,7 @@
{
WSDLTypes types = wsdl.getWsdlTypes();
String namespaceURI = xmlType.getNamespaceURI();
- JBossXSModel schemaModel = types.getSchemaModel();
+ JBossXSModel schemaModel = WSDLUtils.getSchemaModel(types);
XSTypeDefinition type;
if (Constants.NS_SCHEMA_XSD.equals(namespaceURI))
Modified: trunk/src/main/java/org/jboss/ws/tools/helpers/MappingFileGeneratorHelper.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/tools/helpers/MappingFileGeneratorHelper.java 2006-07-13 13:30:04 UTC (rev 599)
+++ trunk/src/main/java/org/jboss/ws/tools/helpers/MappingFileGeneratorHelper.java 2006-07-14 02:53:23 UTC (rev 600)
@@ -382,7 +382,7 @@
QName xmlName = fault.getXmlName();
WSDLTypes types = wsdlDefinitions.getWsdlTypes();
- JBossXSModel xsmodel = types.getSchemaModel();
+ JBossXSModel xsmodel = WSDLUtils.getSchemaModel(types);
XSTypeDefinition xt = xsmodel.getTypeDefinition(xmlType.getLocalPart(),xmlType.getNamespaceURI());
addJavaXMLTypeMap(xt, xmlName.getLocalPart(), jwm, true);
@@ -419,7 +419,7 @@
QName xmlType = part.getXMLType();
WSDLTypes types = wsdlDefinitions.getWsdlTypes();
- JBossXSModel xsmodel = types.getSchemaModel();
+ JBossXSModel xsmodel = WSDLUtils.getSchemaModel(types);
return xsmodel.getTypeDefinition(xmlType.getLocalPart(),xmlType.getNamespaceURI());
}
@@ -580,7 +580,7 @@
boolean primitive = true;
if (! isDocStyle())
{
- JBossXSModel xsmodel = wsdlDefinitions.getWsdlTypes().getSchemaModel();
+ JBossXSModel xsmodel = WSDLUtils.getSchemaModel(wsdlDefinitions.getWsdlTypes());
XSTypeDefinition xt = xsmodel.getTypeDefinition(xmlType.getLocalPart(),xmlType.getNamespaceURI());
XSElementDeclaration unwrapped = SchemaUtils.unwrapArrayType(xt);
Modified: trunk/src/main/java/org/jboss/ws/tools/helpers/ToolsHelper.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/tools/helpers/ToolsHelper.java 2006-07-13 13:30:04 UTC (rev 599)
+++ trunk/src/main/java/org/jboss/ws/tools/helpers/ToolsHelper.java 2006-07-14 02:53:23 UTC (rev 600)
@@ -158,7 +158,7 @@
// String seiName = endpointClass.getName();
// mgf.generateJavaSourceFileForRequestResponseStruct(new File(outDir),
// jwm.getServiceEndpointInterfaceMapping(seiName),
- // wsdl.getWsdlTypes().getSchemaModel(),j2wc.typeNamespace );
+ // WSDLUtils.getSchemaModel(wsdl.getWsdlTypes()),j2wc.typeNamespace );
// }
// }
Modified: trunk/src/test/java/org/jboss/test/ws/tools/config/globalconfig/GlobalConfigTestCase.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/tools/config/globalconfig/GlobalConfigTestCase.java 2006-07-13 13:30:04 UTC (rev 599)
+++ trunk/src/test/java/org/jboss/test/ws/tools/config/globalconfig/GlobalConfigTestCase.java 2006-07-14 02:53:23 UTC (rev 600)
@@ -30,6 +30,7 @@
import org.jboss.test.ws.tools.WSToolsTest;
import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.metadata.wsdl.WSDLUtils;
import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
import org.jboss.ws.tools.WSTools;
@@ -53,7 +54,7 @@
tools.generate(args);
WSDLDefinitions wsdl = getWSDLDefinitions(new File("tools/globalconfig/wsdl/MarshallService.wsdl"));
- JBossXSModel xsmodel = wsdl.getWsdlTypes().getSchemaModel();
+ JBossXSModel xsmodel = WSDLUtils.getSchemaModel(wsdl.getWsdlTypes());
assertNotNull(xsmodel.getNamespaceItem("http://jboss.org/types"));
}
Modified: trunk/src/test/java/org/jboss/test/ws/tools/validation/WSDL11Validator.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/tools/validation/WSDL11Validator.java 2006-07-13 13:30:04 UTC (rev 599)
+++ trunk/src/test/java/org/jboss/test/ws/tools/validation/WSDL11Validator.java 2006-07-14 02:53:23 UTC (rev 600)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.test.ws.tools.validation;
+package org.jboss.test.ws.tools.validation;
import java.util.StringTokenizer;
@@ -51,18 +51,18 @@
/**
* WSDL 11 Validator
* @author <mailto:Anil.Saldhana at jboss.org>Anil Saldhana
- * @since Jul 22, 2005
+ * @since Jul 22, 2005
*/
public class WSDL11Validator extends WSDLValidator
-{
+{
private static Logger log = Logger.getLogger(WSDL11Validator.class);
/**
- *
+ *
*/
public WSDL11Validator()
{
- super();
+ super();
}
/**
* Validates that two wsdl files represented by their WSDLDefinition objects
@@ -76,43 +76,43 @@
{
boolean bool = super.validate(wsdlExp,wsdlAct);
if( bool)
- bool = validateMessages(wsdlExp,wsdlAct);
+ bool = validateMessages(wsdlExp,wsdlAct);
if(!bool) log.error("Message Validation Failed");
return bool;
}
-
+
//**************************************************************************
//
// PRIVATE METHODS
//
//**************************************************************************
- public boolean validateMessages(WSDLDefinitions w1, WSDLDefinitions w2)
+ public boolean validateMessages(WSDLDefinitions w1, WSDLDefinitions w2)
throws JBossWSToolsException
- {
+ {
WSDLInterface[] intf1 = w1.getInterfaces();
WSDLInterface[] intf2 = w2.getInterfaces();
-
+
if(intf1.length != intf2.length)
throw new JBossWSToolsException("Number of portType operations in wsdl mismatch");
-
+
int len = intf1.length;
for (int i = 0; i < len; i++)
{
WSDLInterface i1 = intf1[i];
WSDLInterface i2 = intf2[i];
- WSDLInterfaceOperation[] ops1 = i1.getSortedOperations();
+ WSDLInterfaceOperation[] ops1 = i1.getSortedOperations();
WSDLInterfaceOperation[] ops2 = i2.getSortedOperations();
-
+
int lenOps = ops1.length;
for (int j = 0; j < lenOps; j++)
{
- if(validateMessage(ops1[j],ops2[j]) == false)
+ if(validateMessage(ops1[j],ops2[j]) == false)
{
log.error("Validation of Messages failed");
- throw new JBossWSToolsException("Validation of messages failed");
+ throw new JBossWSToolsException("Validation of messages failed");
}
}//end for
-
+
// Append the Faults
WSDLInterfaceFault[] faults1 = i1.getFaults();
WSDLInterfaceFault[] faults2 = i2.getFaults();
@@ -123,18 +123,18 @@
WSDLInterfaceFault flt2 = faults2[k];
QName elt = flt1.getXmlName();
QName elt2 = flt2.getXmlName();
- if(!(elt.getLocalPart().equals(elt2.getLocalPart()) &&
+ if(!(elt.getLocalPart().equals(elt2.getLocalPart()) &&
elt.getNamespaceURI().equals(elt2.getNamespaceURI())))
{
log.error("Faults do not match");
- throw new JBossWSToolsException("Validation of faults failed:"+elt.getLocalPart());
+ throw new JBossWSToolsException("Validation of faults failed:"+elt.getLocalPart());
}
-
- }
- }//end for
+
+ }
+ }//end for
return true;
}
-
+
//*********************************************************************************
//
// PRIVATE METHODS
@@ -144,10 +144,10 @@
{
WSDLUtils utils = WSDLUtils.getInstance();
if((o1 == null && o2 != null) || (o1 != null && o2 == null) )
- throw new IllegalStateException(utils.getJustClassName(c) + " does not match");
+ throw new IllegalStateException(utils.getJustClassName(c) + " does not match");
}
-
- private boolean validateMessage(WSDLInterfaceOperation op1,
+
+ private boolean validateMessage(WSDLInterfaceOperation op1,
WSDLInterfaceOperation op2 ) throws JBossWSToolsException
{
String op1name = op1.getName().toString();
@@ -157,7 +157,7 @@
if(op1name.equals(op2name) == false)
throw new JBossWSToolsException(op1name + " does not match with " + op2name);
if( intf1name.equals(intf2name) == false)
- throw new JBossWSToolsException(intf1name + " does not match with " + intf2name);
+ throw new JBossWSToolsException(intf1name + " does not match with " + intf2name);
WSDLInterfaceOperationInput[] inputs1 = op1.getInputs();
WSDLInterfaceOperationInput[] inputs2 = op2.getInputs();
@@ -166,15 +166,15 @@
{
WSDLInterfaceOperationInput input1 = inputs1[i];
WSDLInterfaceOperationInput input2 = inputs2[i];
- if(validateInputParts(input1, input2) == false)
+ if(validateInputParts(input1, input2) == false)
throw new JBossWSToolsException("Validation of input parts failed:" + input1.getElement());
- }
+ }
//Now the return type
WSDLInterfaceOperationOutput[] outputs1 = op1.getOutputs();
WSDLInterfaceOperationOutput[] outputs2 = op2.getOutputs();
int lenout = outputs1.length;
-
+
if(lenout != outputs2.length)
throw new JBossWSToolsException("Length of operation outputs do not match");
@@ -182,13 +182,13 @@
{
WSDLInterfaceOperationOutput out1 = outputs1[i];
WSDLInterfaceOperationOutput out2 = outputs2[i];
- if(validateOutputParts(out1, out2) == false)
+ if(validateOutputParts(out1, out2) == false)
throw new JBossWSToolsException("Validation of output parts failed:" + out1);
- }
+ }
return true;
}
- private boolean validateInputParts(WSDLInterfaceOperationInput in1,
+ private boolean validateInputParts(WSDLInterfaceOperationInput in1,
WSDLInterfaceOperationInput in2) throws JBossWSToolsException
{
//Check if there are any custom properties
@@ -206,11 +206,11 @@
return false;
if (zeroarg1 != null && "true".equals(zeroarg1))
return true;
-
+
//Check if there is a property
WSDLProperty wprop1 = in1.getProperty(Constants.WSDL_PROPERTY_RPC_XMLTYPE);
WSDLProperty wprop2 = in2.getProperty(Constants.WSDL_PROPERTY_RPC_XMLTYPE);
-
+
QName el1 = in1.getElement();
QName el2 = in2.getElement();
WSDLDefinitions w1 = in1.getWsdlOperation().getWsdlInterface().getWsdlDefinitions();
@@ -218,14 +218,14 @@
if(wprop1 != null) el1 = parseQName(wprop1.getValue(),w1);
if(wprop2 != null) el2 = parseQName(wprop2.getValue(),w2);
//Validate the QNames by using types
-
+
XSTypeDefinition x1 = getTypeDefinition(el1,w1);
- XSTypeDefinition x2 = getTypeDefinition(el2,w2);
+ XSTypeDefinition x2 = getTypeDefinition(el2,w2);
boolean bool = validateType(x1,x2);
-
+
return bool;
}
-
+
private boolean validateOutputParts(WSDLInterfaceOperationOutput out1,
WSDLInterfaceOperationOutput out2) throws JBossWSToolsException
{
@@ -239,41 +239,41 @@
if(prop1 != null ) voidreturn1 = prop1.getValue();
if(prop2 != null ) voidreturn2 = prop2.getValue();
- if(voidreturn1 != null &&
- voidreturn2 != null &&
+ if(voidreturn1 != null &&
+ voidreturn2 != null &&
voidreturn1.equals(voidreturn2) == false) return false;
if(voidreturn1 != null && "true".equals(voidreturn1)) return true;
-
- QName el1 = out1.getElement();
+
+ QName el1 = out1.getElement();
QName el2 = out2.getElement();
WSDLDefinitions w1 = out1.getWsdlOperation().getWsdlInterface().getWsdlDefinitions();
WSDLDefinitions w2 = out2.getWsdlOperation().getWsdlInterface().getWsdlDefinitions();
if( prop1 != null) el1 = parseQName( prop1.getValue(),w1);
if( prop2 != null) el2 = parseQName( prop2.getValue(),w2);
- //Validate the QNames by using types
+ //Validate the QNames by using types
XSTypeDefinition x1 = getTypeDefinition(el1,w1);
- XSTypeDefinition x2 = getTypeDefinition(el2,w2);
+ XSTypeDefinition x2 = getTypeDefinition(el2,w2);
boolean bool = validateType(x1,x2);
-
+
return bool;
}
-
+
private XSTypeDefinition getTypeDefinition(QName xmlType, WSDLDefinitions wsdl)
{
- WSDLTypes types = wsdl.getWsdlTypes();
- JBossXSModel xsmodel = types.getSchemaModel();
+ WSDLTypes types = wsdl.getWsdlTypes();
+ JBossXSModel xsmodel = WSDLUtils.getSchemaModel(types);
return xsmodel.getTypeDefinition(xmlType.getLocalPart(),xmlType.getNamespaceURI());
}
-
+
private boolean validateType(XSTypeDefinition x1, XSTypeDefinition x2) throws JBossWSToolsException
{
boolean bool = false;
if(x1==null && x2 == null) return true;
this.checkNullParametersInconsistency(x1,x2,XSTypeDefinition.class);
-
+
if(x1.getName().equals(x2.getName()) == false)
- throw new JBossWSToolsException("Validation of XSType failed:"
- + x1.getName() + ":" + x2.getName());
+ throw new JBossWSToolsException("Validation of XSType failed:"
+ + x1.getName() + ":" + x2.getName());
//TODO: Expand comparison of types to include attributes/elements
if(x1 instanceof XSComplexTypeDefinition &&
x2 instanceof XSComplexTypeDefinition)
@@ -284,7 +284,7 @@
}
return bool;
}
-
+
private QName parseQName( String qnamestr, WSDLDefinitions wsdl)
{
QName qn = null;
@@ -297,16 +297,16 @@
qn = new QName(ns,localpart,prefix);
}
return qn;
- }
-
- private boolean checkXSAttributesEquality(XSAttributeDeclaration x1,
+ }
+
+ private boolean checkXSAttributesEquality(XSAttributeDeclaration x1,
XSAttributeDeclaration x2)
{
boolean bool = true;
if(x1.getName().equals(x2.getName())) return false;
XSTypeDefinition xt1 = x1.getTypeDefinition();
XSTypeDefinition xt2 = x2.getTypeDefinition();
- this.checkNullParametersInconsistency(xt1,xt2,XSTypeDefinition.class);
+ this.checkNullParametersInconsistency(xt1,xt2,XSTypeDefinition.class);
if( xt1 != null && xt2 != null)
{
if(xt1.getName().equals(xt2.getName()) == false)
@@ -314,18 +314,18 @@
}
return bool;
}
-
+
private boolean validateXSComplexTypeDefinitions(XSComplexTypeDefinition xc1,
- XSComplexTypeDefinition xc2 )
- {
+ XSComplexTypeDefinition xc2 )
+ {
//First lets validate the attributes
boolean bool = true;
XSObjectList xobj1 = xc1.getAttributeUses();
XSObjectList xobj2 = xc2.getAttributeUses();
this.checkNullParametersInconsistency(xobj1,xobj2,XSObjectList.class);
- if(xobj1 == null && xobj2 == null)
+ if(xobj1 == null && xobj2 == null)
return true;
- if(xobj1.getLength() != xobj2.getLength())
+ if(xobj1.getLength() != xobj2.getLength())
return false;
int len = xobj1.getLength();
for(int i=0; i<len ; i++)
@@ -334,7 +334,7 @@
XSAttributeDeclaration xat2 = (XSAttributeDeclaration)xobj1.item(i);
bool = checkXSAttributesEquality(xat1,xat2);
}
-
+
//Validate the particles
XSParticle xspart1 = xc1.getParticle();
XSParticle xspart2 = xc2.getParticle();
@@ -342,9 +342,9 @@
XSTerm xt2 = xspart2.getTerm();
if(xt1 instanceof XSModelGroup && xt2 instanceof XSModelGroup)
bool = validateXSModelGroups((XSModelGroup)xt1, (XSModelGroup)xt2);
- return bool;
+ return bool;
}
-
+
private boolean validateXSModelGroups( XSModelGroup xm1, XSModelGroup xm2)
{
boolean bool = true;
@@ -374,12 +374,12 @@
}
return bool;
}
-
+
private boolean validateXSElementDeclaration(XSElementDeclaration xe1,
XSElementDeclaration xe2)
{
boolean bool = true;
- bool = (xe1.getName().equals(xe2.getName()));
+ bool = (xe1.getName().equals(xe2.getName()));
if(bool)
{
//Check if there are types
@@ -387,8 +387,8 @@
XSTypeDefinition xt2 = xe2.getTypeDefinition();
bool = xt1.getName().equals(xt2.getName());
String ns1 = xt1.getNamespace();
- String ns2 = xt2.getNamespace();
-
+ String ns2 = xt2.getNamespace();
+
/**
* Ignore the namespace if it is wscompile generated arrays namespace
*/
@@ -396,7 +396,7 @@
bool = xt1.getNamespace().equals(xt2.getNamespace());
//TODO:take care of enclosing CT Definition
}
-
+
return bool;
}
}
Modified: trunk/src/test/java/org/jboss/test/ws/tools/validation/WSDLValidator.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/tools/validation/WSDLValidator.java 2006-07-13 13:30:04 UTC (rev 599)
+++ trunk/src/test/java/org/jboss/test/ws/tools/validation/WSDLValidator.java 2006-07-14 02:53:23 UTC (rev 600)
@@ -36,6 +36,7 @@
import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperation;
import org.jboss.ws.metadata.wsdl.WSDLService;
import org.jboss.ws.metadata.wsdl.WSDLTypes;
+import org.jboss.ws.metadata.wsdl.WSDLUtils;
import org.jboss.ws.tools.exceptions.JBossWSToolsException;
/**
@@ -80,7 +81,7 @@
}
catch (IOException e)
{
- log.error("Error validating types:",e);
+ log.error("Error validating types:",e);
}
validateInterfaces();
validateBindings();
@@ -130,7 +131,7 @@
errorList.add("types cannot be null");
if (Constants.NS_WSDL20.equals(wsdl.getWsdlNamespace()))
{
- if (types.getSchemaModel() == null)
+ if (WSDLUtils.getSchemaModel(types) == null)
errorList.add("schema model is null");
}
}
Modified: trunk/src/test/java/org/jboss/test/ws/tools/xmlschema/WSDLTypesTestCase.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/tools/xmlschema/WSDLTypesTestCase.java 2006-07-13 13:30:04 UTC (rev 599)
+++ trunk/src/test/java/org/jboss/test/ws/tools/xmlschema/WSDLTypesTestCase.java 2006-07-14 02:53:23 UTC (rev 600)
@@ -24,14 +24,15 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.ws.jaxrpc.LiteralTypeMapping;
import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.metadata.wsdl.WSDLTypes;
-import org.jboss.ws.tools.WSDLToJava;
+import org.jboss.ws.metadata.wsdl.WSDLTypes;
+import org.jboss.ws.metadata.wsdl.WSDLUtils;
+import org.jboss.ws.tools.WSDLToJava;
import org.jboss.ws.tools.interfaces.WSDLToJavaIntf;
import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
import javax.xml.namespace.QName;
import java.io.File;
-import java.io.IOException;
+import java.io.IOException;
/**
* Test case that tests the WSDLTypes
@@ -46,7 +47,7 @@
File wsdlFile = new File("resources/wsdlfixture/" + filename);
WSDLTypes types = null;
try
- {
+ {
WSDLToJavaIntf wsdljava = new WSDLToJava();
wsdljava.setTypeMapping(new LiteralTypeMapping());
WSDLDefinitions wsdl = wsdljava.convertWSDL2Java(wsdlFile.toURL());
@@ -70,7 +71,7 @@
File wsdlFile = new File("resources/wsdlfixture/" + filename);
WSDLTypes types = null;
try
- {
+ {
WSDLToJavaIntf wsdljava = new WSDLToJava();
wsdljava.setTypeMapping(new LiteralTypeMapping());
WSDLDefinitions wsdl = wsdljava.convertWSDL2Java(wsdlFile.toURL());
@@ -82,7 +83,7 @@
}
assertNotNull("WSDLTypes is null?", types);
- JBossXSModel xsmodel = types.getSchemaModel();
+ JBossXSModel xsmodel = WSDLUtils.getSchemaModel(types);
assertNotNull("XSModel is null?",xsmodel);
//List xsmodelList = types.getAllSchemaModels();
//assertNotNull("Schema List is null?", xsmodelList);
Modified: trunk/src/test/java/org/jboss/test/ws/wsdl11/MicrosoftGeneratedWSDLTestCase.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/wsdl11/MicrosoftGeneratedWSDLTestCase.java 2006-07-13 13:30:04 UTC (rev 599)
+++ trunk/src/test/java/org/jboss/test/ws/wsdl11/MicrosoftGeneratedWSDLTestCase.java 2006-07-14 02:53:23 UTC (rev 600)
@@ -27,6 +27,7 @@
import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
import org.jboss.ws.metadata.wsdl.WSDLDefinitionsFactory;
import org.jboss.ws.metadata.wsdl.WSDLTypes;
+import org.jboss.ws.metadata.wsdl.WSDLUtils;
/**
* Tests WSDL11Reader ability to parse WSDL Files
@@ -35,19 +36,19 @@
* @author <mailto:Anil.Saldhana at jboss.org>Anil Saldhana
* @since November 10, 2005
*/
-public class MicrosoftGeneratedWSDLTestCase extends JBossWSTest
+public class MicrosoftGeneratedWSDLTestCase extends JBossWSTest
{
public void testBaseRpcLit() throws Exception
{
File wsdlFile = new File("resources/wsdl11/microsoft-interop/rpclit/BaseTypesRpcLit.wsdl");
assertTrue(wsdlFile.exists());
-
-
+
+
WSDLDefinitionsFactory factory = WSDLDefinitionsFactory.newInstance();
WSDLDefinitions wsdlDefinitions = factory.parse(wsdlFile.toURL());
-
+
// check if the schema has been extracted
WSDLTypes wsdlTypes = wsdlDefinitions.getWsdlTypes();
- assertNotNull(wsdlTypes.getSchemaModel());
+ assertNotNull(WSDLUtils.getSchemaModel(wsdlTypes));
}
}
Modified: trunk/src/test/java/org/jboss/test/ws/wsdl11/MultiSchemaTestCase.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/wsdl11/MultiSchemaTestCase.java 2006-07-13 13:30:04 UTC (rev 599)
+++ trunk/src/test/java/org/jboss/test/ws/wsdl11/MultiSchemaTestCase.java 2006-07-14 02:53:23 UTC (rev 600)
@@ -21,13 +21,14 @@
*/
package org.jboss.test.ws.wsdl11;
+import java.io.File;
+
import org.jboss.test.ws.JBossWSTest;
import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
import org.jboss.ws.metadata.wsdl.WSDLDefinitionsFactory;
import org.jboss.ws.metadata.wsdl.WSDLTypes;
+import org.jboss.ws.metadata.wsdl.WSDLUtils;
-import java.io.File;
-
/**
* Test the XSModel, and how it handles multiple schemas
*
@@ -46,8 +47,8 @@
// check if all schemas have been extracted
WSDLTypes wsdlTypes = wsdlDefinitions.getWsdlTypes();
- Object o1 = wsdlTypes.getSchemaModel().getNamespaceItem("http://math.java/jaws");
- Object o2 = wsdlTypes.getSchemaModel().getNamespaceItem("http://org.jboss.ws/marshall/rpclit/types");
+ Object o1 = WSDLUtils.getSchemaModel(wsdlTypes).getNamespaceItem("http://math.java/jaws");
+ Object o2 = WSDLUtils.getSchemaModel(wsdlTypes).getNamespaceItem("http://org.jboss.ws/marshall/rpclit/types");
assertNotNull("NS item for 'http://math.java/jaws' not found", o1);
assertNotNull("NS item for 'http://org.jboss.ws/marshall/rpclit/types' not found", o2);
Modified: trunk/src/test/java/org/jboss/test/ws/wsdl11/WSDL11TestCase.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/wsdl11/WSDL11TestCase.java 2006-07-13 13:30:04 UTC (rev 599)
+++ trunk/src/test/java/org/jboss/test/ws/wsdl11/WSDL11TestCase.java 2006-07-14 02:53:23 UTC (rev 600)
@@ -50,7 +50,7 @@
// check if the schema has been extracted
WSDLTypes wsdlTypes = wsdlDefinitions.getWsdlTypes();
- assertNotNull(wsdlTypes.getSchemaModel());
+ assertNotNull(WSDLUtils.getSchemaModel(wsdlTypes));
// check the echoString operation
WSDLInterfaceOperation wsdlOperation = wsdlInterface.getOperation(new NCName("echoString"));
@@ -96,7 +96,7 @@
// check if the schema has been extracted
WSDLTypes wsdlTypes = wsdlDefinitions.getWsdlTypes();
- assertNotNull(wsdlTypes.getSchemaModel());
+ assertNotNull(WSDLUtils.getSchemaModel(wsdlTypes));
// check the echoString operation
WSDLInterfaceOperation wsdlOperation = wsdlInterface.getOperation(new NCName("echoString"));
@@ -132,7 +132,7 @@
// check if the schema has been extracted
WSDLTypes wsdlTypes = wsdlDefinitions.getWsdlTypes();
- assertNotNull(wsdlTypes.getSchemaModel());
+ assertNotNull(WSDLUtils.getSchemaModel(wsdlTypes));
// check the echoString operation
WSDLInterfaceOperation wsdlOperation = wsdlInterface.getOperation(new NCName("echoString"));
Modified: trunk/src/test/java/org/jboss/test/ws/wsdl11/WSDLTypesTestCase.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/wsdl11/WSDLTypesTestCase.java 2006-07-13 13:30:04 UTC (rev 599)
+++ trunk/src/test/java/org/jboss/test/ws/wsdl11/WSDLTypesTestCase.java 2006-07-14 02:53:23 UTC (rev 600)
@@ -27,6 +27,7 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
import org.jboss.ws.metadata.wsdl.WSDLDefinitionsFactory;
+import org.jboss.ws.metadata.wsdl.WSDLUtils;
import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
/**
@@ -45,7 +46,7 @@
WSDLDefinitionsFactory factory = WSDLDefinitionsFactory.newInstance();
WSDLDefinitions wsdlDefinitions = factory.parse(wsdlLocation.toURL());
- JBossXSModel xsModel = wsdlDefinitions.getWsdlTypes().getSchemaModel();
+ JBossXSModel xsModel = WSDLUtils.getSchemaModel(wsdlDefinitions.getWsdlTypes());
XSTypeDefinition typeDefinition = xsModel.getTypeDefinition("SimpleUserType", "http://org.jboss.ws/jaxrpc/types");
assertNotNull(typeDefinition);
}
@@ -58,7 +59,7 @@
WSDLDefinitionsFactory factory = WSDLDefinitionsFactory.newInstance();
WSDLDefinitions wsdlDefinitions = factory.parse(wsdlLocation.toURL());
- JBossXSModel xsModel = wsdlDefinitions.getWsdlTypes().getSchemaModel();
+ JBossXSModel xsModel = WSDLUtils.getSchemaModel(wsdlDefinitions.getWsdlTypes());
XSTypeDefinition typeDefinition = xsModel.getTypeDefinition("SimpleUserType", "http://org.jboss.ws/jaxrpc/types");
assertNotNull(typeDefinition);
}
Modified: trunk/src/test/java/org/jboss/test/ws/wsdl11/WSDLWithAnonTypesTestCase.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/wsdl11/WSDLWithAnonTypesTestCase.java 2006-07-13 13:30:04 UTC (rev 599)
+++ trunk/src/test/java/org/jboss/test/ws/wsdl11/WSDLWithAnonTypesTestCase.java 2006-07-14 02:53:23 UTC (rev 600)
@@ -34,6 +34,7 @@
import org.jboss.test.ws.tools.WSToolsTest;
import org.jboss.util.xml.DOMUtils;
import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.metadata.wsdl.WSDLUtils;
import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
import org.w3c.dom.Element;
@@ -54,7 +55,7 @@
WSDLDefinitions wsdl = this.getWSDLDefinitions(file);
assertNotNull("Parsed WSDLDefinitions is null?", wsdl);
// Now get the XSModel
- JBossXSModel xsmodel = wsdl.getWsdlTypes().getSchemaModel();
+ JBossXSModel xsmodel = WSDLUtils.getSchemaModel(wsdl.getWsdlTypes());
assertNotNull("Schema Model is null?", xsmodel);
// Lets get the global element called "root"
More information about the jboss-svn-commits
mailing list