ch.cyberduck.core.Protocol.getIdentifier()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(160)

本文整理了Java中ch.cyberduck.core.Protocol.getIdentifier()方法的一些代码示例,展示了Protocol.getIdentifier()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Protocol.getIdentifier()方法的具体详情如下:
包路径:ch.cyberduck.core.Protocol
类名称:Protocol
方法名:getIdentifier

Protocol.getIdentifier介绍

[英]Must be unique across all available protocols.
[中]在所有可用协议中必须是唯一的。

代码示例

代码示例来源:origin: iterate-ch/cyberduck

@Override
public String getIdentifier() {
  return parent.getIdentifier();
}

代码示例来源:origin: iterate-ch/cyberduck

@Override
public int compareTo(final Protocol o) {
  return this.getIdentifier().compareTo(o.getIdentifier());
}

代码示例来源:origin: iterate-ch/cyberduck

@Override
  public int compare(Host o1, Host o2) {
    return comparator.compare(o1.getProtocol().getIdentifier(), o2.getProtocol().getIdentifier());
  }
});

代码示例来源:origin: iterate-ch/cyberduck

@Override
public String help(final Protocol provider) {
  return this.help(provider.getIdentifier());
}

代码示例来源:origin: iterate-ch/cyberduck

@Override
public int compareTo(final Protocol o) {
  return this.getIdentifier().compareTo(o.getIdentifier());
}

代码示例来源:origin: iterate-ch/cyberduck

/**
 * @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;
}

代码示例来源:origin: iterate-ch/cyberduck

@Override
public OAuthTokens findOAuthTokens(final Host bookmark) {
  final long expiry = preferences.getLong(String.format("%s.oauth.expiry", bookmark.getProtocol().getIdentifier()));
  final String prefix = this.getOAuthPrefix(bookmark);
  return new OAuthTokens(this.getPassword(bookmark.getProtocol().getScheme(),
    bookmark.getPort(), URI.create(bookmark.getProtocol().getOAuthTokenUrl()).getHost(),
    String.format("%s OAuth2 Access Token", prefix)),
    this.getPassword(bookmark.getProtocol().getScheme(),
      bookmark.getPort(), URI.create(bookmark.getProtocol().getOAuthTokenUrl()).getHost(),
      String.format("%s OAuth2 Refresh Token", prefix)),
    expiry);
}

代码示例来源:origin: iterate-ch/cyberduck

@Override
public boolean equals(Object o) {
  if(this == o) {
    return true;
  }
  if(!(o instanceof Protocol)) {
    return false;
  }
  Protocol protocol = (Protocol) o;
  if(this.getIdentifier() != null ? !this.getIdentifier().equals(protocol.getIdentifier()) : protocol.getIdentifier() != null) {
    return false;
  }
  if(this.getScheme() != null ? !this.getScheme().equals(protocol.getScheme()) : protocol.getScheme() != null) {
    return false;
  }
  if(this.getProvider() != null ? !this.getProvider().equals(protocol.getProvider()) : protocol.getProvider() != null) {
    return false;
  }
  return true;
}

代码示例来源:origin: iterate-ch/cyberduck

protected static String getScheme(final Protocol protocol) {
    if(new BundledProtocolPredicate().test(protocol)) {
      for(String scheme :
        protocol.getSchemes()) {
        // Return first custom scheme registered
        return scheme;
      }
      // Return default name
      return protocol.getIdentifier();
    }
    // Find parent protocol definition for profile
    final Protocol standard = ProtocolFactory.get().forName(protocol.getIdentifier());
    if(Arrays.equals(protocol.getSchemes(), standard.getSchemes())) {
      // No custom scheme set in profile
      return protocol.getProvider();
    }
    for(String scheme : protocol.getSchemes()) {
      // First custom scheme in profile
      return scheme;
    }
    // Default vendor string of third party profile
    return protocol.getProvider();
  }
}

代码示例来源:origin: iterate-ch/cyberduck

@Action
public void protocolComboboxClicked(NSPopUpButton sender) {
  final Protocol selected = ProtocolFactory.get().forName(sender.selectedItem().representedObject());
  preferences.setProperty("connection.protocol.default", selected.getIdentifier());
  preferences.setProperty("connection.port.default", selected.getDefaultPort());
}

代码示例来源:origin: iterate-ch/cyberduck

@Override
public boolean equals(Object o) {
  if(this == o) {
    return true;
  }
  if(!(o instanceof Protocol)) {
    return false;
  }
  Protocol protocol = (Protocol) o;
  if(this.getIdentifier() != null ? !this.getIdentifier().equals(protocol.getIdentifier()) : protocol.getIdentifier() != null) {
    return false;
  }
  if(this.getScheme() != null ? !this.getScheme().equals(protocol.getScheme()) : protocol.getScheme() != null) {
    return false;
  }
  if(this.getContext() != null ? !this.getContext().equals(protocol.getContext()) : protocol.getContext() != null) {
    return false;
  }
  if(this.getAuthorization() != null ? !this.getAuthorization().equals(protocol.getAuthorization()) : protocol.getAuthorization() != null) {
    return false;
  }
  if(this.getProvider() != null ? !this.getProvider().equals(protocol.getProvider()) : protocol.getProvider() != null) {
    return false;
  }
  if(this.getDefaultHostname() != null ? !this.getDefaultHostname().equals(protocol.getDefaultHostname()) : protocol.getDefaultHostname() != null) {
    return false;
  }
  return true;
}

代码示例来源:origin: iterate-ch/cyberduck

preferences.setProperty(String.format("%s.oauth.expiry", bookmark.getProtocol().getIdentifier()), credentials.getOauth().getExpiryInMilliseconds());

代码示例来源:origin: iterate-ch/cyberduck

@Override
public <T> T serialize(final Serializer dict) {
  dict.setStringForKey(protocol.getIdentifier(), "Protocol");
  if(StringUtils.isNotBlank(protocol.getProvider())) {
    if(!StringUtils.equals(protocol.getProvider(), protocol.getIdentifier())) {
      dict.setStringForKey(protocol.getProvider(), "Provider");

相关文章