コード例 #1
0
  @Override
  public void start() throws CantStartPluginException {

    try {

      FermatEventListener fermatEventListener;
      FermatEventHandler fermatEventHandler;

      this.cryptoCustomerActorDao =
          new CryptoCustomerActorDao(pluginDatabaseSystem, pluginFileSystem, pluginId);
      this.cryptoCustomerActorDao.initializeDatabase();

      fermatManager =
          new CustomerActorManager(
              this.cryptoCustomerActorDao,
              cryptoBrokerANSManager,
              errorManager,
              getPluginVersionReference());

      ActorCustomerExtraDataEventActions handlerAction =
          new ActorCustomerExtraDataEventActions(
              cryptoBrokerANSManager, cryptoCustomerActorDao, cryptoBrokerActorConnectionManager);

      fermatEventListener =
          eventManager.getNewListener(EventType.CRYPTO_BROKER_QUOTES_REQUEST_UPDATES);
      fermatEventHandler = new CryptoCustomerExtraDataEventHandler(handlerAction, this);
      fermatEventListener.setEventHandler(fermatEventHandler);
      eventManager.addListener(fermatEventListener);
      listenersAdded.add(fermatEventListener);

      fermatEventListener =
          eventManager.getNewListener(EventType.CRYPTO_BROKER_ACTOR_CONNECTION_NEW_CONNECTION);
      fermatEventHandler = new CryptoBrokerNewConnectionEventHandler(handlerAction, this);
      fermatEventListener.setEventHandler(fermatEventHandler);
      eventManager.addListener(fermatEventListener);
      listenersAdded.add(fermatEventListener);

      agente =
          new CryptoBrokerExtraDataUpdateAgent(
              cryptoBrokerANSManager,
              cryptoCustomerActorDao,
              errorManager,
              getPluginVersionReference());
      agente.start();
      this.serviceStatus = ServiceStatus.STARTED;

    } catch (CantStartAgentException | CantInitializeCryptoCustomerActorDatabaseException e) {
      errorManager.reportUnexpectedPluginException(
          this.getPluginVersionReference(),
          UnexpectedPluginExceptionSeverity.DISABLES_THIS_PLUGIN,
          e);
      throw new CantStartPluginException(e, this.getPluginVersionReference());
    }
  }
  @Override
  public void start() throws CantStartServiceException {
    try {
      /** I will initialize the handling of com.bitdubai.platform events. */
      FermatEventListener fermatEventListener;
      FermatEventHandler fermatEventHandler;

      fermatEventListener =
          eventManager.getNewListener(EventType.INCOMING_NEW_CONTRACT_STATUS_UPDATE);
      fermatEventHandler = new IncomingNewContractStatusUpdateEventHandler();
      ((IncomingNewContractStatusUpdateEventHandler) fermatEventHandler)
          .setBrokerSubmitOfflineMerchandiseRecorderService(this);
      fermatEventListener.setEventHandler(fermatEventHandler);
      eventManager.addListener(fermatEventListener);
      listenersAdded.add(fermatEventListener);

      fermatEventListener =
          eventManager.getNewListener(EventType.INCOMING_CONFIRM_BUSINESS_TRANSACTION_RESPONSE);
      fermatEventHandler = new IncomingConfirmBusinessTransactionResponseEventHandler();
      ((IncomingConfirmBusinessTransactionResponseEventHandler) fermatEventHandler)
          .setBrokerSubmitOfflineMerchandiseRecorderService(this);
      fermatEventListener.setEventHandler(fermatEventHandler);
      eventManager.addListener(fermatEventListener);
      listenersAdded.add(fermatEventListener);

      this.serviceStatus = ServiceStatus.STARTED;
    } catch (CantSetObjectException exception) {
      this.errorManager.reportUnexpectedPluginException(
          Plugins.BROKER_SUBMIT_OFFLINE_MERCHANDISE,
          UnexpectedPluginExceptionSeverity.DISABLES_THIS_PLUGIN,
          exception);
      throw new CantStartServiceException(
          exception,
          "Starting the BrokerSubmitOfflineMerchandiseRecorderService",
          "The BrokerSubmitOfflineMerchandiseRecorderService is probably null");
    } catch (Exception exception) {
      this.errorManager.reportUnexpectedPluginException(
          Plugins.BROKER_SUBMIT_OFFLINE_MERCHANDISE,
          UnexpectedPluginExceptionSeverity.DISABLES_THIS_PLUGIN,
          exception);
      throw new CantStartServiceException(
          CantStartServiceException.DEFAULT_MESSAGE,
          exception,
          "Starting the CustomerOnlinePaymentRecorderService",
          "Unexpected error");
    }
  }
コード例 #3
0
  @Override
  public void start() throws CantStartServiceException {
    try {
      /** I will initialize the handling of com.bitdubai.platform events. */
      FermatEventListener fermatEventListener;
      FermatEventHandler fermatEventHandler;

      fermatEventListener = eventManager.getNewListener(EventType.INCOMING_CHAT);
      fermatEventHandler = new IncomingChatEventHandler();
      ((IncomingChatEventHandler) fermatEventHandler).setChatMiddlewareRecorderService(this);
      fermatEventListener.setEventHandler(fermatEventHandler);
      eventManager.addListener(fermatEventListener);
      listenersAdded.add(fermatEventListener);

      fermatEventListener = eventManager.getNewListener(EventType.OUTGOING_CHAT);
      fermatEventHandler = new OutgoingChatEventHandler();
      ((OutgoingChatEventHandler) fermatEventHandler).setChatMiddlewareRecorderService(this);
      fermatEventListener.setEventHandler(fermatEventHandler);
      eventManager.addListener(fermatEventListener);
      listenersAdded.add(fermatEventListener);

      fermatEventListener = eventManager.getNewListener(EventType.INCOMING_STATUS);
      fermatEventHandler = new IncomingNewChatStatusUpdateEventHandler();
      ((IncomingNewChatStatusUpdateEventHandler) fermatEventHandler)
          .setChatMiddlewareRecorderService(this);
      fermatEventListener.setEventHandler(fermatEventHandler);
      eventManager.addListener(fermatEventListener);
      listenersAdded.add(fermatEventListener);

      this.serviceStatus = ServiceStatus.STARTED;
    } catch (CantSetObjectException exception) {
      throw new CantStartServiceException(
          exception,
          "Starting the ChatMiddlewareRecorderService",
          "The ChatMiddlewareRecorderService is probably null");
    } catch (Exception exception) {
      errorManager.reportUnexpectedPluginException(
          Plugins.CHAT_MIDDLEWARE,
          UnexpectedPluginExceptionSeverity.DISABLES_SOME_FUNCTIONALITY_WITHIN_THIS_PLUGIN,
          FermatException.wrapException(exception));
      throw new CantStartServiceException(
          exception, "Starting the ChatMiddlewareRecorderService", "Unexpected Exception");
    }
  }
コード例 #4
0
  private void setUpEventListeners() {

    FermatEventListener fermatEventListenerNewNotification =
        eventManager.getNewListener(EventType.INCOMING_MONEY_NOTIFICATION);
    FermatEventHandler fermatEventHandlerNewNotification =
        new IncomingMoneyNotificationHandler(this);
    fermatEventListenerNewNotification.setEventHandler(fermatEventHandlerNewNotification);
    eventManager.addListener(fermatEventListenerNewNotification);
    listenersAdded.add(fermatEventListenerNewNotification);

    FermatEventListener fermatEventListenerCloudClientConnectedNotification =
        eventManager.getNewListener(
            P2pEventType.COMPLETE_CLIENT_COMPONENT_REGISTRATION_NOTIFICATION);
    FermatEventHandler CloudClietNotificationHandler =
        new com.bitdubai.fermat_pip_plugin.layer.sub_app_module.notification.developer.bitdubai
            .version_1.event_handlers.CloudClietNotificationHandler(this);
    fermatEventListenerCloudClientConnectedNotification.setEventHandler(
        CloudClietNotificationHandler);
    eventManager.addListener(fermatEventListenerCloudClientConnectedNotification);
    listenersAdded.add(fermatEventListenerCloudClientConnectedNotification);

    FermatEventListener fermatEventListenerIncomingRequestConnectionNotification =
        eventManager.getNewListener(
            EventType.INCOMING_INTRA_ACTOR_REQUUEST_CONNECTION_NOTIFICATION);
    FermatEventHandler incomingRequestConnectionNotificationHandler =
        new com.bitdubai.fermat_pip_plugin.layer.sub_app_module.notification.developer.bitdubai
            .version_1.event_handlers.IncomingRequestConnectionNotificationHandler(this);
    fermatEventListenerIncomingRequestConnectionNotification.setEventHandler(
        incomingRequestConnectionNotificationHandler);
    eventManager.addListener(fermatEventListenerIncomingRequestConnectionNotification);
    listenersAdded.add(fermatEventListenerIncomingRequestConnectionNotification);
  }
コード例 #5
0
  private void initializeListener() {

    /*
     * Listen and handle Complete Component Registration Notification Event
     */
    FermatEventListener fermatEventListener =
        eventManager.getNewListener(P2pEventType.COMPLETE_COMPONENT_REGISTRATION_NOTIFICATION);
    fermatEventListener.setEventHandler(
        new CompleteComponentRegistrationNotificationEventHandler(this));
    eventManager.addListener(fermatEventListener);
    listenersAdded.add(fermatEventListener);

    /*
     * Listen and handle Complete Request List Component Registered Notification Event
     */
    fermatEventListener =
        eventManager.getNewListener(
            P2pEventType.COMPLETE_REQUEST_LIST_COMPONENT_REGISTERED_NOTIFICATION);
    //        fermatEventListener.setEventHandler(new
    // CompleteRequestListComponentRegisteredNotificationEventHandler(this));
    //        eventManager.addListener(fermatEventListener);
    //        listenersAdded.add(fermatEventListener);

    /*
     * Listen and handle Complete Request List Component Registered Notification Event
     */
    fermatEventListener =
        eventManager.getNewListener(
            P2pEventType.COMPLETE_COMPONENT_CONNECTION_REQUEST_NOTIFICATION);
    fermatEventListener.setEventHandler(
        new CompleteComponentConnectionRequestNotificationEventHandler(this));
    eventManager.addListener(fermatEventListener);
    listenersAdded.add(fermatEventListener);

    /** failure connection */
    fermatEventListener =
        eventManager.getNewListener(P2pEventType.FAILURE_COMPONENT_CONNECTION_REQUEST_NOTIFICATION);
    fermatEventListener.setEventHandler(
        new FailureComponentConnectionRequestNotificationEventHandler(this));
    eventManager.addListener(fermatEventListener);
    listenersAdded.add(fermatEventListener);

    /** close connection */
    fermatEventListener = eventManager.getNewListener(P2pEventType.CLIENT_CONNECTION_CLOSE);
    fermatEventListener.setEventHandler(new ClientConnectionCloseNotificationEventHandler(this));
    eventManager.addListener(fermatEventListener);
    listenersAdded.add(fermatEventListener);

    /*
     * Listen and handle VPN Connection Close Notification Event
     */
    fermatEventListener = eventManager.getNewListener(P2pEventType.VPN_CONNECTION_CLOSE);
    fermatEventListener.setEventHandler(new VPNConnectionCloseNotificationEventHandler(this));
    eventManager.addListener(fermatEventListener);
    listenersAdded.add(fermatEventListener);

    /** new message */
    fermatEventListener =
        eventManager.getNewListener(P2pEventType.NEW_NETWORK_SERVICE_MESSAGE_RECEIVE_NOTIFICATION);
    fermatEventListener.setEventHandler(new NewReceiveMessagesNotificationEventHandler(this));
    eventManager.addListener(fermatEventListener);
    listenersAdded.add(fermatEventListener);

    /*
     * Listen and handle Client Connection Loose Notification Event
     */
    fermatEventListener = eventManager.getNewListener(P2pEventType.CLIENT_CONNECTION_LOOSE);
    fermatEventListener.setEventHandler(new ClientConnectionLooseNotificationEventHandler(this));
    eventManager.addListener(fermatEventListener);
    listenersAdded.add(fermatEventListener);

    /*
     * Listen and handle Client Connection Success Reconnect Notification Event
     */
    fermatEventListener = eventManager.getNewListener(P2pEventType.CLIENT_SUCCESS_RECONNECT);
    fermatEventListener.setEventHandler(
        new ClientSuccessfullReconnectNotificationEventHandler(this));
    eventManager.addListener(fermatEventListener);
    listenersAdded.add(fermatEventListener);
  }
コード例 #6
0
  /** Initialize all event listener and configure */
  private void initializeListener() {

    /*
     * 1. Listen and handle Client Connection Close Notification Event
     */
    FermatEventListener fermatEventListener =
        eventManager.getNewListener(P2pEventType.CLIENT_CONNECTION_CLOSE);
    fermatEventListener.setEventHandler(new ClientConnectionCloseNotificationEventHandler(this));
    eventManager.addListener(fermatEventListener);
    listenersAdded.add(fermatEventListener);

    /*
     * 2 Listen and handle Client Connection Loose Notification Event
     */
    fermatEventListener = eventManager.getNewListener(P2pEventType.CLIENT_CONNECTION_LOOSE);
    fermatEventListener.setEventHandler(new ClientConnectionLooseNotificationEventHandler(this));
    eventManager.addListener(fermatEventListener);
    listenersAdded.add(fermatEventListener);

    /*
     * 3 Listen and handle Client Connection Success Reconnect Notification Event
     */
    fermatEventListener = eventManager.getNewListener(P2pEventType.CLIENT_SUCCESS_RECONNECT);
    fermatEventListener.setEventHandler(
        new ClientSuccessfulReconnectNotificationEventHandler(this));
    eventManager.addListener(fermatEventListener);
    listenersAdded.add(fermatEventListener);

    /*
     * 4 Listen and handle Complete Request List Component Registered Notification Event
     */
    fermatEventListener =
        eventManager.getNewListener(
            P2pEventType.COMPLETE_COMPONENT_CONNECTION_REQUEST_NOTIFICATION);
    fermatEventListener.setEventHandler(
        new CompleteComponentConnectionRequestNotificationEventHandler(this));
    eventManager.addListener(fermatEventListener);
    listenersAdded.add(fermatEventListener);

    /*
     * 5 Listen and handle Complete Component Registration Notification Event
     */
    fermatEventListener =
        eventManager.getNewListener(P2pEventType.COMPLETE_COMPONENT_REGISTRATION_NOTIFICATION);
    fermatEventListener.setEventHandler(
        new CompleteComponentRegistrationNotificationEventHandler(this));
    eventManager.addListener(fermatEventListener);
    listenersAdded.add(fermatEventListener);

    /*
     * 6 Listen and handle Complete Request list
     */
    fermatEventListener =
        eventManager.getNewListener(
            P2pEventType.COMPLETE_REQUEST_LIST_COMPONENT_REGISTERED_NOTIFICATION);
    fermatEventListener.setEventHandler(
        new CompleteRequestListComponentRegisteredNotificationEventHandler(this));
    eventManager.addListener(fermatEventListener);
    listenersAdded.add(fermatEventListener);

    /*
     * 7 Listen and handle Complete Update Actor Profile Notification Event
     */
    fermatEventListener =
        eventManager.getNewListener(P2pEventType.COMPLETE_UPDATE_ACTOR_NOTIFICATION);
    fermatEventListener.setEventHandler(new CompleteUpdateActorNotificationEventHandler(this));
    eventManager.addListener(fermatEventListener);
    listenersAdded.add(fermatEventListener);

    /*
     * 8 Listen and handle failure component connection
     */
    fermatEventListener =
        eventManager.getNewListener(P2pEventType.FAILURE_COMPONENT_CONNECTION_REQUEST_NOTIFICATION);
    fermatEventListener.setEventHandler(
        new FailureComponentConnectionRequestNotificationEventHandler(this));
    eventManager.addListener(fermatEventListener);
    listenersAdded.add(fermatEventListener);

    /*
     * 9 Listen and handle VPN Connection Close Notification Event
     */
    fermatEventListener = eventManager.getNewListener(P2pEventType.VPN_CONNECTION_CLOSE);
    fermatEventListener.setEventHandler(new VPNConnectionCloseNotificationEventHandler(this));
    eventManager.addListener(fermatEventListener);
    listenersAdded.add(fermatEventListener);

    /*
     * 10 Listen and handle VPN Connection Loose Notification Event
     */
    fermatEventListener = eventManager.getNewListener(P2pEventType.VPN_CONNECTION_LOOSE);
    fermatEventListener.setEventHandler(new VPNConnectionLooseNotificationEventHandler(this));
    eventManager.addListener(fermatEventListener);
    listenersAdded.add(fermatEventListener);

    /*
     * 11 Listen and handle Register Server Request Notification Event
     */
    fermatEventListener =
        eventManager.getNewListener(P2pEventType.REGISTER_SERVER_REQUEST_NOTIFICATION);
    fermatEventListener.setEventHandler(new RegisterServerRequestNotificationEventHandler(this));
    eventManager.addListener(fermatEventListener);
    listenersAdded.add(fermatEventListener);
  }