コード例 #1
0
  /**
   * getServiceTypeNames
   *
   * @return a {@link java.util.Collection} object.
   */
  @Override
  public Collection<String> getServiceTypeNames(String groupName) {
    final SortedSet<String> serviceNames = new TreeSet<String>();

    m_readLock.lock();
    try {
      m_pendingForeignSourceRepository.flush();
      final ForeignSource pendingForeignSource =
          m_pendingForeignSourceRepository.getForeignSource(groupName);
      serviceNames.addAll(pendingForeignSource.getDetectorNames());

      m_deployedForeignSourceRepository.flush();
      final ForeignSource deployedForeignSource =
          m_deployedForeignSourceRepository.getForeignSource(groupName);
      serviceNames.addAll(deployedForeignSource.getDetectorNames());

      for (final OnmsServiceType type : m_serviceTypeDao.findAll()) {
        serviceNames.add(type.getName());
      }
      serviceNames.addAll(m_capsdConfig.getConfiguredProtocols());
      return serviceNames;
    } finally {
      m_readLock.unlock();
    }
  }
コード例 #2
0
  /**
   * init
   *
   * @throws javax.servlet.ServletException if any.
   */
  @Override
  public void init() throws ServletException {
    ServletConfig config = this.getServletConfig();
    try {
      props.load(
          new FileInputStream(
              ConfigFileConstants.getFile(ConfigFileConstants.POLLER_CONF_FILE_NAME)));
      PollerConfigFactory.init();
      pollerFactory = PollerConfigFactory.getInstance();
      pollerConfig = pollerFactory.getConfiguration();

      if (pollerConfig == null) {
        throw new ServletException("Poller Configuration file is empty");
      }
      CapsdConfigFactory.init();
      capsdFactory = CapsdConfigFactory.getInstance();
      capsdConfig = capsdFactory.getConfiguration();

      if (capsdConfig == null) {
        throw new ServletException("Poller Configuration file is empty");
      }
    } catch (Throwable e) {
      throw new ServletException(e.getMessage());
    }
    initPollerServices();
    initCapsdProtocols();
    this.redirectSuccess = config.getInitParameter("redirect.success");
    if (this.redirectSuccess == null) {
      throw new ServletException("Missing required init parameter: redirect.success");
    }
  }