/*     */ private static synchronized String makeConnectionId(
     String paramString, Subject paramSubject)
       /*     */ {
   /* 472 */ connectionIdNumber += 1;
   /*     */
   /* 474 */ String str1 = "";
   /*     */ try {
     /* 476 */ str1 = RemoteServer.getClientHost();
     /*     */ } catch (ServerNotActiveException localServerNotActiveException) {
     /* 478 */ logger.trace("makeConnectionId", "getClientHost", localServerNotActiveException);
     /*     */ }
   /*     */
   /* 481 */ StringBuilder localStringBuilder = new StringBuilder();
   /* 482 */ localStringBuilder.append(paramString).append(":");
   /* 483 */ if (str1.length() > 0) /* 484 */ localStringBuilder.append("//").append(str1);
   /* 485 */ localStringBuilder.append(" ");
   /*     */ String str2;
   /*     */ Iterator localIterator;
   /* 486 */ if (paramSubject != null) {
     /* 487 */ Set localSet = paramSubject.getPrincipals();
     /* 488 */ str2 = "";
     /* 489 */ for (localIterator = localSet.iterator(); localIterator.hasNext(); ) {
       /* 490 */ Principal localPrincipal = (Principal) localIterator.next();
       /* 491 */ String str3 = localPrincipal.getName().replace(' ', '_').replace(';', ':');
       /* 492 */ localStringBuilder.append(str2).append(str3);
       /* 493 */ str2 = ";";
       /*     */ }
     /*     */ }
   /* 496 */ localStringBuilder.append(" ").append(connectionIdNumber);
   /* 497 */ if (logger.traceOn())
     /* 498 */ logger.trace("newConnectionId", "connectionId=" + localStringBuilder);
   /* 499 */ return localStringBuilder.toString();
   /*     */ }
Example #2
0
  /**
   * Don't work with SearchResultP2P
   *
   * @param file
   * @return
   * @throws RemoteException
   */
  @Override
  public SimpleEntry<RemoteFile, Integer> downloadFile(SearchResult result) throws RemoteException {
    /*if (!PluginController.getInstance().isLocalPlugin(result.getPluginName()))
    {
        return null;
    }*/
    try {
      String path = result.getURI().toString().replace('\\', '/');

      File file = new File(path);
      InetAddress client = InetAddress.getByName(RemoteServer.getClientHost());

      FileSender sender = new FileSender(file, client);

      SimpleEntry<RemoteFile, Integer> entry =
          new SimpleEntry<RemoteFile, Integer>(new RemoteFile(file), sender.getListenerPort());

      // DebugManager.getInstance().debug("Transfering file: " + entry.getKey().getName() + ",
      // listening port: " + entry.getValue());

      Thread tSender = sender;
      tSender.start();

      return entry;

    } catch (Exception e) {
      e.printStackTrace();
    }
    return null;
  }
Example #3
0
 @Override
 public KeyCollection getPublicKeys() throws RemoteException {
   try {
     System.out.println("--> PublicKey request from " + RemoteServer.getClientHost());
   } catch (ServerNotActiveException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   return publicKeys;
 }
Example #4
0
 @Override
 public void putCryptoCollection(CryptoMessageCollection collection) throws RemoteException {
   try {
     System.out.println(
         "--> Got collection from "
             + RemoteServer.getClientHost()
             + " with "
             + collection.size()
             + " votes and "
             + collection.layers()
             + " layers!");
   } catch (ServerNotActiveException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   mix.putCryptoCollection(collection);
 }
Example #5
0
 private String getCallingClient() throws ServerNotActiveException {
   if (this.expliciteClient != null) {
     return this.expliciteClient;
   }
   return RemoteServer.getClientHost();
 }