From 12d905c8cd8cf3d1e64595ef9a0f42e8e988f61e Mon Sep 17 00:00:00 2001 From: rfeng Date: Thu, 17 Sep 2009 20:12:07 +0000 Subject: Fix for TUSCANY-3273 git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@816364 13f79535-47bb-0310-9956-ffa450edef68 --- .../tuscany/sca/databinding/sdo/SDOContextHelper.java | 16 +++++++++++++--- .../tuscany/sca/databinding/sdo/SDODataBinding.java | 6 ++++-- .../src/main/resources/xqueryquotewsclient.composite | 7 ++++--- .../java/xquery/quote/XQueryQuoteClientTestCase.java | 2 -- 4 files changed, 21 insertions(+), 10 deletions(-) (limited to 'branches/sca-java-1.5.1') diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOContextHelper.java b/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOContextHelper.java index 695722be18..ada0c94a8d 100644 --- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOContextHelper.java +++ b/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOContextHelper.java @@ -138,16 +138,26 @@ public final class SDOContextHelper { } try { Type type = helperContext.getTypeHelper().getType(javaType); - if (type != null && (!type.isDataType())) { + return register(helperContext, type); + } catch (Exception e) { + throw new TransformationException(e); + } + } + + public static boolean register(HelperContext helperContext, Type type) { + if (type != null && (!type.isDataType())) { + try { Method method = type.getClass().getMethod("getEPackage"); Object factory = method.invoke(type, new Object[] {}); method = factory.getClass().getMethod("register", HelperContext.class); method.invoke(factory, new Object[] {helperContext}); return true; + } catch (Exception e) { + e.printStackTrace(); + return false; } + } else { return false; - } catch (Exception e) { - throw new TransformationException(e); } } diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDODataBinding.java b/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDODataBinding.java index 0b58be9e41..39e9ffc161 100644 --- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDODataBinding.java +++ b/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDODataBinding.java @@ -69,7 +69,7 @@ public class SDODataBinding extends BaseDataBinding { } }); - Type type = context.getTypeHelper().getType(javaType); + final Type type = context.getTypeHelper().getType(javaType); if (type == null) { // FIXME: Need a better to test dynamic SDO if (DataObject.class.isAssignableFrom(javaType)) { @@ -92,10 +92,12 @@ public class SDODataBinding extends BaseDataBinding { public Object run() { if (context == SDOContextHelper.getDefaultHelperContext()) { HelperContext newContext = SDOUtil.createHelperContext(); - SDOContextHelper.register(newContext, javaType); + SDOContextHelper.register(newContext, type); if (operation != null) { operation.getInputType().setMetaData(HelperContext.class, newContext); } + } else { + SDOContextHelper.register(context, type); } return null; } diff --git a/branches/sca-java-1.5.1/samples/quote-xquery/src/main/resources/xqueryquotewsclient.composite b/branches/sca-java-1.5.1/samples/quote-xquery/src/main/resources/xqueryquotewsclient.composite index 35306b9f89..c9887c8c19 100644 --- a/branches/sca-java-1.5.1/samples/quote-xquery/src/main/resources/xqueryquotewsclient.composite +++ b/branches/sca-java-1.5.1/samples/quote-xquery/src/main/resources/xqueryquotewsclient.composite @@ -18,7 +18,9 @@ * under the License. --> @@ -101,9 +103,8 @@ - - --> diff --git a/branches/sca-java-1.5.1/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteClientTestCase.java b/branches/sca-java-1.5.1/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteClientTestCase.java index a7224b0efa..9555532b3e 100644 --- a/branches/sca-java-1.5.1/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteClientTestCase.java +++ b/branches/sca-java-1.5.1/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteClientTestCase.java @@ -33,7 +33,6 @@ import org.example.quote.Quote; import org.example.quote.QuoteResponse; import org.junit.After; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import commonj.sdo.DataObject; @@ -63,7 +62,6 @@ import commonj.sdo.DataObject; * total price * 4. SDO is used for data interchange */ -@Ignore("Broken, see TUSCANY-2943") public class XQueryQuoteClientTestCase { public static boolean SHOW_DEBUG_MSG = false; -- cgit v1.2.3