当前位置: 首页>>代码示例>>Java>>正文


Java ForeignSource.getDetectors方法代码示例

本文整理汇总了Java中org.opennms.netmgt.provision.persist.foreignsource.ForeignSource.getDetectors方法的典型用法代码示例。如果您正苦于以下问题:Java ForeignSource.getDetectors方法的具体用法?Java ForeignSource.getDetectors怎么用?Java ForeignSource.getDetectors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.opennms.netmgt.provision.persist.foreignsource.ForeignSource的用法示例。


在下文中一共展示了ForeignSource.getDetectors方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDetectorsForForeignSource

import org.opennms.netmgt.provision.persist.foreignsource.ForeignSource; //导入方法依赖的package包/类
/** {@inheritDoc} */
public List<ServiceDetector> getDetectorsForForeignSource(final String foreignSourceName) {
	final ForeignSource foreignSource = m_foreignSourceRepository.getForeignSource(foreignSourceName);
    assertNotNull(foreignSource, "Expected a foreignSource with name %s", foreignSourceName);
    
    final List<PluginConfig> detectorConfigs = foreignSource.getDetectors();
    if (detectorConfigs == null) {
        return new ArrayList<ServiceDetector>(m_pluginRegistry.getAllPlugins(ServiceDetector.class));
    }
    
    final List<ServiceDetector> detectors = new ArrayList<ServiceDetector>(detectorConfigs.size());
    for(final PluginConfig detectorConfig : detectorConfigs) {
        final ServiceDetector detector = m_pluginRegistry.getPluginInstance(ServiceDetector.class, detectorConfig);
        if (detector == null) {
errorf(this, "Configured plugin does not exist: %s", detectorConfig);
        } else {
            detector.setServiceName(detectorConfig.getName());
            detector.init();
            detectors.add(detector);
        }
    }

    return detectors;
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:25,代码来源:DefaultProvisionService.java

示例2: testDefaultForeignSource

import org.opennms.netmgt.provision.persist.foreignsource.ForeignSource; //导入方法依赖的package包/类
@Test
public void testDefaultForeignSource() throws Exception {
    createRequisition();
    List<String> detectorList = Arrays.asList(new String[]{ "DNS", "FTP", "HTTP", "HTTPS", "ICMP", "IMAP", "LDAP", "NRPE", "POP3", "SMTP", "SNMP", "SSH" });
    String uuid = UUID.randomUUID().toString();
    ForeignSource defaultForeignSource = m_foreignSourceRepository.getForeignSource(uuid);
    assertEquals("name must match requested foreign source repository name", uuid, defaultForeignSource.getName());
    assertEquals("scan-interval must be 1 day", 86400000, defaultForeignSource.getScanInterval().getMillis());
    assertEquals("foreign source must have no default policies", 0, defaultForeignSource.getPolicies().size());
    List<String> fsNames = new ArrayList<String>();
    for (PluginConfig config : defaultForeignSource.getDetectors()) {
        fsNames.add(config.getName());
    }
    assertEquals("detector list must match expected defaults", detectorList, fsNames);
    assertTrue("foreign source must be tagged as default", defaultForeignSource.isDefault());
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:17,代码来源:CachingForeignSourceRepositoryTest.java

示例3: deleteDetector

import org.opennms.netmgt.provision.persist.foreignsource.ForeignSource; //导入方法依赖的package包/类
/**
 * <p>deleteDetector</p>
 *
 * @param foreignSource a {@link java.lang.String} object.
 * @param detector a {@link java.lang.String} object.
 * @return a {@link javax.ws.rs.core.Response} object.
 */
@DELETE
@Path("{foreignSource}/detectors/{detector}")
@Transactional
public Response deleteDetector(@PathParam("foreignSource") String foreignSource, @PathParam("detector") String detector) {
    writeLock();
    try {
        ForeignSource fs = getActiveForeignSource(foreignSource);
        List<PluginConfig> detectors = fs.getDetectors();
        PluginConfig removed = removeEntry(detectors, detector);
        if (removed != null) {
            fs.updateDateStamp();
            fs.setDetectors(detectors);
            m_pendingForeignSourceRepository.save(fs);
            return Response.ok().build();
        }
        return Response.notModified().build();
    } finally {
        writeUnlock();
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:28,代码来源:ForeignSourceRestService.java

示例4: processForeignSources

import org.opennms.netmgt.provision.persist.foreignsource.ForeignSource; //导入方法依赖的package包/类
private Map<String, ServiceCompound> processForeignSources(ForeignSource foreignSource, Map<String, ServiceCompound> serviceCompounds) {
    for (PluginConfig detector : foreignSource.getDetectors()) {
        if (!serviceCompounds.containsKey(detector.getName())){
            serviceCompounds.put(detector.getName(), new ServiceCompound(detector.getName()));
        }
        serviceCompounds.get(detector.getName()).setDetector(detector);
    }
    return serviceCompounds;
}
 
开发者ID:indigo423,项目名称:opennms-config-audit,代码行数:10,代码来源:RequisitionChecker.java

示例5: deleteDetector

import org.opennms.netmgt.provision.persist.foreignsource.ForeignSource; //导入方法依赖的package包/类
/** {@inheritDoc} */
public ForeignSource deleteDetector(String foreignSource, String name) {
    ForeignSource fs = getForeignSource(foreignSource);
    List<PluginConfig> detectors = fs.getDetectors();
    for (Iterator<PluginConfig> i = detectors.iterator(); i.hasNext(); ) {
        PluginConfig pc = i.next();
        if (pc.getName().equals(name)) {
            i.remove();
            break;
        }
    }
    m_pendingForeignSourceRepository.save(fs);
    return fs;
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:15,代码来源:DefaultForeignSourceService.java


注:本文中的org.opennms.netmgt.provision.persist.foreignsource.ForeignSource.getDetectors方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。