/**
   * (non-Javadoc)
   *
   * @see FermatEventHandler#handleEvent(FermatEvent)
   * @param platformEvent
   * @throws Exception
   */
  @Override
  public void handleEvent(FermatEvent platformEvent) throws FermatException {

    if (platformEvent.getSource() == NetworkServiceChatNetworkServicePluginRoot.EVENT_SOURCE) {

      // System.out.println("CompleteComponentConnectionRequestNotificationEventHandler -
      // handleEvent platformEvent =" + platformEvent.toString());
      //  System.out.println("NetworkServiceChatNetworkServicePluginRoot  - NOTIFICACION EVENTO
      // MENSAJE RECIBIDO!!!!");

      /*
       * Get the message receive
       */
      NewNetworkServiceMessageReceivedNotificationEvent
          newNetworkServiceMessageReceivedNotificationEvent =
              (NewNetworkServiceMessageReceivedNotificationEvent) platformEvent;
      FermatMessage fermatMessageReceive =
          (FermatMessage) newNetworkServiceMessageReceivedNotificationEvent.getData();

      /*
       * Get the content of the message like a JsonObject
       */
      JsonObject jsonMsjContent = parser.parse(fermatMessageReceive.getContent()).getAsJsonObject();

      /*
       * Extract the type of content of the message
       */
      ChatMessageTransactionType chatMessageTransactionType =
          gson.fromJson(
              jsonMsjContent.get(ChatTransmissionJsonAttNames.MSJ_CONTENT_TYPE),
              ChatMessageTransactionType.class);

      /*
       * Process the messages for his type
       */
      if (messagesProcessorsRegistered.containsKey(chatMessageTransactionType)) {
        messagesProcessorsRegistered
            .get(chatMessageTransactionType)
            .processingMessage(fermatMessageReceive, jsonMsjContent);
      } else {
        System.out.println(
            "NetworkServiceChatNetworkServicePluginRoot - CompleteComponentConnectionRequestNotificationEventHandler - message type no supported = "
                + chatMessageTransactionType);
      }
    }
  }
  /**
   * Notify the client when a incoming message is receive by the
   * incomingTemplateNetworkServiceMessage ant fire a new event
   *
   * @param incomingMessage received
   */
  private void onMessageReceived(FermatMessage incomingMessage) {

    System.out.println("CommunicationNetworkServiceLocal - onMessageReceived ");
    System.out.println(incomingMessage.getContent());

    /*
     * set the last message received
     */
    this.lastMessageReceived = incomingMessage;

    /** Put the message on a event and fire new event */
    FermatEvent fermatEvent =
        eventManager.getNewEvent(P2pEventType.NEW_NETWORK_SERVICE_MESSAGE_RECEIVE_NOTIFICATION);
    fermatEvent.setSource(AssetTransmissionNetworkServicePluginRoot.EVENT_SOURCE);
    ((NewNetworkServiceMessageReceivedNotificationEvent) fermatEvent).setData(incomingMessage);
    ((NewNetworkServiceMessageReceivedNotificationEvent) fermatEvent)
        .setNetworkServiceTypeApplicant(networkServiceTypePluginRoot);
    eventManager.raiseEvent(fermatEvent);
  }