/** * @param fullname Service name * @return Null if no protocol can be found for the given Rendezvous service type. * @see "http://developer.apple.com/qa/qa2001/qa1312.html" */ protected Protocol getProtocol(final String fullname) { if(fullname.contains(SERVICE_TYPE_SFTP)) { return protocols.forScheme(Scheme.sftp); } if(fullname.contains(SERVICE_TYPE_FTP)) { return protocols.forScheme(Scheme.ftp); } if(fullname.contains(SERVICE_TYPE_WEBDAV)) { return protocols.forScheme(Scheme.dav); } if(fullname.contains(SERVICE_TYPE_WEBDAV_TLS)) { return protocols.forScheme(Scheme.davs); } log.warn(String.format("Cannot find service type in %s", fullname)); return null; }
@Override public void startElement(final String name, final Attributes attrs) { this.attrs = attrs; if(name.equals("Server")) { current = new Host(protocols.forScheme(Scheme.ftp)); } }
public Protocol forScheme(final Scheme scheme) { return this.forScheme(scheme.name(), null); }
public Protocol forScheme(final String scheme, final Protocol fallback) { return this.forScheme(this.find(), scheme, fallback); }
@Override public void startElement(final String name, final Attributes attrs) { switch(name) { case "object": final String type = attrs.getValue("type"); switch(type) { case "FAVORITE": current = new Host(protocols.forScheme(Scheme.ftp)); break; default: log.warn(String.format("Unsupported type: %s", type)); break; } break; case "attribute": attribute = attrs.getValue("name"); break; } }
/** * @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; }
switch(name) { case "site": current = new Host(protocols.forScheme(Scheme.ftp), attrs.getValue("hName")); current.setNickname(attrs.getValue("name")); current.getCredentials().setUsername(attrs.getValue("un")); switch(Integer.valueOf(protocol)) { case 1: current.setProtocol(protocols.forScheme(Scheme.ftp)); break; case 2: case 3: case 4: current.setProtocol(protocols.forScheme(Scheme.ftps)); break; case 6: current.setProtocol(protocols.forScheme(Scheme.dav)); break; case 7: current.setProtocol(protocols.forScheme(Scheme.davs)); break; case 8: case 9: current.setProtocol(protocols.forScheme(Scheme.s3)); break;
@Override public void startElement(String name, Attributes attrs) { if(name.equals("FavoriteItem")) { current = new Host(protocols.forScheme(Scheme.ftp)); current.getCredentials().setUsername( PreferencesFactory.get().getProperty("connection.login.anon.name")); } }
if(line.startsWith("[")) { this.add(current); current = new Host(protocols.forScheme(Scheme.ftp)); current.getCredentials().setUsername( PreferencesFactory.get().getProperty("connection.login.anon.name"));
while((line = in.readLine()) != null) { if(line.startsWith("[account_")) { current = new Host(protocols.forScheme(Scheme.s3));
switch(protocolstring) { case "FTP": protocol = protocols.forScheme(Scheme.ftp); break; case "SFTP": protocol = protocols.forScheme(Scheme.sftp); break; case "FTPTLS": case "FTPSSL": protocol = protocols.forScheme(Scheme.ftps); break; case "S3": protocol = protocols.forScheme(Scheme.s3); break; case "WebDAV": protocol = protocols.forScheme(Scheme.dav); break; case "WebDAVS": protocol = protocols.forScheme(Scheme.davs); break; default:
this.add(current); current = new Host(protocols.forScheme(Scheme.ftp)); current.getCredentials().setUsername( PreferencesFactory.get().getProperty("connection.login.anon.name"));
while((line = in.readLine()) != null) { if(line.startsWith("[")) { current = new Host(protocols.forScheme(Scheme.ftp)); current.getCredentials().setUsername( PreferencesFactory.get().getProperty("connection.login.anon.name"));
switch(StringUtils.lowerCase(elementText)) { case "webdav": current.setProtocol(protocols.forScheme(Scheme.dav)); break; case "webdavs": current.setProtocol(protocols.forScheme(Scheme.davs)); break; case "sftp": current.setProtocol(protocols.forScheme(Scheme.sftp)); break; case "ftptls": case "ftpssl": current.setProtocol(protocols.forScheme(Scheme.ftps)); break; case "ftp": current.setProtocol(protocols.forScheme(Scheme.ftp)); break; case "s3": current.setProtocol(protocols.forScheme(Scheme.s3)); break;
return false; final Host host = new Host(protocols.forScheme(Scheme.ftp), server); final String port = bookmark.stringForKey("Port"); if(StringUtils.isNotBlank(port)) { switch(Integer.parseInt(protocol)) { case 0: host.setProtocol(protocols.forScheme(Scheme.ftp)); break; case 1: host.setProtocol(protocols.forScheme(Scheme.sftp)); break; case 3: host.setProtocol(protocols.forScheme(Scheme.s3)); break; case 2: case 4: if(host.getPort() == Scheme.davs.getPort()) { host.setProtocol(protocols.forScheme(Scheme.davs)); host.setProtocol(protocols.forScheme(Scheme.dav));
host.setProtocol(ProtocolFactory.get().forScheme(Scheme.davs)); return false;
MessageFormat.format(LocaleFactory.localizedString("Unsecured {0} connection", "Credentials"), host.getProtocol().getName()), MessageFormat.format("{0} {1}.", MessageFormat.format(LocaleFactory.localizedString("The server supports encrypted connections. Do you want to switch to {0}?", "Credentials"), ProtocolFactory.get().forScheme(Scheme.ftps).getName()), LocaleFactory.localizedString("Please contact your web hosting service provider for assistance", "Support")), LocaleFactory.localizedString("Continue", "Credentials"), LocaleFactory.localizedString("Change", "Credentials"), host.setProtocol(ProtocolFactory.get().forScheme(Scheme.ftps));
while(reader.hasNext()) { reader.beginObject(); final Host current = new Host(protocols.forScheme(Scheme.ftp)); boolean skip = false; while(reader.hasNext()) {