Пример #1
0
 public String protocolsMissingUploaders(
     final UploaderService uploaderService, final Progress progress) {
   final Map<String, Set<String>> map = new LinkedHashMap<String, Set<String>>();
   for (final Map.Entry<String, UpdateSite> entry : updateSites.entrySet()) {
     final UpdateSite site = entry.getValue();
     if (!site.isUploadable()) continue;
     final String protocol = site.getUploadProtocol();
     try {
       uploaderService.installUploader(protocol, this, progress);
     } catch (IllegalArgumentException e) {
       Set<String> set = map.get(protocol);
       if (set == null) {
         set = new LinkedHashSet<String>();
         map.put(protocol, set);
       }
       set.add(entry.getKey());
     }
   }
   if (map.size() == 0) return null;
   final StringBuilder builder = new StringBuilder();
   builder.append(
       prefixUpdate("").isDirectory()
           ? "Uploads via these protocols require a restart:\n"
           : "Missing uploaders:\n");
   for (final Map.Entry<String, Set<String>> entry : map.entrySet()) {
     final String list = Arrays.toString(entry.getValue().toArray());
     builder.append("'").append(entry.getKey()).append("': ").append(list).append("\n");
   }
   return builder.toString();
 }
Пример #2
0
 public Collection<String> getProtocols(Iterable<FileObject> selected) {
   final Set<String> protocols = new LinkedHashSet<String>();
   for (final FileObject file : selected) {
     final UpdateSite site = getUpdateSite(file.updateSite, false);
     if (site != null) {
       if (site.getHost() == null) protocols.add("unknown(" + file.filename + ")");
       else protocols.add(site.getUploadProtocol());
     }
   }
   return protocols;
 }