@Override public Cluster getCluster() { if (cluster != null) { return cluster; } else { throw new ProcessException("Unable to get the Cassandra cluster detail."); } }
@Override public void write(final int b) throws IOException { try { out.write(b); } catch (final IOException ioe) { throw new FlowFileAccessException("Could not write to " + flowFile, ioe); } }
private void verifyFlowFileKnown(final FlowFile flowFile) { if (session != null && !session.isFlowFileKnown(flowFile)) { throw new FlowFileHandlingException(flowFile + " is not known to " + session); } }
private void verifyNotTerminated() { if (taskTermination.isTerminated()) { throw new TerminatedTaskException(); } }
@Override public void onTrigger(ProcessContext context, ProcessSessionFactory sessionFactory) throws ProcessException { // Should never get this far. throw new ProcessException("Unable to instantiate Processor class"); }
@Override public void write(final byte[] b) throws IOException { try { out.write(b); } catch (final IOException ioe) { throw new FlowFileAccessException("Could not write to " + flowFile, ioe); } }
private void verifyFlowFileKnown(final FlowFile flowFile) { if (session != null && !session.isFlowFileKnown(flowFile)) { throw new FlowFileHandlingException(flowFile + " is not known to " + session); } }
private void verifyTaskActive() { if (taskTermination.isTerminated()) { throw new TerminatedTaskException(); } }
@Override public Session getCassandraSession() { if (cassandraSession != null) { return cassandraSession; } else { throw new ProcessException("Unable to get the Cassandra session."); } }
@Override public void write(final byte[] b, final int off, final int len) throws IOException { try { out.write(b, off, len); } catch (final IOException ioe) { throw new FlowFileAccessException("Could not write to " + flowFile, ioe); } }
@Override public void onTrigger(ReportingContext context) { throw new ProcessException("Unable to instantiate ReportingTask class"); }
@Override public void flush() throws IOException { try { out.flush(); } catch (final IOException ioe) { throw new FlowFileAccessException("Could not flush OutputStream for " + flowFile, ioe); } } }
@Override public SyslogEvent parseEvent(byte[] bytes, String sender) { throw new ProcessException("Unit test intentionally failing"); } };
@Override public long skip(final long n) throws IOException { try { final long count = super.skip(n); bytesConsumed += count; return count; } catch (final IOException ioe) { throw new FlowFileAccessException("Could not skip data in " + flowFile, ioe); } }
@Override public Connection getConnection() throws ProcessException { try { final Connection con = dataSource.getConnection(); return con; } catch (final SQLException e) { throw new ProcessException(e); } }
@Override public int available() throws IOException { try { return super.available(); } catch (final IOException ioe) { throw new FlowFileAccessException("Could not determine amount of data available from " + flowFile, ioe); } }
@Override public long writeResultSet(ResultSet resultSet, OutputStream outputStream, ComponentLog logger, AbstractQueryDatabaseTable.MaxValueResultSetRowCollector callback) throws Exception { try { return JdbcCommon.convertToAvroStream(resultSet, outputStream, options, callback); } catch (SQLException e) { throw new ProcessException(e); } }
@Override public void reset() throws IOException { try { super.reset(); } catch (final IOException ioe) { throw new FlowFileAccessException("Could not reset stream from " + flowFile, ioe); } }
/** * Shutdown pool, close all open connections. */ @OnDisabled public void shutdown() { try { dataSource.close(); } catch (final SQLException e) { throw new ProcessException(e); } }
private String setAndGetWorkingDirectory(final String path) throws IOException { client.changeWorkingDirectory(homeDirectory); if (!client.changeWorkingDirectory(path)) { throw new ProcessException("Unable to change working directory to " + path); } return client.printWorkingDirectory(); }