summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/core-databinding
diff options
context:
space:
mode:
authornash <nash@13f79535-47bb-0310-9956-ffa450edef68>2008-08-12 20:49:42 +0000
committernash <nash@13f79535-47bb-0310-9956-ffa450edef68>2008-08-12 20:49:42 +0000
commit8dd1dfb46f140d376388678590f99d37f70de8c5 (patch)
treeec9d25c125dd6400988583cd55371646833b3bb9 /java/sca/modules/core-databinding
parentb46cd2bd0f57b0385883b1b5a8c12711ee68c007 (diff)
Fix TUSCANY-2531
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@685310 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/core-databinding')
-rw-r--r--java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReferenceDataBinding.java9
-rw-r--r--java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReferenceTypeHelper.java75
2 files changed, 84 insertions, 0 deletions
diff --git a/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReferenceDataBinding.java b/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReferenceDataBinding.java
index 7384b8a31d..012950e215 100644
--- a/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReferenceDataBinding.java
+++ b/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReferenceDataBinding.java
@@ -19,6 +19,7 @@
package org.apache.tuscany.sca.core.databinding.transformers;
+import org.apache.tuscany.sca.databinding.XMLTypeHelper;
import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
import org.osoa.sca.CallableReference;
@@ -27,8 +28,16 @@ public class CallableReferenceDataBinding extends BaseDataBinding {
public static final String NAME = CallableReference.class.getName();
public static final String[] ALIASES = new String[] {"callablereference"};
+ private CallableReferenceTypeHelper xmlTypeHelper;
+
public CallableReferenceDataBinding() {
super(NAME, ALIASES, CallableReference.class);
+ this.xmlTypeHelper = new CallableReferenceTypeHelper();
+ }
+
+ @Override
+ public XMLTypeHelper getXMLTypeHelper() {
+ return xmlTypeHelper;
}
}
diff --git a/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReferenceTypeHelper.java b/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReferenceTypeHelper.java
new file mode 100644
index 0000000000..97629ea7b5
--- /dev/null
+++ b/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReferenceTypeHelper.java
@@ -0,0 +1,75 @@
+/*
+ * 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.core.databinding.transformers;
+
+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;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class CallableReferenceTypeHelper 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 CallableReferenceTypeHelper() {
+ 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>();
+ }
+
+}