tbrugz.sqldump.datadump.JOpenDocODS Maven / Gradle / Ivy
package tbrugz.sqldump.datadump;
import java.io.File;
import java.io.IOException;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.List;
import java.util.Properties;
import java.util.Vector;
import java.util.regex.Matcher;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jopendocument.dom.spreadsheet.SpreadSheet;
import tbrugz.sqldump.util.SQLUtils;
public class JOpenDocODS extends WriterIndependentDumpSyntax {
static final Log log = LogFactory.getLog(JOpenDocODS.class);
static final String JOPENODS_SYNTAX_ID = "jopen-ods";
static final String JOPENODS_FILEEXT = "ods";
static final String PROP_ODS_OUTFILEPATTERN = "sqldump.datadump."+JOPENODS_SYNTAX_ID+".outfilepattern";
/*protected int numCol;
protected final List lsColNames = new ArrayList();
protected final List> lsColTypes = new ArrayList>();*/
String outFilePattern;
//String tableName;
//stateful props
Vector> values;
@Override
public void procProperties(Properties prop) {
outFilePattern = prop.getProperty(PROP_ODS_OUTFILEPATTERN);
if(outFilePattern==null) {
log.warn("prop '"+PROP_ODS_OUTFILEPATTERN+"' must be set");
}
}
@Override
public String getSyntaxId() {
return JOPENODS_SYNTAX_ID;
}
@Override
public String getDefaultFileExtension() {
return "ods";
}
@Override
public String getMimeType() {
return "application/vnd.oasis.opendocument.spreadsheet"; //application/x-vnd.oasis.opendocument.spreadsheet ?
}
@Override
public void initDump(String schema, String tableName, List pkCols,
ResultSetMetaData md) throws SQLException {
super.initDump(schema, tableName, pkCols, md);
/*numCol = md.getColumnCount();
lsColNames.clear();
lsColTypes.clear();
for(int i=0;i>();
}
@Override
public void dumpHeader() throws IOException {
}
@Override
public void dumpRow(ResultSet rs, long count) throws IOException, SQLException {
List