public class Subsetter extends Object
| Constructor and Description |
|---|
Subsetter()
Default constructor.
|
Subsetter(DataSource dataSource,
DBMS dbms,
File dataModel,
File extractionModel,
ScriptFormat scriptFormat)
Creates a new Subsetter with all mandatory attributes.
|
Subsetter(DataSource dataSource,
DBMS dbms,
URL dataModel,
URL extractionModel,
ScriptFormat scriptFormat)
Creates a new Subsetter with all mandatory attributes.
|
Subsetter(Subsetter other)
Copy constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
execute(String whereClause,
File exportScriptFile)
Generates the export-script.
|
void |
execute(String whereClause,
File exportScriptFile,
File deleteScriptFile)
Generates the export- and/or delete-script.
|
URL |
getDataModelURL()
Gets URL of the current data model (the datamodel's base folder)
|
DataSource |
getDataSource()
Gets the data-source to connect with the database.
|
DBMS |
getDbms()
Gets the DBMS of the database.
|
URL |
getExtractionModelURL()
Gets the URL of the extraction model.
|
String |
getImportFilterMappingTableSchema()
Gets schema in which the import-filter mapping tables will be created
|
int |
getModelPoolSize() |
boolean |
getNoRowid()
If
true, Use primary keys to determine row identity (instead
of rowid-column) |
boolean |
getNoSorting()
If
true, The exported rows will not be sorted according to
foreign key constraints |
int |
getNumberOfEntities()
Gets maximum number of entities per insert-statement (in export-file,
default is 10)
|
int |
getNumberOfThreads()
Gets number of parallel threads (default is 1) to be used.
|
Map<String,String> |
getParameters()
Gets parameters
TODO
|
Map<String,String> |
getSchemaMapping() |
WorkingTableScope |
getScope()
Gets scope of working tables, GLOBAL, SESSION_LOCAL or LOCAL_DATABASE
Default is GLOBAL. |
ScriptFormat |
getScriptFormat()
Gets the script format.
|
Map<String,String> |
getSourceSchemaMapping() |
DBMS |
getTargetDBMS()
Gets target-DBMS.
|
boolean |
getUpsertOnly()
If
true, Generate 'upsert'-statements for all entities (in
export-file) |
boolean |
getUTF8()
If
true, Use uTF-8 encoding |
String |
getWorkingTableSchema()
Gets schema in which the working tables will be created
|
String |
getXmlDatePattern()
Gets pattern for dates in XML and LIQUIBASE_XML export file
|
String |
getXmlRootTag()
Gets root tag of XML export file
|
String |
getXmlTimePattern()
Gets pattern for times in XML and LIQUIBASE_XML export file
|
String |
getXmlTimeStampPattern()
Gets pattern for time-stamps in XML and LIQUIBASE_XML export file
|
void |
setDataModelBaseFolder(File datamodelBaseFolder)
Sets the current data model as
File |
void |
setDataModelURL(URL datamodelURL)
Sets URL of the current data model (the datamodel's base folder)
|
void |
setDataSource(DataSource dataSource)
Sets the data-source to connect with the database.
|
void |
setDbms(DBMS dbms)
Sets the DBMS of the database.
|
void |
setExtractionModelURL(URL extractionModelURL)
Sets the URL of the extraction model.
|
void |
setImportFilterMappingTableSchema(String importFilterMappingTableSchema)
Sets schema in which the import-filter mapping tables will be created
|
void |
setModelPoolSize(int modelPoolSize) |
void |
setNoRowid(boolean noRowid)
If
true, Use primary keys to determine row identity (instead
of rowid-column) |
void |
setNoSorting(boolean noSorting)
If
true, The exported rows will not be sorted according to
foreign key constraints |
void |
setNumberOfEntities(int numberOfEntities)
Sets maximum number of entities per insert-statement (in export-file,
default is 10)
|
void |
setNumberOfThreads(int numberOfThreads)
Sets number of parallel threads (default is 1) to be used
|
void |
setParameter(String name,
String value)
Sets a parameter.
|
void |
setSchemaMapping(Map<String,String> schemaMapping)
Sets source schema map
TODO
|
void |
setScope(WorkingTableScope scope)
Sets scope of working tables, GLOBAL, SESSION_LOCAL or LOCAL_DATABASE
|
void |
setScriptFormat(ScriptFormat scriptFormat)
Sets the script format.
|
void |
setSourceSchemaMapping(Map<String,String> sourceSchemaMapping)
TODO
|
void |
setTargetDBMS(DBMS targetDBMS)
Sets target-DBMS.
|
void |
setUpsertOnly(boolean upsertOnly)
If
true, Generate 'upsert'-statements for all entities (in
export-file) |
void |
setUTF8(boolean uTF8)
If
true, use UTF-8 encoding |
void |
setWorkingTableSchema(String workingTableSchema)
Sets schema in which the working tables will be created
|
void |
setXmlDatePattern(String xmlDatePattern)
Sets pattern for dates in XML and LIQUIBASE_XML export file
|
void |
setXmlRootTag(String xmlRootTag)
Sets root tag of XML export file
|
void |
setXmlTimePattern(String xmlTimePattern)
Sets pattern for times in XML and LIQUIBASE_XML export file
|
void |
setXmlTimeStampPattern(String xmlTimeStampPattern)
Sets pattern for time-stamps in XML and LIQUIBASE_XML export file
|
public Subsetter()
public Subsetter(Subsetter other)
public Subsetter(DataSource dataSource, DBMS dbms, URL dataModel, URL extractionModel, ScriptFormat scriptFormat)
dataSource - the data-source to connect with the source databasedbms - the DBMS of the source databasedataModel - URL of the current data model (the datamodel's base folder)extractionModel - URL of the extraction modelscriptFormat - script formatpublic Subsetter(DataSource dataSource, DBMS dbms, File dataModel, File extractionModel, ScriptFormat scriptFormat)
dataSource - the data-source to connect with the source databasedbms - the DBMS of the source databasedataModel - the current data model (the datamodel's base folder)extractionModel - the extraction modelscriptFormat - script formatpublic void execute(String whereClause, File exportScriptFile) throws SQLException, IOException
whereClause - if not null, overrides the extraction model's subject conditionexportScriptFile - the export-script file (compressed if it ends with '.zip' or '.gz')SQLExceptionIOExceptionpublic void execute(String whereClause, File exportScriptFile, File deleteScriptFile) throws SQLException, IOException
whereClause - if not null, overrides the extraction model's subject conditionexportScriptFile - the export-script file (compressed if it ends with '.zip' or '.gz'), optionaldeleteScriptFile - the delete-script file (compressed if it ends with '.zip' or '.gz'), optionalSQLExceptionIOExceptionpublic DataSource getDataSource()
public void setDataSource(DataSource dataSource)
dataSource - the data-source to connect with the databasepublic DBMS getDbms()
public void setDbms(DBMS dbms)
BasicDataSource is used.dbms - the DBMSpublic URL getDataModelURL()
public void setDataModelURL(URL datamodelURL)
public void setDataModelBaseFolder(File datamodelBaseFolder)
FiledatamodelBaseFolder - represents the folder. Will be converted to an URL an set as datamodel URLsetDataModelURL(URL)public URL getExtractionModelURL()
public void setExtractionModelURL(URL extractionModelURL)
extractionModelURL - the URL of the extraction modelpublic ScriptFormat getScriptFormat()
public void setScriptFormat(ScriptFormat scriptFormat)
public boolean getUTF8()
true, Use uTF-8 encodingtrue if use UTF-8 encodingpublic void setUTF8(boolean uTF8)
true, use UTF-8 encodinguTF8 - true if use UTF-8 encodingpublic DBMS getTargetDBMS()
public void setTargetDBMS(DBMS targetDBMS)
targetDBMS - target-DBMS. If it's null, target DBMS is assumed to be the same as getDbms()public String getXmlRootTag()
public void setXmlRootTag(String xmlRootTag)
xmlRootTag - root tag of XML export filepublic String getXmlDatePattern()
public void setXmlDatePattern(String xmlDatePattern)
xmlDatePattern - pattern for dates in XML and LIQUIBASE_XML export filepublic String getXmlTimePattern()
public void setXmlTimePattern(String xmlTimePattern)
xmlTimePattern - pattern for times in XML and LIQUIBASE_XML export filepublic String getXmlTimeStampPattern()
public void setXmlTimeStampPattern(String xmlTimeStampPattern)
xmlTimeStampPattern - pattern for time-stamps in XML and LIQUIBASE_XML export filepublic int getNumberOfThreads()
public void setNumberOfThreads(int numberOfThreads)
numberOfThreads - number of threadspublic int getNumberOfEntities()
public void setNumberOfEntities(int numberOfEntities)
numberOfEntities - maximum number of entities per insert-statement (in
export-file, default is 10)public boolean getUpsertOnly()
true, Generate 'upsert'-statements for all entities (in
export-file)true if Generate 'upsert'-statements for all
entities (in export-file)public void setUpsertOnly(boolean upsertOnly)
true, Generate 'upsert'-statements for all entities (in
export-file)upsertOnly - true if Generate 'upsert'-statements for all
entities (in export-file)public WorkingTableScope getScope()
public void setScope(WorkingTableScope scope)
scope - scope of working tables, GLOBAL, SESSION_LOCAL or
LOCAL_DATABASEpublic String getWorkingTableSchema()
public void setWorkingTableSchema(String workingTableSchema)
workingTableSchema - schema in which the working tables will be createdpublic boolean getNoSorting()
true, The exported rows will not be sorted according to
foreign key constraintstrue if The exported rows will not be sorted
according to foreign key constraintspublic void setNoSorting(boolean noSorting)
true, The exported rows will not be sorted according to
foreign key constraintsnoSorting - true if The exported rows will not be sorted
according to foreign key constraintspublic boolean getNoRowid()
true, Use primary keys to determine row identity (instead
of rowid-column)true if Use primary keys to determine row identity
(instead of rowid-column)public void setNoRowid(boolean noRowid)
true, Use primary keys to determine row identity (instead
of rowid-column)noRowid - true if Use primary keys to determine row
identity (instead of rowid-column)public String getImportFilterMappingTableSchema()
public void setImportFilterMappingTableSchema(String importFilterMappingTableSchema)
importFilterMappingTableSchema - schema in which the import-filter mapping tables will be
createdpublic void setParameter(String name, String value)
name - parameter namevalue - valuepublic void setSchemaMapping(Map<String,String> schemaMapping)
rawsourceschemamapping - source schema mappublic void setSourceSchemaMapping(Map<String,String> sourceSchemaMapping)
sourceSchemaMapping - the sourceSchemaMapping to setpublic int getModelPoolSize()
public void setModelPoolSize(int modelPoolSize)
modelPoolSize - size of extraction-model pool (default is 10)