public TableBuilder(Table table, DataSource dataSource, int step) { this.table = table; this.dataSource = dataSource; this.scriptFileReader = new SimpleScriptFileReaderImpl(); this.step = step; }
public String readScript(String scriptFilePath) throws IOException { return readScript(scriptFilePath, StandardCharsets.ISO_8859_1); } }
private boolean tableHasPlan(String backupPath, int maxSteps, Table table) { return backupLocator.existsFileForTable(backupPath, maxSteps, table); }
PersistenceMode mode = backupLocator.resolvePersistenceMode(backupPath, step, table); String path = backupLocator.getBackupFilePath(backupPath, step, table, mode);
public TextDelimitedFileBackupReader(Table table) { this.csvFileParser = new CsvFileParserImpl(table.getInsertColumnList().size(), StandardCharsets.UTF_8); this.table = table; }
private List<BackupPlanPreExecutionWarning> checkScriptsForStep(String backupPath, int step, Table table, InputDataSourceProvider inputDataSourceProvider) throws IOException { List<BackupPlanPreExecutionWarning> result = new LinkedList<>(); PersistenceMode mode = backupLocator.resolvePersistenceModeOrNull(backupPath, step, table); if(mode!=null){ switch(mode){ case XML : result.addAll(checkXmlScript(backupPath, step, table, inputDataSourceProvider)); break; case CSV : result.add(new BackupPlanPreExecutionWarning(BackupPlanWarningType.HARDCODED_VALUES, step, table)); break; default: break; } } return result; }
private List<BackupPlanPreExecutionWarning> checkXmlScript(String backupPath, int step, Table table, InputDataSourceProvider inputDataSourceProvider) throws IOException { List<BackupPlanPreExecutionWarning> result = new LinkedList<>(); String filePath = backupLocator.getBackupFilePath(backupPath, step, table); SourceAndScript sourceAndScript = xmlFileSourceAndScriptParser.parse(filePath); String sourceRef = sourceAndScript.getSource(); if(isNotProdSourceTargeted(sourceRef, inputDataSourceProvider)){ result.add(new BackupPlanPreExecutionWarning(BackupPlanWarningType.NOT_PROD_TARGET, step, table)); } return result; }
public TableBuilder(Table table, DataSource dataSource, int step) { this.table = table; this.dataSource = dataSource; this.scriptFileReader = new SimpleScriptFileReaderImpl(); this.step = step; }