@Override
    public AbstractUploadFilter filter(final Session<?> source, final Session<?> destination, final TransferAction action, final ProgressListener listener) {
        if(log.isDebugEnabled()) {
            log.debug(String.format("Filter transfer with action %s and options %s", action, options));
        }
        final Symlink symlink = source.getFeature(Symlink.class);
        final UploadSymlinkResolver resolver = new UploadSymlinkResolver(symlink, roots);
        final Find find;
        final AttributesFinder attributes;
        if(roots.size() > 1 || roots.stream().filter(item -> item.remote.isDirectory()).findAny().isPresent()) {
            find = new CachingFindFeature(source, cache, source.getFeature(Find.class, new DefaultFindFeature(source)));
            attributes = new CachingAttributesFinderFeature(source, cache, source.getFeature(AttributesFinder.class, new DefaultAttributesFinderFeature(source)));
        }
        else {
            find = new CachingFindFeature(source, cache, source.getFeature(Find.class));
            attributes = new CachingAttributesFinderFeature(source, cache, source.getFeature(AttributesFinder.class));
        }
        if(log.isDebugEnabled()) {
            log.debug(String.format("Determined features %s and %s", find, attributes));
        }
        if(action.equals(TransferAction.resume)) {
            return new ResumeFilter(resolver, source, options).withFinder(find).withAttributes(attributes);
        }
        if(action.equals(TransferAction.rename)) {
            return new RenameFilter(resolver, source, options).withFinder(find).withAttributes(attributes);
        }
        if(action.equals(TransferAction.renameexisting)) {
            return new RenameExistingFilter(resolver, source, options).withFinder(find).withAttributes(attributes);
        }
        if(action.equals(TransferAction.skip)) {
            return new SkipFilter(resolver, source, options).withFinder(find).withAttributes(attributes);
        }
        if(action.equals(TransferAction.comparison)) {
            return new CompareFilter(resolver, source, options, listener).withFinder(find).withAttributes(attributes);
        }
        return new OverwriteFilter(resolver, source, options).withFinder(find).withAttributes(attributes);
    }
@Test
    public void testTemporaryDisabledLargeUpload() throws Exception {
        final Host h = new Host(new TestProtocol());
        final NullSession session = new NullSession(h);
        final AbstractUploadFilter f = new UploadTransfer(h, Collections.emptyList())
            .filter(session, null, TransferAction.overwrite, new DisabledProgressListener());
        final Path file = new Path("/t", EnumSet.of(Path.Type.file));
        final TransferStatus status = f.prepare(file, new NullLocal("t"), new TransferStatus(), new DisabledProgressListener());
        assertNull(status.getRename().local);
        assertNull(status.getRename().remote);
    }