class B2FindFeature implements Find {

    @Override
    public boolean find(final Path file) throws BackgroundException {
        try {
            if(containerService.isContainer(file)) {
                final List<B2BucketResponse> buckets = session.getClient().listBuckets();
                for(B2BucketResponse bucket : buckets) {
                    if(StringUtils.equals(containerService.getContainer(file).getName(), bucket.getBucketName())) {
                        return true;
                    }
                }
            }
            else {
                try {
                    return null != fileid.withCache(cache).getFileid(file, new DisabledListProgressListener());
                }
                catch(NotfoundException e) {
                    return false;
                }
            }
            return false;
        }
        catch(B2ApiException e) {
            throw new B2ExceptionMappingService().map(e);
        }
        catch(IOException e) {
            throw new DefaultIOExceptionMappingService().map(e);
        }
    }

    public  B2FindFeature(final B2Session session, final B2FileidProvider fileid);

}