The attached patch fixes an issue with converter classloading.
Index: C:/ossoa/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/BaseGenerator.java =================================================================== --- /dev/null (revision 0) +++ C:/ossoa/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/BaseGenerator.java (revision 0) @@ -0,0 +1,22 @@ +package org.apache.tuscany.das.rdb.generator.impl; + +import org.apache.tuscany.das.rdb.Converter; +import org.apache.tuscany.das.rdb.config.Table; +import org.apache.tuscany.das.rdb.config.wrapper.TableWrapper; + +public class BaseGenerator { + + protected Converter getConverter(Table t, String name) { + TableWrapper tw = new TableWrapper(t); + String converter = tw.getConverter(name); + if ( converter != null ) { + try { + return (Converter) Thread.currentThread().getContextClassLoader().loadClass(converter).newInstance(); + } catch (Exception ex) { + throw new RuntimeException(ex); + } + } + return null; + } + +} Index: C:/ossoa/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/DeleteGenerator.java =================================================================== --- C:/ossoa/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/DeleteGenerator.java (revision 417236) +++ C:/ossoa/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/DeleteGenerator.java (working copy) @@ -19,7 +19,6 @@ import java.util.Collection; import java.util.Iterator; -import org.apache.tuscany.das.rdb.Converter; import org.apache.tuscany.das.rdb.SDODataTypes; import org.apache.tuscany.das.rdb.config.Table; import org.apache.tuscany.das.rdb.config.wrapper.TableWrapper; @@ -27,7 +26,7 @@ import org.apache.tuscany.das.rdb.impl.ParameterImpl; import org.apache.tuscany.das.rdb.util.DebugUtil; -public class DeleteGenerator { +public class DeleteGenerator extends BaseGenerator { public static final DeleteGenerator instance = new DeleteGenerator(); @@ -80,18 +79,7 @@ return deleteCommand; } - private Converter getConverter(Table t, String name) { - TableWrapper tw = new TableWrapper(t); - String converter = tw.getConverter(name); - if ( converter != null ) { - try { - return (Converter) Class.forName(converter).newInstance(); - } catch (Exception ex) { - throw new RuntimeException(ex); - } - } - return null; - } + } Index: C:/ossoa/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/UpdateGenerator.java =================================================================== --- C:/ossoa/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/UpdateGenerator.java (revision 417236) +++ C:/ossoa/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/UpdateGenerator.java (working copy) @@ -21,7 +21,6 @@ import java.util.Iterator; import java.util.List; -import org.apache.tuscany.das.rdb.Converter; import org.apache.tuscany.das.rdb.config.Column; import org.apache.tuscany.das.rdb.config.Table; import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; @@ -37,7 +36,7 @@ import commonj.sdo.Property; import commonj.sdo.Type; -public class UpdateGenerator { +public class UpdateGenerator extends BaseGenerator { private boolean debug = false; @@ -111,7 +110,7 @@ ParameterImpl param = new ParameterImpl(); param.setName(p.getName()); param.setType(p.getType()); - param.setConverter(getConverter(t, p.getName())); + param.setConverter(getConverter(table, p.getName())); param.setIndex(idx); updateCommand.addParameter(param); } @@ -157,18 +156,6 @@ } - private Converter getConverter(TableWrapper tw, String name) { - String converter = tw.getConverter(name); - if ( converter != null ) { - try { - return (Converter) Class.forName(converter).newInstance(); - } catch (Exception ex) { - throw new RuntimeException(ex); - } - } - return null; - } - public Collection getUpdateParameters(DataObject changedObject, Table table) { Type type = changedObject.getType(); TableWrapper wrapper = new TableWrapper(table); @@ -181,7 +168,7 @@ Property attr = (Property) i.next(); String field = attr.getName(); - ParameterImpl p = getParameter(wrapper, type.getProperty(field)); + ParameterImpl p = getParameter(table, type.getProperty(field)); if (pkNames.contains(field)) { pkParams.add(p); } else { @@ -193,11 +180,11 @@ } - private ParameterImpl getParameter(TableWrapper wrapper, Property property) { + private ParameterImpl getParameter(Table table, Property property) { ParameterImpl param = new ParameterImpl(); param.setName(property.getName()); param.setType(property.getType()); - param.setConverter(getConverter(wrapper, property.getName())); + param.setConverter(getConverter(table, property.getName())); return param; } Index: C:/ossoa/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/InsertGenerator.java =================================================================== --- C:/ossoa/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/InsertGenerator.java (revision 417236) +++ C:/ossoa/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/InsertGenerator.java (working copy) @@ -22,7 +22,6 @@ import java.util.Iterator; import java.util.List; -import org.apache.tuscany.das.rdb.Converter; import org.apache.tuscany.das.rdb.config.Relationship; import org.apache.tuscany.das.rdb.config.Table; import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; @@ -35,7 +34,7 @@ import commonj.sdo.DataObject; import commonj.sdo.Property; -public class InsertGenerator { +public class InsertGenerator extends BaseGenerator { public static final InsertGenerator instance = new InsertGenerator(); @@ -92,7 +91,7 @@ ParameterImpl p = new ParameterImpl(); p.setName(property.getName()); p.setType(property.getType()); - p.setConverter(getConverter(table, property.getName())); + p.setConverter(getConverter(t, property.getName())); p.setIndex(idx); cmd.addParameter(p); @@ -102,18 +101,6 @@ } - private Converter getConverter(TableWrapper tw, String name) { - String converter = tw.getConverter(name); - if ( converter != null ) { - try { - return (Converter) Class.forName(converter).newInstance(); - } catch (Exception ex) { - throw new RuntimeException(ex); - } - } - return null; - } - private List getAttributeProperties(DataObject obj, MappingWrapper config) { ArrayList fields = new ArrayList(); Iterator i = obj.getType().getProperties().iterator();
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]