JavaDoc


001    /**
002     * Copyright (c) 2008 Regiscope Digital Imaging Co, LLC, All rights reserved.
003     * This program is free software; you can redistribute it and/or modify
004     * it under the terms of version 2 of the GNU General Public License as
005     * published by the Free Software Foundation.
006     * There are special exceptions to the terms and conditions of the GPL
007     * as it is applied to this software. See the GNU General Public License for more details.
008     *
009     * This program is distributed in the hope that it will be useful,
010     * but WITHOUT ANY WARRANTY; without even the implied warranty of
011     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
012     * GNU General Public License for more details.
013     *
014     * You should have received a copy of the GNU General Public License
015     * along with this program; if not, write to the Free Software
016     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
017     */
018    
019    package org.dbreplicator.replication.column;
020    
021    import java.io.*;
022    import java.sql.*;
023    import java.util.*;
024    
025    import org.dbreplicator.replication.xml.*;
026    
027    /**
028     * This class is the abstract class which is extended by all the different
029     * type of ColumnObject classses. This is implemented so that different types
030     * of data can be written differently by different type of databases.
031     * This is most  useful in case of Blob and Clob type of datatype, in which
032     * data is written in to saperate files.
033     *
034     */
035    public abstract class AbstractColumnObject
036    {
037    
038        protected BlobOutPutStream blobst = null;
039        protected ClobOutPutStream clobst = null;
040    
041        public void setBlobHandlerObject(BlobOutPutStream bo0)
042        {
043    //    RepPrinter.print(bo0.hashCode() + " Inside AbstractColumnObject setBlobHandlerObject method ");
044            blobst = bo0;
045        }
046    
047        public void setClobHandlerObject(ClobOutPutStream co0)
048        {
049    //    RepPrinter.print(co0.hashCode() +" Inside AbstractColumnObject setClobHandlerObject method ");
050            clobst = co0;
051        }
052    
053        abstract public void setColumnObject(PreparedStatement pst, XMLElement value,
054                                             int index) throws SQLException;
055    
056        abstract public void setColumnObject(PreparedStatement pst, String value,
057                                             int index) throws SQLException;
058    
059        /**
060         * This method is overridden by different ColumnObject classes.
061         * So that data can be written differently for different datatypes.
062         * It is best suitable for Blob & Clob datatypes where data is
063         * written in the saperate files.
064         *
065         * @param bw      Writer
066         * @param rs      ResultSet
067         * @param index   int
068         * @param encodedCols   ArrayList
069         * @param col     String
070         * @throws SQLException
071         * @throws IOException
072         */
073    
074        abstract public void write(Writer bw, ResultSet rs, int index,ArrayList encodedCols,String col) throws
075            SQLException, IOException;
076    
077        abstract public void writeUpdate(Writer bw, ResultSet rows,
078                                         ResultSet oldResultSet, int index,
079                                         HashMap modifiedColumnsMap,
080                                         String columnName,ArrayList encodedCols) throws SQLException,
081            IOException;
082    
083        abstract public Object getObject(String value) throws SQLException;
084    
085    }





























































Powered by Drupal - Theme by Danger4k