@Override public void cleanup(FlowProcess flowProcess, OperationCall<TupleEntryCollector> operationCall) { if (!flushCalled) throw new RuntimeException("flush never called"); if (path == null) return; operationCall.getContext().close(); }
@Override public void prepare(FlowProcess flowProcess, OperationCall<TupleEntryCollector> operationCall) { if (path == null) return; try { operationCall.setContext(flowProcess.openTapForWrite(path)); } catch (IOException exception) { exception.printStackTrace(); } }
@Override public void prepare(FlowProcess flowProcess, OperationCall<DocumentBuilder> operationCall) { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); operationCall.setContext(factory.newDocumentBuilder()); } catch (ParserConfigurationException exception) { throw new OperationException("could not create document builder", exception); } }
@Override public void prepare(FlowProcess flowProcess, OperationCall<Matcher> operationCall) { operationCall.setContext(getPattern().matcher("")); }
@Override public void prepare(FlowProcess flowProcess, OperationCall<Random> operationCall) { super.prepare(flowProcess, operationCall); operationCall.setContext(new Random(seed)); }