Search in sources :

Example 11 with IncludeRange

use of org.opennms.netmgt.config.discovery.IncludeRange 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

IncludeRange (org.opennms.netmgt.config.discovery.IncludeRange)11 DiscoveryConfiguration (org.opennms.netmgt.config.discovery.DiscoveryConfiguration)9 Specific (org.opennms.netmgt.config.discovery.Specific)7 Test (org.junit.Test)6 ExcludeRange (org.opennms.netmgt.config.discovery.ExcludeRange)6 IncludeUrl (org.opennms.netmgt.config.discovery.IncludeUrl)6 RequestDispatcher (javax.servlet.RequestDispatcher)2 ServletException (javax.servlet.ServletException)2 HttpSession (javax.servlet.http.HttpSession)2 DiscoveryConfigFactory (org.opennms.netmgt.config.DiscoveryConfigFactory)2 EventAnticipator (org.opennms.netmgt.dao.mock.EventAnticipator)2 Event (org.opennms.netmgt.xml.event.Event)2 File (java.io.File)1 FileReader (java.io.FileReader)1 StringWriter (java.io.StringWriter)1 UnknownHostException (java.net.UnknownHostException)1 Date (java.util.Date)1 LinkedList (java.util.LinkedList)1 ServiceRegistry (org.opennms.core.soa.ServiceRegistry)1 DiscoveryTaskExecutor (org.opennms.netmgt.discovery.DiscoveryTaskExecutor)1