You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2007/09/18 19:18:23 UTC
svn commit: r576983 [1/2] - in /incubator/cxf/trunk:
api/src/main/java/org/apache/cxf/databinding/
common/common/src/main/java/org/apache/cxf/common/util/
rt/core/src/main/java/org/apache/cxf/databinding/source/
rt/core/src/main/java/org/apache/cxf/dat...
Author: dkulp
Date: Tue Sep 18 10:18:16 2007
New Revision: 576983
URL: http://svn.apache.org/viewvc?rev=576983&view=rev
Log:
[CXF-984, CXF-1002, CXF-1025] Patches applied from the various JIRA issues
Added:
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/AbstractDataBinding.java (with props)
incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/AbstractTypeMappingRegistry.java (with props)
incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/integration/ParameterMappingTest.java (with props)
incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/namespaces/ExplicitPrefixTest.java (with props)
incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/namespaces/data/Name.aegis.xml (with props)
incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/ArrayService.aegis.xml (with props)
incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/SimpleBean.aegis.xml (with props)
Modified:
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/DataBinding.java
incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/ParamReader.java
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/SourceDataBinding.java
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/stax/StaxDataBinding.java
incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java
incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/AbstractTypeCreator.java
incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/DefaultTypeCreator.java
incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/DefaultTypeMappingRegistry.java
incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/TypeCreator.java
incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/TypeMappingRegistry.java
incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/XMLTypeCreator.java
incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ObjectType.java
incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/Java5TypeCreator.java
incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/util/NamespaceHelper.java
incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/AbstractAegisTest.java
incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/inheritance/ExceptionInheritanceTest.java
incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/inheritance/InheritancePOJOTest.java
incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/namespaces/NamespaceConfusionTest.java
incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/AddNumbers.aegis.xml
incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/AddNumbers.java
incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/SimpleBean.java
incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/basic/BeanTest.java
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerChainBuilder.java
incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineFactory.java
incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JavaParameterTest.java
incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/calculator.wsdl
incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/db.wsdl
incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/hello_soap12.wsdl
incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/hello_world_fault_expected.wsdl
incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/my_hello_soap12.wsdl
incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_hello_world_doc_lit.wsdl
incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/calculator.wsdl
incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/db.wsdl
incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/hello_soap12.wsdl
incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/hello_world_fault_expected.wsdl
incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/my_hello_soap12.wsdl
incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_hello_world_doc_lit.wsdl
Added: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/AbstractDataBinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/AbstractDataBinding.java?rev=576983&view=auto
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/AbstractDataBinding.java (added)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/AbstractDataBinding.java Tue Sep 18 10:18:16 2007
@@ -0,0 +1,35 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.databinding;
+
+import java.util.Map;
+
+/**
+ * Supply default implementations, as appropriate, for DataBinding.
+ */
+public abstract class AbstractDataBinding implements DataBinding {
+
+ /** {@inheritDoc}*/
+ public Map<String, String> getDeclaredNamespaceMappings() {
+ return null;
+ }
+
+
+}
Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/AbstractDataBinding.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/AbstractDataBinding.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/DataBinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/DataBinding.java?rev=576983&r1=576982&r2=576983&view=diff
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/DataBinding.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/DataBinding.java Tue Sep 18 10:18:16 2007
@@ -19,6 +19,8 @@
package org.apache.cxf.databinding;
+import java.util.Map;
+
import org.apache.cxf.service.Service;
public interface DataBinding {
@@ -37,5 +39,12 @@
* @param service
*/
void initialize(Service service);
+
+ /**
+ * Return a set of mappings from namespace to prefix to allow bindings to control
+ * the prefixes.
+ * @return the map, or null if there are none.
+ */
+ Map<String, String> getDeclaredNamespaceMappings();
}
Modified: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/ParamReader.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/ParamReader.java?rev=576983&r1=576982&r2=576983&view=diff
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/ParamReader.java (original)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/ParamReader.java Tue Sep 18 10:18:16 2007
@@ -132,7 +132,7 @@
try {
// get a parameter reader
ParamReader pr = new ParamReader(c);
- // get the paramter names
+ // get the parameter names
return pr.getParameterNames(method);
} catch (IOException e) {
// log it and leave
Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/SourceDataBinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/SourceDataBinding.java?rev=576983&r1=576982&r2=576983&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/SourceDataBinding.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/SourceDataBinding.java Tue Sep 18 10:18:16 2007
@@ -24,7 +24,6 @@
import org.w3c.dom.Node;
-import org.apache.cxf.databinding.DataBinding;
import org.apache.cxf.databinding.DataReader;
import org.apache.cxf.databinding.DataWriter;
import org.apache.cxf.service.Service;
@@ -32,7 +31,7 @@
/**
* A simple databinding implementation which reads and writes Source objects.
*/
-public class SourceDataBinding implements DataBinding {
+public class SourceDataBinding extends org.apache.cxf.databinding.AbstractDataBinding {
private XMLStreamDataReader xsrReader;
private XMLStreamDataWriter xswWriter;
Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/stax/StaxDataBinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/stax/StaxDataBinding.java?rev=576983&r1=576982&r2=576983&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/stax/StaxDataBinding.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/stax/StaxDataBinding.java Tue Sep 18 10:18:16 2007
@@ -32,7 +32,7 @@
import org.apache.cxf.common.i18n.Message;
import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.databinding.DataBinding;
+import org.apache.cxf.databinding.AbstractDataBinding;
import org.apache.cxf.databinding.DataReader;
import org.apache.cxf.databinding.DataWriter;
import org.apache.cxf.interceptor.Fault;
@@ -45,7 +45,7 @@
* A simple databinding implementation which reads and writes Source objects.
* This will not work with the standard databinding interceptors.
*/
-public class StaxDataBinding implements DataBinding {
+public class StaxDataBinding extends AbstractDataBinding {
private XMLStreamDataReader xsrReader;
private XMLStreamDataWriter xswWriter;
Modified: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java?rev=576983&r1=576982&r2=576983&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java (original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java Tue Sep 18 10:18:16 2007
@@ -34,15 +34,18 @@
import org.w3c.dom.Node;
import org.apache.cxf.aegis.DatabindingException;
+import org.apache.cxf.aegis.type.AbstractTypeCreator.TypeClassInfo;
+import org.apache.cxf.aegis.type.Configuration;
import org.apache.cxf.aegis.type.DefaultTypeMappingRegistry;
import org.apache.cxf.aegis.type.Type;
+import org.apache.cxf.aegis.type.TypeCreator;
import org.apache.cxf.aegis.type.TypeMapping;
import org.apache.cxf.aegis.type.TypeMappingRegistry;
import org.apache.cxf.aegis.type.TypeUtil;
import org.apache.cxf.aegis.type.basic.BeanType;
import org.apache.cxf.aegis.util.XmlConstants;
import org.apache.cxf.common.classloader.ClassLoaderUtils;
-import org.apache.cxf.databinding.DataBinding;
+import org.apache.cxf.databinding.AbstractDataBinding;
import org.apache.cxf.databinding.DataReader;
import org.apache.cxf.databinding.DataWriter;
import org.apache.cxf.frontend.MethodDispatcher;
@@ -71,7 +74,7 @@
* <p>
* NOTE: There is an assumed 1:1 mapping between an AegisDatabinding and a Service!
*/
-public class AegisDatabinding implements DataBinding {
+public class AegisDatabinding extends AbstractDataBinding {
public static final String CURRENT_MESSAGE_PART = "currentMessagePart";
public static final String TYPE_MAPPING_KEY = "type.mapping";
@@ -88,7 +91,9 @@
private Map<MessagePartInfo, Type> part2Type;
private List overrideTypes;
private Service service;
-
+ // allow applications to express an opinion about the namespace prefixes.
+ private Map<String, String> namespaceMap;
+
public AegisDatabinding() {
super();
this.typeMappingRegistry = new DefaultTypeMappingRegistry(true);
@@ -265,14 +270,29 @@
}
for (Map.Entry<String, Set<Type>> entry : tns2Type.entrySet()) {
- Element e = new Element("schema", "xsd", XmlConstants.XSD);
+ String xsdPrefix = XmlConstants.XSD_PREFIX;
+ if (namespaceMap != null && namespaceMap.containsKey(XmlConstants.XSD)) {
+ xsdPrefix = namespaceMap.get(XmlConstants.XSD);
+ }
+
+ Element e = new Element("schema", xsdPrefix, XmlConstants.XSD);
e.setAttribute(new Attribute(WSDLConstants.ATTR_TNS, entry.getKey()));
- // Schemas are more readable if there is a specific prefix for the TNS.
- // note: if aegis ever allows users to ask for a specific prefix in the
- // .aegis.xml file, this will need some adjustment in case of conflicts.
- e.addNamespaceDeclaration(Namespace.getNamespace(WSDLConstants.CONVENTIONAL_TNS_PREFIX,
- 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"));
@@ -287,11 +307,17 @@
try {
XmlSchemaCollection col = new XmlSchemaCollection();
NamespaceMap nsMap = new NamespaceMap();
- nsMap.add("xsd", "http://www.w3.org/2001/XMLSchema");
+ nsMap.add(xsdPrefix, XmlConstants.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();
- nsMap.add(n.getPrefix(), n.getURI());
+ if (!nsMap.containsValue(n.getURI())) {
+ nsMap.add(n.getPrefix(), n.getURI());
+ }
}
col.setNamespaceContext(nsMap);
@@ -341,7 +367,7 @@
return name;
}
-
+
private Type getParameterType(Service s, TypeMapping tm, MessagePartInfo param, int paramtype) {
Type type = tm.getType(param.getTypeQName());
@@ -354,23 +380,28 @@
if (paramtype == OUT_PARAM) {
offset = 1;
}
+
+ TypeCreator typeCreator = tm.getTypeCreator();
if (type == null) {
OperationInfo op = param.getMessageInfo().getOperation();
Method m = getMethod(s, op);
+ TypeClassInfo info;
if (paramtype != FAULT_PARAM && m != null) {
-
- /*
- * Note: we are not registering the type here, because it is an
- * anonymous type. Potentially there could be many schema types
- * with this name. For example, there could be many ns:in0
- * paramters.
- */
- type = tm.getTypeCreator().createType(m, param.getIndex() - offset);
+ info = typeCreator.createClassInfo(m, param.getIndex() - offset);
} else {
- type = tm.getTypeCreator().createType(param.getTypeClass());
+ info = typeCreator.createBasicClassInfo(param.getTypeClass());
+ }
+
+ if (info.getMappedName() != null) {
+ param.setConcreteName(info.getMappedName());
+ param.setName(info.getMappedName());
+ }
+ type = typeCreator.createTypeForClass(info);
+ // We have to register the type if we want minOccurs and such to work.
+ if (info.nonDefaultAttributes()) {
+ tm.register(type);
}
-
type.setTypeMapping(tm);
part2Type.put(param, type);
@@ -396,5 +427,53 @@
public Service getService() {
return service;
}
-
+
+ /**
+ * @return Returns the namespaceMap.
+ */
+ public Map<String, String> getNamespaceMap() {
+ return namespaceMap;
+ }
+
+ /**
+ * @param namespaceMap The namespaceMap to set.
+ */
+ public void setNamespaceMap(Map<String, String> namespaceMap) {
+ // make some checks. This is a map from namespace to prefix, but we want unique prefixes.
+ if (namespaceMap != null) {
+ Set<String> prefixesSoFar = new HashSet<String>();
+ for (Map.Entry<String, String> mapping : namespaceMap.entrySet()) {
+ if (prefixesSoFar.contains(mapping.getValue())) {
+ throw new IllegalArgumentException("Duplicate prefix " + mapping.getValue());
+ }
+ }
+ }
+ this.namespaceMap = namespaceMap;
+ }
+
+ /**
+ * Provide explicit mappings to ReflectionServiceFactory.
+ * {@inheritDoc}
+ * */
+ @Override
+ public Map<String, String> getDeclaredNamespaceMappings() {
+ return this.namespaceMap;
+ }
+
+ /**
+ * Return the type mapping configuration associated with this databinding object.
+ * The configuration is retrieved from the type mapping registry.
+ * @return Returns the configuration.
+ */
+ public Configuration getConfiguration() {
+ return typeMappingRegistry.getConfiguration();
+ }
+
+ /**
+ * Set the configuration for this databinding object.
+ * @param configuration The configuration to set.
+ */
+ public void setConfiguration(Configuration configuration) {
+ typeMappingRegistry.setConfiguration(configuration);
+ }
}
Modified: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/AbstractTypeCreator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/AbstractTypeCreator.java?rev=576983&r1=576982&r2=576983&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/AbstractTypeCreator.java (original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/AbstractTypeCreator.java Tue Sep 18 10:18:16 2007
@@ -96,7 +96,7 @@
return info;
}
- protected Type createTypeForClass(TypeClassInfo info) {
+ public Type createTypeForClass(TypeClassInfo info) {
Class javaType = info.getTypeClass();
Type result = null;
boolean newType = true;
@@ -306,6 +306,19 @@
String first = type.getSchemaType().getLocalPart().substring(0, 1);
String last = type.getSchemaType().getLocalPart().substring(1);
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;
+ }
+ if (info.isFlat()) {
+ localName += "Flat";
+ }
+ }
return new QName(ns, localName);
}
@@ -368,6 +381,9 @@
this.typeConfiguration = tpConfiguration;
}
+ /**
+ * Object to carry information for a type, such as that from an XML mapping file.
+ */
public static class TypeClassInfo {
Class typeClass;
@@ -388,6 +404,10 @@
long minOccurs = -1;
long maxOccurs = -1;
boolean flat;
+
+ public boolean nonDefaultAttributes() {
+ return minOccurs != -1 || maxOccurs != -1 || flat;
+ }
public String getDescription() {
return description;
@@ -475,6 +495,11 @@
public void setFlat(boolean flat) {
this.flat = flat;
+ }
+
+ @Override
+ public String toString() {
+ return "TypeClassInfo " + getDescription();
}
}
}
Added: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/AbstractTypeMappingRegistry.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/AbstractTypeMappingRegistry.java?rev=576983&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/AbstractTypeMappingRegistry.java (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/AbstractTypeMappingRegistry.java Tue Sep 18 10:18:16 2007
@@ -0,0 +1,41 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.aegis.type;
+
+/**
+ *
+ */
+public abstract class AbstractTypeMappingRegistry implements TypeMappingRegistry {
+ private Configuration configuration = new Configuration();
+
+ /**
+ * @return Returns the configuration.
+ */
+ public Configuration getConfiguration() {
+ return configuration;
+ }
+
+ /**
+ * @param configuration The configuration to set.
+ */
+ public void setConfiguration(Configuration configuration) {
+ this.configuration = configuration;
+ }
+}
Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/AbstractTypeMappingRegistry.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/AbstractTypeMappingRegistry.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/DefaultTypeCreator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/DefaultTypeCreator.java?rev=576983&r1=576982&r2=576983&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/DefaultTypeCreator.java (original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/DefaultTypeCreator.java Tue Sep 18 10:18:16 2007
@@ -37,6 +37,7 @@
@Override
public TypeClassInfo createClassInfo(Method m, int index) {
TypeClassInfo info = new TypeClassInfo();
+ info.setDescription("method " + m.getName() + " parameter " + index);
if (index >= 0) {
info.setTypeClass(m.getParameterTypes()[index]);
Modified: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/DefaultTypeMappingRegistry.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/DefaultTypeMappingRegistry.java?rev=576983&r1=576982&r2=576983&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/DefaultTypeMappingRegistry.java (original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/DefaultTypeMappingRegistry.java Tue Sep 18 10:18:16 2007
@@ -78,7 +78,8 @@
* @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
* @since Feb 22, 2004
*/
-public final class DefaultTypeMappingRegistry implements TypeMappingRegistry {
+public final class DefaultTypeMappingRegistry extends AbstractTypeMappingRegistry
+ implements TypeMappingRegistry {
static final QName XSD_STRING = new QName(XmlConstants.XSD, "string", XmlConstants.XSD_PREFIX);
static final QName XSD_LONG = new QName(XmlConstants.XSD, "long", XmlConstants.XSD_PREFIX);
static final QName XSD_FLOAT = new QName(XmlConstants.XSD, "float", XmlConstants.XSD_PREFIX);
@@ -133,8 +134,6 @@
private TypeCreator typeCreator;
- private Configuration typeConfiguration;
-
public DefaultTypeMappingRegistry() {
this(false);
}
@@ -147,7 +146,6 @@
registry = Collections.synchronizedMap(new HashMap<String, TypeMapping>());
this.typeCreator = typeCreator;
- this.typeConfiguration = new Configuration();
if (createDefault) {
createDefaultMappings();
@@ -435,13 +433,4 @@
tm.register(class1, name, type);
}
-
- public Configuration getConfiguration() {
- return typeConfiguration;
- }
-
- public void setConfiguration(Configuration tpConfiguration) {
- this.typeConfiguration = tpConfiguration;
- }
-
}
Modified: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/TypeCreator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/TypeCreator.java?rev=576983&r1=576982&r2=576983&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/TypeCreator.java (original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/TypeCreator.java Tue Sep 18 10:18:16 2007
@@ -24,6 +24,8 @@
import javax.xml.namespace.QName;
+import org.apache.cxf.aegis.type.AbstractTypeCreator.TypeClassInfo;
+
/**
* @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
*/
@@ -50,4 +52,24 @@
void setParent(TypeCreator creator);
void setTypeMapping(TypeMapping typeMapping);
+ /** Retrieve the classInfo for a method. Needed to get parameters right.
+ *
+ * @param m Method object
+ * @param index index in the parameter list
+ * @return info
+ */
+ TypeClassInfo createClassInfo(Method m, int index);
+ /**
+ * Retrieve the class info for a class. Needed to get parameters right.
+ * @param itemClass
+ * @return info
+ */
+ TypeClassInfo createBasicClassInfo(Class<?> itemClass);
+
+ /**
+ * Turn a TypeClassInfo into a type.
+ * @param info
+ * @return
+ */
+ Type createTypeForClass(TypeClassInfo info);
}
Modified: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/TypeMappingRegistry.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/TypeMappingRegistry.java?rev=576983&r1=576982&r2=576983&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/TypeMappingRegistry.java (original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/TypeMappingRegistry.java Tue Sep 18 10:18:16 2007
@@ -114,4 +114,14 @@
* TypeMappingRegistry.
*/
void clear();
+
+ /**
+ * Set the type configuration for this type mapping registry.
+ * @param configuration
+ */
+ void setConfiguration(Configuration configuration);
+ /**
+ * @return the configuration.
+ */
+ Configuration getConfiguration();
}
Modified: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/XMLTypeCreator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/XMLTypeCreator.java?rev=576983&r1=576982&r2=576983&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/XMLTypeCreator.java (original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/XMLTypeCreator.java Tue Sep 18 10:18:16 2007
@@ -163,6 +163,7 @@
TypeClassInfo info = new TypeClassInfo();
info.setTypeClass(pd.getReadMethod().getReturnType());
+ info.setDescription("property " + pd);
readMetadata(info, mapping, propertyEl);
return info;
@@ -293,6 +294,7 @@
// find the elements that apply to the specified method
TypeClassInfo info = new TypeClassInfo();
+ info.setDescription("method " + m.getName() + " parameter " + index);
if (index >= 0) {
if (index >= m.getParameterTypes().length) {
throw new DatabindingException("Method " + m
@@ -430,6 +432,7 @@
}
TypeClassInfo componentInfo = new TypeClassInfo();
+ componentInfo.setDescription("generic component " + componentInfo.getDescription());
readMetadata(componentInfo, mapping, propertyEl);
String className = propertyEl.getAttributeValue("class");
if (className == null) {
Modified: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ObjectType.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ObjectType.java?rev=576983&r1=576982&r2=576983&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ObjectType.java (original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ObjectType.java Tue Sep 18 10:18:16 2007
@@ -185,7 +185,8 @@
tm.register(type);
}
- String prefix = writer.getPrefixForNamespace(type.getSchemaType().getNamespaceURI());
+ String prefix = writer.getPrefixForNamespace(type.getSchemaType().getNamespaceURI(),
+ type.getSchemaType().getPrefix());
if (null == prefix || prefix.length() == 0) {
addXsiType(writer, type.getSchemaType().getLocalPart());
Modified: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/Java5TypeCreator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/Java5TypeCreator.java?rev=576983&r1=576982&r2=576983&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/Java5TypeCreator.java (original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/Java5TypeCreator.java Tue Sep 18 10:18:16 2007
@@ -44,6 +44,7 @@
info = nextCreator.createClassInfo(m, index);
} else {
info = new TypeClassInfo();
+ info.setDescription("method " + m.getName() + " parameter " + index);
info.setGenericType(genericType);
}
info.setTypeClass(m.getParameterTypes()[index]);
@@ -66,6 +67,7 @@
info = nextCreator.createClassInfo(m, index);
} else {
info = new TypeClassInfo();
+ info.setDescription("method " + m.getName() + " parameter " + index);
info.setGenericType(genericReturnType);
}
info.setTypeClass(m.getReturnType());
Modified: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/util/NamespaceHelper.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/util/NamespaceHelper.java?rev=576983&r1=576982&r2=576983&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/util/NamespaceHelper.java (original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/util/NamespaceHelper.java Tue Sep 18 10:18:16 2007
@@ -56,7 +56,11 @@
public static String getUniquePrefix(Element element, String namespaceURI) {
String prefix = getPrefix(element, namespaceURI);
+ // it is OK to have both namespace URI and prefix be empty.
if (prefix == null) {
+ if ("".equals(namespaceURI)) {
+ return "";
+ }
prefix = getUniquePrefix(element);
element.addNamespaceDeclaration(Namespace.getNamespace(prefix, namespaceURI));
}
Modified: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/AbstractAegisTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/AbstractAegisTest.java?rev=576983&r1=576982&r2=576983&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/AbstractAegisTest.java (original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/AbstractAegisTest.java Tue Sep 18 10:18:16 2007
@@ -20,6 +20,7 @@
import java.util.ArrayList;
import java.util.Collection;
+
import javax.wsdl.Definition;
import javax.wsdl.Import;
import javax.wsdl.WSDLException;
@@ -117,14 +118,30 @@
return createService(serviceClass, serviceBean, serviceClass.getSimpleName(), name);
}
- public Server createService(Class serviceClass, Object serviceBean,
- String address, QName name) {
- ServerFactoryBean sf = createServiceFactory(serviceClass, serviceBean, address, name);
+ protected Server createService(Class serviceClass, QName name, AegisDatabinding binding) {
+ return createService(serviceClass, serviceClass.getSimpleName(), name, binding);
+ }
+
+ protected Server createService(Class serviceClass,
+ String address, QName name,
+ AegisDatabinding binding) {
+ ServerFactoryBean sf = createServiceFactory(serviceClass, null, address, name, binding);
+ return sf.create();
+ }
+
+ public Server createService(Class serviceClass,
+ Object serviceBean,
+ String address,
+ QName name) {
+ ServerFactoryBean sf = createServiceFactory(serviceClass, serviceBean, address, name, null);
return sf.create();
}
protected ServerFactoryBean createServiceFactory(Class serviceClass,
- Object serviceBean, String address, QName name) {
+ Object serviceBean,
+ String address,
+ QName name,
+ AegisDatabinding binding) {
ServerFactoryBean sf = new ServerFactoryBean();
sf.setServiceClass(serviceClass);
if (serviceBean != null) {
@@ -132,13 +149,18 @@
}
sf.getServiceFactory().setServiceName(name);
sf.setAddress("local://" + address);
- setupAegis(sf);
+ setupAegis(sf, binding);
return sf;
}
-
- protected void setupAegis(AbstractEndpointFactory sf) {
+ protected void setupAegis(AbstractEndpointFactory sf) {
+ setupAegis(sf, null);
+ }
+ protected void setupAegis(AbstractEndpointFactory sf, AegisDatabinding binding) {
+ if (binding == null) {
+ binding = new AegisDatabinding();
+ }
sf.getServiceFactory().getServiceConfigurations().add(0, new AegisServiceConfiguration());
- sf.getServiceFactory().setDataBinding(new AegisDatabinding());
+ sf.getServiceFactory().setDataBinding(binding);
}
protected Collection<Document> getWSDLDocuments(String string) throws WSDLException {
Modified: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/inheritance/ExceptionInheritanceTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/inheritance/ExceptionInheritanceTest.java?rev=576983&r1=576982&r2=576983&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/inheritance/ExceptionInheritanceTest.java (original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/inheritance/ExceptionInheritanceTest.java Tue Sep 18 10:18:16 2007
@@ -70,11 +70,19 @@
@Override
protected ServerFactoryBean createServiceFactory(Class serviceClass,
- Object serviceBean, String address, QName name) {
- ServerFactoryBean sf = super.createServiceFactory(serviceClass, serviceBean, address, name);
+ Object serviceBean,
+ String address,
+ QName name,
+ AegisDatabinding b) {
+ ServerFactoryBean sf = super.createServiceFactory(serviceClass,
+ serviceBean,
+ address,
+ name,
+ b);
sf.getServiceFactory().setProperties(props);
return sf;
}
+
@Test
public void testClient() throws Exception {
Modified: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/inheritance/InheritancePOJOTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/inheritance/InheritancePOJOTest.java?rev=576983&r1=576982&r2=576983&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/inheritance/InheritancePOJOTest.java (original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/inheritance/InheritancePOJOTest.java Tue Sep 18 10:18:16 2007
@@ -44,8 +44,11 @@
public void setUp() throws Exception {
super.setUp();
- ServerFactoryBean sf = createServiceFactory(InheritanceService.class, null, "InheritanceService",
- new QName("urn:xfire:inheritance", "InheritanceService"));
+ ServerFactoryBean sf = createServiceFactory(InheritanceService.class,
+ null, "InheritanceService",
+ new QName("urn:xfire:inheritance",
+ "InheritanceService"),
+ null);
Map<String, Object> props = new HashMap<String, Object>();
props.put(AegisDatabinding.WRITE_XSI_TYPE_KEY, "true");
Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/integration/ParameterMappingTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/integration/ParameterMappingTest.java?rev=576983&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/integration/ParameterMappingTest.java (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/integration/ParameterMappingTest.java Tue Sep 18 10:18:16 2007
@@ -0,0 +1,77 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.aegis.integration;
+
+import java.io.StringWriter;
+
+import javax.wsdl.Definition;
+import javax.wsdl.factory.WSDLFactory;
+
+import org.w3c.dom.Node;
+
+import org.apache.cxf.aegis.AbstractAegisTest;
+import org.apache.cxf.aegis.services.AddNumbers;
+import org.apache.cxf.aegis.services.ArrayService;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Test inspired by CXF-962 ... do parameters actually work?
+ */
+public class ParameterMappingTest extends AbstractAegisTest {
+
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ createService(AddNumbers.class, "AddNumbers", null);
+ createService(ArrayService.class, "ArrayService", null);
+ }
+
+ @Test
+ public void testParametersWSDL() throws Exception {
+ Node doc = getWSDLDocument("AddNumbers");
+ Definition def = getWSDLDefinition("AddNumbers");
+ StringWriter sink = new StringWriter();
+ WSDLFactory.newInstance().newWSDLWriter().writeWSDL(def, sink);
+ assertValid("/wsdl:definitions/wsdl:types/"
+ + "xsd:schema[@targetNamespace='http://services.aegis.cxf.apache.org']"
+ + "/xsd:complexType[@name='add']"
+ + "/xsd:sequence"
+ + "/xsd:element[@name='value1']", doc);
+ assertValid(
+ "/wsdl:definitions/wsdl:types/"
+ + "xsd:schema[@targetNamespace='http://services.aegis.cxf.apache.org']"
+ + "/xsd:complexType[@name='unmappedAdd']" + "/xsd:sequence"
+ + "/xsd:element[@name='one']", doc);
+ }
+
+ @Test
+ public void testOccursWSDL() throws Exception {
+ Node doc = getWSDLDocument("ArrayService");
+ Definition def = getWSDLDefinition("ArrayService");
+ StringWriter sink = new StringWriter();
+ WSDLFactory.newInstance().newWSDLWriter().writeWSDL(def, sink);
+ assertXPathEquals("/wsdl:definitions/wsdl:types/"
+ + "xsd:schema[@targetNamespace= 'http://services.aegis.cxf.apache.org']"
+ + "/xsd:complexType[@name='ArrayOfString-50-2']"
+ + "/xsd:sequence"
+ + "/xsd:element[@name='string']/@minOccurs", "2", doc);
+ }
+}
Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/integration/ParameterMappingTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/integration/ParameterMappingTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/namespaces/ExplicitPrefixTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/namespaces/ExplicitPrefixTest.java?rev=576983&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/namespaces/ExplicitPrefixTest.java (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/namespaces/ExplicitPrefixTest.java Tue Sep 18 10:18:16 2007
@@ -0,0 +1,176 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.aegis.namespaces;
+
+import java.io.StringWriter;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.wsdl.Definition;
+import javax.wsdl.factory.WSDLFactory;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+import org.apache.cxf.aegis.AbstractAegisTest;
+import org.apache.cxf.aegis.databinding.AegisDatabinding;
+import org.apache.cxf.aegis.namespaces.impl.NameServiceImpl;
+import org.apache.cxf.aegis.type.TypeMapping;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.service.Service;
+import org.junit.Test;
+
+/**
+ * Test of the ability of the user to control prefixes by specifying them in a
+ * map.
+ */
+public class ExplicitPrefixTest extends AbstractAegisTest {
+
+ private static final String AEGIS_TEST_NAMESPACE_PREFIX_XYZZY = "xyzzy";
+ private static final String URN_AEGIS_NAMESPACE_TEST = "urn:aegis:namespace:test";
+
+ static class ServiceAndMapping {
+
+ private TypeMapping typeMapping;
+ private Service service;
+ private Server server;
+
+ /**
+ * *
+ *
+ * @return Returns the server.
+ */
+ public Server getServer() {
+ return server;
+ }
+ /**
+ * @param server The server to set.
+ */
+ public void setServer(Server server) {
+ this.server = server;
+ }
+ /**
+ * *
+ *
+ * @return Returns the typeMapping.
+ */
+ public TypeMapping getTypeMapping() {
+ return typeMapping;
+ }
+ /**
+ * @param typeMapping The typeMapping to set.
+ */
+ public void setTypeMapping(TypeMapping typeMapping) {
+ this.typeMapping = typeMapping;
+ }
+ /**
+ * *
+ *
+ * @return Returns the service.
+ */
+ public Service getService() {
+ return service;
+ }
+ /**
+ * @param service The service to set.
+ */
+ public void setService(Service service) {
+ this.service = service;
+ }
+ }
+
+ private ServiceAndMapping setupService(Class<?> seiClass, Map<String, String> namespaces) {
+ AegisDatabinding db = new AegisDatabinding();
+ db.setNamespaceMap(namespaces);
+ Server s = createService(seiClass, null, db);
+ ServiceAndMapping serviceAndMapping = new ServiceAndMapping();
+ serviceAndMapping.setServer(s);
+ serviceAndMapping.setService(s.getEndpoint().getService());
+ serviceAndMapping.setTypeMapping((TypeMapping)
+ serviceAndMapping.getService().get(TypeMapping.class.getName()));
+ return serviceAndMapping;
+ }
+
+ /**
+ * The W3C dom is not helpful in looking at declarations. We could convert
+ * to JDOM, but this is enough to get the job done.
+ *
+ * @param node
+ * @return
+ */
+ private Map<String, String>
+ getNodeNamespaceDeclarations(Node node) {
+ Map<String, String> result = new HashMap<String, String>();
+ NamedNodeMap attributes = node.getAttributes();
+ for (int x = 0; x < attributes.getLength(); x++) {
+ Attr attr = (Attr)attributes.item(x);
+ if (attr.getName().startsWith("xmlns:")) {
+ String[] ns = attr.getName().split(":");
+ result.put(ns[1], attr.getValue());
+ }
+ }
+ return result;
+ }
+
+ /**
+ * This substitutes for using the commons-collection BiDiMap.
+ * @param nsmap
+ * @param namespace
+ * @return
+ */
+ private String lookupPrefix(Map<String, String> nsmap, String namespace) {
+ for (Map.Entry<String, String> nspair : nsmap.entrySet()) {
+ if (namespace.equals(nspair.getValue())) {
+ return nspair.getKey();
+ }
+ }
+ return null;
+ }
+
+ @Test
+ public void testOnePrefix() throws Exception {
+ Map<String, String> mappings = new HashMap<String, String>();
+ mappings.put(URN_AEGIS_NAMESPACE_TEST, AEGIS_TEST_NAMESPACE_PREFIX_XYZZY);
+ ServiceAndMapping serviceAndMapping = setupService(NameServiceImpl.class, mappings);
+ Definition def = getWSDLDefinition("NameServiceImpl");
+ StringWriter wsdlSink = new StringWriter();
+ WSDLFactory.newInstance().newWSDLWriter().writeWSDL(def, wsdlSink);
+ org.w3c.dom.Document wsdlDoc = getWSDLDocument("NameServiceImpl");
+ Element rootElement = wsdlDoc.getDocumentElement();
+ addNamespace(AEGIS_TEST_NAMESPACE_PREFIX_XYZZY, URN_AEGIS_NAMESPACE_TEST);
+ assertXPathEquals("//namespace::xyzzy", URN_AEGIS_NAMESPACE_TEST, rootElement);
+ Element nameSchema = (Element)
+ assertValid("//xsd:schema[@targetNamespace='urn:aegis:namespace:test']", rootElement).item(0);
+ Map<String, String> namePrefixes = getNodeNamespaceDeclarations(nameSchema);
+ // there should be no TNS prefix, since the TNS namespace is explicitly
+ // xyzzy.
+ assertFalse(namePrefixes.containsKey("tns"));
+ Element serviceSchema = (Element)
+ assertValid("//xsd:schema[@targetNamespace='http://impl.namespaces.aegis.cxf.apache.org']",
+ rootElement).item(0);
+ Map<String, String> servicePrefixes = getNodeNamespaceDeclarations(serviceSchema);
+ String testPrefix = lookupPrefix(servicePrefixes, URN_AEGIS_NAMESPACE_TEST);
+ assertEquals(AEGIS_TEST_NAMESPACE_PREFIX_XYZZY, testPrefix);
+
+ serviceAndMapping.getServer().stop();
+ }
+}
Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/namespaces/ExplicitPrefixTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/namespaces/ExplicitPrefixTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/namespaces/NamespaceConfusionTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/namespaces/NamespaceConfusionTest.java?rev=576983&r1=576982&r2=576983&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/namespaces/NamespaceConfusionTest.java (original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/namespaces/NamespaceConfusionTest.java Tue Sep 18 10:18:16 2007
@@ -18,12 +18,16 @@
*/
package org.apache.cxf.aegis.namespaces;
-import javax.wsdl.WSDLException;
+import java.io.StringWriter;
+
+import javax.wsdl.Definition;
+import javax.wsdl.factory.WSDLFactory;
import javax.xml.namespace.QName;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.NodeList;
import org.apache.cxf.aegis.AbstractAegisTest;
import org.apache.cxf.aegis.namespaces.data.Name;
@@ -33,11 +37,6 @@
import org.apache.cxf.endpoint.Server;
import org.apache.cxf.service.Service;
-import org.jaxen.JaxenException;
-import org.jaxen.NamespaceContext;
-import org.jaxen.SimpleNamespaceContext;
-import org.jaxen.dom.DOMXPath;
-
import org.junit.Before;
import org.junit.Test;
@@ -52,7 +51,7 @@
private TypeMapping tm;
private Service service;
-
+
@Before
public void setUp() throws Exception {
super.setUp();
@@ -64,12 +63,9 @@
}
private String getNamespaceForPrefix(Element rootElement,
- NamespaceContext namespaceContext,
Element typeElement,
- String prefix) throws JaxenException {
- DOMXPath findSchema = new DOMXPath("ancestor::xsd:schema");
- findSchema.setNamespaceContext(namespaceContext);
- Element schemaElement = (Element)findSchema.selectSingleNode(typeElement);
+ String prefix) throws Exception {
+ Element schemaElement = (Element)assertValid("ancestor::xsd:schema", typeElement).item(0);
NamedNodeMap attributes = schemaElement.getAttributes();
for (int x = 0; x < attributes.getLength(); x++) {
@@ -95,31 +91,30 @@
return null;
}
-
+
@Test
- public void testNameNamespace() throws WSDLException, JaxenException {
- org.w3c.dom.Document wsdlDoc = getWSDLDocument("NameServiceImpl");
- Element rootElement = wsdlDoc.getDocumentElement();
-
- SimpleNamespaceContext namespaceContext = new SimpleNamespaceContext();
- namespaceContext.addNamespace("xsd", "http://www.w3.org/2001/XMLSchema");
- DOMXPath arrayOfNameFinder =
- new DOMXPath("//xsd:complexType[@name='ArrayOfName']/xsd:sequence/xsd:element");
- arrayOfNameFinder.setNamespaceContext(namespaceContext);
+ public void testNameNamespace() throws Exception {
- Element arrayOfNameElement = (Element)arrayOfNameFinder.selectSingleNode(rootElement);
- assertNotNull(arrayOfNameElement);
+ org.w3c.dom.Document doc = getWSDLDocument("NameServiceImpl");
+ Element rootElement = doc.getDocumentElement();
+ Definition def = getWSDLDefinition("NameServiceImpl");
+ StringWriter sink = new StringWriter();
+ WSDLFactory.newInstance().newWSDLWriter().writeWSDL(def, sink);
+ NodeList aonNodes =
+ assertValid("//xsd:complexType[@name='ArrayOfName']/xsd:sequence/xsd:element", doc);
+ Element arrayOfNameElement = (Element)aonNodes.item(0);
+
String typename = arrayOfNameElement.getAttribute("type");
String prefix = typename.split(":")[0];
- String uri = getNamespaceForPrefix(rootElement, namespaceContext,
- arrayOfNameElement, prefix);
+ String uri = getNamespaceForPrefix(rootElement, arrayOfNameElement, prefix);
assertNotNull(uri);
Type nameType = tm.getTypeCreator().createType(Name.class);
QName tmQname = nameType.getSchemaType();
assertEquals(tmQname.getNamespaceURI(), uri);
+
}
Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/namespaces/data/Name.aegis.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/namespaces/data/Name.aegis.xml?rev=576983&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/namespaces/data/Name.aegis.xml (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/namespaces/data/Name.aegis.xml Tue Sep 18 10:18:16 2007
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<mappings xmlns:nt="urn:aegis:namespace:test">
+ <mapping name="nt:Name">
+ <!-- without this, the XML must contain an array, even if the array is zero-length. -->
+ <property name='data' mappedName='nt:Data' minOccurs='1' nillable='true'/>
+ </mapping>
+</mappings>
Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/namespaces/data/Name.aegis.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/namespaces/data/Name.aegis.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/namespaces/data/Name.aegis.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/AddNumbers.aegis.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/AddNumbers.aegis.xml?rev=576983&r1=576982&r2=576983&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/AddNumbers.aegis.xml (original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/AddNumbers.aegis.xml Tue Sep 18 10:18:16 2007
@@ -1,7 +1,26 @@
-<mappings>
- <mapping uri="urn:AddNumbers">
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<mappings xmlns:anns="urn:AddNumbers">
+ <mapping name="anns:AddNumbers">
<method name="add">
- <parameter index="0" mappedName="value1"/>
+ <parameter index="0" mappedName="value1" />
<parameter index="1" mappedName="value2"/>
<return-type mappedName="sum"/>
</method>
Modified: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/AddNumbers.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/AddNumbers.java?rev=576983&r1=576982&r2=576983&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/AddNumbers.java (original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/AddNumbers.java Tue Sep 18 10:18:16 2007
@@ -22,4 +22,7 @@
public int add(int one, int two) {
return one + two;
}
+ public int unmappedAdd(int one, int two) {
+ return two + one;
+ }
}
Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/ArrayService.aegis.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/ArrayService.aegis.xml?rev=576983&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/ArrayService.aegis.xml (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/ArrayService.aegis.xml Tue Sep 18 10:18:16 2007
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<mappings>
+ <mapping name="ArrayService">
+ <method name="submitStringArray">
+ <parameter index="0" minOccurs='2' maxOccurs='50' />
+ </method>
+ </mapping>
+</mappings>
Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/ArrayService.aegis.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/ArrayService.aegis.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/ArrayService.aegis.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/SimpleBean.aegis.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/SimpleBean.aegis.xml?rev=576983&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/SimpleBean.aegis.xml (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/SimpleBean.aegis.xml Tue Sep 18 10:18:16 2007
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<mappings>
+ <mapping name="SimpleBean">
+ <property name='numbers' nillable='false' minOccurs='2' maxOccurs='50' />
+ </mapping>
+</mappings>
\ No newline at end of file
Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/SimpleBean.aegis.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/SimpleBean.aegis.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/SimpleBean.aegis.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/SimpleBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/SimpleBean.java?rev=576983&r1=576982&r2=576983&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/SimpleBean.java (original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/SimpleBean.java Tue Sep 18 10:18:16 2007
@@ -27,6 +27,16 @@
private String bleh;
private String howdy;
+
+ private int[] numbers;
+
+ public int[] getNumbers() {
+ return numbers;
+ }
+
+ public void setNumbers(int[] numbers) {
+ this.numbers = numbers;
+ }
public String getBleh() {
return bleh;
Modified: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/basic/BeanTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/basic/BeanTest.java?rev=576983&r1=576982&r2=576983&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/basic/BeanTest.java (original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/basic/BeanTest.java Tue Sep 18 10:18:16 2007
@@ -375,7 +375,7 @@
type.setSchemaType(new QName("urn:Bean", "bean"));
PropertyDescriptor[] pds = info.getPropertyDescriptors();
- assertEquals(2, pds.length);
+ assertEquals(3, pds.length);
ExtendedBean bean = new ExtendedBean();
bean.setHowdy("howdy");
Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java?rev=576983&r1=576982&r2=576983&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java (original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java Tue Sep 18 10:18:16 2007
@@ -220,8 +220,7 @@
try {
DOMUtils.writeXml(r.getNode(), System.out);
} catch (TransformerException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ throw new RuntimeException(e);
}
addSchemaDocument(serviceInfo, col,
(Document)r.getNode(), r.getSystemId());
@@ -400,8 +399,8 @@
//Now we can not add all the classes that Jaxb needed into JaxbContext, especially when
- //an ObjectFactroy is pointed by an jaxb @XmlElementDecl annotation
- //added this workaround method to load the jaxb needed OjbectFactory class
+ //an ObjectFactory is pointed to by an jaxb @XmlElementDecl annotation
+ //added this workaround method to load the jaxb needed ObjectFactory class
public boolean addJaxbObjectFactory(JAXBException e1) {
boolean added = false;
java.io.ByteArrayOutputStream bout = new java.io.ByteArrayOutputStream();
@@ -426,6 +425,14 @@
}
return added;
+ }
+
+ /**
+ * Jaxb has no declared namespace prefixes.
+ * {@inheritDoc}
+ */
+ public Map<String, String> getDeclaredNamespaceMappings() {
+ return null;
}
Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerChainBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerChainBuilder.java?rev=576983&r1=576982&r2=576983&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerChainBuilder.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerChainBuilder.java Tue Sep 18 10:18:16 2007
@@ -198,7 +198,7 @@
try {
m = handler.getClass().getMethod("init", Map.class);
} catch (NoSuchMethodException ex) {
- // emtpy
+ // empty
}
return m;
}
Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?rev=576983&r1=576982&r2=576983&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java (original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java Tue Sep 18 10:18:16 2007
@@ -30,6 +30,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -752,9 +753,21 @@
serviceInfo.setXmlSchemaCollection(col);
schemaInfo.setSchema(schema);
+ Map<String, String> explicitNamespaceMappings = this.getDataBinding().getDeclaredNamespaceMappings();
+ if (explicitNamespaceMappings == null) {
+ explicitNamespaceMappings = Collections.emptyMap();
+ }
NamespaceMap nsMap = new NamespaceMap();
- nsMap.add(WSDLConstants.NP_SCHEMA_XSD, WSDLConstants.NU_SCHEMA_XSD);
- nsMap.add(WSDLConstants.CONVENTIONAL_TNS_PREFIX, serviceInfo.getTargetNamespace());
+ for (Map.Entry<String, String> mapping : explicitNamespaceMappings.entrySet()) {
+ nsMap.add(mapping.getValue(), mapping.getKey());
+ }
+
+ if (!explicitNamespaceMappings.containsKey(WSDLConstants.NU_SCHEMA_XSD)) {
+ nsMap.add(WSDLConstants.NP_SCHEMA_XSD, WSDLConstants.NU_SCHEMA_XSD);
+ }
+ if (!explicitNamespaceMappings.containsKey(serviceInfo.getTargetNamespace())) {
+ nsMap.add(WSDLConstants.CONVENTIONAL_TNS_PREFIX, serviceInfo.getTargetNamespace());
+ }
schema.setNamespaceContext(nsMap);
serviceInfo.addSchema(schemaInfo);
return schemaInfo;
@@ -1145,7 +1158,8 @@
new QName(op.getName().getNamespaceURI(), exClass.getSimpleName()));
fi.setProperty(Class.class.getName(), exClass);
fi.setProperty("elementName", faultName);
- MessagePartInfo mpi = fi.addMessagePart(new QName(faultName.getNamespaceURI(), "fault"));
+ MessagePartInfo mpi = fi.addMessagePart(new QName(faultName.getNamespaceURI(),
+ exClass.getSimpleName()));
mpi.setElementQName(faultName);
mpi.setTypeClass(beanClass);
return fi;
Modified: incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineFactory.java?rev=576983&r1=576982&r2=576983&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineFactory.java (original)
+++ incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineFactory.java Tue Sep 18 10:18:16 2007
@@ -138,7 +138,7 @@
threadingParametersMap = threadingParamsMap;
}
- public Map<String, ThreadingParameters> getThreadingParamtersMap() {
+ public Map<String, ThreadingParameters> getThreadingParametersMap() {
return threadingParametersMap;
}
Modified: incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JavaParameterTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JavaParameterTest.java?rev=576983&r1=576982&r2=576983&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JavaParameterTest.java (original)
+++ incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JavaParameterTest.java Tue Sep 18 10:18:16 2007
@@ -32,11 +32,12 @@
assertEquals("\"\"",
holderParameter.getDefaultTypeValue());
- holderParameter = new JavaParameter("org.apache.cxf.tools.common.model.JavaParamter",
- "org.apache.cxf.tools.common.model.JavaParamter", null);
+ holderParameter = new JavaParameter("org.apache.cxf.tools.common.model.JavaParameter",
+ "org.apache.cxf.tools.common.model.JavaParameter", null);
holderParameter.setHolder(true);
holderParameter.setHolderName("javax.xml.ws.Holder");
- assertEquals("null",
- holderParameter.getDefaultTypeValue());
+ String defaultTypeValue = holderParameter.getDefaultTypeValue();
+ assertEquals("new org.apache.cxf.tools.common.model.JavaParameter()",
+ defaultTypeValue);
}
}
Modified: incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/calculator.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/calculator.wsdl?rev=576983&r1=576982&r2=576983&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/calculator.wsdl (original)
+++ incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/calculator.wsdl Tue Sep 18 10:18:16 2007
@@ -50,7 +50,7 @@
</wsdl:part>
</wsdl:message>
<wsdl:message name="AddException">
- <wsdl:part name="fault" element="tns:AddException">
+ <wsdl:part name="AddException" element="tns:AddException">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="CalculatorPortType">
Modified: incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/db.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/db.wsdl?rev=576983&r1=576982&r2=576983&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/db.wsdl (original)
+++ incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/db.wsdl Tue Sep 18 10:18:16 2007
@@ -53,7 +53,7 @@
</wsdl:part>
</wsdl:message>
<wsdl:message name="DBServiceFault">
- <wsdl:part name="fault" element="tns:DBServiceFault">
+ <wsdl:part name="DBServiceFault" element="tns:DBServiceFault">
</wsdl:part>
</wsdl:message>
<wsdl:message name="operation0Response">
Modified: incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/hello_soap12.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/hello_soap12.wsdl?rev=576983&r1=576982&r2=576983&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/hello_soap12.wsdl (original)
+++ incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/hello_soap12.wsdl Tue Sep 18 10:18:16 2007
@@ -55,7 +55,7 @@
</wsdl:part>
</wsdl:message>
<wsdl:message name="PingMeFault">
- <wsdl:part name="fault" element="ns1:faultDetail">
+ <wsdl:part name="PingMeFault" element="ns1:faultDetail">
</wsdl:part>
</wsdl:message>
<wsdl:message name="pingMeResponse">
Modified: incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/hello_world_fault_expected.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/hello_world_fault_expected.wsdl?rev=576983&r1=576982&r2=576983&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/hello_world_fault_expected.wsdl (original)
+++ incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/hello_world_fault_expected.wsdl Tue Sep 18 10:18:16 2007
@@ -67,11 +67,11 @@
</xs:schema>
</wsdl:types>
<wsdl:message name="BadRecordLitFault">
- <wsdl:part name="fault" element="ns1:BadRecordLit">
+ <wsdl:part name="BadRecordLitFault" element="ns1:BadRecordLit">
</wsdl:part>
</wsdl:message>
<wsdl:message name="NoSuchCodeLitFault">
- <wsdl:part name="fault" element="ns1:NoSuchCodeLit">
+ <wsdl:part name="NoSuchCodeLitFault" element="ns1:NoSuchCodeLit">
</wsdl:part>
</wsdl:message>
<wsdl:message name="testDocLitFault">
Modified: incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/my_hello_soap12.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/my_hello_soap12.wsdl?rev=576983&r1=576982&r2=576983&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/my_hello_soap12.wsdl (original)
+++ incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/my_hello_soap12.wsdl Tue Sep 18 10:18:16 2007
@@ -55,7 +55,7 @@
</wsdl:part>
</wsdl:message>
<wsdl:message name="PingMeFault">
- <wsdl:part name="fault" element="ns1:faultDetail">
+ <wsdl:part name="PingMeFault" element="ns1:faultDetail">
</wsdl:part>
</wsdl:message>
<wsdl:message name="pingMeResponse">
Modified: incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_hello_world_doc_lit.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_hello_world_doc_lit.wsdl?rev=576983&r1=576982&r2=576983&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_hello_world_doc_lit.wsdl (original)
+++ incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_hello_world_doc_lit.wsdl Tue Sep 18 10:18:16 2007
@@ -92,7 +92,7 @@
</wsdl:part>
</wsdl:message>
<wsdl:message name="PingMeFault">
- <wsdl:part name="fault" element="ns1:faultDetail">
+ <wsdl:part name="PingMeFault" element="ns1:faultDetail">
</wsdl:part>
</wsdl:message>
<wsdl:message name="greetMeOneWay">
Modified: incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/calculator.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/calculator.wsdl?rev=576983&r1=576982&r2=576983&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/calculator.wsdl (original)
+++ incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/calculator.wsdl Tue Sep 18 10:18:16 2007
@@ -50,7 +50,7 @@
</wsdl:part>
</wsdl:message>
<wsdl:message name="AddException">
- <wsdl:part name="fault" element="tns:AddException">
+ <wsdl:part name="AddException" element="tns:AddException">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="CalculatorPortType">
Modified: incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/db.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/db.wsdl?rev=576983&r1=576982&r2=576983&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/db.wsdl (original)
+++ incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/db.wsdl Tue Sep 18 10:18:16 2007
@@ -53,7 +53,7 @@
</wsdl:part>
</wsdl:message>
<wsdl:message name="DBServiceFault">
- <wsdl:part name="fault" element="tns:DBServiceFault">
+ <wsdl:part name="DBServiceFault" element="tns:DBServiceFault">
</wsdl:part>
</wsdl:message>
<wsdl:message name="operation0Response">
Modified: incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/hello_soap12.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/hello_soap12.wsdl?rev=576983&r1=576982&r2=576983&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/hello_soap12.wsdl (original)
+++ incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/hello_soap12.wsdl Tue Sep 18 10:18:16 2007
@@ -55,7 +55,7 @@
</wsdl:part>
</wsdl:message>
<wsdl:message name="PingMeFault">
- <wsdl:part name="fault" element="ns1:faultDetail">
+ <wsdl:part name="PingMeFault" element="ns1:faultDetail">
</wsdl:part>
</wsdl:message>
<wsdl:message name="pingMeResponse">