You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2013/09/09 17:07:42 UTC

[10/13] ISIS-522: mothballing SQL OS.

http://git-wip-us.apache.org/repos/asf/isis/blob/40561609/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcAbstractReferenceFieldMapping.java
----------------------------------------------------------------------
diff --git a/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcAbstractReferenceFieldMapping.java b/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcAbstractReferenceFieldMapping.java
deleted file mode 100755
index a09048f..0000000
--- a/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcAbstractReferenceFieldMapping.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.objectstore.sql.jdbc;
-
-import org.apache.isis.core.commons.debug.DebugBuilder;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.oid.Oid;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.objectstore.sql.AbstractFieldMappingFactory;
-import org.apache.isis.objectstore.sql.DatabaseConnector;
-import org.apache.isis.objectstore.sql.Defaults;
-import org.apache.isis.objectstore.sql.Results;
-import org.apache.isis.objectstore.sql.Sql;
-import org.apache.isis.objectstore.sql.mapping.FieldMapping;
-
-/**
- * Provides support for persisting abstract classes and interfaces.
- * 
- * Provides two columns: the first is the standard property field. The second is
- * initialised only when the field is "saved", and contains the actual classname
- * of the persisted concrete class.
- * 
- * 
- * @version $Rev$ $Date$
- */
-public class JdbcAbstractReferenceFieldMapping extends JdbcObjectReferenceFieldMapping {
-    private final String classnameColumn;
-    private final String dataType;
-
-    public static class Factory extends AbstractFieldMappingFactory {
-
-        public Factory(final String type) {
-            super();
-        }
-
-        @Override
-        public FieldMapping createFieldMapping(final ObjectSpecification object, final ObjectAssociation field) {
-            final String dataType = getTypeOverride(object, field, Defaults.TYPE_LONG_STRING());
-            return new JdbcAbstractReferenceFieldMapping(field, dataType);
-        }
-    }
-
-    public JdbcAbstractReferenceFieldMapping(final ObjectAssociation field, final String dataType) {
-        super(field);
-        this.dataType = dataType;
-        classnameColumn = Sql.identifier(getColumn() + "_cls");
-    }
-
-    @Override
-    public void appendColumnDefinitions(final StringBuffer sql) {
-        super.appendColumnDefinitions(sql);
-
-        sql.append(", ");
-        sql.append(classnameColumn);
-        sql.append(" ");
-        sql.append(dataType);
-    }
-
-    @Override
-    public void appendCreateColumnDefinitions(final StringBuffer sql) {
-        super.appendCreateColumnDefinitions(sql);
-        sql.append(classnameColumn);
-        sql.append(" ");
-        sql.append(dataType);
-    }
-
-    @Override
-    public void appendColumnNames(final StringBuffer sql) {
-        super.appendColumnNames(sql);
-        sql.append(", ");
-        sql.append(classnameColumn);
-    }
-
-    @Override
-    public void appendWhereClause(final DatabaseConnector connector, final StringBuffer sql, final ObjectAdapter object) {
-        super.appendWhereClause(connector, sql, object);
-    }
-
-    @Override
-    public void appendInsertValues(final DatabaseConnector connector, final StringBuffer sql, final ObjectAdapter object) {
-        super.appendInsertValues(connector, sql, object);
-        sql.append(",?");
-
-        final ObjectAdapter objectAdapter = field.get(object);
-        if (objectAdapter != null) {
-            connector.addToQueryValues(objectAdapter.getSpecification().getFullIdentifier());
-        } else {
-            connector.addToQueryValues(null);
-        }
-    }
-
-    @Override
-    public void appendUpdateValues(final DatabaseConnector connector, final StringBuffer sql, final ObjectAdapter object) {
-        super.appendUpdateValues(connector, sql, object);
-
-        sql.append(",");
-        sql.append(classnameColumn);
-        sql.append(" = ?");
-
-        final ObjectAdapter objectAdapter = field.get(object);
-        if (objectAdapter != null) {
-            connector.addToQueryValues(objectAdapter.getSpecification().getFullIdentifier());
-        } else {
-            connector.addToQueryValues(null);
-        }
-    }
-
-    @Override
-    public void initializeField(final ObjectAdapter object, final Results rs) {
-        final String className = rs.getString(classnameColumn);
-        if (className != null) {
-            final ObjectSpecification specification = getReflector().loadSpecification(className);
-
-            final Oid oid = recreateOid(rs, specification);
-
-            final ObjectAdapter reference = getAdapter(specification, oid);
-            ((OneToOneAssociation) field).initAssociation(object, reference);
-        }
-    }
-
-    @Override
-    public void debugData(final DebugBuilder debug) {
-        debug.appendln(field.getId(), getColumn());
-    }
-
-    private SpecificationLoaderSpi getReflector() {
-        return IsisContext.getSpecificationLoader();
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/40561609/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcBinaryValueMapper.java
----------------------------------------------------------------------
diff --git a/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcBinaryValueMapper.java b/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcBinaryValueMapper.java
deleted file mode 100755
index 16366b4..0000000
--- a/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcBinaryValueMapper.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/**
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.isis.objectstore.sql.jdbc;
-
-import org.apache.isis.core.commons.exceptions.IsisApplicationException;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.objectstore.sql.AbstractFieldMappingFactory;
-import org.apache.isis.objectstore.sql.Results;
-import org.apache.isis.objectstore.sql.mapping.FieldMapping;
-
-/**
- * 
- * 
- * @version $Rev$ $Date$
- */
-public class JdbcBinaryValueMapper extends AbstractJdbcFieldMapping {
-
-    public static class Factory extends AbstractFieldMappingFactory {
-        private final String type;
-
-        public Factory(final String type) {
-            super();
-            this.type = type;
-        }
-
-        @Override
-        public FieldMapping createFieldMapping(final ObjectSpecification object, final ObjectAssociation field) {
-            final String dataType = getTypeOverride(object, field, type);
-            return new JdbcBinaryValueMapper(field, dataType);
-        }
-    }
-
-    private final String type;
-
-    public JdbcBinaryValueMapper(final ObjectAssociation field, final String type) {
-        super(field);
-        this.type = type;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.isis.runtimes.dflt.objectstores.sql.jdbc.AbstractJdbcFieldMapping
-     * #columnType()
-     */
-    @Override
-    protected String columnType() {
-        return type;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.isis.runtimes.dflt.objectstores.sql.jdbc.AbstractJdbcFieldMapping
-     * #preparedStatementObject(org.apache
-     * .isis.core.metamodel.adapter.ObjectAdapter)
-     */
-    @Override
-    protected Object preparedStatementObject(final ObjectAdapter value) {
-        if (value == null) {
-            return null;
-        }
-        final Object o = value.getObject();
-        return o;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.isis.runtimes.dflt.objectstores.sql.jdbc.AbstractJdbcFieldMapping
-     * #setFromDBColumn(org.apache.isis. runtimes.dflt.objectstores.sql.Results,
-     * java.lang.String,
-     * org.apache.isis.core.metamodel.spec.feature.ObjectAssociation)
-     */
-    @Override
-    protected ObjectAdapter setFromDBColumn(final Results results, final String columnName, final ObjectAssociation field) {
-        ObjectAdapter restoredValue;
-
-        final Class<?> correspondingClass = field.getSpecification().getCorrespondingClass();
-        Object resultObject = results.getObject(columnName);
-        if (resultObject == null) {
-            return null;
-        }
-
-        if (resultObject.getClass() != correspondingClass) {
-            if (checkIfIsClass(correspondingClass, Integer.class, int.class)) {
-                resultObject = results.getInt(columnName);
-            } else if (checkIfIsClass(correspondingClass, Double.class, double.class)) {
-                resultObject = results.getDouble(columnName);
-            } else if (checkIfIsClass(correspondingClass, Float.class, float.class)) {
-                resultObject = results.getFloat(columnName);
-            } else if (checkIfIsClass(correspondingClass, Short.class, short.class)) {
-                resultObject = results.getShort(columnName);
-            } else if (checkIfIsClass(correspondingClass, Long.class, long.class)) {
-                resultObject = results.getLong(columnName);
-            } else if (checkIfIsClass(correspondingClass, Boolean.class, boolean.class)) {
-                resultObject = results.getBoolean(columnName);
-            } else {
-                throw new IsisApplicationException("Unhandled type: " + correspondingClass.getCanonicalName());
-            }
-        }
-
-        restoredValue = IsisContext.getPersistenceSession().getAdapterManager().adapterFor(resultObject);
-
-        return restoredValue;
-
-    }
-
-    private boolean checkIfIsClass(final Class<?> expected, final Class<?> couldBe1, final Class<?> couldBe2) {
-        return (expected == couldBe1 || expected == couldBe2);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/40561609/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcColorValueMapper.java
----------------------------------------------------------------------
diff --git a/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcColorValueMapper.java b/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcColorValueMapper.java
deleted file mode 100755
index e36c14a..0000000
--- a/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcColorValueMapper.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/**
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.isis.objectstore.sql.jdbc;
-
-import org.apache.isis.applib.value.Color;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.objectstore.sql.AbstractFieldMappingFactory;
-import org.apache.isis.objectstore.sql.Results;
-import org.apache.isis.objectstore.sql.mapping.FieldMapping;
-
-/**
- * 
- * 
- * @version $Rev$ $Date$
- */
-public class JdbcColorValueMapper extends AbstractJdbcFieldMapping {
-
-    public static class Factory extends AbstractFieldMappingFactory {
-        private final String type;
-
-        public Factory(final String type) {
-            super();
-            this.type = type;
-        }
-
-        @Override
-        public FieldMapping createFieldMapping(final ObjectSpecification object, final ObjectAssociation field) {
-            final String dataType = getTypeOverride(object, field, type);
-            return new JdbcColorValueMapper(field, dataType);
-        }
-    }
-
-    private final String type;
-
-    public JdbcColorValueMapper(final ObjectAssociation field, final String type) {
-        super(field);
-        this.type = type;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.isis.runtimes.dflt.objectstores.sql.jdbc.AbstractJdbcFieldMapping
-     * #columnType()
-     */
-    @Override
-    protected String columnType() {
-        return type;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.isis.runtimes.dflt.objectstores.sql.jdbc.AbstractJdbcFieldMapping
-     * #preparedStatementObject(org.apache
-     * .isis.core.metamodel.adapter.ObjectAdapter)
-     */
-    @Override
-    protected Object preparedStatementObject(final ObjectAdapter value) {
-        final Object o = value.getObject();
-        return ((Color) o).intValue();
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.isis.runtimes.dflt.objectstores.sql.jdbc.AbstractJdbcFieldMapping
-     * #setFromDBColumn(org.apache.isis. runtimes.dflt.objectstores.sql.Results,
-     * java.lang.String,
-     * org.apache.isis.core.metamodel.spec.feature.ObjectAssociation)
-     */
-    @Override
-    protected ObjectAdapter setFromDBColumn(final Results results, final String columnName, final ObjectAssociation field) {
-        ObjectAdapter restoredValue;
-        final int intValue = results.getInt(columnName);
-        final Color colorValue = new Color(intValue);
-        restoredValue = IsisContext.getPersistenceSession().getAdapterManager().adapterFor(colorValue);
-        return restoredValue;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/40561609/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcConnector.java
----------------------------------------------------------------------
diff --git a/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcConnector.java b/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcConnector.java
deleted file mode 100644
index 9c3523e..0000000
--- a/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcConnector.java
+++ /dev/null
@@ -1,404 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.objectstore.sql.jdbc;
-
-import java.io.InputStream;
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.DriverManager;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.joda.time.DateTimeZone;
-import org.joda.time.LocalDate;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.isis.core.commons.config.IsisConfiguration;
-import org.apache.isis.core.commons.debug.DebugBuilder;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.objectstore.sql.AbstractDatabaseConnector;
-import org.apache.isis.objectstore.sql.Results;
-import org.apache.isis.objectstore.sql.SqlMetaData;
-import org.apache.isis.objectstore.sql.SqlObjectStore;
-import org.apache.isis.objectstore.sql.SqlObjectStoreException;
-
-public class JdbcConnector extends AbstractDatabaseConnector {
-    private static final Logger LOG = LoggerFactory.getLogger(JdbcConnector.class);
-    private Connection connection;
-    private final String baseName;
-
-    public JdbcConnector() {
-        baseName = SqlObjectStore.BASE_NAME;
-    }
-
-    public JdbcConnector(final String propertyBase) {
-        baseName = propertyBase;
-    }
-
-    @Override
-    public void close() {
-        try {
-            if (connection != null) {
-                LOG.info("close");
-                connection.close();
-                connection = null;
-
-            }
-        } catch (final SQLException e) {
-            throw new SqlObjectStoreException("Failed to close", e);
-        }
-    }
-
-    @Override
-    public int count(final String sql) {
-        LOG.debug("SQL: " + sql);
-        PreparedStatement statement;
-        try {
-            statement = connection.prepareStatement(sql);
-            final ResultSet result = statement.executeQuery();
-            result.next();
-            final int count = result.getInt(1);
-            statement.close();
-            return count;
-        } catch (final SQLException e) {
-            throw new SqlObjectStoreException("Failed count", e);
-        }
-    }
-
-    @Override
-    public void delete(final String sql) {
-        update(sql);
-    }
-
-    public void open() {
-        final String BASE = baseName + ".jdbc.";
-        final IsisConfiguration params = IsisContext.getConfiguration().getProperties(BASE);
-
-        try {
-            final String driver = params.getString(BASE + "driver");
-            final String url = params.getString(BASE + "connection");
-            final String user = params.getString(BASE + "user");
-            final String password = params.getString(BASE + "password");
-
-            if (connection != null) {
-                throw new SqlObjectStoreException("Connection already established");
-            }
-
-            if (driver == null) {
-                throw new SqlObjectStoreException("No driver specified for database connection");
-            }
-            if (url == null) {
-                throw new SqlObjectStoreException("No connection URL specified to database");
-            }
-            if (user == null) {
-                LOG.info("No user specified; will attempt to login with no credentials");
-            } else {
-                if (password == null) {
-                    throw new SqlObjectStoreException("No password specified for database connection");
-                }
-            }
-
-            Class.forName(driver);
-            connection = getConnection(url, user, password);
-            if (connection == null) {
-                throw new SqlObjectStoreException("No connection established to " + url);
-            }
-        } catch (final SQLException e) {
-            throw new SqlObjectStoreException("Failed to start", e);
-        } catch (final ClassNotFoundException e) {
-            throw new SqlObjectStoreException("Could not find database driver", e);
-        }
-
-    }
-
-    private static Connection getConnection(final String url, final String user, final String password)
-        throws SQLException {
-        if (user != null) {
-            LOG.info("Connecting to " + url + " as " + user);
-            return DriverManager.getConnection(url, user, password);
-        } else {
-            LOG.info("Connecting to " + url + " with no credentials");
-            return DriverManager.getConnection(url);
-        }
-    }
-
-    /*
-     * public void executeStoredProcedure(final StoredProcedure storedProcedure) { Parameter[] parameters =
-     * storedProcedure.getParameters(); StringBuffer sql = new StringBuffer("{call ");
-     * sql.append(storedProcedure.getName()); sql.append(" ("); for (int i = 0, no = parameters.length; i < no; i++) {
-     * sql.append(i == 0 ? "?" : ",?"); } sql.append(")}"); LOG.debug("SQL: " + sql);
-     * 
-     * CallableStatement statement; try { statement = connection.prepareCall(sql.toString());
-     * 
-     * for (int i = 0; i < parameters.length; i++) { LOG.debug(" setup param " + i + " " + parameters[i]);
-     * parameters[i].setupParameter(i + 1, parameters[i].getName(), storedProcedure); } LOG.debug(" execute ");
-     * statement.execute(); for (int i = 0; i < parameters.length; i++) { parameters[i].retrieve(i + 1,
-     * parameters[i].getName(), storedProcedure); LOG.debug(" retrieve param " + i + " " + parameters[i]); } } catch
-     * (SQLException e) { throw new ObjectAdapterRuntimeException(e); }
-     * 
-     * }
-     * 
-     * 
-     * public MultipleResults executeStoredProcedure(final String name, final Parameter[] parameters) { StringBuffer sql
-     * = new StringBuffer("{call "); sql.append(name); sql.append(" ("); for (int i = 0; i < parameters.length; i++) {
-     * sql.append(i == 0 ? "?" : ",?"); } sql.append(")}"); LOG.debug("SQL: " + sql);
-     * 
-     * CallableStatement statement; try { statement = connection.prepareCall(sql.toString());
-     * 
-     * StoredProcedure storedProcedure = new JdbcStoredProcedure(statement);
-     * 
-     * for (int i = 0; i < parameters.length; i++) { LOG.debug(" setup param " + i + " " + parameters[i]);
-     * parameters[i].setupParameter(i + 1, parameters[i].getName(), storedProcedure); } LOG.debug(" execute ");
-     * statement.execute(); for (int i = 0; i < parameters.length; i++) { parameters[i].retrieve(i + 1,
-     * parameters[i].getName(), storedProcedure); LOG.debug(" retrieve param " + i + " " + parameters[i]); }
-     * 
-     * return new JdbcResults(statement); } catch (SQLException e) { throw new ObjectAdapterRuntimeException(e); } }
-     */
-
-    @Override
-    public Results select(final String sql) {
-        LOG.debug("SQL: " + sql);
-        PreparedStatement statement;
-        try {
-            statement = connection.prepareStatement(sql);
-            addPreparedValues(statement);
-            return new JdbcResults(statement.executeQuery());
-        } catch (final SQLException e) {
-            throw new SqlObjectStoreException(e);
-        } finally {
-            clearPreparedValues();
-        }
-    }
-
-    @Override
-    public int update(final String sql) {
-        if (sql.length() == 0) {
-            return 0;
-        }
-        LOG.debug("SQL: " + sql);
-        PreparedStatement statement;
-        try {
-            statement = connection.prepareStatement(sql);
-            addPreparedValues(statement);
-            final int updateCount = statement.executeUpdate();
-            statement.close();
-            return updateCount;
-        } catch (final SQLException e) {
-            LOG.error("failed to execute " + sql, e);
-            throw new SqlObjectStoreException("SQL error: " + e.toString(), e);
-        } finally {
-            clearPreparedValues();
-        }
-    }
-
-    private void clearPreparedValues() {
-        queryValues.clear();
-    }
-
-    private void addPreparedValues(final PreparedStatement statement) throws SQLException {
-        if (queryValues.size() > 0) {
-            int i = 1;
-            try {
-                for (final Object value : queryValues) {
-                    if (value instanceof LocalDate) {
-                        try {
-                            statement.setObject(i, value, java.sql.Types.DATE);
-                        } catch (final SQLException e) {
-                            // TODO This daft catch is required my MySQL, which
-                            // also requires the TimeZone offset to be
-                            // "undone"
-                            final LocalDate localDate = (LocalDate) value;
-                            final int millisOffset = -DateTimeZone.getDefault().getOffset(null);
-                            final java.util.Date javaDate =
-                                localDate.toDateTimeAtStartOfDay(DateTimeZone.forOffsetMillis(millisOffset)).toDate();
-
-                            statement.setObject(i, javaDate, java.sql.Types.DATE);
-                        }
-                    } else if (value instanceof InputStream) {
-                        statement.setBlob(i, (InputStream) value);
-                    } else {
-                        statement.setObject(i, value);
-                    }
-                    i++;
-                }
-            } catch (final SQLException e) {
-                LOG.error("Error adding prepared value " + i + " of type "
-                    + queryValues.get(i - 1).getClass().getSimpleName(), e);
-                throw e;
-            }
-        }
-    }
-
-    @Override
-    public boolean hasTable(final String tableName) {
-        try {
-            final ResultSet set = connection.getMetaData().getTables(null, null, tableName, null);
-            if (set.next()) {
-                LOG.debug("Found " + set.getString("TABLE_NAME"));
-                set.close();
-                return true;
-            } else {
-                set.close();
-                return false;
-            }
-        } catch (final SQLException e) {
-            throw new SqlObjectStoreException(e);
-        }
-    }
-
-    @Override
-    public boolean hasColumn(final String tableName, final String columnName) {
-        try {
-            final ResultSet set = connection.getMetaData().getColumns(null, null, tableName, columnName);
-            if (set.next()) {
-                LOG.debug("Found " + set.getString("COLUMN_NAME") + " in " + set.getString("TABLE_NAME"));
-                set.close();
-                return true;
-            } else {
-                set.close();
-                return false;
-            }
-        } catch (final SQLException e) {
-            throw new SqlObjectStoreException(e);
-        }
-    }
-
-    @Override
-    public void insert(final String sql) {
-        update(sql);
-    }
-
-    @Override
-    public void insert(final String sql, final Object oid) {
-        LOG.debug("SQL: " + sql);
-        PreparedStatement statement;
-        try {
-            statement = connection.prepareStatement(sql);
-            statement.executeUpdate();
-            /*
-             * require 3.0 ResultSet rs = statement.getGeneratedKeys(); if(rs.next()) { int id = rs.getInt(1); }
-             */statement.close();
-        } catch (final SQLException e) {
-            throw new SqlObjectStoreException("SQL error", e);
-        }
-    }
-
-    public Connection getConnection() {
-        return connection;
-    }
-
-    @Override
-    public void commit() {
-        try {
-            LOG.debug("commit");
-            connection.commit();
-            connection.setAutoCommit(true);
-        } catch (final SQLException e) {
-            throw new SqlObjectStoreException("Commit error", e);
-        }
-    }
-
-    @Override
-    public void begin() {
-        try {
-            LOG.debug("begin transaction");
-            connection.setAutoCommit(false);
-            clearPreparedValues();
-        } catch (final SQLException e) {
-            throw new SqlObjectStoreException("Rollback error", e);
-        }
-
-    }
-
-    @Override
-    public void rollback() {
-        try {
-            LOG.debug("rollback");
-            connection.rollback();
-            connection.setAutoCommit(true);
-        } catch (final SQLException e) {
-            throw new SqlObjectStoreException("Rollback error", e);
-        }
-    }
-
-    @Override
-    public SqlMetaData getMetaData() {
-        try {
-            final DatabaseMetaData metaData = connection.getMetaData();
-            return new JdbcSqlMetaData(metaData);
-        } catch (final SQLException e) {
-            throw new SqlObjectStoreException("Metadata error", e);
-        }
-    }
-
-    @Override
-    public void debug(final DebugBuilder debug) {
-        try {
-            final DatabaseMetaData metaData = connection.getMetaData();
-            debug.appendln("Product", metaData.getDatabaseProductName() + "  " + metaData.getDatabaseProductVersion());
-            try {
-                debug.appendln("Product Version",
-                    metaData.getDatabaseMajorVersion() + "." + metaData.getDatabaseMinorVersion());
-            } catch (final AbstractMethodError ignore) {
-            }
-            debug.appendln("Drive", metaData.getDriverName() + "  " + metaData.getDriverVersion());
-            debug.appendln("Driver Version", metaData.getDriverMajorVersion() + "." + metaData.getDriverMinorVersion());
-            debug.appendln("Keywords", metaData.getSQLKeywords());
-            debug.appendln("Date/Time functions", metaData.getTimeDateFunctions());
-            debug.appendln("Mixed case identifiers", metaData.supportsMixedCaseIdentifiers());
-            debug.appendln("Lower case identifiers", metaData.storesLowerCaseIdentifiers());
-            debug.appendln("Lower case quoted", metaData.storesLowerCaseQuotedIdentifiers());
-            debug.appendln("Mixed case identifiers", metaData.storesMixedCaseIdentifiers());
-            debug.appendln("Mixed case quoted", metaData.storesMixedCaseQuotedIdentifiers());
-            debug.appendln("Upper case identifiers", metaData.storesUpperCaseIdentifiers());
-            debug.appendln("Upper case quoted", metaData.storesUpperCaseQuotedIdentifiers());
-            debug.appendln("Max table name length", metaData.getMaxTableNameLength());
-            debug.appendln("Max column name length", metaData.getMaxColumnNameLength());
-
-        } catch (final SQLException e) {
-            throw new SqlObjectStoreException("Metadata error", e);
-        }
-    }
-
-    private final List<Object> queryValues = new ArrayList<Object>();
-
-    @Override
-    public String addToQueryValues(final int i) {
-        queryValues.add(i);
-        return "?";
-    }
-
-    @Override
-    public String addToQueryValues(final String s) {
-        queryValues.add(s);
-        return "?";
-    }
-
-    @Override
-    public String addToQueryValues(final Object o) {
-        queryValues.add(o);
-        return "?";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/40561609/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcConnectorFactory.java
----------------------------------------------------------------------
diff --git a/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcConnectorFactory.java b/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcConnectorFactory.java
deleted file mode 100644
index fcb6a72..0000000
--- a/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcConnectorFactory.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.objectstore.sql.jdbc;
-
-import org.apache.isis.objectstore.sql.DatabaseConnector;
-import org.apache.isis.objectstore.sql.DatabaseConnectorFactory;
-
-public class JdbcConnectorFactory implements DatabaseConnectorFactory {
-
-    @Override
-    public DatabaseConnector createConnector() {
-        final JdbcConnector connection = new JdbcConnector();
-        connection.open();
-        return connection;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/40561609/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcDateMapper.java
----------------------------------------------------------------------
diff --git a/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcDateMapper.java b/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcDateMapper.java
deleted file mode 100644
index 20592b3..0000000
--- a/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcDateMapper.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.objectstore.sql.jdbc;
-
-import org.joda.time.LocalDate;
-
-import org.apache.isis.applib.PersistFailedException;
-import org.apache.isis.applib.value.Date;
-import org.apache.isis.core.commons.exceptions.IsisApplicationException;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
-import org.apache.isis.objectstore.sql.AbstractFieldMappingFactory;
-import org.apache.isis.objectstore.sql.Defaults;
-import org.apache.isis.objectstore.sql.Results;
-import org.apache.isis.objectstore.sql.mapping.FieldMapping;
-
-/**
- * Handles reading and writing java.sql.Date and org.apache.isis.applib.value.Date values to and from the data store.
- * 
- * 
- * @version $Rev$ $Date$
- */
-public class JdbcDateMapper extends AbstractJdbcFieldMapping {
-
-    private final String dataType;
-
-    public static class Factory extends AbstractFieldMappingFactory {
-        @Override
-        public FieldMapping createFieldMapping(final ObjectSpecification object, final ObjectAssociation field) {
-            final String dataType = getTypeOverride(object, field, Defaults.TYPE_DATE());
-            return new JdbcDateMapper(field, dataType);
-        }
-    }
-
-    protected JdbcDateMapper(final ObjectAssociation field, final String dataType) {
-        super(field);
-        this.dataType = dataType;
-    }
-
-    @Override
-    protected Object preparedStatementObject(final ObjectAdapter value) {
-        final Object o = value.getObject();
-        if (o instanceof java.sql.Date) {
-            final java.sql.Date javaSqlDate = (java.sql.Date) value.getObject();
-            final long millisSinceEpoch = javaSqlDate.getTime();
-            return new LocalDate(millisSinceEpoch);
-        } else if (o instanceof Date) {
-            final Date asDate = (Date) value.getObject();
-            return new LocalDate(asDate.getMillisSinceEpoch());
-        } else {
-            throw new IsisApplicationException("Unimplemented JdbcDateMapper instance type: "
-                + value.getClass().toString());
-        }
-    }
-
-    @Override
-    public ObjectAdapter setFromDBColumn(final Results results, final String columnName, final ObjectAssociation field) {
-        ObjectAdapter restoredValue;
-        final java.util.Date javaDateValue = results.getJavaDateOnly(columnName);
-        final Class<?> correspondingClass = field.getSpecification().getCorrespondingClass();
-        if (correspondingClass == java.util.Date.class || correspondingClass == java.sql.Date.class) {
-            // 2011-04-08 = 1270684800000
-            restoredValue = getAdapterManager().adapterFor(javaDateValue);
-        } else if (correspondingClass == Date.class) {
-            // 2010-03-05 = 1267747200000
-            Date dateValue;
-            dateValue = new Date(javaDateValue);
-            restoredValue = getAdapterManager().adapterFor(dateValue);
-        } else {
-            throw new PersistFailedException("Unhandled date type: " + correspondingClass.getCanonicalName());
-        }
-        return restoredValue;
-    }
-
-    @Override
-    public String columnType() {
-        return dataType;
-    }
-
-    protected PersistenceSession getPersistenceSession() {
-        return IsisContext.getPersistenceSession();
-    }
-
-    protected AdapterManager getAdapterManager() {
-        return getPersistenceSession().getAdapterManager();
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/40561609/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcDateTimeMapper.java
----------------------------------------------------------------------
diff --git a/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcDateTimeMapper.java b/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcDateTimeMapper.java
deleted file mode 100644
index 19c2c96..0000000
--- a/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcDateTimeMapper.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.objectstore.sql.jdbc;
-
-import org.apache.isis.applib.PersistFailedException;
-import org.apache.isis.applib.value.DateTime;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.objectstore.sql.AbstractFieldMappingFactory;
-import org.apache.isis.objectstore.sql.Defaults;
-import org.apache.isis.objectstore.sql.Results;
-import org.apache.isis.objectstore.sql.mapping.FieldMapping;
-
-public class JdbcDateTimeMapper extends AbstractJdbcFieldMapping {
-
-    private final String dataType;
-
-    public static class Factory extends AbstractFieldMappingFactory {
-        @Override
-        public FieldMapping createFieldMapping(final ObjectSpecification object, final ObjectAssociation field) {
-            final String dataType = getTypeOverride(object, field, Defaults.TYPE_DATETIME());
-            return new JdbcDateTimeMapper(field, dataType);
-        }
-    }
-
-    protected JdbcDateTimeMapper(final ObjectAssociation field, final String dataType) {
-        super(field);
-        this.dataType = dataType;
-    }
-
-    @Override
-    protected Object preparedStatementObject(final ObjectAdapter value) {
-        final DateTime asDate = (DateTime) value.getObject();
-        final java.sql.Timestamp dateTime = new java.sql.Timestamp(asDate.millisSinceEpoch());
-        return dateTime;
-    }
-
-    @Override
-    public ObjectAdapter setFromDBColumn(final Results results, final String columnName, final ObjectAssociation field) {
-
-        ObjectAdapter restoredValue;
-        final Class<?> correspondingClass = field.getSpecification().getCorrespondingClass();
-        if (correspondingClass == DateTime.class) {
-            final java.sql.Timestamp o = (java.sql.Timestamp) results.getObject(columnName);
-            final DateTime timeValue = new DateTime(o.getTime());
-            restoredValue = IsisContext.getPersistenceSession().getAdapterManager().adapterFor(timeValue);
-        } else {
-            throw new PersistFailedException("Unhandled time type: " + correspondingClass.getCanonicalName());
-        }
-        return restoredValue;
-    }
-
-    @Override
-    public String columnType() {
-        return dataType;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/40561609/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcGeneralValueMapper.java
----------------------------------------------------------------------
diff --git a/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcGeneralValueMapper.java b/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcGeneralValueMapper.java
deleted file mode 100644
index 0129ddc..0000000
--- a/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcGeneralValueMapper.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.objectstore.sql.jdbc;
-
-import org.apache.isis.applib.value.Money;
-import org.apache.isis.applib.value.Password;
-import org.apache.isis.applib.value.Percentage;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facets.object.encodeable.EncodableFacet;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.objectstore.sql.AbstractFieldMappingFactory;
-import org.apache.isis.objectstore.sql.Results;
-import org.apache.isis.objectstore.sql.mapping.FieldMapping;
-
-public class JdbcGeneralValueMapper extends AbstractJdbcFieldMapping {
-
-    public static class Factory extends AbstractFieldMappingFactory {
-        private final String type;
-
-        public Factory(final String type) {
-            super();
-            this.type = type;
-        }
-
-        @Override
-        public FieldMapping createFieldMapping(final ObjectSpecification object, final ObjectAssociation field) {
-            final String dataType = getTypeOverride(object, field, type);
-            return new JdbcGeneralValueMapper(field, dataType);
-        }
-    }
-
-    private final String type;
-
-    public JdbcGeneralValueMapper(final ObjectAssociation field, final String type) {
-        super(field);
-        this.type = type;
-    }
-
-    @Override
-    protected Object preparedStatementObject(final ObjectAdapter value) {
-        if (value == null) {
-            return null;
-        }
-
-        final Object o = value.getObject();
-
-        if (o instanceof Money) {
-            return ((Money) o).floatValue();
-        } else if (o instanceof Percentage) {
-            return ((Percentage) o).floatValue();
-        } else if (o instanceof Password) {
-            return ((Password) o).getPassword();
-        } else if (o instanceof String) {
-            return o;
-        } else if (o instanceof Boolean) {
-            return o;
-        } else {
-            if (columnType().contains("CHAR")) {
-                final EncodableFacet facet = value.getSpecification().getFacet(EncodableFacet.class);
-                final String encodedString = facet.toEncodedString(value);
-                return encodedString;
-            } else {
-                return o;
-            }
-        }
-    }
-
-    @Override
-    public ObjectAdapter setFromDBColumn(final Results results, final String columnName, final ObjectAssociation field) {
-        final String encodedValue = results.getString(columnName);
-        if (encodedValue == null) {
-            return null;
-        }
-        final EncodableFacet facet = field.getSpecification().getFacet(EncodableFacet.class);
-        return facet.fromEncodedString(encodedValue);
-    }
-
-    @Override
-    public String columnType() {
-        return type;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/40561609/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcImageValueMapper.java
----------------------------------------------------------------------
diff --git a/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcImageValueMapper.java b/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcImageValueMapper.java
deleted file mode 100644
index f64bf24..0000000
--- a/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcImageValueMapper.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/**
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.isis.objectstore.sql.jdbc;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.apache.isis.applib.PersistFailedException;
-import org.apache.isis.applib.value.Image;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.objectstore.sql.Results;
-import org.apache.isis.objectstore.sql.mapping.FieldMapping;
-import org.apache.isis.objectstore.sql.mapping.FieldMappingFactory;
-
-/**
- * 
- * 
- * @version $Rev$ $Date$
- */
-public class JdbcImageValueMapper extends AbstractJdbcMultiFieldMapping {
-
-    public static class Factory implements FieldMappingFactory {
-        private final String type_string; // A reference, e.g. file name
-        private final String type_blob; // The BLOB data
-
-        public Factory(final String string_type, final String type_blob) {
-            this.type_string = string_type;
-            this.type_blob = type_blob;
-        }
-
-        @Override
-        public FieldMapping createFieldMapping(final ObjectSpecification object, final ObjectAssociation field) {
-            return new JdbcImageValueMapper(field, type_string, type_blob);
-        }
-    }
-
-    public JdbcImageValueMapper(final ObjectAssociation field, final String type1, final String type2) {
-        super(field, 2, type1, type2);
-    }
-
-    @Override
-    protected Object preparedStatementObject(int index, Object o) {
-        if (o instanceof Image) {
-            if (index == 0) {
-                return "Image";
-            } else {
-                return getOutputStreamFromImage((Image) o);
-            }
-        } else {
-            throw new PersistFailedException("Invalid object type " + o.getClass().getCanonicalName()
-                + " for JdbcImageValueMapper");
-        }
-    }
-
-    private Object getOutputStreamFromImage(Image o) {
-        int[][] intArray = o.getImage();
-        ByteArrayOutputStream stream = new ByteArrayOutputStream();
-        final int height = o.getHeight();
-        final int width = o.getWidth();
-
-        stream.write(height);
-        stream.write(width);
-        for (int j = 0; j < height; j++) {
-            for (int i = 0; i < width; i++) {
-                // stream.write(o.getImage());
-                stream.write(intArray[j][i]);
-            }
-        }
-        return new ByteArrayInputStream(stream.toByteArray());
-    }
-
-    @Override
-    protected Object getObjectFromResults(Results results) {
-        // final String name = results.getString(columnName(0));
-        InputStream binaryStream = results.getStream(columnName(1));
-
-        int[][] intArray;
-        try {
-            int width = binaryStream.read();
-            int height = binaryStream.read();
-
-            intArray = new int[height][width];
-            for (int j = 0; j < height; j++) {
-                for (int i = 0; i < width; i++) {
-                    intArray[j][i] = binaryStream.read();
-                }
-            }
-        } catch (IOException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-            intArray = new int[0][0];
-        }
-
-        final Image object = new Image(intArray);
-
-        return object;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/40561609/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcMoneyValueMapper.java
----------------------------------------------------------------------
diff --git a/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcMoneyValueMapper.java b/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcMoneyValueMapper.java
deleted file mode 100755
index 1821795..0000000
--- a/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcMoneyValueMapper.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.objectstore.sql.jdbc;
-
-import org.apache.isis.applib.PersistFailedException;
-import org.apache.isis.applib.value.Money;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.objectstore.sql.Results;
-import org.apache.isis.objectstore.sql.mapping.FieldMapping;
-import org.apache.isis.objectstore.sql.mapping.FieldMappingFactory;
-
-/**
- * Money needs to implement a two-column persistence, 1 for amount, 1 for
- * 3-digit currency
- * 
- * @version $Rev$ $Date$
- */
-public class JdbcMoneyValueMapper extends AbstractJdbcMultiFieldMapping {
-
-    public static class Factory implements FieldMappingFactory {
-        private final String type1;
-        private final String type2;
-
-        public Factory(final String type1, final String type2) {
-            this.type1 = type1;
-            this.type2 = type2;
-        }
-
-        @Override
-        public FieldMapping createFieldMapping(final ObjectSpecification object, final ObjectAssociation field) {
-            return new JdbcMoneyValueMapper(field, type1, type2);
-        }
-    }
-
-    public JdbcMoneyValueMapper(final ObjectAssociation field, final String type1, final String type2) {
-        super(field, 2, type1, type2);
-    }
-
-    @Override
-    protected Object preparedStatementObject(final int index, final Object o) {
-
-        if (o instanceof Money) {
-            if (index == 0) {
-                return ((Money) o).doubleValue();
-            } else {
-                return ((Money) o).getCurrency();
-            }
-        } else {
-            throw new PersistFailedException("Invalid object type " + o.getClass().getCanonicalName() + " for MoneyValueMapper");
-        }
-    }
-
-    @Override
-    protected Object getObjectFromResults(final Results results) {
-        final double doubleValue = results.getDouble(columnName(0));
-        final String currencyValue = results.getString(columnName(1));
-
-        final Money moneyObject = new Money(doubleValue, currencyValue);
-
-        return moneyObject;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/40561609/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcObjectReferenceFieldMapping.java
----------------------------------------------------------------------
diff --git a/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcObjectReferenceFieldMapping.java b/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcObjectReferenceFieldMapping.java
deleted file mode 100644
index db826c4..0000000
--- a/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcObjectReferenceFieldMapping.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.objectstore.sql.jdbc;
-
-import org.apache.isis.core.commons.debug.DebugBuilder;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.oid.RootOid;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
-import org.apache.isis.objectstore.sql.AbstractFieldMappingFactory;
-import org.apache.isis.objectstore.sql.DatabaseConnector;
-import org.apache.isis.objectstore.sql.Defaults;
-import org.apache.isis.objectstore.sql.Results;
-import org.apache.isis.objectstore.sql.Sql;
-import org.apache.isis.objectstore.sql.mapping.FieldMapping;
-
-public class JdbcObjectReferenceFieldMapping extends JdbcObjectReferenceMapping implements FieldMapping {
-
-    public static class Factory extends AbstractFieldMappingFactory {
-        @Override
-        public FieldMapping createFieldMapping(final ObjectSpecification object, final ObjectAssociation field) {
-            if (field.getSpecification().isAbstract()) {
-                final String dataType = getTypeOverride(object, field, Defaults.TYPE_LONG_STRING());
-                return new JdbcAbstractReferenceFieldMapping(field, dataType);
-            }
-            return new JdbcObjectReferenceFieldMapping(field);
-        }
-    }
-
-    protected final ObjectAssociation field;
-
-    @Override
-    public ObjectAssociation getField() {
-        return field;
-    }
-
-    @Override
-    public void appendWhereClause(final DatabaseConnector connector, final StringBuffer sql, final ObjectAdapter object) {
-        final ObjectAdapter fieldValue = field.get(object);
-        final RootOid oid = (RootOid) fieldValue.getOid();
-        appendWhereClause(connector, sql, oid);
-    }
-
-    @Override
-    public void appendWhereObject(final DatabaseConnector connector, final ObjectAdapter objectAdapter) {
-        final ObjectAdapter fieldValue = field.get(objectAdapter);
-        final RootOid oid = (RootOid) fieldValue.getOid();
-        connector.addToQueryValues(primaryKey(oid));
-    }
-
-    public JdbcObjectReferenceFieldMapping(final ObjectAssociation field) {
-        super(columnName(field), field.getSpecification());
-        this.field = field;
-    }
-
-    private static String columnName(final ObjectAssociation field) {
-        return Sql.sqlFieldName(field.getId());
-    }
-
-    @Override
-    public void appendInsertValues(final DatabaseConnector connector, final StringBuffer sb, final ObjectAdapter object) {
-        final ObjectAdapter fieldValue = field.get(object);
-        super.appendInsertValues(connector, sb, fieldValue);
-    }
-
-    @Override
-    public void appendUpdateValues(final DatabaseConnector connector, final StringBuffer sql, final ObjectAdapter object) {
-        final ObjectAdapter fieldValue = field.get(object);
-        super.appendUpdateValues(connector, sql, fieldValue);
-    }
-
-    @Override
-    public void initializeField(final ObjectAdapter object, final Results rs) {
-        final ObjectAdapter reference = initializeField(rs);
-        ((OneToOneAssociation) field).initAssociation(object, reference);
-    }
-
-    @Override
-    public void debugData(final DebugBuilder debug) {
-        debug.appendln(field.getId(), getColumn());
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/40561609/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcObjectReferenceMapping.java
----------------------------------------------------------------------
diff --git a/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcObjectReferenceMapping.java b/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcObjectReferenceMapping.java
deleted file mode 100644
index 95a02b5..0000000
--- a/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcObjectReferenceMapping.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.objectstore.sql.jdbc;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.oid.Oid;
-import org.apache.isis.core.metamodel.adapter.oid.RootOid;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.objectstore.sql.DatabaseConnector;
-import org.apache.isis.objectstore.sql.IdMappingAbstract;
-import org.apache.isis.objectstore.sql.Results;
-import org.apache.isis.objectstore.sql.Sql;
-import org.apache.isis.objectstore.sql.SqlObjectStoreException;
-import org.apache.isis.objectstore.sql.mapping.ObjectReferenceMapping;
-
-public class JdbcObjectReferenceMapping extends IdMappingAbstract implements ObjectReferenceMapping {
-    private final ObjectSpecification specification;
-
-    public JdbcObjectReferenceMapping(final String columnName, final ObjectSpecification specification) {
-        this.specification = specification;
-        final String idColumn = Sql.sqlName("fk_" + columnName);
-        setColumn(idColumn);
-    }
-
-    @Override
-    public void appendUpdateValues(final DatabaseConnector connector, final StringBuffer sql, final ObjectAdapter adapter) {
-        sql.append(getColumn());
-        if (adapter == null) {
-            sql.append("= NULL ");
-        } else {
-            sql.append("= ?");
-            // sql.append(primaryKey(object.getOid()));
-            final RootOid oid = (RootOid) adapter.getOid();
-            connector.addToQueryValues(primaryKey(oid));
-        }
-    }
-
-    public ObjectAdapter initializeField(final Results rs) {
-        final Oid oid = recreateOid(rs, specification);
-        if (oid != null) {
-            if (specification.isAbstract()) {
-                throw new SqlObjectStoreException("NOT DEALING WITH POLYMORPHIC ASSOCIATIONS");
-            } else {
-                return getAdapter(specification, oid);
-            }
-        } else {
-            return null;
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/40561609/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcObjectReferenceMappingFactory.java
----------------------------------------------------------------------
diff --git a/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcObjectReferenceMappingFactory.java b/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcObjectReferenceMappingFactory.java
deleted file mode 100644
index e2e1d23..0000000
--- a/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcObjectReferenceMappingFactory.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.objectstore.sql.jdbc;
-
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.objectstore.sql.mapping.ObjectReferenceMapping;
-import org.apache.isis.objectstore.sql.mapping.ObjectReferenceMappingFactory;
-
-public class JdbcObjectReferenceMappingFactory implements ObjectReferenceMappingFactory {
-
-    @Override
-    public ObjectReferenceMapping createReferenceMapping(final String columnName, final ObjectSpecification specification) {
-        return new JdbcObjectReferenceMapping(columnName, specification);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/40561609/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcPasswordValueMapper.java
----------------------------------------------------------------------
diff --git a/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcPasswordValueMapper.java b/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcPasswordValueMapper.java
deleted file mode 100644
index 0c2bd4e..0000000
--- a/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcPasswordValueMapper.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/**
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.isis.objectstore.sql.jdbc;
-
-import org.apache.isis.applib.value.Password;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facets.object.encodeable.EncodableFacet;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.objectstore.sql.AbstractFieldMappingFactory;
-import org.apache.isis.objectstore.sql.Results;
-import org.apache.isis.objectstore.sql.jdbc.helpers.SimplePasswordEncoderDecoder;
-import org.apache.isis.objectstore.sql.mapping.FieldMapping;
-
-/**
- * Implements a Password string type that stores the passwords with a simple encoding in the database.
- * 
- * @version $Rev$ $Date$
- */
-public class JdbcPasswordValueMapper extends AbstractJdbcFieldMapping {
-
-    public static class Factory extends AbstractFieldMappingFactory {
-        private final String type;
-        private final String passwordSeed;
-        private final Integer encLength;
-
-        public Factory(final String type, final String passwordSeed, final Integer encLength) {
-            super();
-            this.type = type;
-            this.passwordSeed = passwordSeed;
-            this.encLength = encLength;
-        }
-
-        @Override
-        public FieldMapping createFieldMapping(final ObjectSpecification object, final ObjectAssociation field) {
-            final String dataType = getTypeOverride(object, field, type);
-            return new JdbcPasswordValueMapper(field, dataType, passwordSeed, encLength);
-        }
-    }
-
-    private final String type;
-
-    private final SimplePasswordEncoderDecoder simplePasswordEncoderDecoder;
-
-    public JdbcPasswordValueMapper(final ObjectAssociation field, final String type, final String passwordSeed,
-        final Integer encLength) {
-        super(field);
-        this.type = type;
-
-        simplePasswordEncoderDecoder = new SimplePasswordEncoderDecoder(passwordSeed, encLength);
-    }
-
-    /*
-     * @see org.apache.isis.runtimes.dflt.objectstores.sql.jdbc.AbstractJdbcFieldMapping#columnType()
-     */
-    @Override
-    protected String columnType() {
-        return type;
-    }
-
-    /*
-     * @see
-     * org.apache.isis.runtimes.dflt.objectstores.sql.jdbc.AbstractJdbcFieldMapping#preparedStatementObject(org.apache
-     * .isis.core.metamodel.adapter.ObjectAdapter)
-     */
-    @Override
-    protected Object preparedStatementObject(ObjectAdapter value) {
-        if (value == null) {
-            return null;
-        }
-        final Object o = value.getObject();
-        final String rawPassword = ((Password) o).getPassword();
-        return simplePasswordEncoderDecoder.encodeRawValueIntoEncodedString(rawPassword);
-    }
-
-    /*
-     * @see
-     * org.apache.isis.runtimes.dflt.objectstores.sql.jdbc.AbstractJdbcFieldMapping#setFromDBColumn(org.apache.isis.
-     * runtimes.dflt.objectstores.sql.Results, java.lang.String,
-     * org.apache.isis.core.metamodel.spec.feature.ObjectAssociation)
-     */
-    @Override
-    protected ObjectAdapter setFromDBColumn(Results results, String columnName, ObjectAssociation field) {
-        final String encodedValue = results.getString(columnName);
-        if (encodedValue == null) {
-            return null;
-        }
-        final EncodableFacet facet = field.getSpecification().getFacet(EncodableFacet.class);
-        return facet.fromEncodedString(simplePasswordEncoderDecoder.decodeEncodedValueIntoRawString(encodedValue));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/40561609/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcPolymorphicObjectReferenceMapping.java
----------------------------------------------------------------------
diff --git a/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcPolymorphicObjectReferenceMapping.java b/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcPolymorphicObjectReferenceMapping.java
deleted file mode 100755
index cf6c419..0000000
--- a/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcPolymorphicObjectReferenceMapping.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.objectstore.sql.jdbc;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.oid.Oid;
-import org.apache.isis.core.metamodel.adapter.oid.RootOid;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.objectstore.sql.DatabaseConnector;
-import org.apache.isis.objectstore.sql.IdMappingAbstract;
-import org.apache.isis.objectstore.sql.Results;
-import org.apache.isis.objectstore.sql.Sql;
-import org.apache.isis.objectstore.sql.SqlObjectStoreException;
-import org.apache.isis.objectstore.sql.mapping.ObjectReferenceMapping;
-
-public class JdbcPolymorphicObjectReferenceMapping extends IdMappingAbstract implements ObjectReferenceMapping {
-    private ObjectSpecification specification;
-
-    public JdbcPolymorphicObjectReferenceMapping(final String columnName) {
-        final String idColumn = Sql.sqlName(columnName);
-        setColumn(idColumn);
-    }
-
-    public void setObjectSpecification(final ObjectSpecification specification) {
-        this.specification = specification;
-    }
-
-    @Override
-    public void appendUpdateValues(final DatabaseConnector connector, final StringBuffer sql, final ObjectAdapter adapter) {
-        sql.append(getColumn());
-        if (adapter == null) {
-            sql.append("= NULL ");
-        } else {
-            sql.append("= ?");
-            // sql.append(primaryKey(object.getOid()));
-            final RootOid oid = (RootOid) adapter.getOid();
-            connector.addToQueryValues(primaryKey(oid));
-        }
-    }
-
-    public ObjectAdapter initializeField(final Results rs) {
-        final Oid oid = recreateOid(rs, specification);
-        if (oid != null) {
-            if (specification.isAbstract()) {
-                throw new SqlObjectStoreException("NOT DEALING WITH POLYMORPHIC ASSOCIATIONS");
-            } else {
-                return getAdapter(specification, oid);
-            }
-        } else {
-            return null;
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/40561609/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcResults.java
----------------------------------------------------------------------
diff --git a/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcResults.java b/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcResults.java
deleted file mode 100644
index 8fb81a8..0000000
--- a/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcResults.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.objectstore.sql.jdbc;
-
-import java.io.InputStream;
-import java.sql.CallableStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.Calendar;
-import java.util.HashMap;
-
-import org.joda.time.DateTime;
-import org.joda.time.DateTimeZone;
-import org.joda.time.format.DateTimeFormat;
-import org.joda.time.format.DateTimeFormatter;
-
-import org.apache.isis.applib.value.Date;
-import org.apache.isis.applib.value.Time;
-import org.apache.isis.objectstore.sql.Defaults;
-import org.apache.isis.objectstore.sql.Results;
-import org.apache.isis.objectstore.sql.SqlObjectStoreException;
-
-public class JdbcResults implements Results {
-    ResultSet set;
-
-    public JdbcResults(final CallableStatement statement) {
-    }
-
-    public JdbcResults(final ResultSet set) {
-        this.set = set;
-    }
-
-    @Override
-    public void close() {
-        try {
-            set.close();
-        } catch (final SQLException e) {
-            throw new SqlObjectStoreException(e);
-        }
-    }
-
-    @Override
-    public int getInt(final String columnName) {
-        try {
-            return set.getInt(columnName);
-        } catch (final SQLException e) {
-            throw new SqlObjectStoreException(e);
-        }
-    }
-
-    @Override
-    public long getLong(final String columnName) {
-        try {
-            return set.getLong(columnName);
-        } catch (final SQLException e) {
-            throw new SqlObjectStoreException(e);
-        }
-    }
-
-    @Override
-    public String getString(final String columnName) {
-        try {
-            return set.getString(columnName);
-        } catch (final SQLException e) {
-            throw new SqlObjectStoreException(e);
-        }
-    }
-
-    @Override
-    public boolean next() {
-        try {
-            return set.next();
-        } catch (final SQLException e) {
-            throw new SqlObjectStoreException(e);
-        }
-    }
-
-    @Override
-    public java.sql.Date getJavaDateOnly(final String columnName) {
-        try {
-            // 2010-03-05 = 1267747200000
-            // 2010-04-08 = 1270684800000
-            // This is really painful! Java refuses to create java.util.Date in
-            // UTC!
-            // It creates java.util.Dates in Local time-zone, but assumes the DB
-            // date is UTC.
-            final String string = set.getString(columnName);
-            final DateTime utcDate = new DateTime(string, Defaults.getTimeZone());
-            final java.sql.Date date = new java.sql.Date(utcDate.getMillis());
-            return date;
-        } catch (final SQLException e) {
-            throw new SqlObjectStoreException(e);
-        }
-    }
-
-    @Override
-    public java.sql.Time getJavaTimeOnly(final String columnName) {
-        try {
-            final String string = set.getString(columnName);
-
-            final DateTimeFormatter formatter = DateTimeFormat.forPattern("HH:mm:ss");
-
-            final DateTime utcDate = formatter.withZone(Defaults.getTimeZone()).parseDateTime(string);
-            final java.sql.Time time = new java.sql.Time(utcDate.getMillis());
-
-            return time;
-        } catch (final SQLException e) {
-            throw new SqlObjectStoreException(e);
-        }
-    }
-
-    @Override
-    public java.util.Date getJavaDateTime(final String columnName, final Calendar calendar) {
-        try {
-            return set.getDate(columnName, calendar);
-        } catch (final SQLException e) {
-            throw new SqlObjectStoreException(e);
-        }
-    }
-
-    @Override
-    public Object getObject(final String columnName) {
-        try {
-            return set.getObject(columnName);
-        } catch (final SQLException e) {
-            throw new SqlObjectStoreException(e);
-        }
-    }
-
-    @Override
-    public Date getDate(final String columnName) {
-        try {
-            // 2010-03-05 = 1267747200000
-            // 2010-04-08 = 1270684800000
-            // This is really painful! Java refuses to create java.util.Date in
-            // UTC!
-            // It creates java.util.Dates in Local time-zone, but assumes the DB
-            // date is UTC.
-            final String string = set.getString(columnName);
-            final DateTime utcDate = new DateTime(string, Defaults.getTimeZone());
-            return new Date(utcDate);
-        } catch (final SQLException e) {
-            throw new SqlObjectStoreException(e);
-        }
-    }
-
-    @Override
-    public Time getTime(final String columnName) {
-        try {
-            final String string = set.getString(columnName);
-            final DateTimeFormatter formatter = DateTimeFormat.forPattern("HH:mm:ss");
-            final DateTimeZone defaultTimeZone = Defaults.getTimeZone();
-            final DateTime utcDate = formatter.withZone(defaultTimeZone).parseDateTime(string);
-            return new Time(utcDate);
-        } catch (final SQLException e) {
-            throw new SqlObjectStoreException(e);
-        }
-    }
-
-    @Override
-    public double getDouble(final String columnName) {
-        try {
-            return set.getDouble(columnName);
-        } catch (final SQLException e) {
-            throw new SqlObjectStoreException(e);
-        }
-    }
-
-    @Override
-    public Object getAsType(final String columnName, final Class<?> clazz) {
-        try {
-            final HashMap<String, Class<?>> map = new HashMap<String, Class<?>>();
-            map.put("FLOAT", float.class);
-            return set.getObject(columnName, map);
-        } catch (final SQLException e) {
-            throw new SqlObjectStoreException(e);
-        }
-    }
-
-    @Override
-    public Float getFloat(final String columnName) {
-        try {
-            return set.getFloat(columnName);
-        } catch (final SQLException e) {
-            throw new SqlObjectStoreException(e);
-        }
-    }
-
-    @Override
-    public Short getShort(final String columnName) {
-        try {
-            return set.getShort(columnName);
-        } catch (final SQLException e) {
-            throw new SqlObjectStoreException(e);
-        }
-    }
-
-    @Override
-    public Boolean getBoolean(final String columnName) {
-        try {
-            return set.getBoolean(columnName);
-        } catch (final SQLException e) {
-            throw new SqlObjectStoreException(e);
-        }
-    }
-
-    @Override
-    public InputStream getStream(String column) {
-        try {
-            return set.getBinaryStream(column);
-        } catch (final SQLException e) {
-            throw new SqlObjectStoreException(e);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/40561609/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcSqlMetaData.java
----------------------------------------------------------------------
diff --git a/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcSqlMetaData.java b/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcSqlMetaData.java
deleted file mode 100644
index 0efd9fe..0000000
--- a/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/jdbc/JdbcSqlMetaData.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.objectstore.sql.jdbc;
-
-import java.sql.DatabaseMetaData;
-import java.sql.SQLException;
-
-import org.apache.isis.objectstore.sql.SqlMetaData;
-
-public class JdbcSqlMetaData implements SqlMetaData {
-
-    private final boolean hasQuoteString;
-    private final String quoteString;
-    private final String keywords;
-    private final String timeDateFunctions;
-    private final boolean storesLowerCaseIdentifiers;
-    private final boolean storesMixedCaseIdentifiers;
-    private final boolean storesUpperCaseIdentifiers;
-
-    public JdbcSqlMetaData(final DatabaseMetaData metaData) throws SQLException {
-        keywords = metaData.getSQLKeywords();
-        timeDateFunctions = metaData.getTimeDateFunctions();
-        quoteString = metaData.getIdentifierQuoteString();
-        hasQuoteString = (quoteString != " ");
-        storesLowerCaseIdentifiers = metaData.storesLowerCaseIdentifiers();
-        storesMixedCaseIdentifiers = metaData.storesMixedCaseIdentifiers();
-        storesUpperCaseIdentifiers = metaData.storesUpperCaseIdentifiers();
-
-    }
-
-    @Override
-    public String getKeywords() {
-        return keywords;
-    }
-
-    @Override
-    public String getTimeDateFunctions() {
-        return timeDateFunctions;
-    }
-
-    @Override
-    public String getQuoteString() {
-        return quoteString;
-    }
-
-    @Override
-    public boolean isStoresLowerCaseIdentifiers() {
-        return storesLowerCaseIdentifiers;
-    }
-
-    @Override
-    public boolean isStoresMixedCaseIdentifiers() {
-        return storesMixedCaseIdentifiers;
-    }
-
-    @Override
-    public boolean isStoresUpperCaseIdentifiers() {
-        return storesUpperCaseIdentifiers;
-    }
-
-    @Override
-    public String quoteIdentifier(final String identifier) {
-        if (hasQuoteString) {
-            return quoteString + identifier + quoteString;
-        } else {
-            return identifier;
-        }
-    }
-}