@Override public void run(ActionContext context) throws Exception { context.execute(new TxRunnable() { @Override public void run(DatasetContext context) throws Exception { FileSet sourceFileSet = context.getDataset(conf.sourceFileset); FileSet destinationFileSet = context.getDataset(conf.destinationFileset); Pattern pattern = Pattern.compile(conf.filterRegex); for (Location sourceFile : sourceFileSet.getBaseLocation().list()) { if (pattern.matcher(sourceFile.getName()).matches()) { Location destFile = destinationFileSet.getBaseLocation().append(sourceFile.getName()); sourceFile.renameTo(destFile); } } } }); }
@Override public void run(ActionContext context) throws Exception { context.execute(new TxRunnable() { @Override public void run(DatasetContext context) throws Exception { Table table = context.getDataset(config.tableName); Put put = new Put(config.rowKey); put.add(config.columnKey, config.value); table.put(put); } }); // Set the same value in the arguments as well. context.getArguments().set(config.rowKey + config.columnKey, config.value); if (config.argumentKey != null && config.argumentValue != null) { if (!context.getArguments().get(config.argumentKey).equals(config.argumentValue)) { throw new IllegalStateException(String.format("Expected %s to be present in the argument map with value %s.", config.argumentKey, config.argumentValue)); } } }
context.getArguments().set(config.outputKey, out); } finally { connection.close();