final String tempFileName) throws ResourceException ExecutionContext executionContext = new ExecutionContext(); TransactionalResourceCommand deliveryCommand = null; if (!unzip) executionContext.put(ExecutionContext.FILE_INPUT_STREAM, inputStream); executionContext.put(ExecutionContext.RELATIVE_FILE_PATH_PARAM, fileName); deliveryCommand = new DeliverFileCommand(outputDir, renameExtension, overwrite, createParentDirectory, tempFileName); executionContext.put(ExecutionContext.BATCHED_FILE_PROVIDER, new UnzippingFileProvider(inputStream)); executionContext.put(ExecutionContext.BATCHED_FILE_NAME, fileName); deliveryCommand = new DeliverBatchCommand(outputDir, overwrite);
@Override protected ExecutionOutput performExecute() { logger.info("execute called on this command: [" + this + "]"); //$NON-NLS-1$ //$NON-NLS-2$ // Don't need to do anything on execute except remember the // fileChunkHeader Id this.fileChunkHeader = ((FileChunkHeader) executionContext.get(ExecutionContext.FILE_CHUNK_HEADER)); this.fileChunkHeaderId = fileChunkHeader.getId(); return new ExecutionOutput(); }
/** * Initialises the command for execution * Retrieves required parameters from the execution context * * @throws ResourceException Exception from Connector */ private void initialise() throws ResourceException { oldFilePath = executionContext.getRequiredString(ExecutionContext.RENAMABLE_FILE_PATH_PARAM); newFilePath = executionContext.getRequiredString(ExecutionContext.NEW_FILE_PATH_PARAM); }
.getRequiredString(ExecutionContext.DELIVERED_FILE_PATH_PARAM); .getRequired(ExecutionContext.PAYLOAD);
.get(ExecutionContext.BASE_FILE_TRANSFER_MAPPED_RECORD); InputStream inputStream = (InputStream) this.executionContext.getRequired(ExecutionContext.FILE_INPUT_STREAM); String filePath = (String) this.executionContext.getRequired(ExecutionContext.RELATIVE_FILE_PATH_PARAM);
.getRequired(ExecutionContext.PAYLOAD);
.getRequired(ExecutionContext.BATCHED_FILE_PROVIDER); String batchedFileName = (String) executionContext.getRequired(ExecutionContext.BATCHED_FILE_NAME); batchFolder = batchedFileName; int suffix = 1;
ExecutionContext executionContext = new ExecutionContext(); executionContext.put(ExecutionContext.CLIENT_ID, this.clientId); FileDiscoveryCommand fileDiscoveryCommand = new FileDiscoveryCommand(sourceDir, filenamePattern, baseFileTransferDao, minAge, filterDuplicates, filterOnFilename, filterOnLastModifiedDate,isRecursive);
/** * (non-Javadoc) * @see org.ikasan.connector.basefiletransfer.outbound.command.AbstractBaseFileTransferTransactionalResourceCommand#performExecute() */ @Override protected ExecutionOutput performExecute() throws ResourceException { logger.info("execute called on this command: [" + this + "]"); //$NON-NLS-1$ //$NON-NLS-2$ ClientListEntry entry = (ClientListEntry) executionContext.get(ExecutionContext.RETRIEVABLE_FILE_PARAM); //sourcePath = entry.getUri().getPath(); // We change the path to be file based as opposed to URI based, // means that root starts as '/' as opposed to '//' which // some FTP servers don't like String uriPath = entry.getUri().getPath(); File path = new File(uriPath); sourcePath = path.getPath(); BaseFileTransferMappedRecord record = getFile(entry); String clientId = (String) executionContext.get(ExecutionContext.CLIENT_ID); logger.debug("got clientId [" + clientId + "]"); //$NON-NLS-1$ //$NON-NLS-2$ entry.setClientId(clientId); dao.persistClientListEntry(entry); return new ExecutionOutput(record); }
ExecutionContext executionContext = new ExecutionContext(); executionContext.put(ExecutionContext.CLIENT_ID, clientId);
@Override protected ExecutionOutput performExecute() throws ResourceException { logger.info("execute called on this command: [" + this + "]"); //$NON-NLS-1$ //$NON-NLS-2$ ClientListEntry entry = (ClientListEntry) executionContext.get(ExecutionContext.RETRIEVABLE_FILE_PARAM); this.sourcePath = entry.getUri().getPath(); File file = new File(entry.getUri().getPath()); try { String directory = file.getParent() + "/"; chunker.chunkFile(directory, file.getName(), chunkSize); } catch (ChunkException e) { throw new ResourceException("Exception caught whilst trying to chunk", e); //$NON-NLS-1$ } FileChunkHeader fileChunkHeader = ((ChunkerImpl) chunker).getFileChunkHeader(); clientId = (String) executionContext.get(ExecutionContext.CLIENT_ID); entry.setClientId(clientId); dao.persistClientListEntry(entry); return new ExecutionOutput(fileChunkHeader); }
logger.info("move on success = [" + moveOnSuccess + "] and path = [" + moveOnSuccessNewPath + "]."); Payload result = null; ExecutionContext executionContext = new ExecutionContext(); executionContext.put(ExecutionContext.CLIENT_ID, clientID); executionContext.put(ExecutionContext.RETRIEVABLE_FILE_PARAM, entry); if (chunking && shouldChunk(entry)) executionContext.put(ExecutionContext.PAYLOAD, result); logger.debug("About to call ChecksumValidatorCommand"); //$NON-NLS-1$
for (ClientListEntry entry : filteredFiles) clientId = (String) this.executionContext.get(ExecutionContext.CLIENT_ID); entry.setClientId(clientId);
ExecutionContext executionContext = new ExecutionContext(); executionContext.put(ExecutionContext.CLIENT_ID, clientID); executionContext.put(ExecutionContext.RETRIEVABLE_FILE_PARAM, entry); if(chunking && shouldChunk(entry)) executionContext.put(ExecutionContext.PAYLOAD, result); logger.debug("About to call ChecksumValidatorCommand"); //$NON-NLS-1$ if(checksum)
boolean checksumDelivered, boolean unzip, boolean cleanup)throws ResourceException ExecutionContext executionContext = new ExecutionContext(); executionContext.put(ExecutionContext.PAYLOAD, payload); String tempFilePath; TargetDirectorySelector selector = new FilenameRegexpMatchedTargetDirectorySelector(outputTargets); executionContext.put(ExecutionContext.FILE_INPUT_STREAM, chunkInputStream); executionContext.put(ExecutionContext.RELATIVE_FILE_PATH_PARAM, fileChunkHeader.getFileName()); executionContext.put(ExecutionContext.BATCHED_FILE_PROVIDER, new UnzippingFileProvider(chunkInputStream)); executionContext.put(ExecutionContext.BATCHED_FILE_NAME, fileChunkHeader.getFileName()); deliveryCommand = new DeliverBatchCommand(outputTarget, overwrite); executionContext.put(ExecutionContext.FILE_CHUNK_HEADER, reconstitutedFileChunkHeader); CleanupChunksCommand cleanupChunksCommand = new CleanupChunksCommand(); executionContext.put(ExecutionContext.BASE_FILE_TRANSFER_MAPPED_RECORD, mappedRecord); executionContext.put(ExecutionContext.BATCHED_FILE_PROVIDER, new UnzippingFileProvider(bais)); executionContext.put(ExecutionContext.BATCHED_FILE_NAME, mappedRecord.getName()); deliveryCommand = new DeliverBatchCommand(outputTarget, overwrite); executionContext.put(ExecutionContext.DELIVERED_FILE_PATH_PARAM, tempFilePath); ChecksumDeliveredCommand checksumDeliveredCommand = new ChecksumDeliveredCommand(); executeCommand(checksumDeliveredCommand, executionContext);
String renameExtension, boolean checksumDelivered, boolean unzip, boolean cleanup) throws ResourceException ExecutionContext executionContext = new ExecutionContext(); executionContext.put(ExecutionContext.PAYLOAD, payload); String tempFilePath; TargetDirectorySelector selector = new FilenameRegexpMatchedTargetDirectorySelector(outputTargets); if (!unzip) executionContext.put(ExecutionContext.FILE_INPUT_STREAM, chunkInputStream); executionContext.put(ExecutionContext.RELATIVE_FILE_PATH_PARAM, fileChunkHeader.getFileName()); executionContext.put(ExecutionContext.BATCHED_FILE_PROVIDER, new UnzippingFileProvider( chunkInputStream)); executionContext.put(ExecutionContext.BATCHED_FILE_NAME, fileChunkHeader.getFileName()); executionContext.put(ExecutionContext.FILE_CHUNK_HEADER, reconstitutedFileChunkHeader); executionContext.put(ExecutionContext.BASE_FILE_TRANSFER_MAPPED_RECORD, mappedRecord); executionContext.put(ExecutionContext.BATCHED_FILE_PROVIDER, new UnzippingFileProvider(bais)); executionContext.put(ExecutionContext.BATCHED_FILE_NAME, mappedRecord.getName()); executionContext.put(ExecutionContext.DELIVERED_FILE_PATH_PARAM, tempFilePath); ChecksumDeliveredCommand checksumDeliveredCommand = new ChecksumDeliveredCommand(); executeCommand(checksumDeliveredCommand, executionContext);