protected TableDefinition getFicstarTableDefinition(DataFile dataFile) throws IOException { RetailerSite retailerSite = dataFile.getRetailerSite(); File schemaFile = this.getFicstarSchemaFile(); DataImportConfig dataImportConfig = applicationContext.getBean("dataImportConfig", DataImportConfig.class); dataImportConfig.setConfigFilePath(schemaFile.getAbsolutePath()); dataImportConfig.afterPropertiesSet(); // now the config is ready. Schema schema = dataImportConfig.getSchema(); TableDefinition tableDefinition = schema.getDefinitionByDestination(dataFile.getImportType()); Assert.notNull( tableDefinition, "cannot find tableDefinition for :=" + dataFile.getImportType() + " in schema :=" + schemaFile.getAbsolutePath()); String csvFilePath = FilenameUtils.normalize( configurationService.getFileSystem().getFileSystemAsString() + "/" + dataFile.getFilePath()); tableDefinition.setProperty("path", csvFilePath); tableDefinition.setProperty("relativePath", dataFile.getFilePath()); tableDefinition.setProperty("isPathAbsolute", "true"); // some feeds like google dont have siteName == RetailerSiteName tableDefinition.setProperty("columns.siteName.defaultValue", retailerSite.getSiteName()); return tableDefinition; }
/* * (non-Javadoc) * * @see * com.dell.acs.dataimport.preprocessor.PreprocessorHandler#preprocess(com * .dell.acs.persistence.domain.DataFile) */ @Override public void preprocess(DataFile dataFile) { RetailerSite retailerSite = retailerSiteRepository.getByName(dataFile.getRetailerSite().getSiteName(), true); if (configurationService.getBooleanProperty( DataFilesDownloadManager.class, retailerSite.getSiteName() + ".blocking", false)) { int blockSize = configurationService.getIntegerProperty( DataFilesDownloadManager.class, retailerSite.getSiteName() + ".blockSize", -1); if (blockSize == -1) { throw new RuntimeException( "Protocol Error, Invalid configuration for block size discovered!"); } this.blockDataFile(dataFile, retailerSite, blockSize); } else if (configurationService.getBooleanProperty( DataFilesDownloadManager.class, retailerSite.getSiteName() + ".splitting", false)) { int splitSize = configurationService.getIntegerProperty( DataFilesDownloadManager.class, retailerSite.getSiteName() + ".splitSize", -1); if (splitSize == -1) { throw new RuntimeException( "Protocol Error, Invalid configuration for split size discovered!"); } this.splitDataFile(dataFile, retailerSite, splitSize); } else { this.noSplit(dataFile, retailerSite); } }