コード例 #1
0
  /**
   * Handle the event CompleteComponentConnectionRequestNotificationEvent
   *
   * @param event
   */
  public void handleCompleteComponentConnectionRequestNotificationEvent(
      CompleteComponentConnectionRequestNotificationEvent event) {

    try {

      /*
       * Tell the manager to handler the new connection established
       */
      communicationNetworkServiceConnectionManager
          .handleEstablishedRequestedNetworkServiceConnection(event.getRemoteComponent());
      communicationSupervisorPendingMessagesAgent.removeConnectionWaitingForResponse(
          event.getRemoteComponent().getIdentityPublicKey());

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
  /**
   * (non-Javadoc)
   *
   * @see FermatEventHandler#handleEvent(FermatEvent)
   * @param platformEvent
   * @throws Exception
   */
  @Override
  public void handleEvent(FermatEvent platformEvent) throws FermatException {

    System.out.println(
        "CompleteComponentConnectionRequestNotificationEventHandler - handleEvent platformEvent ="
            + platformEvent);

    if (((Service) this.networkService).getStatus() == ServiceStatus.STARTED) {

      CompleteComponentConnectionRequestNotificationEvent
          completeComponentConnectionRequestNotificationEvent =
              (CompleteComponentConnectionRequestNotificationEvent) platformEvent;

      if (completeComponentConnectionRequestNotificationEvent.getNetworkServiceTypeApplicant()
          == this.networkService.getPlatformComponentProfilePluginRoot().getNetworkServiceType()) {
        /*
         *  networkService make the job
         */
        this.networkService.handleCompleteComponentConnectionRequestNotificationEvent(
            completeComponentConnectionRequestNotificationEvent.getApplicantComponent(),
            completeComponentConnectionRequestNotificationEvent.getRemoteComponent());
      }
    }
  }