/** * Create output resource (if necessary) and point the delegate to it. */ private File setResourceToDelegate() throws IOException { String path = resource.getFile().getAbsolutePath() + suffixCreator.getSuffix(resourceIndex); File file = new File(path); delegate.setResource(new FileSystemResource(file)); return file; } }
/** * Create output resource (if necessary) and point the delegate to it. */ private File setResourceToDelegate() throws IOException { resource = resourceLocator.getResource(executionContext); delegate.setResource(resource); LOGGER.debug("Setting resource={} to delegate", resource != null ? resource.getFile().getAbsolutePath() : "null"); return resource.getFile(); }
private void initializeStreams() throws Exception { if (createBackupFile) { outputResource = new FileSystemResource(File.createTempFile(resource.getFilename(), ".tmp", resource.getFile().getParentFile())); } else { outputResource = resource; } reader.setResource(resource); writer.setResource(outputResource); }
/** * Create output resource (if necessary) and point the delegate to it. */ private File setResourceToDelegate() throws IOException { String path = resource.getFile().getAbsolutePath() + suffixCreator.getSuffix(resourceIndex); File file = new File(path); delegate.setResource(new FileSystemResource(file)); return file; } }
@Override public void write(List<? extends ExcelRow> items) throws Exception { if (!initialized && items.size() > 0) { SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd"); String suffix = format.format(items.get(0).getDate()); File file = ExcelFileUtils.getFile(new File(directoryPath), fileName, suffix, fileExtension); delegate.setResource(new FileSystemResource(file)); delegate.open(executionContext); initialized = true; } delegate.write(items); }
@Override protected void doOpen() throws Exception { if (executionContext.containsKey(getExecutionContextKey(RESOURCE_KEY))) { resource = new FileSystemResource(executionContext.getString(getExecutionContextKey(RESOURCE_KEY), "")); // It's a restart delegate.open(executionContext); delegate.setResource(resource); // We don't have to create the resource opened = true; LOGGER.trace("Stream is opened"); } else { opened = false; LOGGER.trace("Stream is not opened yet"); } }