diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-10-26 23:44:59 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-10-26 23:44:59 +0000 |
commit | 71a7cba384b8ae7f4578fb9ab1f725d5ce616074 (patch) | |
tree | 98bbc7c066d037a8d9ea1fea7a3ccfa64419ab11 /branches/sca-java-1.x/modules/databinding-sdo | |
parent | 01a38d872dc2692d2a31f07f9c8f8098aa078853 (diff) |
Merge all changes from 1.5.2 branch into trunk
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@830026 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.x/modules/databinding-sdo')
2 files changed, 17 insertions, 5 deletions
diff --git a/branches/sca-java-1.x/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOContextHelper.java b/branches/sca-java-1.x/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOContextHelper.java index 695722be18..ada0c94a8d 100644 --- a/branches/sca-java-1.x/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOContextHelper.java +++ b/branches/sca-java-1.x/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.x/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDODataBinding.java b/branches/sca-java-1.x/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDODataBinding.java index 0b58be9e41..39e9ffc161 100644 --- a/branches/sca-java-1.x/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDODataBinding.java +++ b/branches/sca-java-1.x/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; } |