tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdan...@apache.org
Subject svn commit: r451460 [3/6] - in /incubator/tuscany/java/das/rdb/src: main/java/org/apache/tuscany/das/rdb/ main/java/org/apache/tuscany/das/rdb/config/wrapper/ main/java/org/apache/tuscany/das/rdb/generator/impl/ main/java/org/apache/tuscany/das/rdb/gra...
Date Fri, 29 Sep 2006 21:36:41 GMT
Modified: incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeSummarizer.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeSummarizer.java?view=diff&rev=451460&r1=451459&r2=451460
==============================================================================
--- incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeSummarizer.java (original)
+++ incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeSummarizer.java Fri Sep 29 14:36:37 2006
@@ -22,6 +22,7 @@
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.log4j.Logger;
 import org.apache.tuscany.das.rdb.Command;
@@ -43,199 +44,199 @@
 
     private final Logger logger = LoggerFactory.INSTANCE.getLogger(ChangeSummarizer.class);
 
-	private Changes changes = new Changes();
+    private Changes changes = new Changes();
 
-	private FactoryRegistry registry;
+    private FactoryRegistry registry;
 
-	private MappingWrapper mapping = new MappingWrapper();
+    private MappingWrapper mapping = new MappingWrapper();
 
-	private ConnectionImpl connection;
+    private ConnectionImpl connection;
 
-	private HashMap generatedKeys = new HashMap();
+    private Map generatedKeys = new HashMap();
 
-	public ChangeSummarizer() {
-		// Empty Constructor
-	}
+    public ChangeSummarizer() {
+        // Empty Constructor
+    }
 
-	public Changes loadChanges(DataObject root) {
-		ChangeSummary changeSummary = root.getDataGraph().getChangeSummary();
-		if (changeSummary.isLogging())
-			((ChangeSummaryImpl) changeSummary).summarize();
+    public Changes loadChanges(DataObject root) {
+        ChangeSummary changeSummary = root.getDataGraph().getChangeSummary();
+        if (changeSummary.isLogging()) {
+            ((ChangeSummaryImpl) changeSummary).summarize();
+        }
 
-		List changedObjects = changeSummary.getChangedDataObjects();
+        List changedObjects = changeSummary.getChangedDataObjects();
 
-        if(this.logger.isDebugEnabled())
+        if (this.logger.isDebugEnabled()) {
             this.logger.debug("List of changed objects contains " + changedObjects.size() + " object(s)");
+        }
 
-		changes.setInsertOrder(mapping.getInsertOrder());
-		changes.setDeleteOrder(mapping.getDeleteOrder());
+        changes.setInsertOrder(mapping.getInsertOrder());
+        changes.setDeleteOrder(mapping.getDeleteOrder());
 
-		Iterator i = changedObjects.iterator();
-		while (i.hasNext()) {
-			DataObject o = (DataObject) i.next();
-
-			if (!(o.equals(root))) {
-				createChange(changeSummary, o);
-			}
-		}
+        Iterator i = changedObjects.iterator();
+        while (i.hasNext()) {
+            DataObject o = (DataObject) i.next();
 
-		return changes;
-	}
+            if (!(o.equals(root))) {
+                createChange(changeSummary, o);
+            }
+        }
 
-	public void createChange(ChangeSummary changeSummary,
-			DataObject changedObject) {
+        return changes;
+    }
 
-		if (changeSummary.isCreated(changedObject)) {
-            if(this.logger.isDebugEnabled())
-                this.logger.debug("Change is a create");
-
-			if (!changeSummary.isDeleted(changedObject)) {
-				ChangeFactory factory = getRegistry().getFactory(changedObject.getType());
-				String propagatedID = (String) generatedKeys.get(changedObject.getType().getName());
-				changes.addInsert(factory.createInsertOperation(changedObject, propagatedID));
-			}
-		} else if (changeSummary.isDeleted(changedObject)) {
-			ChangeFactory factory = getRegistry().getFactory(changedObject.getType());
+    public void createChange(ChangeSummary changeSummary, DataObject changedObject) {
 
-            if(this.logger.isDebugEnabled())
+        if (changeSummary.isCreated(changedObject)) {
+            if (this.logger.isDebugEnabled()) {
+                this.logger.debug("Change is a create");
+            }
+            if (!changeSummary.isDeleted(changedObject)) {
+                ChangeFactory factory = getRegistry().getFactory(changedObject.getType());
+                String propagatedID = (String) generatedKeys.get(changedObject.getType().getName());
+                changes.addInsert(factory.createInsertOperation(changedObject, propagatedID));
+            }
+        } else if (changeSummary.isDeleted(changedObject)) {
+            ChangeFactory factory = getRegistry().getFactory(changedObject.getType());
+            if (this.logger.isDebugEnabled()) {
                 this.logger.debug("Change is a delete");
-
-			changes.addDelete(factory.createDeleteOperation(changedObject));
-		} else {
-			// bumpCollisionField(changedObject);
-            if(this.logger.isDebugEnabled())
+            }
+            changes.addDelete(factory.createDeleteOperation(changedObject));
+        } else {
+            if (this.logger.isDebugEnabled()) {
                 this.logger.debug("Change is a modify");
-
-			List attrList = changeSummary.getOldValues(changedObject);
-			if (hasAttributeChange(attrList)) {
-				ChangeFactory factory = getRegistry().getFactory(changedObject.getType());
-
-                if(this.logger.isDebugEnabled())
+            }
+            List attrList = changeSummary.getOldValues(changedObject);
+            if (hasAttributeChange(attrList)) {
+                ChangeFactory factory = getRegistry().getFactory(changedObject.getType());
+                if (this.logger.isDebugEnabled()) {
                     this.logger.debug("Attribute Change for " + changedObject.getType().getName());
-
-				String propagatedID = (String) generatedKeys.get(changedObject.getType().getName());
-				changes.addUpdate(factory.createUpdateOperation(changedObject, propagatedID));
-			} else {
-				// Reference change
-				List values = changeSummary.getOldValues(changedObject);
-				Iterator i = values.iterator();
-				while (i.hasNext()) {
-					ChangeSummary.Setting setting = (ChangeSummary.Setting) i.next();
-
-					if (!setting.getProperty().getType().isDataType()) {
-                        if(this.logger.isDebugEnabled())
+                }
+                String propagatedID = (String) generatedKeys.get(changedObject.getType().getName());
+                changes.addUpdate(factory.createUpdateOperation(changedObject, propagatedID));
+            } else {
+                List values = changeSummary.getOldValues(changedObject);
+                Iterator i = values.iterator();
+                while (i.hasNext()) {
+                    ChangeSummary.Setting setting = (ChangeSummary.Setting) i.next();
+                    if (!setting.getProperty().getType().isDataType()) {
+                        if (this.logger.isDebugEnabled()) {
                             this.logger.debug("Reference change for " + changedObject.getType().getName());
-
-						Property ref = setting.getProperty();
-
-                        if(this.logger.isDebugEnabled())
+                        }
+                        Property ref = setting.getProperty();
+                        if (this.logger.isDebugEnabled()) {
                             this.logger.debug(ref.getName());
-
-						if (hasState(ref, changedObject) ) {
-							ChangeFactory factory = getRegistry().getFactory(changedObject.getType());
-							changes.addUpdate(factory.createUpdateOperation(changedObject));
-						}
-
-					}
-				}
-			}
-		}
-
-	}
-
-	private boolean hasState(Property ref, DataObject changedObject) {
-		if ( ref.getOpposite().isMany() ) {
-			return true;
-		} else {
-			MappingWrapper mw = this.mapping;
-			if ( mw.getConfig() == null )
-				mw = registry.getFactory(changedObject.getType()).getConfig();
-			if ( mw.getConfig() == null )
-				return false;
-
-			Relationship rel = mw.getRelationshipByReference(ref);
-
-			if ( !rel.isMany()) {
-				if ( rel.isKeyRestricted())
-					throw new RuntimeException("Can not modify a one to one relationship that is key restricted");
-				// This is a one-one relationship
-				Table t = mapping.getTableByTypeName(changedObject.getType().getName());
-				TableWrapper tw = new TableWrapper(t);
-				RelationshipWrapper rw = new RelationshipWrapper(rel);
-				if (( rel.getForeignKeyTable().equals(t.getTableName())) &&
-						( Collections.disjoint(tw.getPrimaryKeyProperties(),rw.getForeignKeys()) ))
-					return true;
-
-			}
-
-		}
-		return false;
-	}
-
-	private boolean hasAttributeChange(List theChanges) {
-		Iterator i = theChanges.iterator();
-		while (i.hasNext()) {
-			ChangeSummary.Setting setting = (ChangeSummary.Setting) i.next();
-			if (setting.getProperty().getType().isDataType())
-				return true;
-		}
-		return false;
-	}
-
-	public void addCreateCommand(Type type, Command cmd) {
-		ChangeFactory cf = getRegistry().getFactory(type);
-		cf.setCreateCommand((InsertCommandImpl) cmd);
-		((CommandImpl) cmd).setConnection(connection);
-	}
-
-	public void addUpdateCommand(Type type, Command cmd) {
-		ChangeFactory cf = getRegistry().getFactory(type);
-		cf.setUpdateCommand((UpdateCommandImpl) cmd);
-		((CommandImpl) cmd).setConnection(connection);
-	}
-
-	public void addDeleteCommand(Type type, Command cmd) {
-		ChangeFactory cf = getRegistry().getFactory(type);
-		cf.setDeleteCommand((DeleteCommandImpl) cmd);
-		 ((CommandImpl) cmd).setConnection(connection);
-
-	}
-
-	private FactoryRegistry getRegistry() {
-		if (this.registry == null) {
-			this.registry = new FactoryRegistry(mapping, connection);
-		}
-		return this.registry;
-	}
-
-	public void setConnection(ConnectionImpl connection) {
-		this.connection = connection;
-	}
-
-	public void setMapping(MappingWrapper map) {
-		this.mapping = map;
-
-		if ( mapping.getConfig() == null )
-			return;
-
-		Iterator i = mapping.getConfig().getTable().iterator();
-		while (i.hasNext()) {
-			Table t = (Table) i.next();
-			Iterator columns = t.getColumn().iterator();
-			while ( columns.hasNext()) {
-				Column c = (Column) columns.next();
-				if ( c.isPrimaryKey() && c.isGenerated()) {
-                    if(this.logger.isDebugEnabled())
+                        }
+                        if (hasState(ref, changedObject)) {
+                            ChangeFactory factory = getRegistry().getFactory(changedObject.getType());
+                            changes.addUpdate(factory.createUpdateOperation(changedObject));
+                        }
+                    }
+                }
+            }
+        }
+
+    }
+
+    private boolean hasState(Property ref, DataObject changedObject) {
+        if (ref.getOpposite().isMany()) {
+            return true;
+        } 
+
+        MappingWrapper mw = this.mapping;
+        if (mw.getConfig() == null) {
+            mw = registry.getFactory(changedObject.getType()).getConfig();
+        }
+        if (mw.getConfig() == null) {
+            return false;
+        }
+
+        Relationship rel = mw.getRelationshipByReference(ref);
+
+        if (!rel.isMany()) {
+            if (rel.isKeyRestricted()) {
+                throw new RuntimeException("Can not modify a one to one relationship that is key restricted");
+            }
+            // This is a one-one relationship
+            Table t = mapping.getTableByTypeName(changedObject.getType().getName());
+            TableWrapper tw = new TableWrapper(t);
+            RelationshipWrapper rw = new RelationshipWrapper(rel);
+            if ((rel.getForeignKeyTable().equals(t.getTableName())) 
+                    && (Collections.disjoint(tw.getPrimaryKeyProperties(), rw.getForeignKeys()))) {
+                return true;
+            }
+
+        }
+
+        return false;
+    }
+
+    private boolean hasAttributeChange(List theChanges) {
+        Iterator i = theChanges.iterator();
+        while (i.hasNext()) {
+            ChangeSummary.Setting setting = (ChangeSummary.Setting) i.next();
+            if (setting.getProperty().getType().isDataType()) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public void addCreateCommand(Type type, Command cmd) {
+        ChangeFactory cf = getRegistry().getFactory(type);
+        cf.setCreateCommand((InsertCommandImpl) cmd);
+        ((CommandImpl) cmd).setConnection(connection);
+    }
+
+    public void addUpdateCommand(Type type, Command cmd) {
+        ChangeFactory cf = getRegistry().getFactory(type);
+        cf.setUpdateCommand((UpdateCommandImpl) cmd);
+        ((CommandImpl) cmd).setConnection(connection);
+    }
+
+    public void addDeleteCommand(Type type, Command cmd) {
+        ChangeFactory cf = getRegistry().getFactory(type);
+        cf.setDeleteCommand((DeleteCommandImpl) cmd);
+        ((CommandImpl) cmd).setConnection(connection);
+
+    }
+
+    private FactoryRegistry getRegistry() {
+        if (this.registry == null) {
+            this.registry = new FactoryRegistry(mapping, connection);
+        }
+        return this.registry;
+    }
+
+    public void setConnection(ConnectionImpl connection) {
+        this.connection = connection;
+    }
+
+    public void setMapping(MappingWrapper map) {
+        this.mapping = map;
+
+        if (mapping.getConfig() == null) {
+            return;
+        }
+
+        Iterator i = mapping.getConfig().getTable().iterator();
+        while (i.hasNext()) {
+            Table t = (Table) i.next();
+            Iterator columns = t.getColumn().iterator();
+            while (columns.hasNext()) {
+                Column c = (Column) columns.next();
+                if (c.isPrimaryKey() && c.isGenerated()) {
+                    if (this.logger.isDebugEnabled()) {
                         this.logger.debug("adding generated key " + t.getTableName() + "." + c.getColumnName());
+                    }
 
-					generatedKeys.put(t.getTableName(), c.getColumnName());
-				}
-			}
-		}
-	}
-
-
-	public ConnectionImpl getConnection() {
-		return this.connection;
-	}
+                    generatedKeys.put(t.getTableName(), c.getColumnName());
+                }
+            }
+        }
+    }
+
+    public ConnectionImpl getConnection() {
+        return this.connection;
+    }
 }

Modified: incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Changes.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Changes.java?view=diff&rev=451460&r1=451459&r2=451460
==============================================================================
--- incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Changes.java (original)
+++ incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Changes.java Fri Sep 29 14:36:37 2006
@@ -18,65 +18,65 @@
  */
 package org.apache.tuscany.das.rdb.impl;
 
-import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.List;
 
 /**
- * Mangages a set of graph-change operations.  This simple implementaiton can be 
+ * Manages a set of graph-change operations. This simple implementaiton can be 
  * replaced with a version that provides R/I sorting
  * 
  */
 public class Changes {
 
-	private InsertList inserts = new InsertList();
-	private UpdateList updates = new UpdateList();
-	private DeleteList deletes = new DeleteList();
-	
-
-	public void addInsert(ChangeOperation c) {
-		inserts.add(c);
-	}
-	
-	public void addUpdate(ChangeOperation c) {
-		updates.add(c);
-	}
-	
-	public void addDelete(ChangeOperation c) {
-		deletes.add(c);
-	}
-
-	/**
-	 * Execute all my change
-	 */
-	public void execute() {
-		
-		Iterator i = inserts.getSortedList().iterator();
-		while ( i.hasNext() ) {
-			ChangeOperation c = (ChangeOperation) i.next();
-			c.execute();
-		}
-		
-		i = updates.getSortedList().iterator();
-		while ( i.hasNext() ) {
-			ChangeOperation c = (ChangeOperation) i.next();
-			c.execute();
-		}
-		
-		
-		i = deletes.getSortedList().iterator();
-		while (i.hasNext() ) {
-			ChangeOperation c = (ChangeOperation) i.next();
-			c.execute();
-		}
-	
-	}
-	
-	public void setInsertOrder(ArrayList insertOrder) {
-		inserts.setOrder(insertOrder);
-	}
-
-	public void setDeleteOrder(ArrayList deleteOrder) {
-		deletes.setOrder(deleteOrder);
-	}
+    private InsertList inserts = new InsertList();
+
+    private UpdateList updates = new UpdateList();
+
+    private DeleteList deletes = new DeleteList();
+
+    public void addInsert(ChangeOperation c) {
+        inserts.add(c);
+    }
+
+    public void addUpdate(ChangeOperation c) {
+        updates.add(c);
+    }
+
+    public void addDelete(ChangeOperation c) {
+        deletes.add(c);
+    }
+
+    /**
+     * Execute all my change
+     */
+    public void execute() {
+
+        Iterator i = inserts.getSortedList().iterator();
+        while (i.hasNext()) {
+            ChangeOperation c = (ChangeOperation) i.next();
+            c.execute();
+        }
+
+        i = updates.getSortedList().iterator();
+        while (i.hasNext()) {
+            ChangeOperation c = (ChangeOperation) i.next();
+            c.execute();
+        }
+
+        i = deletes.getSortedList().iterator();
+        while (i.hasNext()) {
+            ChangeOperation c = (ChangeOperation) i.next();
+            c.execute();
+        }
+
+    }
+
+    public void setInsertOrder(List insertOrder) {
+        inserts.setOrder(insertOrder);
+    }
+
+    public void setDeleteOrder(List deleteOrder) {
+        deletes.setOrder(deleteOrder);
+    }
 
 }

Modified: incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandImpl.java?view=diff&rev=451460&r1=451459&r2=451460
==============================================================================
--- incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandImpl.java (original)
+++ incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandImpl.java Fri Sep 29 14:36:37 2006
@@ -29,74 +29,71 @@
 import commonj.sdo.helper.XSDHelper;
 
 public abstract class CommandImpl extends BaseCommandImpl implements Command {
+    
+    protected Statement statement;
 
-	protected Statement statement;
-
-	protected Parameters parameters = new Parameters();
+    protected Parameters parameters = new Parameters();
 
-	protected static final boolean debug = false;
+   
 
-	protected ResultSetShape resultSetShape;
+    protected ResultSetShape resultSetShape;
 
-	public CommandImpl(String sqlString) {
-		statement = new Statement(sqlString);
+    public CommandImpl(String sqlString) {
+        statement = new Statement(sqlString);
 
-		try {
-			URL url = getClass().getResource("/xml/sdoJava.xsd");
-			if (url == null)
-				throw new RuntimeException(
-					"Could not find resource: xml/sdoJava.xsd");
-		
-			InputStream inputStream = url.openStream();
-			XSDHelper.INSTANCE.define(inputStream, url.toString());
-			inputStream.close();
-		} catch ( IOException ex ) {
-			throw new RuntimeException(ex);
-		}
+        try {
+            URL url = getClass().getResource("/xml/sdoJava.xsd");
+            if (url == null) {
+                throw new RuntimeException("Could not find resource: xml/sdoJava.xsd");
+            }
 
-	}
+            InputStream inputStream = url.openStream();
+            XSDHelper.INSTANCE.define(inputStream, url.toString());
+            inputStream.close();
+        } catch (IOException ex) {
+            throw new RuntimeException(ex);
+        }
 
-	public abstract void execute();
+    }
 
-	public abstract DataObject executeQuery();
+    public abstract void execute();
 
-	public void setParameter(int index, Object value) {
-		parameters.setParameter(index, value);
-	}
+    public abstract DataObject executeQuery();
 
-	public void addParameter(ParameterImpl param) {
-		parameters.add(param);
-	}
+    public void setParameter(int index, Object value) {
+        parameters.setParameter(index, value);
+    }
 
+    public void addParameter(ParameterImpl param) {
+        parameters.add(param);
+    }
 
-	public List getParameters() {
-		return parameters.parameterList();
-	}
+    public List getParameters() {
+        return parameters.parameterList();
+    }
 
-	public Object getParameter(int index) {
-		return parameters.parameterWithIndex(index).getValue();
-	}
+    public Object getParameter(int index) {
+        return parameters.parameterWithIndex(index).getValue();
+    }
 
-	public void setConnection(ConnectionImpl connection) {
-		statement.setConnection(connection);
-	}
+    public void setConnection(ConnectionImpl connection) {
+        statement.setConnection(connection);
+    }
 
-	protected ConnectionImpl getConnection() {
-		return statement.getConnection();
-	}
+    protected ConnectionImpl getConnection() {
+        return statement.getConnection();
+    }
 
-    
-    /* 
-     * The default impl is to throw an exception.  This is overridden by
-     * InsertCommandImpl
+    /*
+     * The default impl is to throw an exception. This is overridden by InsertCommandImpl
      */
     public int getGeneratedKey() {
-        
+
         throw new RuntimeException("This method is only valid for insert commands");
     }
 
-	public void close() {
-		statement.close();
-	}
+    public void close() {
+        statement.close();
+    }
 
 }

Modified: incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ConnectionImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ConnectionImpl.java?view=diff&rev=451460&r1=451459&r2=451460
==============================================================================
--- incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ConnectionImpl.java (original)
+++ incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ConnectionImpl.java Fri Sep 29 14:36:37 2006
@@ -33,90 +33,91 @@
 
     private final Logger logger = LoggerFactory.INSTANCE.getLogger(ConnectionImpl.class);
 
-	private Connection connection;
+    private Connection connection;
 
-	private boolean managingTransaction = true;
-	private final boolean useGetGeneratedKeys;
+    private boolean managingTransaction = true;
 
-	public ConnectionImpl(Connection connection) {
-		this.connection = connection;
-		
-		try {
-			DatabaseMetaData dbmd = connection.getMetaData();
-		 
-			if (dbmd.getDatabaseProductName().contains("Oracle") )
-				this.useGetGeneratedKeys = false;
-			else
-				this.useGetGeneratedKeys = true;
-			if (connection.getAutoCommit())
-				throw new RuntimeException("AutoCommit must be off");
-		} catch (SQLException e) {
-			throw new RuntimeException(e);
-		}
-
-	}
-
-	public Connection getJDBCConnection() {
-		return connection;
-	}
-
-	public void cleanUp() {
-		try {
-			if (managingTransaction) {
-                if(this.logger.isDebugEnabled())
+    private final boolean useGetGeneratedKeys;
+
+    public ConnectionImpl(Connection connection) {
+        this.connection = connection;
+
+        try {
+            DatabaseMetaData dbmd = connection.getMetaData();
+
+            if (dbmd.getDatabaseProductName().contains("Oracle")) {
+                this.useGetGeneratedKeys = false;
+            } else {
+                this.useGetGeneratedKeys = true;
+            }
+            if (connection.getAutoCommit())
+                throw new RuntimeException("AutoCommit must be off");
+        } catch (SQLException e) {
+            throw new RuntimeException(e);
+        }
+
+    }
+
+    public Connection getJDBCConnection() {
+        return connection;
+    }
+
+    public void cleanUp() {
+        try {
+            if (managingTransaction) {
+                if (this.logger.isDebugEnabled())
                     this.logger.debug("Committing Transaction");
 
-				connection.commit();
-			}
-		} catch (SQLException e) {
-			throw new RuntimeException(e);
-		}
-	}
-
-	public void errorCleanUp() {
-		try {
-			if (managingTransaction) {
-                if(this.logger.isDebugEnabled())
+                connection.commit();
+            }
+        } catch (SQLException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    public void errorCleanUp() {
+        try {
+            if (managingTransaction) {
+                if (this.logger.isDebugEnabled())
                     this.logger.debug("Rolling back Transaction");
 
-				connection.rollback();
-			}
-		} catch (SQLException e) {
-			throw new RuntimeException(e);
-		}
-	}
-
-	public PreparedStatement prepareStatement(String queryString, String[] returnKeys)
-			throws SQLException {
-		if (this.logger.isDebugEnabled())
-			this.logger.debug("Preparing Statement: " + queryString);
-
-		if ( useGetGeneratedKeys )
-			return connection.prepareStatement(queryString, Statement.RETURN_GENERATED_KEYS);
-		
-		else if (returnKeys.length > 0)
-			return connection.prepareStatement(queryString, returnKeys);
-		
-		return connection.prepareStatement(queryString);
-	}
+                connection.rollback();
+            }
+        } catch (SQLException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    public PreparedStatement prepareStatement(String queryString, String[] returnKeys) throws SQLException {
+        if (this.logger.isDebugEnabled())
+            this.logger.debug("Preparing Statement: " + queryString);
+
+        if (useGetGeneratedKeys)
+            return connection.prepareStatement(queryString, Statement.RETURN_GENERATED_KEYS);
+
+        else if (returnKeys.length > 0)
+            return connection.prepareStatement(queryString, returnKeys);
+
+        return connection.prepareStatement(queryString);
+    }
 
-	public PreparedStatement preparePagedStatement(String queryString) throws SQLException {
-        if(this.logger.isDebugEnabled())
+    public PreparedStatement preparePagedStatement(String queryString) throws SQLException {
+        if (this.logger.isDebugEnabled())
             this.logger.debug("Preparing Statement: " + queryString);
 
-		return connection.prepareStatement(queryString, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
-	}
+        return connection.prepareStatement(queryString, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
+    }
 
-	public void setManageTransactions(boolean manageTransactions) {
-		managingTransaction = manageTransactions;
+    public void setManageTransactions(boolean manageTransactions) {
+        managingTransaction = manageTransactions;
 
-	}
+    }
 
-	public CallableStatement prepareCall(String queryString) throws SQLException {
-		return connection.prepareCall(queryString);
-	}
+    public CallableStatement prepareCall(String queryString) throws SQLException {
+        return connection.prepareCall(queryString);
+    }
 
-	public boolean useGetGeneratedKeys() {
-		return this.useGetGeneratedKeys;
-	}
+    public boolean useGetGeneratedKeys() {
+        return this.useGetGeneratedKeys;
+    }
 }

Modified: incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CreateOperation.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CreateOperation.java?view=diff&rev=451460&r1=451459&r2=451460
==============================================================================
--- incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CreateOperation.java (original)
+++ incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CreateOperation.java Fri Sep 29 14:36:37 2006
@@ -18,14 +18,13 @@
  */
 package org.apache.tuscany.das.rdb.impl;
 
-
 import commonj.sdo.DataObject;
 
 public class CreateOperation extends ChangeOperation {
 
-	public CreateOperation(InsertCommandImpl command, DataObject changedObject, String ID) {
-		super(command, changedObject);
-		this.propagatedID = ID;
-	}
+    public CreateOperation(InsertCommandImpl command, DataObject changedObject, String ID) {
+        super(command, changedObject);
+        this.propagatedID = ID;
+    }
 
 }

Modified: incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DASFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DASFactoryImpl.java?view=diff&rev=451460&r1=451459&r2=451460
==============================================================================
--- incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DASFactoryImpl.java (original)
+++ incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DASFactoryImpl.java Fri Sep 29 14:36:37 2006
@@ -27,25 +27,24 @@
 
 public class DASFactoryImpl implements DASFactory {
 
-	public DAS createDAS(InputStream configStream) {
-		return new DASImpl(configStream);
-	}
+    public DAS createDAS(InputStream configStream) {
+        return new DASImpl(configStream);
+    }
 
-	public DAS createDAS(Config config) {
-		return new DASImpl(config);
-	}
+    public DAS createDAS(Config config) {
+        return new DASImpl(config);
+    }
 
-	public DAS createDAS(InputStream configStream, Connection connection) {
-		return new DASImpl(configStream, connection);
-	}
+    public DAS createDAS(InputStream configStream, Connection connection) {
+        return new DASImpl(configStream, connection);
+    }
 
-	public DAS createDAS(Config config, Connection connection) {
-		return new DASImpl(config, connection);
-	}
-
-	public DAS createDAS(Connection connection) {
-		return new DASImpl(connection);
-	}
+    public DAS createDAS(Config config, Connection connection) {
+        return new DASImpl(config, connection);
+    }
 
+    public DAS createDAS(Connection connection) {
+        return new DASImpl(connection);
+    }
 
 }

Modified: incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DASImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DASImpl.java?view=diff&rev=451460&r1=451459&r2=451460
==============================================================================
--- incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DASImpl.java (original)
+++ incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DASImpl.java Fri Sep 29 14:36:37 2006
@@ -40,9 +40,9 @@
 import commonj.sdo.DataObject;
 
 /**
- * An ConfiguredCommandFactory produces instances of Command and
- * ApplyChangesCommand. This factory is initialized with a configuration that
- * defines the commands it produces.
+ * An ConfiguredCommandFactory produces instances of Command and ApplyChangesCommand. This 
+ * factory is initialized with a configuration that defines
+ * the commands it produces.
  * 
  */
 public class DASImpl implements DAS {
@@ -55,54 +55,53 @@
 
     public DASImpl(InputStream stream) {
         this(ConfigUtil.loadConfig(stream));
-        
+
     }
 
     public DASImpl(Config inConfig) {
-    	Config cfg = inConfig;
-    	if ( cfg == null ) 
-    		cfg = ConfigFactory.INSTANCE.createConfig();
-    	this.configWrapper = new MappingWrapper(cfg);
-        
+        Config cfg = inConfig;
+        if (cfg == null)
+            cfg = ConfigFactory.INSTANCE.createConfig();
+        this.configWrapper = new MappingWrapper(cfg);
+
         Iterator i = configWrapper.getConfig().getCommand().iterator();
         while (i.hasNext()) {
-            org.apache.tuscany.das.rdb.config.Command commandConfig = (org.apache.tuscany.das.rdb.config.Command) i
-                    .next();
+            org.apache.tuscany.das.rdb.config.Command commandConfig = (org.apache.tuscany.das.rdb.config.Command) i.next();
             String kind = commandConfig.getKind();
-            if (kind.equalsIgnoreCase("select"))                             
-                commands.put(commandConfig.getName(), new ReadCommandImpl(commandConfig.getSQL(), configWrapper, commandConfig.getResultDescriptor()));
-            else if (kind.equalsIgnoreCase("update"))
+            if (kind.equalsIgnoreCase("select")) {
+                commands
+                        .put(commandConfig.getName(), new ReadCommandImpl(commandConfig.getSQL(), configWrapper, commandConfig.getResultDescriptor()));
+            } else if (kind.equalsIgnoreCase("update")) {
                 commands.put(commandConfig.getName(), new UpdateCommandImpl(commandConfig.getSQL()));
-            else if (kind.equalsIgnoreCase("insert"))
-                commands.put(commandConfig.getName(), new InsertCommandImpl(commandConfig.getSQL(),new String[0]));
-            else if (kind.equalsIgnoreCase("delete"))
+            } else if (kind.equalsIgnoreCase("insert")) {
+                commands.put(commandConfig.getName(), new InsertCommandImpl(commandConfig.getSQL(), new String[0]));
+            } else if (kind.equalsIgnoreCase("delete")) {
                 commands.put(commandConfig.getName(), new DeleteCommandImpl(commandConfig.getSQL()));
-            else if (kind.equalsIgnoreCase("procedure"))
-            	commands.put(commandConfig.getName(), new SPCommandImpl(commandConfig.getSQL(),configWrapper, commandConfig.getParameter()));
-            else
+            } else if (kind.equalsIgnoreCase("procedure")) {
+                commands.put(commandConfig.getName(), new SPCommandImpl(commandConfig.getSQL(), configWrapper, commandConfig.getParameter()));
+            } else {
                 throw new RuntimeException("Invalid kind of command: " + kind);
+            }
 
         }
 
     }
 
- 
+    public DASImpl(Config inConfig, Connection inConnection) {
+        this(inConfig);
+        setConnection(inConnection);
+    }
 
-	public DASImpl(Config inConfig, Connection inConnection) {
-		this(inConfig);
-		setConnection(inConnection);
-	}
-
-	public DASImpl(InputStream configStream, Connection inConnection) {
-		this(ConfigUtil.loadConfig(configStream), inConnection);	
-	}
-
-	public DASImpl(Connection inConnection) {
-		this(ConfigFactory.INSTANCE.createConfig());
-		setConnection(inConnection);
-	}
+    public DASImpl(InputStream configStream, Connection inConnection) {
+        this(ConfigUtil.loadConfig(configStream), inConnection);
+    }
+
+    public DASImpl(Connection inConnection) {
+        this(ConfigFactory.INSTANCE.createConfig());
+        setConnection(inConnection);
+    }
 
-	/*
+    /*
      * (non-Javadoc)
      * 
      * @see org.apache.tuscany.das.rdb.CommandGroup#getApplyChangesCommand()
@@ -125,7 +124,6 @@
         return cmd;
     }
 
-
     public void setConnection(Connection connection) {
         this.connection = connection;
     }
@@ -137,12 +135,10 @@
     }
 
     private void initializeConnection() {
-       Config config = configWrapper.getConfig();
-        if (config == null || 
-        		config.getConnectionInfo() == null || 
-        		config.getConnectionInfo().getDataSource() == null)
-            throw new RuntimeException(
-                    "No connection has been provided and no data source has been specified");
+        Config config = configWrapper.getConfig();
+        if (config == null || config.getConnectionInfo() == null || config.getConnectionInfo().getDataSource() == null) {
+            throw new RuntimeException("No connection has been provided and no data source has been specified");
+        }
 
         Connection connection = null;
 
@@ -152,12 +148,12 @@
         } catch (NamingException e) {
             throw new RuntimeException(e);
         }
-        try {          
+        try {
             DataSource ds = (DataSource) ctx.lookup(configWrapper.getConfig().getConnectionInfo().getDataSource());
             try {
                 connection = ds.getConnection();
-                if ( connection == null ) 
-                	throw new RuntimeException("Could not obtain a Connection from DataSource");
+                if (connection == null)
+                    throw new RuntimeException("Could not obtain a Connection from DataSource");
                 connection.setAutoCommit(false);
                 setConnection(connection);
             } catch (SQLException e) {
@@ -186,15 +182,14 @@
     }
 
     /**
-     * If the config has connection properties then we are "managing" the
-     * connection via DataSource
+     * If the config has connection properties then we are "managing" the connection via DataSource
      */
     private boolean managingConnections() {
 
         if (configWrapper.getConfig().getConnectionInfo().getDataSource() == null) {
             return false;
         }
-       
+
         return true;
 
     }
@@ -208,35 +203,35 @@
     }
 
     private Command baseCreateCommand(String inSql, MappingWrapper config) {
-    	CommandImpl returnCmd = null;
+        CommandImpl returnCmd = null;
         String sql = inSql.trim(); // Remove leading white space
         char firstChar = Character.toUpperCase(sql.charAt(0));
         switch (firstChar) {
-        case 'S':
-            returnCmd =  new ReadCommandImpl(sql, config, null);
-            break;
-        case 'I':
-            returnCmd =  new InsertCommandImpl(sql, new String[0]);
-            break;
-        case 'U':
-            returnCmd =  new UpdateCommandImpl(sql);
-            break;
-        case 'D':
-            returnCmd =  new DeleteCommandImpl(sql);
-            break;
-        case '{':
-            returnCmd =  new SPCommandImpl(sql, config, Collections.EMPTY_LIST);
-            break;
-        default:
-            throw new RuntimeException("SQL => " + sql + " is not valid");
+            case 'S':
+                returnCmd = new ReadCommandImpl(sql, config, null);
+                break;
+            case 'I':
+                returnCmd = new InsertCommandImpl(sql, new String[0]);
+                break;
+            case 'U':
+                returnCmd = new UpdateCommandImpl(sql);
+                break;
+            case 'D':
+                returnCmd = new DeleteCommandImpl(sql);
+                break;
+            case '{':
+                returnCmd = new SPCommandImpl(sql, config, Collections.EMPTY_LIST);
+                break;
+            default:
+                throw new RuntimeException("SQL => " + sql + " is not valid");
         }
 
         returnCmd.setConnection(getConnection(), config.getConfig());
         return returnCmd;
     }
 
-	public void applyChanges(DataObject root) {
-		getApplyChangesCommand().execute(root);			
-	}
+    public void applyChanges(DataObject root) {
+        getApplyChangesCommand().execute(root);
+    }
 
 }

Modified: incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DatabaseObject.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DatabaseObject.java?view=diff&rev=451460&r1=451459&r2=451460
==============================================================================
--- incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DatabaseObject.java (original)
+++ incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DatabaseObject.java Fri Sep 29 14:36:37 2006
@@ -21,6 +21,7 @@
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.log4j.Logger;
 import org.apache.tuscany.das.rdb.config.Column;
@@ -35,10 +36,9 @@
 import commonj.sdo.Property;
 
 /**
- * DatabaseObject wraps DataObject. If a field is an FK field, it will return
- * the value from the parent.
- *
- *
+ * DatabaseObject wraps DataObject. If a field is an FK field, it will return the value from the parent.
+ * 
+ * 
  */
 public class DatabaseObject {
 
@@ -50,7 +50,7 @@
 
     private Property parentReference;
 
-    private HashMap keyMappings = new HashMap();
+    private Map keyMappings = new HashMap();
 
     public DatabaseObject(Config model, DataObject changedObject) {
         this.mappingWrapper = new MappingWrapper(model);
@@ -65,9 +65,9 @@
             Iterator i = relationships.iterator();
             while (i.hasNext()) {
                 Relationship r = (Relationship) i.next();
-                if(this.logger.isDebugEnabled())
+                if (this.logger.isDebugEnabled()) {
                     this.logger.debug("Initializing relationship: " + r.getName());
-
+                }
                 if (r.getForeignKeyTable().equals(getTypeName())) {
                     List pairs = r.getKeyPair();
                     Iterator iter = pairs.iterator();
@@ -82,17 +82,20 @@
 
     public Object get(String parameter) {
 
-        if (isPartOfPrimaryKey(parameter))
+        if (isPartOfPrimaryKey(parameter)) {
             return dataObject.get(parameter);
+        }
 
         Relationship r = (Relationship) keyMappings.get(parameter);
-        if (r == null)
+        if (r == null) {
             return dataObject.get(parameter);
+        }
 
         Property parentRef = getParentReference(r.getPrimaryKeyTable());
         DataObject parent = dataObject.getDataObject(parentRef);
-        if (parent == null)
+        if (parent == null) {
             return null;
+        }
         String parentKey = getParentKey(r, parameter);
         return parent.get(parentKey);
 
@@ -103,8 +106,9 @@
         Iterator i = keyPairs.iterator();
         while (i.hasNext()) {
             KeyPair pair = (KeyPair) i.next();
-            if (pair.getForeignKeyColumn().equals(parameter))
+            if (pair.getForeignKeyColumn().equals(parameter)) {
                 return pair.getPrimaryKeyColumn();
+            }
         }
         return null;
     }
@@ -124,10 +128,10 @@
     }
 
     public String getTableName() {
-        if (mappingWrapper.getConfig() != null)
+        if (mappingWrapper.getConfig() != null) {
             return mappingWrapper.getTableByTypeName(getTypeName()).getTableName();
-        else
-            return null;
+        } 
+        return null;       
     }
 
     public String getTypeName() {
@@ -139,14 +143,19 @@
     }
 
     private boolean isPartOfPrimaryKey(String parameter) {
-        if (mappingWrapper.getConfig() == null)
+        if (mappingWrapper.getConfig() == null) {
             return false;
+        }
+        
         Table t = mappingWrapper.getTable(getTableName());
-        if (t == null)
+        if (t == null) {
             return false;
+        }
         Column c = mappingWrapper.getColumnByPropertyName(t, parameter);
-        if (c == null)
+        if (c == null) {
             return false;
+        }
+        
         return c.isPrimaryKey();
     }
 

Modified: incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteList.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteList.java?view=diff&rev=451460&r1=451459&r2=451460
==============================================================================
--- incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteList.java (original)
+++ incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteList.java Fri Sep 29 14:36:37 2006
@@ -22,54 +22,55 @@
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 
 /**
- * DeleteList will sort delete operations so that child objects are deleted
- * before their parents
+ * DeleteList will sort delete operations so that child objects are deleted before their parents
  * 
  * 
  */
 public class DeleteList {
 
-	private HashMap opsByTableName = new HashMap();
+    private Map opsByTableName = new HashMap();
 
-	private ArrayList order;
-	
-	private ArrayList deleteOperations = new ArrayList();
-
-	public DeleteList() {
-		super();
-	}
-
-	public void add(ChangeOperation op) {
-		if (( order.size() == 0  ) || ( op.getTableName() == null ) ) {
-			deleteOperations.add(op);
-		} else {
-			String name = op.getTableName();
-			ArrayList ops = (ArrayList) opsByTableName.get(name);
-			if (ops == null)
-				ops = new ArrayList();
-
-			ops.add(op);
-			opsByTableName.put(name, ops);
-		}
-	}
-
-	public Collection getSortedList() {
-		if  (( order.size() > 0  ) && ( opsByTableName.keySet().size() > 0) ) {
-			Iterator i = this.order.iterator();
-			while (i.hasNext()) {
-				String name = (String) i.next();
-				if ( opsByTableName.get(name) != null)
-					deleteOperations.addAll((Collection) opsByTableName.get(name));
-			}
-		}
-		
-		return deleteOperations;
-	}
-
-	public void setOrder(ArrayList deleteOrder) {
-		this.order = deleteOrder;
-	}
+    private List order;
+
+    private List deleteOperations = new ArrayList();
+
+    public DeleteList() {
+        super();
+    }
+
+    public void add(ChangeOperation op) {
+        if ((order.size() == 0) || (op.getTableName() == null)) {
+            deleteOperations.add(op);
+        } else {
+            String name = op.getTableName();
+            List ops = (List) opsByTableName.get(name);
+            if (ops == null)
+                ops = new ArrayList();
+
+            ops.add(op);
+            opsByTableName.put(name, ops);
+        }
+    }
+
+    public Collection getSortedList() {
+        if ((order.size() > 0) && (opsByTableName.keySet().size() > 0)) {
+            Iterator i = this.order.iterator();
+            while (i.hasNext()) {
+                String name = (String) i.next();
+                if (opsByTableName.get(name) != null)
+                    deleteOperations.addAll((Collection) opsByTableName.get(name));
+            }
+        }
+
+        return deleteOperations;
+    }
+
+    public void setOrder(List deleteOrder) {
+        this.order = deleteOrder;
+    }
 
 }

Modified: incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteOperation.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteOperation.java?view=diff&rev=451460&r1=451459&r2=451460
==============================================================================
--- incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteOperation.java (original)
+++ incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteOperation.java Fri Sep 29 14:36:37 2006
@@ -33,7 +33,7 @@
 	 */
 	public DeleteOperation(DeleteCommandImpl command, DataObject changedObject) {
 		super(command);
-		this.dObject = new DatabaseObject(command.getMappingModel(),DataObjectUtil.getRestoredCopy(changedObject));
+		this.dObject = new DatabaseObject(command.getMappingModel(), DataObjectUtil.getRestoredCopy(changedObject));
 
 	}
 

Modified: incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/FactoryRegistry.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/FactoryRegistry.java?view=diff&rev=451460&r1=451459&r2=451460
==============================================================================
--- incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/FactoryRegistry.java (original)
+++ incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/FactoryRegistry.java Fri Sep 29 14:36:37 2006
@@ -19,6 +19,7 @@
 package org.apache.tuscany.das.rdb.impl;
 
 import java.util.HashMap;
+import java.util.Map;
 
 import org.apache.log4j.Logger;
 import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper;
@@ -30,28 +31,28 @@
 
     private final Logger logger = LoggerFactory.INSTANCE.getLogger(FactoryRegistry.class);
 
-	private HashMap registry = new HashMap();
+    private Map registry = new HashMap();
 
     private final MappingWrapper mapping;
 
     private final ConnectionImpl connection;
 
-	public FactoryRegistry(MappingWrapper mapping, ConnectionImpl connection) {
-		this.mapping = mapping;
-		this.connection = connection;
-	}
-
-	public ChangeFactory getFactory(Type type) {
-		ChangeFactory factory = (ChangeFactory)registry.get(type);
-		if ( factory == null )  {
-            if(this.logger.isDebugEnabled())
+    public FactoryRegistry(MappingWrapper mapping, ConnectionImpl connection) {
+        this.mapping = mapping;
+        this.connection = connection;
+    }
+
+    public ChangeFactory getFactory(Type type) {
+        ChangeFactory factory = (ChangeFactory) registry.get(type);
+        if (factory == null) {
+            if (this.logger.isDebugEnabled()) {
                 this.logger.debug("Creating new ChangeFactory for type " + type.getName());
+            }
 
-			factory = new ChangeFactory(mapping, connection);
-			registry.put(type, factory);
-		}
-		return factory;
-	}
-
+            factory = new ChangeFactory(mapping, connection);
+            registry.put(type, factory);
+        }
+        return factory;
+    }
 
 }

Modified: incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertCommandImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertCommandImpl.java?view=diff&rev=451460&r1=451459&r2=451460
==============================================================================
--- incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertCommandImpl.java (original)
+++ incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertCommandImpl.java Fri Sep 29 14:36:37 2006
@@ -46,10 +46,11 @@
 		} catch (SQLException e) {
 			throw new RuntimeException(e);
 		} finally {
-			if (success)
+			if (success) {
 				statement.getConnection().cleanUp();
-			else
+			} else {
 				statement.getConnection().errorCleanUp();
+			}
 		}
 
 	}

Modified: incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertList.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertList.java?view=diff&rev=451460&r1=451459&r2=451460
==============================================================================
--- incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertList.java (original)
+++ incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertList.java Fri Sep 29 14:36:37 2006
@@ -22,28 +22,30 @@
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 
 import org.apache.log4j.Logger;
 import org.apache.tuscany.das.rdb.util.LoggerFactory;
 
 /**
- * InsertList will sort ChangeOperation objects so that parents are inserted
- * before children
- *
- *
+ * InsertList will sort ChangeOperation objects so that parents are inserted before children
+ * 
+ * 
  */
 public class InsertList {
     private final Logger logger = LoggerFactory.INSTANCE.getLogger(InsertList.class);
 
-    private HashMap opsByTableName = new HashMap();
+    private Map opsByTableName = new HashMap();
 
-    private ArrayList insertOperations = new ArrayList();
+    private List insertOperations = new ArrayList();
 
-    private ArrayList order;
+    private List order;
 
     public void add(ChangeOperation op) {
-        if(this.logger.isDebugEnabled())
+        if (this.logger.isDebugEnabled()) {
             this.logger.debug("Adding insert operation ");
+        }
 
         // If nothing has been added yet, or this is no ordering, simply
         // add the operation to the list
@@ -51,9 +53,10 @@
             insertOperations.add(op);
         } else {
             String name = op.getTableName();
-            ArrayList ops = (ArrayList) opsByTableName.get(name);
-            if (ops == null)
+            List ops = (List) opsByTableName.get(name);
+            if (ops == null) {
                 ops = new ArrayList();
+            }
 
             ops.add(op);
             opsByTableName.put(name, ops);
@@ -61,28 +64,32 @@
     }
 
     public Collection getSortedList() {
-        if(this.logger.isDebugEnabled())
+        if (this.logger.isDebugEnabled()) {
             this.logger.debug("Getting sorted insert list");
+        }
 
         if ((order.size() > 0) && opsByTableName.keySet().size() > 0) {
             Iterator i = this.order.iterator();
             while (i.hasNext()) {
                 String name = (String) i.next();
-                if(this.logger.isDebugEnabled())
+                if (this.logger.isDebugEnabled()) {
                     this.logger.debug("Adding operations for table " + name);
+                }
 
                 // A null here means a table is in the config but hasn't been changed here
-                if (opsByTableName.get(name) != null)
+                if (opsByTableName.get(name) != null) {
                     insertOperations.addAll((Collection) opsByTableName.get(name));
+                }
             }
         }
-        if(this.logger.isDebugEnabled())
+        if (this.logger.isDebugEnabled()) {
             this.logger.debug("Returning " + insertOperations.size() + " insert operations");
+        }
 
         return insertOperations;
     }
 
-    public void setOrder(ArrayList insertOrder) {
+    public void setOrder(List insertOrder) {
         this.order = insertOrder;
     }
 

Modified: incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ManagedParameterImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ManagedParameterImpl.java?view=diff&rev=451460&r1=451459&r2=451460
==============================================================================
--- incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ManagedParameterImpl.java (original)
+++ incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ManagedParameterImpl.java Fri Sep 29 14:36:37 2006
@@ -27,9 +27,9 @@
 	}
 	
 	private Object updateValue(Object oldValue) {
-		if ( oldValue instanceof Integer) 
-			return new Integer( ((Integer)oldValue).intValue() + 1);
-		else if ( oldValue instanceof BigDecimal ) 
+		if (oldValue instanceof Integer) 
+			return new Integer(((Integer) oldValue).intValue() + 1);
+		else if (oldValue instanceof BigDecimal) 
 			return ((BigDecimal)oldValue).add(new BigDecimal(1));
 		else
 			throw new RuntimeException("Unsupported type for managed column: " + oldValue.getClass().getName());		

Modified: incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/OptimisticWriteCommandImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/OptimisticWriteCommandImpl.java?view=diff&rev=451460&r1=451459&r2=451460
==============================================================================
--- incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/OptimisticWriteCommandImpl.java (original)
+++ incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/OptimisticWriteCommandImpl.java Fri Sep 29 14:36:37 2006
@@ -39,7 +39,7 @@
 		try {
 			int rowsAffected = statement.executeUpdate(parameters);
 			success = true;
-			if ( rowsAffected == 0 ) 
+			if (rowsAffected == 0) 
 				throw new RuntimeException("OCC Exception");
 		} catch (SQLException e) {
 			throw new RuntimeException(e);

Modified: incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/PagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/PagerImpl.java?view=diff&rev=451460&r1=451459&r2=451460
==============================================================================
--- incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/PagerImpl.java (original)
+++ incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/PagerImpl.java Fri Sep 29 14:36:37 2006
@@ -55,7 +55,7 @@
 	
 	public DataObject previous() {
 		int start = idx - (2 * size);
-		if ( start < 1 ) 
+		if (start < 1)
 			start = 1;
 		int end = start + size;
 		idx = end; 

Modified: incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParameterImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParameterImpl.java?view=diff&rev=451460&r1=451459&r2=451460
==============================================================================
--- incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParameterImpl.java (original)
+++ incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParameterImpl.java Fri Sep 29 14:36:37 2006
@@ -22,95 +22,98 @@
 
 import commonj.sdo.Type;
 
-public class ParameterImpl  {
+public class ParameterImpl {
 
-	/**
-	 * Value for "Direction" that indicates that a parameter is soley for input.
-	 */
-	final static int IN = 1;
-
-	/**
-	 * Value for "Direction" that indicates that a parameter is soley for
-	 * output. Out parameters only apply to Stored Procedures
-	 */
-	final static int OUT = 2;
-
-	/**
-	 * Value for "Direction" that indicates that a parameter is for both input
-	 * and output. In-out parameters only apply to stored procedures
-	 */
-	final static int IN_OUT = 3;
-	
-	private int index;
-	private Type type;
-	private String name;
-	protected Object value = null;
-	private int direction = IN;
-	private Converter converter;
-	
-	public ParameterImpl() {
-		super();
-	}
-
-	public ParameterImpl(int index) {
-		this.index = index;
-	}
-
-
-	public void setType(Type type) {
-		this.type = type;
-	}
-
-	public void setIndex(int index) {
-		if ( index == 0 ) 
-			throw new RuntimeException("Index of zero not allowed");
-		this.index = index;
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	public void setValue(Object value) {
-		this.value = value;
-	}
-
-	public void setDirection(int direction) {
-		this.direction = direction;
-	}
-
-	public Type getType() {
-		return this.type;
-	}
-
-	public int getIndex() {
-		return this.index;
-	}
-
-	public String getName() {
-		return this.name;
-	}
-
-	public Object getValue() {
-		if ( getConverter() != null ) {
-			return getConverter().getColumnValue(this.value);
-		} else {
-			return this.value;
-		}
-	}
-
-	public int getDirection() {
-		return this.direction;
-	}
-
-	public void setConverter(Converter converter) {
-		this.converter = converter;		
-	}
-
-	public Converter getConverter() {
-		return this.converter;
-	}
+    /**
+     * Value for "Direction" that indicates that a parameter is soley for input.
+     */
+    static final int IN = 1;
+
+    /**
+     * Value for "Direction" that indicates that a parameter is soley for output. 
+     * Out parameters only apply to Stored Procedures
+     */
+    static final int OUT = 2;
+
+    /**
+     * Value for "Direction" that indicates that a parameter is for both input and output. 
+     * In-out parameters only apply to stored procedures
+     */
+    static final int IN_OUT = 3;
+
+    protected Object value;
+
+    private int index;
+
+    private Type type;
+
+    private String name;
+
+    private int direction = IN;
+
+    private Converter converter;
+
+    
+    public ParameterImpl() {
+        super();
+    }
+
+    public ParameterImpl(int index) {
+        this.index = index;
+    }
+
+    public void setType(Type type) {
+        this.type = type;
+    }
+
+    public void setIndex(int index) {
+        if (index == 0)
+            throw new RuntimeException("Index of zero not allowed");
+        this.index = index;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public void setValue(Object value) {
+        this.value = value;
+    }
+
+    public void setDirection(int direction) {
+        this.direction = direction;
+    }
+
+    public Type getType() {
+        return this.type;
+    }
+
+    public int getIndex() {
+        return this.index;
+    }
+
+    public String getName() {
+        return this.name;
+    }
+
+    public Object getValue() {
+        if (getConverter() != null) {
+            return getConverter().getColumnValue(this.value);
+        } else {
+            return this.value;
+        }
+    }
+
+    public int getDirection() {
+        return this.direction;
+    }
+
+    public void setConverter(Converter converter) {
+        this.converter = converter;
+    }
+
+    public Converter getConverter() {
+        return this.converter;
+    }
 
-	
-	
 }

Modified: incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Parameters.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Parameters.java?view=diff&rev=451460&r1=451459&r2=451460
==============================================================================
--- incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Parameters.java (original)
+++ incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Parameters.java Fri Sep 29 14:36:37 2006
@@ -30,84 +30,81 @@
 public class Parameters {
     private final Logger logger = LoggerFactory.INSTANCE.getLogger(Parameters.class);
 
-	private ArrayList parameters = new ArrayList();
+    private List parameters = new ArrayList();
 
-	private ArrayList inParams = new ArrayList();
+    private List inParams = new ArrayList();
 
-	private ArrayList outParams = new ArrayList();
+    private List outParams = new ArrayList();
 
-	public Parameters() {
-		super();
-	}
-
-	public ParameterImpl get(int index) {
-		return (ParameterImpl) parameters.get(index);
-	}
-
-	public List outParams() {
-		return outParams;
-	}
-
-	public List inParams() {
-		return inParams;
-	}
-
-	private void addParameter(ParameterImpl param) {
-		if (param.getDirection() == ParameterImpl.IN)
-			inParams.add(param);
-		else if ((param.getDirection() == ParameterImpl.OUT)
-				|| (param.getDirection() == ParameterImpl.IN_OUT))
-			outParams.add(param);
-
-		this.parameters.add(param);
-	}
-
-	public void add(ParameterImpl param) {
-		addParameter(param);
-	}
-
-	public ParameterImpl findOrCreateParameterWithIndex(int index, int direction,
-			Type sdoType) {
-		Iterator i = parameters.iterator();
-		while (i.hasNext()) {
-			ParameterImpl param = (ParameterImpl) i.next();
-
-			if (param.getIndex() == index)
-				return param;
-		}
-        if(this.logger.isDebugEnabled())
+    public Parameters() {
+        super();
+    }
+
+    public ParameterImpl get(int index) {
+        return (ParameterImpl) parameters.get(index);
+    }
+
+    public List outParams() {
+        return outParams;
+    }
+
+    public List inParams() {
+        return inParams;
+    }
+
+    private void addParameter(ParameterImpl param) {
+        if (param.getDirection() == ParameterImpl.IN)
+            inParams.add(param);
+        else if ((param.getDirection() == ParameterImpl.OUT) || (param.getDirection() == ParameterImpl.IN_OUT))
+            outParams.add(param);
+
+        this.parameters.add(param);
+    }
+
+    public void add(ParameterImpl param) {
+        addParameter(param);
+    }
+
+    public ParameterImpl findOrCreateParameterWithIndex(int index, int direction, Type sdoType) {
+        Iterator i = parameters.iterator();
+        while (i.hasNext()) {
+            ParameterImpl param = (ParameterImpl) i.next();
+
+            if (param.getIndex() == index)
+                return param;
+        }
+        if (this.logger.isDebugEnabled())
             this.logger.debug("Creating new parameter with index " + index);
 
-		ParameterImpl newParam = new ParameterImpl(index);
-		newParam.setDirection(direction);
-		newParam.setType(sdoType);
-		addParameter(newParam);
-		return newParam;
-	}
-
-	public List parameterList() {
-		return parameters;
-	}
+        ParameterImpl newParam = new ParameterImpl(index);
+        newParam.setDirection(direction);
+        newParam.setType(sdoType);
+        addParameter(newParam);
+        return newParam;
+    }
+
+    public List parameterList() {
+        return parameters;
+    }
 
-	public ParameterImpl findOrCreateParameterWithIndex(int index) {
+    public ParameterImpl findOrCreateParameterWithIndex(int index) {
         return findOrCreateParameterWithIndex(index, ParameterImpl.IN, null);
-	}
-
-	public void setParameter(int index, Object value) {
-		ParameterImpl param = findOrCreateParameterWithIndex(index);
-		param.setValue(value);
-	}
+    }
 
+    public void setParameter(int index, Object value) {
+        ParameterImpl param = findOrCreateParameterWithIndex(index);
+        param.setValue(value);
+    }
 
     public ParameterImpl parameterWithIndex(int index) {
-		Iterator i = parameters.iterator();
-		while (i.hasNext()) {
-			ParameterImpl param = (ParameterImpl) i.next();
-
-			if (param.getIndex() == index)
-				return param;
-		}
-		return null;
-	}
+        Iterator i = parameters.iterator();
+        while (i.hasNext()) {
+            ParameterImpl param = (ParameterImpl) i.next();
+
+            if (param.getIndex() == index)
+                return param;
+        }
+        return null;
+    }
 
 }

Modified: incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ReadCommandImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ReadCommandImpl.java?view=diff&rev=451460&r1=451459&r2=451460
==============================================================================
--- incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ReadCommandImpl.java (original)
+++ incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ReadCommandImpl.java Fri Sep 29 14:36:37 2006
@@ -40,7 +40,7 @@
         super(sqlString);
         this.configWrapper = mapping;
         
-        if ( resultDescriptor != null && !resultDescriptor.isEmpty()) 
+        if (resultDescriptor != null && !resultDescriptor.isEmpty()) 
         	this.resultSetShape = new ResultSetShape(resultDescriptor);
     }
 

Modified: incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ResultSetShape.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ResultSetShape.java?view=diff&rev=451460&r1=451459&r2=451460
==============================================================================
--- incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ResultSetShape.java (original)
+++ incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ResultSetShape.java Fri Sep 29 14:36:37 2006
@@ -29,10 +29,8 @@
 import commonj.sdo.helper.TypeHelper;
 
 /**
- * Describes the structure of the result set returned from execution 
- * of a SELECT statement.  This description is typcially not required since the 
- * shape can be retreived from the JDBC ResultSetMetadata.  However, some platforms
- * such as Oracle do not support fully suport ResultSetMedata.
+ * Describes the structure of the result set returned from execution of a SELECT statement. This description is typcially not required since the shape
+ * can be retreived from the JDBC ResultSetMetadata. However, some platforms such as Oracle do not support fully suport ResultSetMedata.
  * <p>
  * There may also be a performance boost when using this interface.
  * 
@@ -40,81 +38,80 @@
  */
 public class ResultSetShape {
 
-	private final String[] columns;
-	private final String[] tables;
-	private final Type[] types;	
-
-	public ResultSetShape(ResultSetMetaData metadata) throws SQLException {
-		columns = new String[metadata.getColumnCount()];
-		tables = new String[metadata.getColumnCount()];
-		types = new Type[metadata.getColumnCount()];	
-		
-		ResultSetTypeMap typeMap = ResultSetTypeMap.instance;
-		for (int i = 1; i <= metadata.getColumnCount(); i++) {
-			tables[i-1] = metadata.getTableName(i);
-			columns[i-1] = metadata.getColumnName(i);
-			types[i-1] = typeMap.getType(metadata.getColumnType(i), true);
-		}
-	}
-
-	public ResultSetShape(List resultDescriptor) {
-		TypeHelper helper = TypeHelper.INSTANCE;
-		int size = resultDescriptor.size();
-		columns = new String[size];
-		tables = new String[size];
-		types = new Type[size];	
-		
-		for (int i=0; i<size; i++) {
-			ResultDescriptor desc = (ResultDescriptor) resultDescriptor.get(i);
-			tables[i] = desc.getTableName();
-			columns[i] = desc.getColumnName();
-			
-			
-			int idx = desc.getColumnType().lastIndexOf('.');
-			String uri = desc.getColumnType().substring(0, idx);
-			String typeName = desc.getColumnType().substring(idx+1);
-			
-			types[i] = helper.getType(uri, typeName);
-			if ( types[i] == null ) 
-				throw new RuntimeException("Could not find type " + desc.getColumnType() + " for column " + desc.getColumnName());
-		}
-		
-		
-	}
-
-	public int getColumnCount() {
-		return columns.length;
-	}
-
-	public String getTableName(int i) {
-		return tables[i-1];
-	}
-	
-	public String getColumnName(int i) {
-		return columns[i-1];
-	}
-	
-	public Type getColumnType(int i) {
-		return types[i-1];
-	}
-	
-	
-	public String toString() {
-		StringBuffer result = new StringBuffer();
-		result.append(" column/table/type: ");
-		for (int i=0; i < columns.length; i++) {
-			result.append(columns[i]);
-			result.append('\t');
-			result.append(tables[i]);
-			result.append('\t');
-			if ( types[i] == null ) 
-				result.append("null");
-			else 
-				result.append(types[i].getName());			
-			result.append('\n');
-		}
-		
-		return result.toString();
-	}
+    private final String[] columns;
+
+    private final String[] tables;
+
+    private final Type[] types;
+
+    public ResultSetShape(ResultSetMetaData metadata) throws SQLException {
+        columns = new String[metadata.getColumnCount()];
+        tables = new String[metadata.getColumnCount()];
+        types = new Type[metadata.getColumnCount()];
+
+        ResultSetTypeMap typeMap = ResultSetTypeMap.instance;
+        for (int i = 1; i <= metadata.getColumnCount(); i++) {
+            tables[i - 1] = metadata.getTableName(i);
+            columns[i - 1] = metadata.getColumnName(i);
+            types[i - 1] = typeMap.getType(metadata.getColumnType(i), true);
+        }
+    }
+
+    public ResultSetShape(List resultDescriptor) {
+        TypeHelper helper = TypeHelper.INSTANCE;
+        int size = resultDescriptor.size();
+        columns = new String[size];
+        tables = new String[size];
+        types = new Type[size];
+
+        for (int i = 0; i < size; i++) {
+            ResultDescriptor desc = (ResultDescriptor) resultDescriptor.get(i);
+            tables[i] = desc.getTableName();
+            columns[i] = desc.getColumnName();
+
+            int idx = desc.getColumnType().lastIndexOf('.');
+            String uri = desc.getColumnType().substring(0, idx);
+            String typeName = desc.getColumnType().substring(idx + 1);
+
+            types[i] = helper.getType(uri, typeName);
+            if (types[i] == null)
+                throw new RuntimeException("Could not find type " + desc.getColumnType() + " for column " + desc.getColumnName());
+        }
+
+    }
+
+    public int getColumnCount() {
+        return columns.length;
+    }
+
+    public String getTableName(int i) {
+        return tables[i - 1];
+    }
+
+    public String getColumnName(int i) {
+        return columns[i - 1];
+    }
+
+    public Type getColumnType(int i) {
+        return types[i - 1];
+    }
+
+    public String toString() {
+        StringBuffer result = new StringBuffer();
+        result.append(" column/table/type: ");
+        for (int i = 0; i < columns.length; i++) {
+            result.append(columns[i]);
+            result.append('\t');
+            result.append(tables[i]);
+            result.append('\t');
+            if (types[i] == null)
+                result.append("null");
+            else
+                result.append(types[i].getName());
+            result.append('\n');
+        }
+
+        return result.toString();
+    }
 
 }

Modified: incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypeHelper.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypeHelper.java?view=diff&rev=451460&r1=451459&r2=451460
==============================================================================
--- incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypeHelper.java (original)
+++ incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypeHelper.java Fri Sep 29 14:36:37 2006
@@ -20,85 +20,90 @@
 
 import java.sql.Types;
 
-
 import commonj.sdo.Type;
 
-public class SDODataTypeHelper {
-	
-	static public int sqlTypeFor(Type sdoType) {
-        if (sdoType == null)
-            return Types.OTHER;
+public final class SDODataTypeHelper {
+
+    private SDODataTypeHelper() {
         
-		if ( sdoType == SDODataTypes.BOOLEAN)
-			return Types.BOOLEAN;
-		else if ( sdoType == SDODataTypes.STRING)
-			return Types.VARCHAR;
-		else if ( sdoType == SDODataTypes.BYTE)
-			return Types.TINYINT;
-		else if ( sdoType == SDODataTypes.BYTES)
-			return Types.BINARY;
-		else if ( sdoType == SDODataTypes.CHARACTER)
-			return Types.CHAR;
-		else if ( sdoType == SDODataTypes.DATE)
-			return Types.DATE;
-		else if ( sdoType == SDODataTypes.DATETIME)
-			return Types.DATE;
-		else if ( sdoType == SDODataTypes.DAY )
-			return java.sql.Types.BINARY;
-		else if ( sdoType == SDODataTypes.DECIMAL )
-			return java.sql.Types.DECIMAL;
-		else if ( sdoType == SDODataTypes.DOUBLE )
-			return java.sql.Types.DOUBLE;
-		else if ( sdoType == SDODataTypes.DURATION )
-			return java.sql.Types.VARCHAR;
-		else if ( sdoType == SDODataTypes.FLOAT )
-			return java.sql.Types.REAL;
-		else if ( sdoType == SDODataTypes.INT )
-			return java.sql.Types.INTEGER;
-		else if ( sdoType == SDODataTypes.INTEGER )
-			return java.sql.Types.INTEGER;
-		else if ( sdoType == SDODataTypes.LONG )
-			return java.sql.Types.BIGINT;
-		else if ( sdoType == SDODataTypes.MONTH )
-			return java.sql.Types.VARCHAR;
-		else if ( sdoType == SDODataTypes.MONTHDAY )
-			return java.sql.Types.VARCHAR;
-		else if ( sdoType == SDODataTypes.OBJECT )
-			return java.sql.Types.JAVA_OBJECT;
- 		else if ( sdoType == SDODataTypes.SHORT )
-			return java.sql.Types.SMALLINT;
-		else if ( sdoType == SDODataTypes.STRING )
-			return java.sql.Types.VARCHAR;
-		else if ( sdoType == SDODataTypes.STRINGS )
-			return java.sql.Types.OTHER;
-		else if ( sdoType == SDODataTypes.TIME )
-			return java.sql.Types.VARCHAR;
-		else if ( sdoType == SDODataTypes.URI )
-			return java.sql.Types.VARCHAR;
-		else if ( sdoType == SDODataTypes.YEAR )
-			return java.sql.Types.VARCHAR;
-		else if ( sdoType == SDODataTypes.YEARMONTH )
-			return java.sql.Types.VARCHAR;
-		else if ( sdoType == SDODataTypes.YEARMONTHDAY )
-			return java.sql.Types.VARCHAR;
-		else if ( sdoType == SDODataTypes.BOOLEANOBJECT )
-			return java.sql.Types.BOOLEAN;
-		else if ( sdoType == SDODataTypes.BYTEOBJECT )
-			return java.sql.Types.TINYINT;
-		else if ( sdoType == SDODataTypes.CHARACTEROBJECT )
-			return java.sql.Types.CHAR;
-		else if ( sdoType == SDODataTypes.DOUBLEOBJECT )
-			return java.sql.Types.DOUBLE;
-		else if ( sdoType == SDODataTypes.FLOATOBJECT )
-			return java.sql.Types.REAL;
-		else if ( sdoType == SDODataTypes.INTEGEROBJECT )
-			return java.sql.Types.INTEGER;
-		else if ( sdoType == SDODataTypes.LONGOBJECT )
-			return java.sql.Types.BIGINT;
-		else if ( sdoType == SDODataTypes.SHORTOBJECT )
-			return java.sql.Types.SMALLINT;
-		else
-			throw new RuntimeException("Not a valid SDO Type " + sdoType);
-		
-	} 
+    }
+    
+    public static int sqlTypeFor(Type sdoType) {
+        if (sdoType == null) {
+            return Types.OTHER;
+        }
+
+        if (sdoType == SDODataTypes.BOOLEAN) {
+            return Types.BOOLEAN;
+        } else if (sdoType == SDODataTypes.STRING) {
+            return Types.VARCHAR;
+        } else if (sdoType == SDODataTypes.BYTE) {
+            return Types.TINYINT;
+        } else if (sdoType == SDODataTypes.BYTES) {
+            return Types.BINARY;
+        } else if (sdoType == SDODataTypes.CHARACTER) {
+            return Types.CHAR;
+        } else if (sdoType == SDODataTypes.DATE) {
+            return Types.DATE;
+        } else if (sdoType == SDODataTypes.DATETIME) {
+            return Types.DATE;
+        } else if (sdoType == SDODataTypes.DAY) {
+            return java.sql.Types.BINARY;
+        } else if (sdoType == SDODataTypes.DECIMAL) {
+            return java.sql.Types.DECIMAL;
+        } else if (sdoType == SDODataTypes.DOUBLE) {
+            return java.sql.Types.DOUBLE;
+        } else if (sdoType == SDODataTypes.DURATION) {
+            return java.sql.Types.VARCHAR;
+        } else if (sdoType == SDODataTypes.FLOAT) {
+            return java.sql.Types.REAL;
+        } else if (sdoType == SDODataTypes.INT) {
+            return java.sql.Types.INTEGER;
+        } else if (sdoType == SDODataTypes.INTEGER) {
+            return java.sql.Types.INTEGER;
+        } else if (sdoType == SDODataTypes.LONG) {
+            return java.sql.Types.BIGINT;
+        } else if (sdoType == SDODataTypes.MONTH) {
+            return java.sql.Types.VARCHAR;
+        } else if (sdoType == SDODataTypes.MONTHDAY) {
+            return java.sql.Types.VARCHAR;
+        } else if (sdoType == SDODataTypes.OBJECT) {
+            return java.sql.Types.JAVA_OBJECT;
+        } else if (sdoType == SDODataTypes.SHORT) {
+            return java.sql.Types.SMALLINT;
+        } else if (sdoType == SDODataTypes.STRING) {
+            return java.sql.Types.VARCHAR;
+        } else if (sdoType == SDODataTypes.STRINGS) {
+            return java.sql.Types.OTHER;
+        } else if (sdoType == SDODataTypes.TIME) {
+            return java.sql.Types.VARCHAR;
+        } else if (sdoType == SDODataTypes.URI) {
+            return java.sql.Types.VARCHAR;
+        } else if (sdoType == SDODataTypes.YEAR) {
+            return java.sql.Types.VARCHAR;
+        } else if (sdoType == SDODataTypes.YEARMONTH) {
+            return java.sql.Types.VARCHAR;
+        } else if (sdoType == SDODataTypes.YEARMONTHDAY) {
+            return java.sql.Types.VARCHAR;
+        } else if (sdoType == SDODataTypes.BOOLEANOBJECT) {
+            return java.sql.Types.BOOLEAN;
+        } else if (sdoType == SDODataTypes.BYTEOBJECT) {
+            return java.sql.Types.TINYINT;
+        } else if (sdoType == SDODataTypes.CHARACTEROBJECT) {
+            return java.sql.Types.CHAR;
+        } else if (sdoType == SDODataTypes.DOUBLEOBJECT) {
+            return java.sql.Types.DOUBLE;
+        } else if (sdoType == SDODataTypes.FLOATOBJECT) {
+            return java.sql.Types.REAL;
+        } else if (sdoType == SDODataTypes.INTEGEROBJECT) {
+            return java.sql.Types.INTEGER;
+        } else if (sdoType == SDODataTypes.LONGOBJECT) {
+            return java.sql.Types.BIGINT;
+        } else if (sdoType == SDODataTypes.SHORTOBJECT) {
+            return java.sql.Types.SMALLINT;
+        } else {
+            throw new RuntimeException("Not a valid SDO Type " + sdoType);
+        }
+
+    }
 }

Modified: incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypes.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypes.java?view=diff&rev=451460&r1=451459&r2=451460
==============================================================================
--- incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypes.java (original)
+++ incubator/tuscany/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypes.java Fri Sep 29 14:36:37 2006
@@ -24,43 +24,75 @@
 /**
  * Defines SDO data types. This is used primalirly to type stored procedure OUT parameters.
  * 
- */public class SDODataTypes {
+ */
+public class SDODataTypes {
 
-     static TypeHelper helper = TypeHelper.INSTANCE;
-     
-	final public static Type BOOLEAN = helper.getType("commonj.sdo", "Boolean");
-	final public static Type BYTE = helper.getType("commonj.sdo", "Byte");
-	final public static Type BYTES = helper.getType("commonj.sdo", "Bytes");
-	final public static Type CHARACTER = helper.getType("commonj.sdo", "Character");
-	final public static Type DATE = helper.getType("commonj.sdo", "Date");
-	final public static Type DATETIME = helper.getType("commonj.sdo", "Date");
-	final public static Type DAY = helper.getType("commonj.sdo", "Date");
-	final public static Type DECIMAL = helper.getType("commonj.sdo", "Float");
-	final public static Type DOUBLE =helper.getType("commonj.sdo", "Double");
-	final public static Type DURATION = helper.getType("commonj.sdo", "Date");
-	final public static Type FLOAT = helper.getType("commonj.sdo", "Float");
-	final public static Type INT = helper.getType("commonj.sdo", "Int");
-	final public static Type INTEGER = helper.getType("commonj.sdo", "Integer");
-	final public static Type LONG = helper.getType("commonj.sdo", "Long");
-	final public static Type MONTH = helper.getType("commonj.sdo", "Date");
-	final public static Type MONTHDAY = helper.getType("commonj.sdo", "Date");
-	final public static Type OBJECT = helper.getType("commonj.sdo", "Object");
-	final public static Type SHORT = helper.getType("commonj.sdo", "Short");
-	final public static Type STRING = helper.getType("commonj.sdo", "String");
-	final public static Type STRINGS = helper.getType("commonj.sdo", "String");
-	final public static Type TIME = helper.getType("commonj.sdo", "Date");
-	final public static Type URI = helper.getType("commonj.sdo", "String");
-	final public static Type YEAR = helper.getType("commonj.sdo", "Date");
-	final public static Type YEARMONTH = helper.getType("commonj.sdo", "Date");
-	final public static Type YEARMONTHDAY = helper.getType("commonj.sdo", "Date");
-	final public static Type BOOLEANOBJECT = helper.getType("commonj.sdo", "BooleanObject");
-	final public static Type BYTEOBJECT = helper.getType("commonj.sdo", "ByteObject");
-	final public static Type CHARACTEROBJECT = helper.getType("commonj.sdo", "CharacterObject");
-	final public static Type DOUBLEOBJECT = helper.getType("commonj.sdo", "DoubleObject");
-	final public static Type FLOATOBJECT = helper.getType("commonj.sdo", "FloatObject");
-	final public static Type INTEGEROBJECT = helper.getType("commonj.sdo", "IntObject");
-	final public static Type LONGOBJECT = helper.getType("commonj.sdo", "LongObject");
-	final public static Type SHORTOBJECT = helper.getType("commonj.sdo", "ShortObject");
+    public static final TypeHelper TYPE_HELPER = TypeHelper.INSTANCE;
 
+    public static final Type BOOLEAN = TYPE_HELPER.getType("commonj.sdo", "Boolean");
+
+    public static final Type BYTE = TYPE_HELPER.getType("commonj.sdo", "Byte");
+
+    public static final Type BYTES = TYPE_HELPER.getType("commonj.sdo", "Bytes");
+
+    public static final Type CHARACTER = TYPE_HELPER.getType("commonj.sdo", "Character");
+
+    public static final Type DATE = TYPE_HELPER.getType("commonj.sdo", "Date");
+
+    public static final Type DATETIME = TYPE_HELPER.getType("commonj.sdo", "Date");
+
+    public static final Type DAY = TYPE_HELPER.getType("commonj.sdo", "Date");
+
+    public static final Type DECIMAL = TYPE_HELPER.getType("commonj.sdo", "Float");
+
+    public static final Type DOUBLE = TYPE_HELPER.getType("commonj.sdo", "Double");
+
+    public static final Type DURATION = TYPE_HELPER.getType("commonj.sdo", "Date");
+
+    public static final Type FLOAT = TYPE_HELPER.getType("commonj.sdo", "Float");
+
+    public static final Type INT = TYPE_HELPER.getType("commonj.sdo", "Int");
+
+    public static final Type INTEGER = TYPE_HELPER.getType("commonj.sdo", "Integer");
+
+    public static final Type LONG = TYPE_HELPER.getType("commonj.sdo", "Long");
+
+    public static final Type MONTH = TYPE_HELPER.getType("commonj.sdo", "Date");
+
+    public static final Type MONTHDAY = TYPE_HELPER.getType("commonj.sdo", "Date");
+
+    public static final Type OBJECT = TYPE_HELPER.getType("commonj.sdo", "Object");
+
+    public static final Type SHORT = TYPE_HELPER.getType("commonj.sdo", "Short");
+
+    public static final Type STRING = TYPE_HELPER.getType("commonj.sdo", "String");
+
+    public static final Type STRINGS = TYPE_HELPER.getType("commonj.sdo", "String");
+
+    public static final Type TIME = TYPE_HELPER.getType("commonj.sdo", "Date");
+
+    public static final Type URI = TYPE_HELPER.getType("commonj.sdo", "String");
+
+    public static final Type YEAR = TYPE_HELPER.getType("commonj.sdo", "Date");
+
+    public static final Type YEARMONTH = TYPE_HELPER.getType("commonj.sdo", "Date");
+
+    public static final Type YEARMONTHDAY = TYPE_HELPER.getType("commonj.sdo", "Date");
+
+    public static final Type BOOLEANOBJECT = TYPE_HELPER.getType("commonj.sdo", "BooleanObject");
+
+    public static final Type BYTEOBJECT = TYPE_HELPER.getType("commonj.sdo", "ByteObject");
+
+    public static final Type CHARACTEROBJECT = TYPE_HELPER.getType("commonj.sdo", "CharacterObject");
+
+    public static final Type DOUBLEOBJECT = TYPE_HELPER.getType("commonj.sdo", "DoubleObject");
+
+    public static final Type FLOATOBJECT = TYPE_HELPER.getType("commonj.sdo", "FloatObject");
+
+    public static final Type INTEGEROBJECT = TYPE_HELPER.getType("commonj.sdo", "IntObject");
+
+    public static final Type LONGOBJECT = TYPE_HELPER.getType("commonj.sdo", "LongObject");
+
+    public static final Type SHORTOBJECT = TYPE_HELPER.getType("commonj.sdo", "ShortObject");
 
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message