Skip to content

Commit

Permalink
Overload constructors.
Browse files Browse the repository at this point in the history
  • Loading branch information
dkocher committed Jan 15, 2025
1 parent 94921b1 commit d3c526c
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,7 @@ public Set<ProfileDescription> initialize() {

@Override
public Set<ProfileDescription> run(final Session<?> session) throws BackgroundException {
// Find all locally installed profiles
final LocalProfilesFinder local = new LocalProfilesFinder(registry, directory, ProtocolFactory.BUNDLED_PROFILE_PREDICATE);
// Find all profiles from repository
final RemoteProfilesFinder remote = new RemoteProfilesFinder(registry, session);
return new ProtocolFactoryProfilesSynchronizer(registry, local, remote).sync(
return new ProtocolFactoryProfilesSynchronizer(session).sync(
// Match profiles by ETag and MD5 checksum of profile on disk
new ChecksumProfileMatcher(), visitor);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@
*/

import ch.cyberduck.core.Local;
import ch.cyberduck.core.LocalFactory;
import ch.cyberduck.core.ProtocolFactory;
import ch.cyberduck.core.Session;
import ch.cyberduck.core.exception.BackgroundException;
import ch.cyberduck.core.preferences.PreferencesFactory;
import ch.cyberduck.core.preferences.SupportDirectoryFinderFactory;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand All @@ -33,6 +37,34 @@ public class ProtocolFactoryProfilesSynchronizer implements ProfilesSynchronizer
private final LocalProfilesFinder local;
private final RemoteProfilesFinder remote;

public ProtocolFactoryProfilesSynchronizer(final Session<?> session) {
this(ProtocolFactory.get(), session, LocalFactory.get(SupportDirectoryFinderFactory.get().find(),
PreferencesFactory.get().getProperty("profiles.folder.name")));
}

public ProtocolFactoryProfilesSynchronizer(final ProtocolFactory registry, final Session<?> session, final Local directory) {
this(ProtocolFactory.get(),
// Find all locally installed profiles
new LocalProfilesFinder(registry, directory, ProtocolFactory.BUNDLED_PROFILE_PREDICATE), session);
}

public ProtocolFactoryProfilesSynchronizer(final ProtocolFactory registry, final LocalProfilesFinder local, final Session<?> session) {
this(registry, local,
// Find all profiles from repository
new RemoteProfilesFinder(registry, session));
}

public ProtocolFactoryProfilesSynchronizer(final ProtocolFactory registry, final RemoteProfilesFinder remote) {
this(registry, LocalFactory.get(SupportDirectoryFinderFactory.get().find(),
PreferencesFactory.get().getProperty("profiles.folder.name")), remote);
}

public ProtocolFactoryProfilesSynchronizer(final ProtocolFactory registry, final Local directory, final RemoteProfilesFinder remote) {
this(registry,
// Find all locally installed profiles
new LocalProfilesFinder(registry, directory, ProtocolFactory.BUNDLED_PROFILE_PREDICATE), remote);
}

public ProtocolFactoryProfilesSynchronizer(final ProtocolFactory registry, final LocalProfilesFinder local, final RemoteProfilesFinder remote) {
this.registry = registry;
this.local = local;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ public RemoteProfilesFinder(final ProtocolFactory protocols, final Session<?> se
this(protocols, session, new CompareFilter(new DisabledDownloadSymlinkResolver(), session), new ProfileFilter());
}

public RemoteProfilesFinder(final Session<?> session,
final TransferPathFilter comparison, final Filter<Path> filter) {
this(ProtocolFactory.get(), session, comparison, filter);
}

public RemoteProfilesFinder(final ProtocolFactory protocols, final Session<?> session,
final TransferPathFilter comparison, final Filter<Path> filter) {
this.protocols = protocols;
Expand Down

0 comments on commit d3c526c

Please sign in to comment.