class StandardFlowRetrievalService implements FlowRetrievalService {

    @Override
    public VersionedFlowSnapshot getFlow(final FlowUri flowUri, final int version)
            throws IOException, FlowRetrievalException {

        if (flowUri == null) {
            throw new IllegalArgumentException("FlowUri cannot be null");
        }

        if (version < 1) {
            throw new IllegalArgumentException("Version must be greater than or equal to 1");
        }

        if (LOGGER.isTraceEnabled()) {
            LOGGER.trace("Getting flow for {} with version {}", new Object[] {flowUri, Integer.valueOf(version)});
        }

        final NiFiRegistryClient client = clientFactory.getClient();
        try {
            return client.getFlowSnapshotClient().get(flowUri.getBucketId(), flowUri.getFlowId(), version);
        } catch (IOException ioe) {
            throw ioe;
        } catch (NiFiRegistryException nre) {
            throw new FlowRetrievalException("Error retrieving flow for " + flowUri + ": " + nre.getMessage(), nre);
        }
    }

    @Autowired public  StandardFlowRetrievalService(final C2NiFiRegistryClient clientFactory);

}