@Override public Type getType() { return parent.getType(); }
@Override public boolean test(final Protocol protocol) { if(types.contains(protocol.getType())) { return super.test(protocol); } return false; } }
private Protocol forType(final List<Protocol> enabled, final Protocol.Type type) { return enabled.stream().filter(protocol -> protocol.getType().equals(type)).findFirst().orElse(null); }
@Override public boolean isSupported(final Path source, final Path target) { switch(from.getHost().getProtocol().getType()) { case ftp: case irods: // Stateful return !Objects.equals(from, to); } return true; }
/** * @param enabled List of protocols * @param identifier Serialized protocol reference or scheme * @param provider Custom inherited protocol definition * @return Matching protocol or null if no match */ public Protocol forName(final List<Protocol> enabled, final String identifier, final String provider) { final Protocol match = // Matching hash code backward compatibility enabled.stream().filter(protocol -> String.valueOf(protocol.hashCode()).equals(identifier)).findFirst().orElse( // Matching vendor string for third party profiles enabled.stream().filter(protocol -> new ProfileProtocolPredicate().test(protocol) && StringUtils.equals(protocol.getProvider(), provider)).findFirst().orElse( // Matching vendor string usage in CLI enabled.stream().filter(protocol -> StringUtils.equals(protocol.getProvider(), identifier)).findFirst().orElse( // Fallback for bug in 6.1 enabled.stream().filter(protocol -> StringUtils.equals(String.format("%s-%s", protocol.getIdentifier(), protocol.getProvider()), identifier)).findFirst().orElse( // Matching scheme with fallback to generic protocol type this.forScheme(enabled, identifier, enabled.stream().filter(protocol -> StringUtils.equals(protocol.getType().name(), identifier)).findFirst().orElse(null)) ) ) ) ); if(null == match) { if(enabled.isEmpty()) { log.error(String.format("List of registered protocols in %s is empty", this)); } log.error(String.format("Missing registered protocol for identifier %s", identifier)); } return match; }
private static void append(final Protocol protocol, final StringBuilder builder) { final String url; switch(protocol.getType()) { case b2: case s3: case googlestorage: case swift: case azure: url = String.format("%s://<container>/<key>", getScheme(protocol)); break; default: if(protocol.isHostnameConfigurable()) { url = String.format("%s://<hostname>/<folder>/<file>", getScheme(protocol)); } else { // case file: // case googledrive: // case dropbox: // case onedrive: url = String.format("%s://<folder>/<file>", getScheme(protocol)); } break; } builder .append(String.format("%s %s", StringUtils.leftPad(protocol.getDescription(), 50), url)) .append(StringUtils.LF); }
@Override public void change(Host bookmark) { connectmodePopup.setEnabled(bookmark.getProtocol().getType() == Protocol.Type.ftp); if(bookmark.getProtocol().getType() == Protocol.Type.ftp) { connectmodePopup.selectItemAtIndex(connectmodePopup.indexOfItemWithRepresentedObject(bookmark.getFTPConnectMode().name())); } } });
switch(protocol.getType()) {
switch(host.getProtocol().getType()) { case file: case b2:
return false; return session.getHost().getProtocol().getType() == Protocol.Type.s3 || session.getHost().getProtocol().getType() == Protocol.Type.b2 || session.getHost().getProtocol().getType() == Protocol.Type.azure || session.getHost().getProtocol().getType() == Protocol.Type.googlestorage; case metadata: if(anonymous) {
if(!skip && protocol != null && StringUtils.isNotBlank(user)) { if(ssl) { switch(protocol.getType()) { case ftp: protocol = protocols.forScheme(Scheme.ftps);
if(file.isFile() || file.isSymbolicLink()) { final Path copy = new Path(file); switch(host.getProtocol().getType()) { case s3: if(!file.attributes().isDuplicate()) {
dict.setObjectForKey(credentials.getIdentity(), "Private Key File Dictionary"); if(protocol.getType() == Protocol.Type.ftp) { if(connectMode != FTPConnectMode.unknown) { dict.setStringForKey(connectMode.name(), "FTP Connect Mode");
this.window().endEditingFor(null); final Credentials credentials = session.getHost().getCredentials(); boolean enable = session.getHost().getProtocol().getType() == Protocol.Type.s3 || session.getHost().getProtocol().getType() == Protocol.Type.b2 || session.getHost().getProtocol().getType() == Protocol.Type.azure || session.getHost().getProtocol().getType() == Protocol.Type.googlestorage; if(enable) { enable = !credentials.isAnonymousLogin();
&& controller.getSession().getHost().getProtocol().getType() == Protocol.Type.sftp && TerminalServiceFactory.get() != null;