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 2009/02/19 15:19:11 UTC
svn commit: r745879 [1/4] - in /cxf/branches/2.1.x-fixes: ./
api/src/main/java/org/apache/cxf/
api/src/main/java/org/apache/cxf/service/model/
api/src/main/java/org/apache/cxf/wsdl/ api/src/test/java/org/apache/cxf/
common/common/src/main/java/org/apac...
Author: bimargulies
Date: Thu Feb 19 14:18:49 2009
New Revision: 745879
URL: http://svn.apache.org/viewvc?rev=745879&view=rev
Log:
Merged revisions 688593,725710,731402,731406,731681,732020,732059-732060,732106,732124,732168 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r688593 | bimargulies | 2008-08-24 21:10:23 -0400 (Sun, 24 Aug 2008) | 3 lines
Add unit test for copying part attributes from Aegis to parts. Fix Aegis array types to
have min-max instead of max-min in the names.
........
r725710 | bimargulies | 2008-12-11 10:27:27 -0500 (Thu, 11 Dec 2008) | 2 lines
Bump XML Schema dependency to 1.4.3. Alphabetize versions for easier maintenance,.
........
r731402 | bimargulies | 2009-01-04 20:32:52 -0500 (Sun, 04 Jan 2009) | 2 lines
Remove all JAXEN dependencies.
........
r731406 | bimargulies | 2009-01-04 20:49:52 -0500 (Sun, 04 Jan 2009) | 2 lines
Put Jaxen version management back until the other consumers are resolved.
........
r731681 | bimargulies | 2009-01-05 15:10:42 -0500 (Mon, 05 Jan 2009) | 2 lines
Herd a bunch of XmlSchema utilities into one place.
........
r732020 | bimargulies | 2009-01-06 12:43:36 -0500 (Tue, 06 Jan 2009) | 2 lines
Disentangle unit tests, and especially the soap-encoding support code, from JDOM. Sadly, there's more work where this came from.
........
r732059 | bimargulies | 2009-01-06 14:01:46 -0500 (Tue, 06 Jan 2009) | 2 lines
More JDOM reduction.
........
r732060 | bimargulies | 2009-01-06 14:02:20 -0500 (Tue, 06 Jan 2009) | 2 lines
Clean unused import.
........
r732106 | bimargulies | 2009-01-06 15:41:56 -0500 (Tue, 06 Jan 2009) | 2 lines
Make JDOM entirely optional in Aegis.
........
r732124 | bimargulies | 2009-01-06 16:20:21 -0500 (Tue, 06 Jan 2009) | 2 lines
Turn off not quite working test.
........
r732168 | bimargulies | 2009-01-06 18:12:26 -0500 (Tue, 06 Jan 2009) | 3 lines
Fix schema generation problem with missing import in Aegis. Remove JDOM usage from Javascript Aegis test
rather than track down very muddy change in behavior from old world. Remove the unwanted ant tasks.
........
Added:
cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/common/WSDLConstants.java
- copied unchanged from r732020, cxf/trunk/common/common/src/main/java/org/apache/cxf/common/WSDLConstants.java
cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/common/xmlschema/Messages.properties
- copied unchanged from r732020, cxf/trunk/common/common/src/main/java/org/apache/cxf/common/xmlschema/Messages.properties
cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/common/xmlschema/UnsupportedConstruct.java
- copied unchanged from r732020, cxf/trunk/common/common/src/main/java/org/apache/cxf/common/xmlschema/UnsupportedConstruct.java
cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/common/xmlschema/XmlSchemaUtils.java
- copied, changed from r732020, cxf/trunk/common/common/src/main/java/org/apache/cxf/common/xmlschema/XmlSchemaUtils.java
cxf/branches/2.1.x-fixes/common/common/src/resources/
- copied from r732020, cxf/trunk/common/common/src/resources/
cxf/branches/2.1.x-fixes/common/common/src/resources/META-INF/
- copied from r732020, cxf/trunk/common/common/src/resources/META-INF/
cxf/branches/2.1.x-fixes/common/common/src/resources/META-INF/spring.schemas
- copied unchanged from r732020, cxf/trunk/common/common/src/resources/META-INF/spring.schemas
cxf/branches/2.1.x-fixes/common/common/src/resources/schemas/
- copied from r732020, cxf/trunk/common/common/src/resources/schemas/
cxf/branches/2.1.x-fixes/common/common/src/resources/schemas/configuration/
- copied from r732020, cxf/trunk/common/common/src/resources/schemas/configuration/
cxf/branches/2.1.x-fixes/common/common/src/resources/schemas/configuration/cxf-beans.xsd
- copied unchanged from r732020, cxf/trunk/common/common/src/resources/schemas/configuration/cxf-beans.xsd
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/standalone/SchemaAddinsTest.java
- copied unchanged from r731406, cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/standalone/SchemaAddinsTest.java
Removed:
cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/wsdl/WSDLConstants.java
cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/common/xmlschema/XmlSchemaTools.java
cxf/branches/2.1.x-fixes/common/common/src/main/resources/
cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/XmlSchemaUtils.java
Modified:
cxf/branches/2.1.x-fixes/ (props changed)
cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/NSManager.java
cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/service/model/SchemaInfo.java
cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java
cxf/branches/2.1.x-fixes/api/src/test/java/org/apache/cxf/NSManagerTest.java
cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/MapNamespaceContext.java
cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/XPathUtils.java
cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/DepthXMLStreamReader.java
cxf/branches/2.1.x-fixes/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingOutSetupInterceptor.java
cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/model/SoapBindingInfo.java
cxf/branches/2.1.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapBindingFactoryTest.java
cxf/branches/2.1.x-fixes/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLFormatValidator.java
cxf/branches/2.1.x-fixes/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/wsdl11/HttpAddressPlugin.java
cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFTest.java
cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/test/XPathAssert.java
cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java
cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/pom.xml
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/AegisContext.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/AbstractTypeCreator.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/DefaultTypeMapping.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/Type.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/TypeUtil.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/XMLTypeCreator.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ArrayType.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanType.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanTypeInfo.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ObjectType.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/XMLBeanTypeInfo.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/collection/MapType.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/encoded/ArrayTypeInfo.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/encoded/SoapArrayType.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/encoded/SoapRefType.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/EnumType.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/mtom/AbstractXOPType.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/util/NamespaceHelper.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/util/stax/JDOMNamespaceContext.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/util/stax/JDOMStreamWriter.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/jdom/JDOMWriter.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/stax/ElementWriter.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/AbstractAegisTest.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/custom/CustomMappingTest.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/integration/ParameterMappingTest.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/integration/WrappedTest.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/ArrayService.aegis.xml
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/basic/BeanTest.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/basic/QualificationTest.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/AbstractEncodedTest.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/ArrayTypeInfoTest.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/SoapArrayTypeTest.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/StructTypeTest.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/AnnotatedTypeTest.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/EnumTypeTest.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbTypeTest.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireTypeTest.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/streams/XMLStreamReaderMappingTest.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/resources/org/apache/cxf/aegis/type/aegisOptionsTestBeans.xml
cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
cxf/branches/2.1.x-fixes/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WeatherService2Test.java
cxf/branches/2.1.x-fixes/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/XMLBeansServiceTest.java
cxf/branches/2.1.x-fixes/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/rpc/WeatherServiceRPCLitTest.java
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/pom.xml
cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalMessageImpl.java
cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/DispatchOutDatabindingInterceptor.java
cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/ProviderImpl.java
cxf/branches/2.1.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/AttributeInfo.java
cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptUtils.java
cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/NamespacePrefixAccumulator.java
cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/ParticleInfo.java
cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java
cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
cxf/branches/2.1.x-fixes/rt/javascript/src/test/java/org/apache/cxf/javascript/AegisTest.java
cxf/branches/2.1.x-fixes/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AegisService.java
cxf/branches/2.1.x-fixes/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AegisServiceImpl.java
cxf/branches/2.1.x-fixes/systests/pom.xml
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/aegis/AegisClientServerTest.java
cxf/branches/2.1.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/util/SOAPBindingUtil.java
cxf/branches/2.1.x-fixes/tools/common/src/test/java/org/apache/cxf/tools/common/WSDLVersionTest.java
cxf/branches/2.1.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/WSDLSchemaManager.java
cxf/branches/2.1.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2js/processor/JavaToJSProcessor.java
cxf/branches/2.1.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/WSDLGeneratorFactory.java
cxf/branches/2.1.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/JavaToWSDLProcessor.java
cxf/branches/2.1.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/generator/WSDLGeneratorFactoryTest.java
cxf/branches/2.1.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
cxf/branches/2.1.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/Stax2DOM.java
cxf/branches/2.1.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/ValidatorUtil.java
cxf/branches/2.1.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java
cxf/branches/2.1.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/model/XBinding.java
cxf/branches/2.1.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/model/XDef.java
cxf/branches/2.1.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/model/XFault.java
cxf/branches/2.1.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/model/XInput.java
cxf/branches/2.1.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/model/XMessage.java
cxf/branches/2.1.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/model/XOperation.java
cxf/branches/2.1.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/model/XOutput.java
cxf/branches/2.1.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/model/XPort.java
cxf/branches/2.1.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/model/XPortType.java
cxf/branches/2.1.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/model/XService.java
cxf/branches/2.1.x-fixes/tools/validator/src/test/java/org/apache/cxf/tools/validator/internal/model/XNodeTest.java
cxf/branches/2.1.x-fixes/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
cxf/branches/2.1.x-fixes/tools/wsdlto/frontend/javascript/src/main/java/org/apache/cxf/tools/wsdlto/javascript/JavaScriptContainer.java
cxf/branches/2.1.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessor.java
cxf/branches/2.1.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToSoapProcessor.java
cxf/branches/2.1.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToXMLProcessor.java
cxf/branches/2.1.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/XSDToWSDLProcessor.java
cxf/branches/2.1.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/address/SoapAddress.java
cxf/branches/2.1.x-fixes/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToSoapProcessorTest.java
Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/NSManager.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/NSManager.java?rev=745879&r1=745878&r2=745879&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/NSManager.java (original)
+++ cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/NSManager.java Thu Feb 19 14:18:49 2009
@@ -25,8 +25,8 @@
import java.util.Map;
import java.util.Set;
+import org.apache.cxf.common.WSDLConstants;
import org.apache.cxf.ws.addressing.JAXWSAConstants;
-import org.apache.cxf.wsdl.WSDLConstants;
/***
* Only public/static/final fields can be resolved
Modified: cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/service/model/SchemaInfo.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/service/model/SchemaInfo.java?rev=745879&r1=745878&r2=745879&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/service/model/SchemaInfo.java (original)
+++ cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/service/model/SchemaInfo.java Thu Feb 19 14:18:49 2009
@@ -25,13 +25,14 @@
import org.w3c.dom.Document;
import org.w3c.dom.Element;
+import org.apache.cxf.common.WSDLConstants;
+import org.apache.cxf.common.xmlschema.XmlSchemaConstants;
import org.apache.cxf.helpers.XMLUtils;
import org.apache.cxf.io.CachedOutputStream;
-import org.apache.cxf.wsdl.WSDLConstants;
import org.apache.ws.commons.schema.XmlSchema;
import org.apache.ws.commons.schema.XmlSchemaElement;
import org.apache.ws.commons.schema.XmlSchemaForm;
-
+import org.apache.ws.commons.schema.utils.NamespaceMap;
public final class SchemaInfo extends AbstractPropertiesHolder {
@@ -76,7 +77,16 @@
CachedOutputStream cout = new CachedOutputStream();
XmlSchema sch = getSchema();
synchronized (sch) {
- getSchema().write(cout);
+ XmlSchema schAgain = getSchema();
+ // XML Schema blows up when the context is null as opposed to empty.
+ // Some unit tests really want to see 'tns:'.
+ if (schAgain.getNamespaceContext() == null) {
+ NamespaceMap nsMap = new NamespaceMap();
+ nsMap.add("xsd", XmlSchemaConstants.XSD_NAMESPACE_URI);
+ nsMap.add("tns", schAgain.getTargetNamespace());
+ schAgain.setNamespaceContext(nsMap);
+ }
+ schAgain.write(cout);
}
Document sdoc = null;
try {
Modified: cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java?rev=745879&r1=745878&r2=745879&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java (original)
+++ cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java Thu Feb 19 14:18:49 2009
@@ -65,6 +65,7 @@
import org.xml.sax.InputSource;
import org.apache.cxf.Bus;
+import org.apache.cxf.common.WSDLConstants;
import org.apache.cxf.common.i18n.Message;
import org.apache.cxf.common.logging.LogUtils;
import org.apache.cxf.common.util.StringUtils;
Modified: cxf/branches/2.1.x-fixes/api/src/test/java/org/apache/cxf/NSManagerTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/api/src/test/java/org/apache/cxf/NSManagerTest.java?rev=745879&r1=745878&r2=745879&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/api/src/test/java/org/apache/cxf/NSManagerTest.java (original)
+++ cxf/branches/2.1.x-fixes/api/src/test/java/org/apache/cxf/NSManagerTest.java Thu Feb 19 14:18:49 2009
@@ -19,8 +19,8 @@
package org.apache.cxf;
+import org.apache.cxf.common.WSDLConstants;
import org.apache.cxf.ws.addressing.JAXWSAConstants;
-import org.apache.cxf.wsdl.WSDLConstants;
import org.junit.Assert;
import org.junit.Test;
Copied: cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/common/xmlschema/XmlSchemaUtils.java (from r732020, cxf/trunk/common/common/src/main/java/org/apache/cxf/common/xmlschema/XmlSchemaUtils.java)
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/common/xmlschema/XmlSchemaUtils.java?p2=cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/common/xmlschema/XmlSchemaUtils.java&p1=cxf/trunk/common/common/src/main/java/org/apache/cxf/common/xmlschema/XmlSchemaUtils.java&r1=732020&r2=745879&rev=745879&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/common/xmlschema/XmlSchemaUtils.java (original)
+++ cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/common/xmlschema/XmlSchemaUtils.java Thu Feb 19 14:18:49 2009
@@ -202,7 +202,9 @@
*/
public static void addImportIfNeeded(XmlSchema schema, String namespaceUri) {
// no need to import nothing or the XSD schema.
- if ("".equals(namespaceUri) || XmlSchemaConstants.XSD_NAMESPACE_URI.equals(namespaceUri)) {
+ if ("".equals(namespaceUri)
+ || XmlSchemaConstants.XSD_NAMESPACE_URI.equals(namespaceUri)
+ || schema.getTargetNamespace().equals(namespaceUri)) {
return;
}
Modified: cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/MapNamespaceContext.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/MapNamespaceContext.java?rev=745879&r1=745878&r2=745879&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/MapNamespaceContext.java (original)
+++ cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/MapNamespaceContext.java Thu Feb 19 14:18:49 2009
@@ -55,11 +55,16 @@
}
public String getNamespaceURI(String prefix) {
+ if (null == prefix) {
+ throw new IllegalArgumentException("Null prefix to getNamespacePrefix");
+ }
+ // if we have a target node, facts-on-the-ground in its parent tree take precedence.
if (targetNode != null) {
- String s = targetNode.lookupNamespaceURI(prefix);
- if (prefix != null && s != null) {
- namespaces.put(prefix, s);
+ String uri = DOMUtils.getNamespace(targetNode, prefix);
+ if (uri != null) {
+ return uri;
}
+
}
return namespaces.get(prefix);
}
Modified: cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/XPathUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/XPathUtils.java?rev=745879&r1=745878&r2=745879&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/XPathUtils.java (original)
+++ cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/XPathUtils.java Thu Feb 19 14:18:49 2009
@@ -29,11 +29,11 @@
import org.w3c.dom.Node;
public class XPathUtils {
-
- XPath xpath;
+ private static final XPathFactory FACTORY = XPathFactory.newInstance();
+ private XPath xpath;
public XPathUtils() {
- xpath = XPathFactory.newInstance().newXPath();
+ xpath = FACTORY.newXPath();
}
public XPathUtils(final Map<String, String> ns) {
@@ -60,4 +60,8 @@
public boolean isExist(String xpathExpression, Node node, QName type) {
return getValue(xpathExpression, node, type) != null;
}
+
+ public static XPathFactory getFactory() {
+ return FACTORY;
+ }
}
Modified: cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/DepthXMLStreamReader.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/DepthXMLStreamReader.java?rev=745879&r1=745878&r2=745879&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/DepthXMLStreamReader.java (original)
+++ cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/DepthXMLStreamReader.java Thu Feb 19 14:18:49 2009
@@ -75,8 +75,8 @@
return reader.getAttributeValue(arg0);
}
- public String getAttributeValue(String arg0, String arg1) {
- return reader.getAttributeValue(arg0, arg1);
+ public String getAttributeValue(String namespace, String localName) {
+ return reader.getAttributeValue(namespace, localName);
}
public String getCharacterEncodingScheme() {
Modified: cxf/branches/2.1.x-fixes/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingOutSetupInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingOutSetupInterceptor.java?rev=745879&r1=745878&r2=745879&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingOutSetupInterceptor.java (original)
+++ cxf/branches/2.1.x-fixes/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingOutSetupInterceptor.java Thu Feb 19 14:18:49 2009
@@ -27,6 +27,7 @@
import org.apache.cxf.binding.http.HttpConstants;
import org.apache.cxf.binding.http.URIMapper;
import org.apache.cxf.binding.xml.interceptor.XMLMessageOutInterceptor;
+import org.apache.cxf.common.WSDLConstants;
import org.apache.cxf.endpoint.Endpoint;
import org.apache.cxf.helpers.DOMUtils;
import org.apache.cxf.helpers.MapNamespaceContext;
@@ -39,7 +40,6 @@
import org.apache.cxf.phase.Phase;
import org.apache.cxf.service.model.BindingOperationInfo;
import org.apache.cxf.staxutils.W3CDOMStreamWriter;
-import org.apache.cxf.wsdl.WSDLConstants;
public class DatabindingOutSetupInterceptor extends AbstractPhaseInterceptor<Message> {
private static final WrappedOutInterceptor WRAPPED_OUT = new WrappedOutInterceptor();
Modified: cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java?rev=745879&r1=745878&r2=745879&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java (original)
+++ cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java Thu Feb 19 14:18:49 2009
@@ -57,6 +57,7 @@
import org.apache.cxf.binding.soap.model.SoapBodyInfo;
import org.apache.cxf.binding.soap.model.SoapHeaderInfo;
import org.apache.cxf.binding.soap.model.SoapOperationInfo;
+import org.apache.cxf.common.WSDLConstants;
import org.apache.cxf.common.util.StringUtils;
import org.apache.cxf.common.xmlschema.SchemaCollection;
import org.apache.cxf.endpoint.Endpoint;
@@ -87,7 +88,6 @@
import org.apache.cxf.transport.Destination;
import org.apache.cxf.transport.MessageObserver;
import org.apache.cxf.transport.MultipleEndpointObserver;
-import org.apache.cxf.wsdl.WSDLConstants;
import org.apache.cxf.wsdl.WSDLManager;
import org.apache.cxf.wsdl11.WSDLServiceBuilder;
Modified: cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/model/SoapBindingInfo.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/model/SoapBindingInfo.java?rev=745879&r1=745878&r2=745879&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/model/SoapBindingInfo.java (original)
+++ cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/model/SoapBindingInfo.java Thu Feb 19 14:18:49 2009
@@ -22,12 +22,12 @@
import org.apache.cxf.binding.soap.Soap11;
import org.apache.cxf.binding.soap.Soap12;
import org.apache.cxf.binding.soap.SoapVersion;
+import org.apache.cxf.common.WSDLConstants;
import org.apache.cxf.service.model.BindingInfo;
import org.apache.cxf.service.model.BindingOperationInfo;
import org.apache.cxf.service.model.OperationInfo;
import org.apache.cxf.service.model.ServiceInfo;
-import org.apache.cxf.wsdl.WSDLConstants;
public class SoapBindingInfo extends BindingInfo {
private SoapVersion soapVersion;
Modified: cxf/branches/2.1.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapBindingFactoryTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapBindingFactoryTest.java?rev=745879&r1=745878&r2=745879&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapBindingFactoryTest.java (original)
+++ cxf/branches/2.1.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapBindingFactoryTest.java Thu Feb 19 14:18:49 2009
@@ -36,6 +36,7 @@
import org.apache.cxf.binding.soap.model.SoapBindingInfo;
import org.apache.cxf.binding.soap.model.SoapBodyInfo;
import org.apache.cxf.binding.soap.model.SoapOperationInfo;
+import org.apache.cxf.common.WSDLConstants;
import org.apache.cxf.service.model.BindingFaultInfo;
import org.apache.cxf.service.model.BindingInfo;
import org.apache.cxf.service.model.BindingMessageInfo;
@@ -43,7 +44,6 @@
import org.apache.cxf.service.model.MessagePartInfo;
import org.apache.cxf.service.model.ServiceInfo;
import org.apache.cxf.transport.DestinationFactoryManager;
-import org.apache.cxf.wsdl.WSDLConstants;
import org.apache.cxf.wsdl11.WSDLServiceBuilder;
import org.easymock.IMocksControl;
import org.junit.Assert;
Modified: cxf/branches/2.1.x-fixes/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLFormatValidator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLFormatValidator.java?rev=745879&r1=745878&r2=745879&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLFormatValidator.java (original)
+++ cxf/branches/2.1.x-fixes/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLFormatValidator.java Thu Feb 19 14:18:49 2009
@@ -27,13 +27,13 @@
import javax.xml.namespace.QName;
import org.apache.cxf.bindings.xformat.XMLBindingMessageFormat;
+import org.apache.cxf.common.WSDLConstants;
import org.apache.cxf.service.model.BindingInfo;
import org.apache.cxf.service.model.BindingOperationInfo;
import org.apache.cxf.service.model.OperationInfo;
import org.apache.cxf.service.model.ServiceInfo;
import org.apache.cxf.tools.validator.ServiceValidator;
-import org.apache.cxf.wsdl.WSDLConstants;
public class XMLFormatValidator extends ServiceValidator {
Modified: cxf/branches/2.1.x-fixes/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/wsdl11/HttpAddressPlugin.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/wsdl11/HttpAddressPlugin.java?rev=745879&r1=745878&r2=745879&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/wsdl11/HttpAddressPlugin.java (original)
+++ cxf/branches/2.1.x-fixes/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/wsdl11/HttpAddressPlugin.java Thu Feb 19 14:18:49 2009
@@ -25,9 +25,9 @@
import javax.wsdl.extensions.ExtensibilityElement;
import javax.wsdl.extensions.http.HTTPAddress;
+import org.apache.cxf.common.WSDLConstants;
import org.apache.cxf.tools.common.ToolConstants;
import org.apache.cxf.wsdl.AbstractWSDLPlugin;
-import org.apache.cxf.wsdl.WSDLConstants;
import org.apache.cxf.wsdl.http.AddressType;
public final class HttpAddressPlugin extends AbstractWSDLPlugin {
Modified: cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFTest.java?rev=745879&r1=745878&r2=745879&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFTest.java (original)
+++ cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFTest.java Thu Feb 19 14:18:49 2009
@@ -25,6 +25,7 @@
import java.util.Map;
import javax.wsdl.WSDLException;
+import javax.xml.namespace.NamespaceContext;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
@@ -34,6 +35,7 @@
import org.apache.cxf.BusException;
import org.apache.cxf.BusFactory;
import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.helpers.MapNamespaceContext;
import org.junit.After;
import org.junit.Assert;
@@ -156,6 +158,10 @@
public void addNamespace(String ns, String uri) {
testUtilities.addNamespace(ns, uri);
}
+
+ public NamespaceContext getNamespaceContext() {
+ return new MapNamespaceContext(testUtilities.getNamespaces());
+ }
public Map<String, String> getNamespaces() {
return testUtilities.getNamespaces();
Modified: cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/test/XPathAssert.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/test/XPathAssert.java?rev=745879&r1=745878&r2=745879&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/test/XPathAssert.java (original)
+++ cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/test/XPathAssert.java Thu Feb 19 14:18:49 2009
@@ -135,7 +135,10 @@
throws Exception {
Node result = (Node)createXPath(namespaces).evaluate(xpath, node, XPathConstants.NODE);
if (result == null) {
- throw new AssertionFailedError("No nodes were found for expression: " + xpath);
+ throw new AssertionFailedError("No nodes were found for expression: "
+ + xpath
+ + " in document "
+ + writeNodeToString(node));
}
String value2 = DOMUtils.getContent(result).trim();
Modified: cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java?rev=745879&r1=745878&r2=745879&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java (original)
+++ cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java Thu Feb 19 14:18:49 2009
@@ -59,6 +59,7 @@
import com.ibm.wsdl.extensions.schema.SchemaImpl;
import org.apache.cxf.Bus;
import org.apache.cxf.NSManager;
+import org.apache.cxf.common.WSDLConstants;
import org.apache.cxf.helpers.CastUtils;
import org.apache.cxf.helpers.XMLUtils;
import org.apache.cxf.helpers.XPathUtils;
@@ -76,7 +77,6 @@
import org.apache.cxf.service.model.OperationInfo;
import org.apache.cxf.service.model.SchemaInfo;
import org.apache.cxf.service.model.ServiceInfo;
-import org.apache.cxf.wsdl.WSDLConstants;
import org.apache.cxf.wsdl.WSDLManager;
import org.apache.ws.commons.schema.utils.NamespacePrefixList;
Modified: cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java?rev=745879&r1=745878&r2=745879&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java (original)
+++ cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java Thu Feb 19 14:18:49 2009
@@ -51,12 +51,12 @@
import org.apache.cxf.Bus;
import org.apache.cxf.BusException;
import org.apache.cxf.catalog.CatalogWSDLLocator;
+import org.apache.cxf.common.WSDLConstants;
import org.apache.cxf.common.logging.LogUtils;
import org.apache.cxf.common.util.CacheMap;
import org.apache.cxf.common.util.PropertiesLoaderUtils;
import org.apache.cxf.service.model.ServiceSchemaInfo;
import org.apache.cxf.wsdl.JAXBExtensionHelper;
-import org.apache.cxf.wsdl.WSDLConstants;
import org.apache.cxf.wsdl.WSDLManager;
/**
Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/pom.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/pom.xml?rev=745879&r1=745878&r2=745879&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/pom.xml (original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/pom.xml Thu Feb 19 14:18:49 2009
@@ -82,13 +82,9 @@
<groupId>jdom</groupId>
<artifactId>jdom</artifactId>
<version>${jdom.version}</version>
+ <scope>provided</scope>
</dependency>
<dependency>
- <groupId>jaxen</groupId>
- <artifactId>jaxen</artifactId>
- </dependency>
-
- <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/AegisContext.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/AegisContext.java?rev=745879&r1=745878&r2=745879&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/AegisContext.java (original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/AegisContext.java Thu Feb 19 14:18:49 2009
@@ -46,11 +46,10 @@
import org.apache.cxf.aegis.type.java5.Java5TypeCreator;
import org.apache.cxf.common.classloader.ClassLoaderUtils;
import org.apache.cxf.common.util.SOAPConstants;
-import org.apache.cxf.helpers.DOMUtils;
-import org.jaxen.JaxenException;
-import org.jaxen.jdom.JDOMXPath;
-import org.jdom.Element;
-import org.jdom.Namespace;
+import org.apache.cxf.common.xmlschema.XmlSchemaUtils;
+import org.apache.cxf.helpers.XMLUtils;
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
/**
* The Aegis Databinding context object. This object coordinates the data binding process: reading and writing
@@ -74,19 +73,11 @@
public class AegisContext {
/**
- * Namespace used for miscellaneous Aegis types.
+ * Namespace used for the miscellaneous Aegis type schema.
*/
- public static final String SCHEMA_NS = "http://cxf.apache.org/aegisTypes";
- private static JDOMXPath importTypesXpath;
-
- static {
- try {
- importTypesXpath = new JDOMXPath("xsd:import[@namespace='" + SCHEMA_NS + "']");
- importTypesXpath.addNamespace(SOAPConstants.XSD_PREFIX, SOAPConstants.XSD);
- } catch (JaxenException e) {
- throw new RuntimeException(e);
- }
- }
+ public static final String UTILITY_TYPES_SCHEMA_NS = "http://cxf.apache.org/aegisTypes";
+ private Document aegisTypesSchemaDocument;
+ private Document xmimeSchemaDocument;
private boolean writeXsiTypes;
private boolean readXsiTypes = true;
@@ -101,9 +92,9 @@
private TypeCreationOptions configuration;
private boolean mtomEnabled;
private boolean mtomUseXmime;
+ private boolean enableJDOMMappings;
// this URI goes into the type map.
private String mappingNamespaceURI;
- private Document typesSchemaDocument;
/**
* Construct a context.
@@ -150,7 +141,9 @@
}
if (typeMapping == null) {
boolean defaultNillable = configuration.isDefaultNillable();
- TypeMapping baseTM = DefaultTypeMapping.createDefaultTypeMapping(defaultNillable, mtomUseXmime);
+ TypeMapping baseTM = DefaultTypeMapping.createDefaultTypeMapping(defaultNillable,
+ mtomUseXmime,
+ enableJDOMMappings);
// The use of the XSD URI in the mapping is, MAGIC.
if (mappingNamespaceURI == null) {
mappingNamespaceURI = SOAPConstants.XSD;
@@ -248,43 +241,47 @@
}
}
- public static boolean schemaImportsUtilityTypes(Element schemaElement) {
- try {
- return importTypesXpath.selectSingleNode(schemaElement) != null;
- } catch (JaxenException e) {
- throw new RuntimeException(e);
- }
- }
-
- public Document getTypesSchemaDocument() {
- ensureTypesSchemaDocument();
- return typesSchemaDocument;
+ public static boolean schemaImportsUtilityTypes(XmlSchema schema) {
+ return XmlSchemaUtils.schemaImportsNamespace(schema, UTILITY_TYPES_SCHEMA_NS);
}
-
- private void ensureTypesSchemaDocument() {
- if (typesSchemaDocument != null) {
- return;
- }
+
+ private Document getSchemaDocument(String resourcePath) {
try {
- typesSchemaDocument = DOMUtils.readXml(getClass()
- .getResourceAsStream("/META-INF/cxf/aegisTypes.xsd"));
+ return XMLUtils.parse(getClass().getResourceAsStream(resourcePath));
+ } catch (ParserConfigurationException e) {
+ throw new RuntimeException(e);
} catch (SAXException e) {
throw new RuntimeException(e);
} catch (IOException e) {
throw new RuntimeException(e);
- } catch (ParserConfigurationException e) {
- throw new RuntimeException(e);
}
}
-
- public static void addUtilityTypesToSchema(Element root) {
- if (schemaImportsUtilityTypes(root)) {
- return;
+
+ // could we make these documents static? What would we synchronize on?
+ private Document getAegisTypesSchemaDocument() {
+ if (aegisTypesSchemaDocument == null) {
+ aegisTypesSchemaDocument = getSchemaDocument("/META-INF/cxf/aegisTypes.xsd");
+ }
+ return aegisTypesSchemaDocument;
+ }
+
+ private Document getXmimeSchemaDocument() {
+ if (xmimeSchemaDocument == null) {
+ xmimeSchemaDocument = getSchemaDocument("/schemas/wsdl/xmime.xsd");
}
- Element element = new Element("import", SOAPConstants.XSD_PREFIX, SOAPConstants.XSD);
- root.addContent(0, element);
- element.setAttribute("namespace", SCHEMA_NS);
- root.addNamespaceDeclaration(Namespace.getNamespace("aegisTypes", SCHEMA_NS));
+ return xmimeSchemaDocument;
+ }
+
+ public XmlSchema addTypesSchemaDocument(XmlSchemaCollection collection) {
+ return collection.read(getAegisTypesSchemaDocument(), null);
+ }
+
+ public XmlSchema addXmimeSchemaDocument(XmlSchemaCollection collection) {
+ return collection.read(getXmimeSchemaDocument(), null);
+ }
+
+ public static void addUtilityTypesToSchema(XmlSchema root) {
+ XmlSchemaUtils.addImportIfNeeded(root, UTILITY_TYPES_SCHEMA_NS);
}
/**
@@ -467,4 +464,16 @@
public void setMappingNamespaceURI(String mappingNamespaceURI) {
this.mappingNamespaceURI = mappingNamespaceURI;
}
+
+ public boolean isEnableJDOMMappings() {
+ return enableJDOMMappings;
+ }
+
+ /**
+ * Whether to enable JDOM as a mapping for xsd:anyType if JDOM is in the classpath.
+ * @param enableJDOMMappings
+ */
+ public void setEnableJDOMMappings(boolean enableJDOMMappings) {
+ this.enableJDOMMappings = enableJDOMMappings;
+ }
}
Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java?rev=745879&r1=745878&r2=745879&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java (original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java Thu Feb 19 14:18:49 2009
@@ -18,7 +18,6 @@
*/
package org.apache.cxf.aegis.databinding;
-import java.io.IOException;
import java.lang.reflect.Method;
import java.util.Collection;
import java.util.HashMap;
@@ -29,53 +28,43 @@
import java.util.logging.Logger;
import javax.xml.namespace.QName;
-import javax.xml.parsers.ParserConfigurationException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
import org.w3c.dom.Node;
-import org.xml.sax.SAXException;
-
import org.apache.cxf.aegis.AegisContext;
import org.apache.cxf.aegis.DatabindingException;
-import org.apache.cxf.aegis.type.AbstractTypeCreator.TypeClassInfo;
+import org.apache.cxf.aegis.type.AbstractTypeCreator;
import org.apache.cxf.aegis.type.Type;
import org.apache.cxf.aegis.type.TypeCreationOptions;
import org.apache.cxf.aegis.type.TypeCreator;
import org.apache.cxf.aegis.type.TypeMapping;
import org.apache.cxf.aegis.type.mtom.AbstractXOPType;
+import org.apache.cxf.common.WSDLConstants;
import org.apache.cxf.common.classloader.ClassLoaderUtils;
import org.apache.cxf.common.i18n.Message;
import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.common.util.SOAPConstants;
import org.apache.cxf.common.xmlschema.SchemaCollection;
+import org.apache.cxf.common.xmlschema.XmlSchemaConstants;
+import org.apache.cxf.common.xmlschema.XmlSchemaUtils;
import org.apache.cxf.databinding.AbstractDataBinding;
import org.apache.cxf.databinding.DataReader;
import org.apache.cxf.databinding.DataWriter;
import org.apache.cxf.frontend.MethodDispatcher;
import org.apache.cxf.frontend.SimpleMethodDispatcher;
import org.apache.cxf.helpers.CastUtils;
-import org.apache.cxf.helpers.DOMUtils;
import org.apache.cxf.service.Service;
-import org.apache.cxf.service.factory.ServiceConstructionException;
import org.apache.cxf.service.model.AbstractMessageContainer;
import org.apache.cxf.service.model.FaultInfo;
import org.apache.cxf.service.model.MessagePartInfo;
import org.apache.cxf.service.model.OperationInfo;
+import org.apache.cxf.service.model.SchemaInfo;
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.XmlSchemaAnnotated;
+import org.apache.ws.commons.schema.XmlSchemaForm;
import org.apache.ws.commons.schema.utils.NamespaceMap;
-import org.jaxen.JaxenException;
-import org.jaxen.jdom.JDOMXPath;
-import org.jdom.Attribute;
-import org.jdom.Document;
-import org.jdom.Element;
-import org.jdom.JDOMException;
-import org.jdom.Namespace;
-import org.jdom.output.DOMOutputter;
/**
* CXF databinding object for Aegis. By default, this creates an AegisContext object. To customize
@@ -110,7 +99,6 @@
protected static final int FAULT_PARAM = 2;
private static final Logger LOG = LogUtils.getL7dLogger(AegisDatabinding.class);
- private static org.w3c.dom.Document xmimeSchemaDocument;
private AegisContext aegisContext;
private Map<MessagePartInfo, Type> part2Type;
@@ -120,36 +108,10 @@
private TypeCreationOptions configuration;
private boolean mtomEnabled;
private boolean mtomUseXmime;
- private JDOMXPath importXmimeXpath;
public AegisDatabinding() {
super();
part2Type = new HashMap<MessagePartInfo, Type>();
- // we have this also in AbstractXOPType. There has to be a better way.
- importXmimeXpath = AbstractXOPType.getXmimeXpathImport();
- }
-
- private boolean schemaImportsXmime(Element schemaElement) {
- try {
- return importXmimeXpath.selectSingleNode(schemaElement) != null;
- } catch (JaxenException e) {
- throw new RuntimeException(e);
- }
- }
-
- private void ensureXmimeSchemaDocument() {
- if (xmimeSchemaDocument != null) {
- return;
- }
- try {
- xmimeSchemaDocument = DOMUtils.readXml(getClass().getResourceAsStream("/schemas/wsdl/xmime.xsd"));
- } catch (SAXException e) {
- throw new RuntimeException(e);
- } catch (IOException e) {
- throw new RuntimeException(e);
- } catch (ParserConfigurationException e) {
- throw new RuntimeException(e);
- }
}
/**
@@ -459,106 +421,90 @@
}
Map<String, String> namespaceMap = getDeclaredNamespaceMappings();
- boolean needXmimeSchema = false;
- // utility types.
- boolean needTypesSchema = false;
-
- for (Map.Entry<String, Set<Type>> entry : tns2Type.entrySet()) {
- String xsdPrefix = SOAPConstants.XSD_PREFIX;
- if (namespaceMap != null && namespaceMap.containsKey(SOAPConstants.XSD)) {
- xsdPrefix = namespaceMap.get(SOAPConstants.XSD);
- }
-
- Element e = new Element("schema", xsdPrefix, SOAPConstants.XSD);
-
- e.setAttribute(new Attribute(WSDLConstants.ATTR_TNS, entry.getKey()));
-
- if (null != namespaceMap) { // did application hand us some
- // additional namespaces?
- for (Map.Entry<String, String> mapping : namespaceMap.entrySet()) {
- // user gives us namespace->prefix mapping.
- e.addNamespaceDeclaration(Namespace.getNamespace(mapping.getValue(), mapping.getKey()));
- }
- }
-
- // if the user didn't pick something else, assign 'tns' as the
- // prefix.
- if (namespaceMap == null || !namespaceMap.containsKey(entry.getKey())) {
- // Schemas are more readable if there is a specific prefix for
- // the TNS.
- e.addNamespaceDeclaration(Namespace.getNamespace(WSDLConstants.CONVENTIONAL_TNS_PREFIX, entry
- .getKey()));
- }
- e.setAttribute(new Attribute("elementFormDefault", "qualified"));
- e.setAttribute(new Attribute("attributeFormDefault", "qualified"));
- for (Type t : entry.getValue()) {
- t.writeSchema(e);
- }
-
- if (e.getChildren().size() == 0) {
- continue;
- }
-
- if (schemaImportsXmime(e)) {
- needXmimeSchema = true;
- }
- if (AegisContext.schemaImportsUtilityTypes(e)) {
- needTypesSchema = true;
- }
-
- try {
- NamespaceMap nsMap = new NamespaceMap();
-
- nsMap.add(xsdPrefix, SOAPConstants.XSD);
-
- // We prefer explicit prefixes over those generated in the
- // types.
- // This loop may have intended to support prefixes from
- // individual aegis files,
- // but that isn't a good idea.
- for (Iterator itr = e.getAdditionalNamespaces().iterator(); itr.hasNext();) {
- Namespace n = (Namespace)itr.next();
- if (!nsMap.containsValue(n.getURI())) {
- nsMap.add(n.getPrefix(), n.getURI());
+ for (ServiceInfo si : s.getServiceInfos()) {
+ // these two must be recalculated per-service-info!
+ boolean needXmimeSchema = false;
+ boolean needTypesSchema = false;
+
+ for (Map.Entry<String, Set<Type>> entry : tns2Type.entrySet()) {
+
+ String schemaNamespaceUri = entry.getKey();
+
+ if (XmlSchemaConstants.XSD_NAMESPACE_URI.equals(schemaNamespaceUri)) {
+ continue;
+ }
+
+ if (AegisContext.UTILITY_TYPES_SCHEMA_NS.equals(schemaNamespaceUri)) {
+ continue; // we handle this separately.
+ }
+
+ if (AbstractXOPType.XML_MIME_NS.equals(schemaNamespaceUri)) {
+ continue; // similiarly.
+ }
+
+ SchemaInfo schemaInfo = si.addNewSchema(entry.getKey());
+ XmlSchema schema = schemaInfo.getSchema();
+ NamespaceMap xmlsNamespaceMap = new NamespaceMap();
+
+ // user-requested prefix mappings.
+ if (namespaceMap != null) {
+ for (Map.Entry<String, String> e : namespaceMap.entrySet()) {
+ xmlsNamespaceMap.add(e.getValue(), e.getKey());
}
}
+
+ // tns: is conventional, and besides we have unit tests that are hardcoded to it.
+ if (!xmlsNamespaceMap.containsKey(WSDLConstants.CONVENTIONAL_TNS_PREFIX)
+ // if some wants something other than TNS, they get it.
+ && !xmlsNamespaceMap.containsValue(entry.getKey())) {
+ xmlsNamespaceMap.add(WSDLConstants.CONVENTIONAL_TNS_PREFIX, entry.getKey());
+ }
+
+ // ditto for xsd: instead of just namespace= for the schema schema.
+ if (!xmlsNamespaceMap.containsKey("xsd")
+ && !xmlsNamespaceMap.containsValue(XmlSchemaConstants.XSD_NAMESPACE_URI)) {
+ xmlsNamespaceMap.add("xsd", XmlSchemaConstants.XSD_NAMESPACE_URI);
+ }
+
+ schema.setNamespaceContext(xmlsNamespaceMap);
+ schema.setTargetNamespace(entry.getKey());
+ schema.setElementFormDefault(new XmlSchemaForm(XmlSchemaForm.QUALIFIED));
+ schema.setAttributeFormDefault(new XmlSchemaForm(XmlSchemaForm.QUALIFIED));
- org.w3c.dom.Document schema = new DOMOutputter().output(new Document(e));
+ for (Type t : entry.getValue()) {
+ t.writeSchema(schema);
+ }
- for (ServiceInfo si : s.getServiceInfos()) {
- 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
- // assign namespaces to attributes. If JDOM worked right,
- // the collection object would get the prefixes for itself.
- xmlSchema.setNamespaceContext(nsMap);
+ if (schemaImportsXmime(schema)) {
+ needXmimeSchema = true;
+ }
+
+ if (AegisContext.schemaImportsUtilityTypes(schema)) {
+ needTypesSchema = true;
}
- } catch (JDOMException e1) {
- throw new ServiceConstructionException(e1);
}
- }
-
- if (needXmimeSchema) {
- ensureXmimeSchemaDocument();
- for (ServiceInfo si : s.getServiceInfos()) {
- SchemaCollection col = si.getXmlSchemaCollection();
- // invented systemId.
- addSchemaDocument(si, col, xmimeSchemaDocument, AbstractXOPType.XML_MIME_NS);
+ if (needXmimeSchema) {
+ XmlSchema schema =
+ aegisContext.addXmimeSchemaDocument(si.getXmlSchemaCollection().getXmlSchemaCollection());
+ SchemaInfo schemaInfo = new SchemaInfo(schema.getTargetNamespace());
+ schemaInfo.setSchema(schema);
+ si.addSchema(schemaInfo);
}
- }
-
- if (needTypesSchema) {
- org.w3c.dom.Document schema = aegisContext.getTypesSchemaDocument();
- for (ServiceInfo si : s.getServiceInfos()) {
- SchemaCollection col = si.getXmlSchemaCollection();
- addSchemaDocument(si, col, schema, AegisContext.SCHEMA_NS);
+
+ if (needTypesSchema) {
+ XmlSchema schema =
+ aegisContext.addTypesSchemaDocument(si.getXmlSchemaCollection().getXmlSchemaCollection());
+ SchemaInfo schemaInfo = new SchemaInfo(schema.getTargetNamespace());
+ schemaInfo.setSchema(schema);
+ si.addSchema(schemaInfo);
}
}
-
+ }
+
+ private boolean schemaImportsXmime(XmlSchema schema) {
+ return XmlSchemaUtils.schemaImportsNamespace(schema, AbstractXOPType.XML_MIME_NS);
}
public QName getSuggestedName(Service s, TypeMapping tm, OperationInfo op, int param) {
@@ -600,7 +546,7 @@
OperationInfo op = param.getMessageInfo().getOperation();
Method m = getMethod(s, op);
- TypeClassInfo info;
+ AbstractTypeCreator.TypeClassInfo info;
if (paramtype != FAULT_PARAM && m != null) {
info = typeCreator.createClassInfo(m, param.getIndex() - offset);
} else {
Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/AbstractTypeCreator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/AbstractTypeCreator.java?rev=745879&r1=745878&r2=745879&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/AbstractTypeCreator.java (original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/AbstractTypeCreator.java Thu Feb 19 14:18:49 2009
@@ -34,13 +34,15 @@
import org.apache.cxf.aegis.type.collection.MapType;
import org.apache.cxf.aegis.util.NamespaceHelper;
import org.apache.cxf.aegis.util.ServiceUtils;
+import org.apache.cxf.common.WSDLConstants;
import org.apache.cxf.common.util.XMLSchemaQNames;
-import org.apache.cxf.wsdl.WSDLConstants;
/**
* @author Hani Suleiman Date: Jun 14, 2005 Time: 11:59:57 PM
*/
public abstract class AbstractTypeCreator implements TypeCreator {
+ public static final String HTTP_CXF_APACHE_ORG_ARRAYS = "http://cxf.apache.org/arrays";
+
protected TypeMapping tm;
protected AbstractTypeCreator nextCreator;
@@ -308,7 +310,7 @@
ns = tm.getMappingIdentifierURI();
}
if (WSDLConstants.NS_SCHEMA_XSD.equals(ns)) {
- ns = "http://cxf.apache.org/arrays";
+ ns = HTTP_CXF_APACHE_ORG_ARRAYS;
}
String first = type.getSchemaType().getLocalPart().substring(0, 1);
@@ -316,13 +318,13 @@
String localName = "ArrayOf" + first.toUpperCase() + last;
if (info.nonDefaultAttributes()) {
localName += "-";
- if (info.getMaxOccurs() >= 0) {
- localName += info.maxOccurs;
- }
- localName += "-";
if (info.getMinOccurs() >= 0) {
localName += info.minOccurs;
}
+ localName += "-";
+ if (info.getMaxOccurs() >= 0) {
+ localName += info.maxOccurs;
+ }
if (info.isFlat()) {
localName += "Flat";
}
Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/DefaultTypeMapping.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/DefaultTypeMapping.java?rev=745879&r1=745878&r2=745879&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/DefaultTypeMapping.java (original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/DefaultTypeMapping.java Thu Feb 19 14:18:49 2009
@@ -68,9 +68,9 @@
import org.apache.cxf.aegis.type.xml.SourceType;
import org.apache.cxf.aegis.type.xml.XMLStreamReaderType;
import org.apache.cxf.binding.soap.Soap11;
+import org.apache.cxf.common.classloader.ClassLoaderUtils;
import org.apache.cxf.common.util.SOAPConstants;
import org.apache.cxf.common.util.XMLSchemaQNames;
-import org.jdom.Element;
/**
* Contains type mappings for java/qname pairs.
@@ -224,7 +224,7 @@
}
private static void fillStandardMappings(TypeMapping tm, boolean defaultNillable,
- boolean enableMtomXmime) {
+ boolean enableMtomXmime, boolean enableJDOM) {
defaultRegister(tm, defaultNillable, BigDecimal.class, XMLSchemaQNames.XSD_DECIMAL,
new BigDecimalType());
defaultRegister(tm, defaultNillable, BigInteger.class, XMLSchemaQNames.XSD_INTEGER,
@@ -234,9 +234,6 @@
defaultRegister(tm, defaultNillable, Calendar.class, XMLSchemaQNames.XSD_DATETIME,
new CalendarType());
defaultRegister(tm, defaultNillable, Date.class, XMLSchemaQNames.XSD_DATETIME, new DateTimeType());
- defaultRegister(tm, defaultNillable, Document.class, XMLSchemaQNames.XSD_ANY, new DocumentType());
- defaultRegister(tm, defaultNillable, Element.class, XMLSchemaQNames.XSD_ANY,
- new JDOMElementType());
defaultRegister(tm, defaultNillable, Float.class, XMLSchemaQNames.XSD_FLOAT, new FloatType());
defaultRegister(tm, defaultNillable, Double.class, XMLSchemaQNames.XSD_DOUBLE, new DoubleType());
defaultRegister(tm, defaultNillable, Integer.class, XMLSchemaQNames.XSD_INT, new IntType());
@@ -265,8 +262,6 @@
defaultRegister(tm, defaultNillable, java.sql.Date.class, XMLSchemaQNames.XSD_DATETIME,
new SqlDateType());
- defaultRegister(tm, defaultNillable, org.jdom.Document.class, XMLSchemaQNames.XSD_ANY,
- new JDOMDocumentType());
QName mtomBase64 = XMLSchemaQNames.XSD_BASE64;
if (enableMtomXmime) {
@@ -277,13 +272,56 @@
new DataSourceType(enableMtomXmime, null));
defaultRegister(tm, defaultNillable, DataHandler.class, mtomBase64,
new DataHandlerType(enableMtomXmime, null));
+
+
+ defaultRegister(tm, defaultNillable, Document.class, XMLSchemaQNames.XSD_ANY, new DocumentType());
+ if (enableJDOM) {
+ registerJDOMTypes(tm, defaultNillable);
+ }
+
+ }
+
+ private static void registerJDOMTypes(TypeMapping tm, boolean defaultNillable) {
+ try {
+ Class<?> jdomDocClass = ClassLoaderUtils.loadClass("org.jdom.Document", DefaultTypeMapping.class);
+ defaultRegister(tm, defaultNillable, jdomDocClass, XMLSchemaQNames.XSD_ANY,
+ new JDOMDocumentType());
+
+ } catch (ClassNotFoundException e) {
+ // not available.
+ }
+
+ try {
+ Class<?> jdomElementClass =
+ ClassLoaderUtils.loadClass("org.jdom.Element", DefaultTypeMapping.class);
+ defaultRegister(tm, defaultNillable, jdomElementClass, XMLSchemaQNames.XSD_ANY,
+ new JDOMElementType());
+ } catch (ClassNotFoundException e) {
+ // not available.
+ }
+ }
+
+ public static DefaultTypeMapping createSoap11TypeMapping(boolean defaultNillable,
+ boolean enableMtomXmime) {
+ return createSoap11TypeMapping(
+ defaultNillable,
+ enableMtomXmime,
+ false);
}
+ /**
+ * Create a type mapping object with a stock set of mappings, including the SOAP 1.1 'encoded'
+ * types.
+ * @param defaultNillable whether elements are nillable by default.
+ * @param enableMtomXmime whether to enable XMIME annotations with MTOM.
+ * @param enableJDOM whether to add mappings for JDOM.
+ * @return
+ */
public static DefaultTypeMapping createSoap11TypeMapping(boolean defaultNillable,
- boolean enableMtomXmime) {
+ boolean enableMtomXmime, boolean enableJDOM) {
// Create a Type Mapping for SOAP 1.1 Encoding
DefaultTypeMapping soapTM = new DefaultTypeMapping(Soap11.SOAP_ENCODING_URI);
- fillStandardMappings(soapTM, defaultNillable, enableMtomXmime);
+ fillStandardMappings(soapTM, defaultNillable, enableMtomXmime, enableJDOM);
defaultRegister(soapTM, defaultNillable, boolean.class, Soap11.ENCODED_BOOLEAN, new BooleanType());
defaultRegister(soapTM, defaultNillable, char.class, Soap11.ENCODED_CHAR, new CharacterType());
@@ -315,10 +353,26 @@
}
public static DefaultTypeMapping createDefaultTypeMapping(boolean defaultNillable,
- boolean enableMtomXmime) {
+ boolean enableMtomXmime) {
+ return createDefaultTypeMapping(
+ defaultNillable,
+ enableMtomXmime,
+ false);
+ }
+
+ /**
+ * Create a set of default type mappings.
+ * @param defaultNillable whether elements are nillable by default.
+ * @param enableMtomXmime whether to enable XMIME annotations on MTOM.
+ * @param enableJDOM whether to map JDOM types.
+ * @return
+ */
+ public static DefaultTypeMapping createDefaultTypeMapping(boolean defaultNillable,
+ boolean enableMtomXmime,
+ boolean enableJDOM) {
// by convention, the default mapping is against the XML schema URI.
DefaultTypeMapping tm = new DefaultTypeMapping(SOAPConstants.XSD);
- fillStandardMappings(tm, defaultNillable, enableMtomXmime);
+ fillStandardMappings(tm, defaultNillable, enableMtomXmime, enableJDOM);
defaultRegister(tm, defaultNillable, Character.class,
CharacterAsStringType.CHARACTER_AS_STRING_TYPE_QNAME,
new CharacterAsStringType());
Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/Type.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/Type.java?rev=745879&r1=745878&r2=745879&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/Type.java (original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/Type.java Thu Feb 19 14:18:49 2009
@@ -26,7 +26,8 @@
import org.apache.cxf.aegis.DatabindingException;
import org.apache.cxf.aegis.xml.MessageReader;
import org.apache.cxf.aegis.xml.MessageWriter;
-import org.jdom.Element;
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaElement;
/**
* A Type reads and writes XML fragments to create and write objects.
@@ -76,7 +77,7 @@
* type object adds it to the schema.
* @param root root of the XSD document.
*/
- public void writeSchema(Element root) {
+ public void writeSchema(XmlSchema root) {
}
/**
@@ -84,7 +85,7 @@
* xsd:element element, it can implement this.
* @param schemaElement
*/
- public void addToSchemaElement(Element schemaElement) {
+ public void addToSchemaElement(XmlSchemaElement schemaElement) {
}
/**
Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/TypeUtil.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/TypeUtil.java?rev=745879&r1=745878&r2=745879&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/TypeUtil.java (original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/TypeUtil.java Thu Feb 19 14:18:49 2009
@@ -18,8 +18,6 @@
*/
package org.apache.cxf.aegis.type;
-import java.util.List;
-
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamReader;
import org.apache.commons.logging.Log;
@@ -27,10 +25,9 @@
import org.apache.cxf.aegis.AegisContext;
import org.apache.cxf.aegis.util.NamespaceHelper;
import org.apache.cxf.common.util.SOAPConstants;
-import org.apache.cxf.helpers.CastUtils;
-import org.jdom.Attribute;
-import org.jdom.Element;
-import org.jdom.Namespace;
+import org.apache.cxf.common.xmlschema.XmlSchemaUtils;
+import org.apache.ws.commons.schema.XmlSchema;
+
/**
* Static methods/constants for Aegis.
@@ -159,26 +156,9 @@
return type;
}
- public static Attribute createTypeAttribute(String prefix, Type type, Element root) {
+
+ public static void setAttributeAttributes(QName name, Type type, XmlSchema root) {
String ns = type.getSchemaType().getNamespaceURI();
- if (!ns.equals(root.getAttributeValue("targetNamespace"))
- && !ns.equals(SOAPConstants.XSD)) {
- //find import statement
- List<Element> l = CastUtils.cast(root.getChildren("import",
- Namespace.getNamespace(SOAPConstants.XSD)));
- boolean found = false;
- for (Element e : l) {
- if (ns.equals(e.getAttributeValue("namespace"))) {
- found = true;
- }
- }
- if (!found) {
- Element element = new Element("import", SOAPConstants.XSD_PREFIX, SOAPConstants.XSD);
- root.addContent(0, element);
- element.setAttribute("namespace", ns);
- }
- }
- return new Attribute("type", prefix + ':' + type.getSchemaType().getLocalPart());
+ XmlSchemaUtils.addImportIfNeeded(root, ns);
}
-
}
Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/XMLTypeCreator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/XMLTypeCreator.java?rev=745879&r1=745878&r2=745879&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/XMLTypeCreator.java (original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/XMLTypeCreator.java Thu Feb 19 14:18:49 2009
@@ -38,6 +38,12 @@
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
+import javax.xml.xpath.XPathConstants;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
@@ -50,12 +56,8 @@
import org.apache.cxf.aegis.type.basic.XMLBeanTypeInfo;
import org.apache.cxf.aegis.util.NamespaceHelper;
import org.apache.cxf.common.classloader.ClassLoaderUtils;
-import org.jdom.Document;
-import org.jdom.Element;
-import org.jdom.JDOMException;
-import org.jdom.Namespace;
-import org.jdom.input.DOMBuilder;
-import org.jdom.xpath.XPath;
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.helpers.XPathUtils;
/**
* Deduce mapping information from an xml file. The xml file should be in the
@@ -113,7 +115,7 @@
if (is != null) {
try {
aegisDocumentBuilderFactory = DocumentBuilderFactory.newInstance();
-
+ aegisDocumentBuilderFactory.setNamespaceAware(true);
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
aegisSchema = schemaFactory.newSchema(new StreamSource(is));
@@ -132,6 +134,8 @@
}
}
}
+
+ private XPathUtils xpathUtils = new XPathUtils();
private Document readAegisFile(InputStream is, final String path) throws IOException {
DocumentBuilder documentBuilder;
@@ -184,7 +188,7 @@
// above.
return null;
}
- return new DOMBuilder().build(doc);
+ return doc;
}
protected Document getDocument(Class clazz) {
@@ -321,17 +325,17 @@
if (mapping != null || mappings.size() > 0) {
String typeNameAtt = null;
if (mapping != null) {
- typeNameAtt = mapping.getAttributeValue("name");
+ typeNameAtt = DOMUtils.getAttributeValueEmptyNull(mapping, "name");
}
String extensibleElements = null;
if (mapping != null) {
- extensibleElements = mapping.getAttributeValue("extensibleElements");
+ extensibleElements = mapping.getAttribute("extensibleElements");
}
String extensibleAttributes = null;
if (mapping != null) {
- extensibleAttributes = mapping.getAttributeValue("extensibleAttributes");
+ extensibleAttributes = mapping.getAttribute("extensibleAttributes");
}
String defaultNS = NamespaceHelper.makeNamespaceFromClassName(info.getTypeClass().getName(),
@@ -436,7 +440,7 @@
}
info.setTypeClass(m.getReturnType());
// info.setAnnotations(m.getAnnotations());
- Element rtElement = bestMatch.getChild("return-type");
+ Element rtElement = DOMUtils.getFirstChildWithName(bestMatch, "", "return-type");
readMetadata(info, mapping, rtElement);
}
@@ -444,24 +448,25 @@
}
protected void readMetadata(TypeClassInfo info, Element mapping, Element parameter) {
- info.setTypeName(createQName(parameter, parameter.getAttributeValue("typeName")));
- info.setMappedName(createQName(parameter, parameter.getAttributeValue("mappedName")));
+ info.setTypeName(createQName(parameter, DOMUtils.getAttributeValueEmptyNull(parameter, "typeName")));
+ info.setMappedName(createQName(parameter,
+ DOMUtils.getAttributeValueEmptyNull(parameter, "mappedName")));
setComponentType(info, mapping, parameter);
setKeyType(info, mapping, parameter);
setValueType(info, mapping, parameter);
setType(info, parameter);
- String min = parameter.getAttributeValue("minOccurs");
+ String min = DOMUtils.getAttributeValueEmptyNull(parameter, "minOccurs");
if (min != null) {
info.setMinOccurs(Long.parseLong(min));
}
- String max = parameter.getAttributeValue("maxOccurs");
+ String max = DOMUtils.getAttributeValueEmptyNull(parameter, "maxOccurs");
if (max != null) {
info.setMaxOccurs(Long.parseLong(max));
}
- String flat = parameter.getAttributeValue("flat");
+ String flat = DOMUtils.getAttributeValueEmptyNull(parameter, "flat");
if (flat != null) {
info.setFlat(Boolean.valueOf(flat.toLowerCase()).booleanValue());
}
@@ -520,7 +525,7 @@
}
protected void setComponentType(TypeClassInfo info, Element mapping, Element parameter) {
- String componentType = parameter.getAttributeValue("componentType");
+ String componentType = DOMUtils.getAttributeValueEmptyNull(parameter, "componentType");
if (componentType != null) {
info.setGenericType(loadGeneric(info, mapping, componentType));
}
@@ -538,7 +543,7 @@
TypeClassInfo componentInfo = new TypeClassInfo();
componentInfo.setDescription("generic component " + componentInfo.getDescription());
readMetadata(componentInfo, mapping, propertyEl);
- String className = propertyEl.getAttributeValue("class");
+ String className = DOMUtils.getAttributeValueEmptyNull(propertyEl, "class");
if (className == null) {
throw new DatabindingException("A 'class' attribute must be specified for <component> "
+ name);
@@ -561,7 +566,7 @@
}
protected void setType(TypeClassInfo info, Element parameter) {
- String type = parameter.getAttributeValue("type");
+ String type = DOMUtils.getAttributeValueEmptyNull(parameter, "type");
if (type != null) {
try {
info.setType(ClassLoaderUtils.loadClass(type, getClass()));
@@ -572,14 +577,14 @@
}
protected void setKeyType(TypeClassInfo info, Element mapping, Element parameter) {
- String componentType = parameter.getAttributeValue("keyType");
+ String componentType = DOMUtils.getAttributeValueEmptyNull(parameter, "keyType");
if (componentType != null) {
info.setKeyType(loadGeneric(info, mapping, componentType));
}
}
private void setValueType(TypeClassInfo info, Element mapping, Element parameter) {
- String componentType = parameter.getAttributeValue("valueType");
+ String componentType = DOMUtils.getAttributeValueEmptyNull(parameter, "valueType");
if (componentType != null) {
info.setValueType(loadGeneric(info, mapping, componentType));
}
@@ -612,10 +617,10 @@
Element match = getMatch(element, "parameter[@index='" + i + "']");
if (match != null
// we check if the type is specified and matches
- && match.getAttributeValue("class") != null
+ && DOMUtils.getAttributeValueEmptyNull(match, "class") != null
// if it doesn't match, then we can definitely rule out
// this result
- && !match.getAttributeValue("class").equals(parameterType.getName())) {
+ && !DOMUtils.getAttributeValueEmptyNull(match, "class").equals(parameterType.getName())) {
iterator.remove();
}
@@ -632,7 +637,9 @@
int highestSpecified = 0;
for (Iterator iterator = nodes.iterator(); iterator.hasNext();) {
Element element = (Element)iterator.next();
- int availableParameters = element.getChildren("parameter").size();
+
+ List<Element> params = DOMUtils.getChildrenWithName(element, "", "parameter");
+ int availableParameters = params.size();
if (availableParameters > highestSpecified) {
bestCandidate = element;
highestSpecified = availableParameters;
@@ -641,23 +648,17 @@
return bestCandidate;
}
- private Element getMatch(Object doc, String xpath) {
- try {
- XPath path = XPath.newInstance(xpath);
- return (Element)path.selectSingleNode(doc);
- } catch (JDOMException e) {
- throw new DatabindingException("Error evaluating xpath " + xpath, e);
- }
+ private Element getMatch(Node doc, String xpath) {
+ return (Element)xpathUtils.getValue(xpath, doc, XPathConstants.NODE);
}
- @SuppressWarnings("unchecked")
- private List<Element> getMatches(Object doc, String xpath) {
- try {
- XPath path = XPath.newInstance(xpath);
- return path.selectNodes(doc);
- } catch (JDOMException e) {
- throw new DatabindingException("Error evaluating xpath " + xpath, e);
+ private List<Element> getMatches(Node doc, String xpath) {
+ NodeList nl = (NodeList)xpathUtils.getValue(xpath, doc, XPathConstants.NODESET);
+ List<Element> r = new ArrayList<Element>();
+ for (int x = 0; x < nl.getLength(); x++) {
+ r.add((Element)nl.item(x));
}
+ return r;
}
/**
@@ -676,12 +677,12 @@
String prefix = value.substring(0, index);
String localName = value.substring(index + 1);
- Namespace ns = e.getNamespace(prefix);
+ String ns = DOMUtils.getNamespace(e, prefix);
if (ns == null || localName == null) {
throw new DatabindingException("Invalid QName in mapping: " + value);
}
- return new QName(ns.getURI(), localName, prefix);
+ return new QName(ns, localName, prefix);
}
}