diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2012-01-19 14:33:20 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2012-01-19 14:33:20 +0000 |
commit | 8624fc0322f368b2a59a61597e7f50e16e76ed94 (patch) | |
tree | dc9bec1760d9e8f1c6dad63acfea07de65092dee /sca-java-2.x/trunk/modules/databinding/src | |
parent | 0a86a47979a0bf3eeacb75d45d56b5abe3150bbf (diff) |
TUSCANY-3283 - these are similar changes to those made in 1.x to correct WSDL gen in various areas including, generating unannotated types into the service interface namespace, making wrapper parameters generally non-nillable, using JAXB to generate wrapper XSD (which fixes other failures where our code doesn't support various JAXB annotations), correcting the namespace of generated exceptions and the way that the generated classes are cached. Fixing the WSDL requires other fixes, for example, a new databinding to force ServiceReference to map to anyType (so that we don't try and process these interfaces with JAXB) and a fix to correct the order of response holders. T
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1233402 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/databinding/src')
3 files changed, 117 insertions, 0 deletions
diff --git a/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/servicereference/ServiceReferenceDataBinding.java b/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/servicereference/ServiceReferenceDataBinding.java new file mode 100644 index 0000000000..2117d2c3cf --- /dev/null +++ b/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/servicereference/ServiceReferenceDataBinding.java @@ -0,0 +1,42 @@ +/*
+ * 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.tuscany.sca.databinding.servicereference;
+
+import org.apache.tuscany.sca.databinding.BaseDataBinding;
+import org.apache.tuscany.sca.databinding.XMLTypeHelper;
+import org.oasisopen.sca.ServiceReference;
+
+public class ServiceReferenceDataBinding extends BaseDataBinding {
+
+ public static final String NAME = ServiceReference.class.getName();
+
+ private ServiceReferenceTypeHelper xmlTypeHelper;
+
+ public ServiceReferenceDataBinding() {
+ super(NAME, ServiceReference.class);
+ this.xmlTypeHelper = new ServiceReferenceTypeHelper();
+ }
+
+ @Override
+ public XMLTypeHelper getXMLTypeHelper() {
+ return xmlTypeHelper;
+ }
+
+}
diff --git a/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/servicereference/ServiceReferenceTypeHelper.java b/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/servicereference/ServiceReferenceTypeHelper.java new file mode 100644 index 0000000000..57da596d24 --- /dev/null +++ b/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/servicereference/ServiceReferenceTypeHelper.java @@ -0,0 +1,74 @@ +/* + * 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.tuscany.sca.databinding.servicereference; + +import java.beans.Introspector; +import java.util.ArrayList; +import java.util.List; +import javax.xml.namespace.QName; + +import org.apache.tuscany.sca.contribution.resolver.ModelResolver; +import org.apache.tuscany.sca.databinding.XMLTypeHelper; +import org.apache.tuscany.sca.interfacedef.DataType; +import org.apache.tuscany.sca.interfacedef.Interface; +import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper; +import org.apache.tuscany.sca.interfacedef.util.TypeInfo; +import org.apache.tuscany.sca.interfacedef.util.XMLType; +import org.apache.tuscany.sca.xsd.XSDFactory; +import org.apache.tuscany.sca.xsd.XSDefinition; + +/** + * Maps ServiceReference interfaces to AnyType + */ +public class ServiceReferenceTypeHelper implements XMLTypeHelper { + private static final String SCHEMA_NS = "http://www.w3.org/2001/XMLSchema"; + private static final String ANYTYPE_NAME = "anyType"; + private static final QName ANYTYPE_QNAME = new QName(SCHEMA_NS, ANYTYPE_NAME); + + public ServiceReferenceTypeHelper() { + super(); + } + + public TypeInfo getTypeInfo(Class javaType, Object logical) { + QName xmlType = JavaXMLMapper.getXMLType(javaType); + if (xmlType != null) { + return new TypeInfo(xmlType, true, null); + } else if (javaType.isInterface()) { + return new TypeInfo(ANYTYPE_QNAME, true, null); + } else { + if (logical instanceof XMLType) { + xmlType = ((XMLType)logical).getTypeName(); + } + if (xmlType == null) { + xmlType = new QName(Introspector.decapitalize(javaType.getSimpleName())); + } + return new TypeInfo(xmlType, false, null); + } + } + + public List<XSDefinition> getSchemaDefinitions(XSDFactory factory, ModelResolver resolver, Interface intf) { + return new ArrayList<XSDefinition>(); + } + + public List<XSDefinition> getSchemaDefinitions(XSDFactory factory, ModelResolver resolver, List<DataType> dataTypes) { + return new ArrayList<XSDefinition>(); + } + +} diff --git a/sca-java-2.x/trunk/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding b/sca-java-2.x/trunk/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding index ef8a825d68..3c0dce0492 100644 --- a/sca-java-2.x/trunk/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding +++ b/sca-java-2.x/trunk/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding @@ -23,4 +23,5 @@ org.apache.tuscany.sca.databinding.javabeans.JavaBeansDataBinding;name=java:comp org.apache.tuscany.sca.databinding.javabeans.SimpleJavaDataBinding;name=java:simpleType
org.apache.tuscany.sca.databinding.javabeans.JavaExceptionDataBinding;name=java:exception
org.apache.tuscany.sca.databinding.externalizable.ExternalizableDataBinding;name=java.io.Externalizable
+org.apache.tuscany.sca.databinding.servicereference.ServiceReferenceDataBinding;name=org.oasisopen.sca.ServiceReference
|