/** * Returns all transaction information. * @return transaction information */ public List<TransactionInfo> list() { LOG.debug("loading all transaction info"); try { return getEditor().list(); } catch (IOException e) { throw new CommandExecutionException("error occurred while loading transactions", e); } }
/** * Returns a transaction. * @param id the transaction ID * @return the corresponded transaction information */ public Optional<TransactionInfo> find(String id) { LOG.debug("loading transaction info: {}", id); try { return Optional.ofNullable(getEditor().get(id)); } catch (IOException e) { throw new CommandExecutionException(MessageFormat.format( "error occurred while loading transaction: {0}", id), e); } } }
throw new CommandExecutionException(MessageFormat.format( "cannot copy resource: {0} -> {1}", source, destination), e);
throw new CommandExecutionException(MessageFormat.format( "cannot copy resource: {0} -> {1}", source, destination), e);
throw new CommandExecutionException(MessageFormat.format( "cannot copy resource: {0} -> {1}", source, destination), e);
verboseParameter.ifRequired(() -> TransactionShowCommand.print(writer, info, 0)); if (editor.abort(id) == false) { throw new CommandExecutionException(MessageFormat.format( "cannot abort transaction \"{0}\" (see the above log message)", id)); throw new CommandExecutionException(MessageFormat.format( "cannot abort transaction \"{0}\" (see the causal exception message)", id), e);
verboseParameter.ifRequired(() -> TransactionShowCommand.print(writer, info, 0)); if (editor.apply(id) == false) { throw new CommandExecutionException(MessageFormat.format( "cannot apply transaction \"{0}\" (see the above log message)", id)); throw new CommandExecutionException(MessageFormat.format( "cannot apply transaction \"{0}\" (see the causal exception message)", id), e);
@Override public void run() { LOG.debug("start run command"); ExecutionContext context = contextParameter.getExecutionContext(); BatchInfo workflow = workflowParameter.getBatchInfo(context); BatchExecutor executor = executorParameter.getBatchExecutor(context); Map<String, String> arguments = applicationParameter.getBatchArguments(); try { executor.execute(context, workflow, arguments); } catch (ExecutionConditionException e) { throw new CommandConfigurationException(MessageFormat.format( "cannot execute batch \"{0}\" ({1})", workflow.getId(), e.getMessage()), e); } catch (IOException | InterruptedException e) { throw new CommandExecutionException(MessageFormat.format( "executing batch \"{0}\" was failed", workflow.getId()), e); } }
private long delete(DirectIoPath dpath) { try { Counter counter = new Counter(); if (dpath.getResourcePattern().isPresent()) { dpath.getSource().getEntity().delete( dpath.getComponentPath().getPathString(), dpath.getResourcePattern().get(), recursive, counter); } else { dpath.getSource().getEntity().delete( BasePath.EMPTY.getPathString(), dpath.getComponentPath().asFilePattern(), recursive, counter); } return counter.get(); } catch (IOException | InterruptedException e) { throw new CommandExecutionException(MessageFormat.format( "error occurred while deleting file: {0}", dpath.getBarePath()), e); } } }
static List<ResourceInfo> list(DirectIoPath path) { LOG.debug("listing: {} ({})", path, path.getBarePath()); try { if (path.isComponentRoot()) { return Collections.singletonList(new ResourceInfo( path.getSource().getId(), path.getSource().getEntity().path(path.getComponentPath().getPathString()), true)); } else if (path.getResourcePattern().isPresent()) { return path.getSource().getEntity().list( path.getComponentPath().getPathString(), path.getResourcePattern().get(), new Counter()); } else { return path.getSource().getEntity().list( BasePath.EMPTY.getPathString(), path.getComponentPath().asFilePattern(), new Counter()); } } catch (IOException | InterruptedException e) { throw new CommandExecutionException(MessageFormat.format( "error occurred while resolving path: {0} ({1})", path, path.getBarePath()), e); } } }