org.kuali.common.impex.data.service.impl
Class DefaultDumpDataService

java.lang.Object
  extended by org.kuali.common.impex.data.service.impl.DefaultDumpDataService
All Implemented Interfaces:
DumpDataService

public class DefaultDumpDataService
extends Object
implements DumpDataService


Field Summary
protected static int DEFAULT_DATABASE_ROW_COUNT
          In the absence of a properties file holding detailed table statistics, this value is used.
protected static org.slf4j.Logger logger
           
 
Constructor Summary
DefaultDumpDataService()
           
 
Method Summary
 DumpTableResult dumpTable(DumpDataContext context, DumpTableContext tableContext, Connection conn)
           
protected  DumpTableResult dumpTable(DumpDataContext dataContext, DumpTableContext tableContext, ResultSet rs)
           
 List<DumpTableResult> dumpTables(DumpDataContext context, Schema schema)
           
protected  String getClob(Clob clob)
          Convert a CLOB to a String
protected  String getColumnValueAsString(String dateFormat, ResultSet rs, int index, Column column)
          Use JDBC to extract the data held by the database into a java.lang.String suitable for dumping to disk.
protected  long getDumpedTableCount(List<DumpTableResult> results)
           
protected  DumpProgress getDumpProgress(OutputStream out, List<Column> columns, List<List<String>> data, DumpDataContext ddc, DumpTableContext dtc, TableTracker tracker)
           
protected  long getDumpResultRows(List<DumpTableResult> results)
           
protected  long getDumpResultSize(List<DumpTableResult> results)
           
protected  List<Column> getOrderedColumnsFromMetadata(ResultSetMetaData md, Table t)
          Convert the JDBC metadata into a list of Column objects ordered in exactly the same way as the metadata
protected  List<String> getRowData(String dateFormat, String tableName, ResultSet rs, List<Column> columns)
          Convert the data from the row into String form
protected  String getSelectAllQuery(Table table)
          Generate a SQL statement that selects all data from the table
protected  long getSize(List<String> data)
           
protected  List<DumpTableBucket> getTableBuckets(List<DumpTableContext> tables, DumpDataContext context, List<DumpTableResult> results, org.kuali.common.util.PercentCompleteInformer progressTracker)
           
protected  long getTotalRowCount(List<DumpTableContext> contexts)
           
protected  boolean isIntervalLimitExceeded(TableTracker tracker, DumpDataContext context)
          Return true if we have processed 50 rows or 50k of data, whichever comes first.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final org.slf4j.Logger logger

DEFAULT_DATABASE_ROW_COUNT

protected static final int DEFAULT_DATABASE_ROW_COUNT
In the absence of a properties file holding detailed table statistics, this value is used. The logic prints a dot to the console each time it thinks it makes 1% progress towards the overall goal. This default count will cause a dot to get printed for every 5,000 rows that get dumped.

See Also:
Constant Field Values
Constructor Detail

DefaultDumpDataService

public DefaultDumpDataService()
Method Detail

dumpTable

public DumpTableResult dumpTable(DumpDataContext context,
                                 DumpTableContext tableContext,
                                 Connection conn)
Specified by:
dumpTable in interface DumpDataService

dumpTable

protected DumpTableResult dumpTable(DumpDataContext dataContext,
                                    DumpTableContext tableContext,
                                    ResultSet rs)

isIntervalLimitExceeded

protected boolean isIntervalLimitExceeded(TableTracker tracker,
                                          DumpDataContext context)
Return true if we have processed 50 rows or 50k of data, whichever comes first.


getRowData

protected List<String> getRowData(String dateFormat,
                                  String tableName,
                                  ResultSet rs,
                                  List<Column> columns)
                           throws SQLException
Convert the data from the row into String form

Throws:
SQLException

getClob

protected String getClob(Clob clob)
                  throws SQLException
Convert a CLOB to a String

Throws:
SQLException

getColumnValueAsString

protected String getColumnValueAsString(String dateFormat,
                                        ResultSet rs,
                                        int index,
                                        Column column)
                                 throws SQLException
Use JDBC to extract the data held by the database into a java.lang.String suitable for dumping to disk. The String returned by this method must be completely disconnected from the ResultSet and database. Once this method returns, invoking a method on the underlying ResultSet or otherwise contacting the database to assist with processing the data held in this row/column is forbidden.

Throws:
SQLException

getTotalRowCount

protected long getTotalRowCount(List<DumpTableContext> contexts)

dumpTables

public List<DumpTableResult> dumpTables(DumpDataContext context,
                                        Schema schema)
Specified by:
dumpTables in interface DumpDataService

getDumpedTableCount

protected long getDumpedTableCount(List<DumpTableResult> results)

getDumpResultRows

protected long getDumpResultRows(List<DumpTableResult> results)

getDumpResultSize

protected long getDumpResultSize(List<DumpTableResult> results)

getTableBuckets

protected List<DumpTableBucket> getTableBuckets(List<DumpTableContext> tables,
                                                DumpDataContext context,
                                                List<DumpTableResult> results,
                                                org.kuali.common.util.PercentCompleteInformer progressTracker)

getSelectAllQuery

protected String getSelectAllQuery(Table table)
Generate a SQL statement that selects all data from the table


getOrderedColumnsFromMetadata

protected List<Column> getOrderedColumnsFromMetadata(ResultSetMetaData md,
                                                     Table t)
                                              throws SQLException
Convert the JDBC metadata into a list of Column objects ordered in exactly the same way as the metadata

Throws:
SQLException

getDumpProgress

protected DumpProgress getDumpProgress(OutputStream out,
                                       List<Column> columns,
                                       List<List<String>> data,
                                       DumpDataContext ddc,
                                       DumpTableContext dtc,
                                       TableTracker tracker)

getSize

protected long getSize(List<String> data)


Copyright © 2004-2013 The Kuali Foundation. All Rights Reserved.