Search in sources :

Example 6 with ExcludeRange

use of org.opennms.netmgt.config.discovery.ExcludeRange in project opennms by OpenNMS.

the class DiscoveryRestService method getDiscoveryConfig.

private DiscoveryConfiguration getDiscoveryConfig(DiscoveryConfigurationDTO discoveryConfigurationDTO) {
    DiscoveryConfiguration discoveryConfiguration = new DiscoveryConfiguration();
    discoveryConfiguration.setTimeout(discoveryConfigurationDTO.getTimeout());
    discoveryConfiguration.setRetries(discoveryConfigurationDTO.getRetries());
    discoveryConfiguration.setForeignSource(discoveryConfigurationDTO.getForeignSource());
    discoveryConfiguration.setLocation(discoveryConfigurationDTO.getLocation());
    discoveryConfiguration.setChunkSize(discoveryConfigurationDTO.getChunkSize());
    for (DiscoveryConfigurationDTO.SpecificDTO specificDTO : discoveryConfigurationDTO.getSpecificDTOList()) {
        Specific specific = new Specific();
        specific.setAddress(specificDTO.getContent());
        specific.setTimeout(specificDTO.getTimeout());
        specific.setRetries(specificDTO.getRetries());
        specific.setForeignSource(specificDTO.getForeignSource());
        specific.setLocation(specificDTO.getLocation());
        discoveryConfiguration.addSpecific(specific);
    }
    for (DiscoveryConfigurationDTO.IncludeUrlDTO includeUrlDTO : discoveryConfigurationDTO.getIncludeUrlDTOList()) {
        IncludeUrl includeUrl = new IncludeUrl();
        includeUrl.setUrl(includeUrlDTO.getContent());
        includeUrl.setTimeout(includeUrlDTO.getTimeout());
        includeUrl.setRetries(includeUrlDTO.getRetries());
        includeUrl.setForeignSource(includeUrlDTO.getForeignSource());
        includeUrl.setLocation(includeUrlDTO.getLocation());
        discoveryConfiguration.addIncludeUrl(includeUrl);
    }
    for (DiscoveryConfigurationDTO.IncludeRangeDTO includeRangeDTO : discoveryConfigurationDTO.getIncludeRangeDTOList()) {
        IncludeRange includeRange = new IncludeRange();
        includeRange.setBegin(includeRangeDTO.getBegin());
        includeRange.setEnd(includeRangeDTO.getEnd());
        includeRange.setTimeout(includeRangeDTO.getTimeout());
        includeRange.setRetries(includeRangeDTO.getRetries());
        includeRange.setForeignSource(includeRangeDTO.getForeignSource());
        includeRange.setLocation(includeRangeDTO.getLocation());
        discoveryConfiguration.addIncludeRange(includeRange);
    }
    for (DiscoveryConfigurationDTO.ExcludeRangeDTO excludeRangeDTO : discoveryConfigurationDTO.getExcludeRangeDTOList()) {
        ExcludeRange excludeRange = new ExcludeRange();
        excludeRange.setBegin(excludeRangeDTO.getBegin());
        excludeRange.setEnd(excludeRangeDTO.getEnd());
        discoveryConfiguration.addExcludeRange(excludeRange);
    }
    return discoveryConfiguration;
}
Also used : IncludeRange(org.opennms.netmgt.config.discovery.IncludeRange) IncludeUrl(org.opennms.netmgt.config.discovery.IncludeUrl) DiscoveryConfiguration(org.opennms.netmgt.config.discovery.DiscoveryConfiguration) Specific(org.opennms.netmgt.config.discovery.Specific) ExcludeRange(org.opennms.netmgt.config.discovery.ExcludeRange)

Aggregations

DiscoveryConfiguration (org.opennms.netmgt.config.discovery.DiscoveryConfiguration)6 ExcludeRange (org.opennms.netmgt.config.discovery.ExcludeRange)6 IncludeRange (org.opennms.netmgt.config.discovery.IncludeRange)6 Specific (org.opennms.netmgt.config.discovery.Specific)5 IncludeUrl (org.opennms.netmgt.config.discovery.IncludeUrl)4 Test (org.junit.Test)3 RequestDispatcher (javax.servlet.RequestDispatcher)2 ServletException (javax.servlet.ServletException)2 HttpSession (javax.servlet.http.HttpSession)2 StringWriter (java.io.StringWriter)1 ServiceRegistry (org.opennms.core.soa.ServiceRegistry)1 DiscoveryConfigFactory (org.opennms.netmgt.config.DiscoveryConfigFactory)1 DiscoveryTaskExecutor (org.opennms.netmgt.discovery.DiscoveryTaskExecutor)1 EventProxy (org.opennms.netmgt.events.api.EventProxy)1 EventBuilder (org.opennms.netmgt.model.events.EventBuilder)1 WebApplicationContext (org.springframework.web.context.WebApplicationContext)1