コード例 #1
0
  /**
   * Few types are specified in configuration but actually they are derived like :
   * FTP,TIMER,SRM_EVENT and SRM_JMS servers they are all poll-comm-servers.
   *
   * @param pseudoType
   * @return
   */
  public static String mapPseudo2ActualType(String pseudoType) {
    if (ServiceMgrConsts.FTP_POLLER.equals(pseudoType)
        || ServiceMgrConsts.ASYNC_TIMER_SERVER.equals(pseudoType)
        || ServiceMgrConsts.FILE_SERVER.equals(pseudoType)
        || ServiceMgrConsts.SRM_EVENT_SERVER.equals(pseudoType)
        || ServiceMgrConsts.SRM_JMS_SERVER.equals(pseudoType)
        || ServiceMgrConsts.SRM_CONFIGURED_QUEUES_JMS_SERVER.equals(pseudoType)
        || ServiceMgrConsts.IA_SERVER.equals(pseudoType)) // change made on this line
    return ServiceMgrConsts.POLL_COMM_SERVER;

    return pseudoType;
  }
コード例 #2
0
  /**
   * Start the Poll Comm Server identified by parameters.
   *
   * @param parameters identifies the Consumer to be started
   * @throws ProcessingException when unable to start the server.
   */
  public void start(Map parameters) throws ProcessingException {
    if (Debug.isLevelEnabled(Debug.NORMAL_STATUS))
      Debug.log(
          Debug.NORMAL_STATUS, "Starting Poll Comm Server [" + getType() + "]: " + parameters);

    String id = (String) parameters.get(ATTR_COMM_SERVER_ID);

    if (id == null) {
      Debug.log(Debug.MSG_WARNING, "Could not start a Poll Comm Server with id [" + id + "].");
      return;
    }

    CommServerConf comServerConf = commServerConfMap.get(id);
    if (comServerConf == null) {
      if (Debug.isLevelEnabled(Debug.NORMAL_STATUS))
        Debug.log(
            Debug.NORMAL_STATUS,
            "Could not start a Poll Comm Server with id["
                + id
                + "] since Poll Comm Server "
                + "was not already configured.");
    } else {
      ComServerBase commServer = comServerConf.getCommServer();
      if (commServer == null) {
        if (ServiceMgrConsts.FTP_POLLER.equals(comServerConf.getServerType())) {
          if ("true".equals(comServerConf.getParamVal(SSL_PARAM_NM))) {
            commServer =
                new com.nightfire.comms.ftp.ssl.FTPPoller(
                    comServerConf.getDriverKey(), comServerConf.getDriverType());
          } else {
            commServer =
                new com.nightfire.comms.ftp.java.FTPPoller(
                    comServerConf.getDriverKey(), comServerConf.getDriverType());
          }
        } else if (ServiceMgrConsts.ASYNC_TIMER_SERVER.equals(comServerConf.getServerType())) {
          commServer =
              new AsyncTimerServer(comServerConf.getDriverKey(), comServerConf.getDriverType());
        } else if (ServiceMgrConsts.FILE_SERVER.equals(comServerConf.getServerType())) {
          commServer =
              new AsyncFileServer(comServerConf.getDriverKey(), comServerConf.getDriverType());
        } else if (ServiceMgrConsts.SRM_EVENT_SERVER.equals(comServerConf.getServerType())) {
          commServer =
              new MultiCustomerEventConsumerServer(
                  comServerConf.getDriverKey(), comServerConf.getDriverType());
        } else if (ServiceMgrConsts.SRM_CONFIGURED_QUEUES_JMS_SERVER.equals(
            comServerConf.getServerType())) {
          commServer =
              new JMSQueueEventConsumerServer(
                  comServerConf.getDriverKey(), comServerConf.getDriverType());
        } else if (ServiceMgrConsts.SRM_JMS_SERVER.equals(comServerConf.getServerType())) {
          commServer =
              new MultiCustomerJMSConsumerServer(
                  comServerConf.getDriverKey(), comServerConf.getDriverType());
        } else if (ServiceMgrConsts.IA_SERVER.equals(comServerConf.getServerType())) {
          try {
            commServer = new IAServer(comServerConf.getDriverKey(), comServerConf.getDriverType());
          } catch (FrameworkException e) {
            throw new ProcessingException(e);
          }
        }

        comServerConf.setCommServer(commServer);
        new Thread(commServer).start();
      } else {
        if (Debug.isLevelEnabled(Debug.NORMAL_STATUS))
          Debug.log(Debug.NORMAL_STATUS, "Poll Comm Server is already started [" + getType() + "]");
      }
    }

    // update configuration with the latest status.
    updateXML(ELEM_POLL_COMM_SERVER, ATTR_COMM_SERVER_ID, id, ATTR_COMM_SERVER_START, "true");
  }