本文整理汇总了Java中org.opennms.netmgt.config.PollerConfigFactory类的典型用法代码示例。如果您正苦于以下问题:Java PollerConfigFactory类的具体用法?Java PollerConfigFactory怎么用?Java PollerConfigFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PollerConfigFactory类属于org.opennms.netmgt.config包,在下文中一共展示了PollerConfigFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSubInterfacesForNewInterface
import org.opennms.netmgt.config.PollerConfigFactory; //导入依赖的package包/类
private void getSubInterfacesForNewInterface(Connection dbc,
DbNodeEntry node, InetAddress ifaddr, IfCollector collector,
Date now, int nodeId, int ifIndex) throws SQLException {
if (!collector.hasSnmpCollection()) {
return;
}
CapsdConfig cFactory = CapsdConfigFactory.getInstance();
PollerConfig pollerCfgFactory = PollerConfigFactory.getInstance();
IfSnmpCollector snmpc = collector.getSnmpCollector();
// Made it this far...lets add the IP sub-interfaces
addSubIpInterfaces(dbc, node, collector, now, nodeId, cFactory, pollerCfgFactory,
snmpc);
}
示例2: initPollerConfigFactory
import org.opennms.netmgt.config.PollerConfigFactory; //导入依赖的package包/类
private void initPollerConfigFactory() throws ServletException {
try {
PollerConfigFactory.init();
} catch (Throwable e) {
throw new ServletException(e);
}
m_pollerFactory = PollerConfigFactory.getInstance();
m_pollerConfig = m_pollerFactory.getConfiguration();
if (m_pollerConfig == null) {
throw new ServletException("Poller Configuration file is empty");
}
}
示例3: init
import org.opennms.netmgt.config.PollerConfigFactory; //导入依赖的package包/类
/**
* <p>init</p>
*
* @throws javax.servlet.ServletException if any.
*/
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) {
// response.sendRedirect( "error.jsp?error=2");
errorflag = true;
throw new ServletException("Poller Configuration file is empty");
}
CapsdConfigFactory.init();
capsdFactory = CapsdConfigFactory.getInstance();
capsdConfig = capsdFactory.getConfiguration();
if (capsdConfig == null) {
// response.sendRedirect( "error.jsp?error=3");
errorflag = true;
throw new ServletException("Capsd 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");
}
}
示例4: reloadFiles
import org.opennms.netmgt.config.PollerConfigFactory; //导入依赖的package包/类
/**
* <p>reloadFiles</p>
*
* @throws javax.servlet.ServletException if any.
*/
public void reloadFiles() 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) {
// response.sendRedirect( "error.jsp?error=2");
errorflag = true;
throw new ServletException("Poller Configuration file is empty");
}
CapsdConfigFactory.init();
capsdFactory = CapsdConfigFactory.getInstance();
capsdConfig = capsdFactory.getConfiguration();
if (capsdConfig == null) {
errorflag = true;
// response.sendRedirect( "error.jsp?error=3");
throw new ServletException("Capsd 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");
}
}
示例5: init
import org.opennms.netmgt.config.PollerConfigFactory; //导入依赖的package包/类
/**
* <p>init</p>
*
* @throws javax.servlet.ServletException if any.
*/
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");
}
}
示例6: reloadFiles
import org.opennms.netmgt.config.PollerConfigFactory; //导入依赖的package包/类
/**
* <p>reloadFiles</p>
*
* @throws javax.servlet.ServletException if any.
*/
public void reloadFiles() 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");
}
}
示例7: getPackageForNewInterface
import org.opennms.netmgt.config.PollerConfigFactory; //导入依赖的package包/类
private org.opennms.netmgt.config.poller.Package getPackageForNewInterface(
Connection dbc, InetAddress ifaddr, DbIpInterfaceEntry ipIfEntry,
boolean addrUnmanaged) throws SQLException {
if (addrUnmanaged) {
return null;
}
PollerConfig pollerCfgFactory = PollerConfigFactory.getInstance();
org.opennms.netmgt.config.poller.Package ipPkg = null;
/*
* The newly discoveried IP addr is not in the Package IPList Mapping
* yet, so rebuild the list.
*/
pollerCfgFactory.rebuildPackageIpListMap();
boolean ipToBePolled = false;
ipPkg = pollerCfgFactory.getFirstPackageMatch(str(ifaddr));
if (ipPkg != null) {
ipToBePolled = true;
}
if (log().isDebugEnabled()) {
log().debug("addInterfaces: " + ifaddr + " is to be polled = "
+ ipToBePolled);
}
if (!ipToBePolled) {
// update ismanaged to 'N' in ipinterface
ipIfEntry.setManagedState(DbIpInterfaceEntry.STATE_NOT_POLLED);
ipIfEntry.store(dbc);
}
return ipPkg;
}
示例8: isServicePolled
import org.opennms.netmgt.config.PollerConfigFactory; //导入依赖的package包/类
private boolean isServicePolled(String ifAddr, String svcName, org.opennms.netmgt.config.poller.Package ipPkg) {
boolean svcToBePolled = false;
if (ipPkg != null) {
svcToBePolled = PollerConfigFactory.getInstance().isPolled(svcName, ipPkg);
if (!svcToBePolled)
svcToBePolled = PollerConfigFactory.getInstance().isPolled(ifAddr, svcName);
}
return svcToBePolled;
}
示例9: isServicePolledLocally
import org.opennms.netmgt.config.PollerConfigFactory; //导入依赖的package包/类
private boolean isServicePolledLocally(String ifAddr, String svcName, org.opennms.netmgt.config.poller.Package ipPkg) {
boolean svcToBePolled = false;
if (ipPkg != null && !ipPkg.getRemote()) {
svcToBePolled = PollerConfigFactory.getInstance().isPolled(svcName, ipPkg);
if (!svcToBePolled)
svcToBePolled = PollerConfigFactory.getInstance().isPolledLocally(ifAddr, svcName);
}
return svcToBePolled;
}
示例10: isServicePolled
import org.opennms.netmgt.config.PollerConfigFactory; //导入依赖的package包/类
private static boolean isServicePolled(String ifAddr, String svcName, org.opennms.netmgt.config.poller.Package ipPkg) {
boolean svcToBePolled = false;
if (ipPkg != null) {
svcToBePolled = PollerConfigFactory.getInstance().isPolled(svcName, ipPkg);
if (!svcToBePolled)
svcToBePolled = PollerConfigFactory.getInstance().isPolled(ifAddr, svcName);
}
return svcToBePolled;
}
示例11: isServicePolledLocally
import org.opennms.netmgt.config.PollerConfigFactory; //导入依赖的package包/类
private static boolean isServicePolledLocally(String ifAddr, String svcName, org.opennms.netmgt.config.poller.Package ipPkg) {
boolean svcToBePolled = false;
if (ipPkg != null && !ipPkg.getRemote()) {
svcToBePolled = PollerConfigFactory.getInstance().isPolled(svcName, ipPkg);
if (!svcToBePolled)
svcToBePolled = PollerConfigFactory.getInstance().isPolledLocally(ifAddr, svcName);
}
return svcToBePolled;
}
示例12: readPollerConfiguration
import org.opennms.netmgt.config.PollerConfigFactory; //导入依赖的package包/类
private PollerConfiguration readPollerConfiguration() throws IOException, MarshalException, ValidationException {
PollerConfigFactory.init();
PollerConfigFactory pollerConfigFactory = new PollerConfigFactory(0, new FileInputStream(new File(CONFIG_FOLDER.concat(File.separator + CONFIG_FILE))), "LocalServer?", false);
return pollerConfigFactory.getConfiguration();
}
示例13: getPollerdPackage
import org.opennms.netmgt.config.PollerConfigFactory; //导入依赖的package包/类
private org.opennms.netmgt.config.poller.Package getPollerdPackage(String packageName) throws IllegalArgumentException {
org.opennms.netmgt.config.poller.Package pkg = PollerConfigFactory.getInstance().getPackage(packageName);
if (pkg == null) throw new IllegalArgumentException("Poller package " + packageName + " does not exist.");
return pkg;
}
示例14: setUp
import org.opennms.netmgt.config.PollerConfigFactory; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
MockLogAppender.setupLogging();
MockDatabase db = new MockDatabase();
DataSourceFactory.setInstance(db);
RrdUtils.setStrategy(m_strategy);
m_provisioner = new OpenNMSProvisioner();
m_eventManager = new MockEventIpcManager();
m_provisioner.setEventManager(m_eventManager);
m_capsdConfig = new TestCapsdConfigManager(CAPSD_CONFIG);
CapsdConfigFactory.setInstance(m_capsdConfig);
m_pollerConfig = new TestPollerConfigManager(POLLER_CONFIG, "localhost", false);
PollerConfigFactory.setInstance(m_pollerConfig);
m_provisioner.setCapsdConfig(m_capsdConfig);
m_provisioner.setPollerConfig(m_pollerConfig);
InputStream configStream = ConfigurationTestUtils.getInputStreamForConfigFile("opennms-server.xml");
OpennmsServerConfigFactory onmsSvrConfig = new OpennmsServerConfigFactory(configStream);
configStream.close();
OpennmsServerConfigFactory.setInstance(onmsSvrConfig);
configStream = ConfigurationTestUtils.getInputStreamForConfigFile("database-schema.xml");
DatabaseSchemaConfigFactory.setInstance(new DatabaseSchemaConfigFactory(configStream));
configStream.close();
configStream = ConfigurationTestUtils.getInputStreamForResource(this, "/org/opennms/netmgt/capsd/collectd-configuration.xml");
CollectdConfigFactory.setInstance(new CollectdConfigFactory(configStream, onmsSvrConfig.getServerName(), onmsSvrConfig.verifyServer()));
configStream.close();
JdbcTemplate jdbcTemplate = new JdbcTemplate(db);
m_syncer = new JdbcCapsdDbSyncer();
m_syncer.setJdbcTemplate(jdbcTemplate);
m_syncer.setOpennmsServerConfig(OpennmsServerConfigFactory.getInstance());
m_syncer.setCapsdConfig(m_capsdConfig);
m_syncer.setPollerConfig(m_pollerConfig);
m_syncer.setCollectdConfig(CollectdConfigFactory.getInstance());
m_syncer.setNextSvcIdSql(db.getNextServiceIdStatement());
m_syncer.afterPropertiesSet();
m_syncer.syncServices();
m_provisioner.setCapsdDbSyncer(m_syncer);
}
示例15: setUp
import org.opennms.netmgt.config.PollerConfigFactory; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
m_agent = MockSnmpAgent.createAgentAndRun(new ClassPathResource("org/opennms/netmgt/snmp/snmpTestData1.properties"), InetAddressUtils.str(this.myLocalHost()) + "/9161");
InputStream configStream = ConfigurationTestUtils.getInputStreamForConfigFile("database-schema.xml");
DatabaseSchemaConfigFactory.setInstance(new DatabaseSchemaConfigFactory(configStream));
configStream.close();
configStream = ConfigurationTestUtils.getInputStreamForResource(this, "/org/opennms/netmgt/capsd/capsd-configuration.xml");
DefaultCapsdConfigManager capsdConfig = new DefaultCapsdConfigManager(configStream);
configStream.close();
CapsdConfigFactory.setInstance(capsdConfig);
configStream = ConfigurationTestUtils.getInputStreamForConfigFile("opennms-server.xml");
OpennmsServerConfigFactory onmsSvrConfig = new OpennmsServerConfigFactory(configStream);
configStream.close();
OpennmsServerConfigFactory.setInstance(onmsSvrConfig);
configStream = ConfigurationTestUtils.getInputStreamForResource(this, "/org/opennms/netmgt/capsd/poller-configuration.xml");
PollerConfigFactory.setInstance(new PollerConfigFactory(System.currentTimeMillis(), configStream, onmsSvrConfig.getServerName(), onmsSvrConfig.verifyServer()));
configStream.close();
RrdTestUtils.initialize();
configStream = ConfigurationTestUtils.getInputStreamForResource(this, "/org/opennms/netmgt/capsd/collectd-configuration.xml");
CollectdConfigFactory.setInstance(new CollectdConfigFactory(configStream, onmsSvrConfig.getServerName(), onmsSvrConfig.verifyServer()));
configStream.close();
JdbcTemplate jdbcTemplate = new JdbcTemplate(m_db);
JdbcCapsdDbSyncer syncer = new JdbcCapsdDbSyncer();
syncer.setJdbcTemplate(jdbcTemplate);
syncer.setOpennmsServerConfig(OpennmsServerConfigFactory.getInstance());
syncer.setCapsdConfig(CapsdConfigFactory.getInstance());
syncer.setPollerConfig(PollerConfigFactory.getInstance());
syncer.setCollectdConfig(CollectdConfigFactory.getInstance());
syncer.setNextSvcIdSql(m_db.getNextServiceIdStatement());
syncer.afterPropertiesSet();
PluginManager pluginManager = new PluginManager();
pluginManager.setCapsdConfig(capsdConfig);
pluginManager.afterPropertiesSet();
DefaultProcessorFactory defaultProcessorFactory = new DefaultProcessorFactory();
defaultProcessorFactory.setCapsdDbSyncer(syncer);
defaultProcessorFactory.setPluginManager(pluginManager);
RunnableConsumerThreadPool suspectRunner =
new RunnableConsumerThreadPool("SuspectRunner", 0.0f, 0.0f, 1);
RunnableConsumerThreadPool rescanRunner =
new RunnableConsumerThreadPool("RescanRunner", 0.0f, 0.0f, 1);
Scheduler scheduler = new Scheduler(rescanRunner.getRunQueue(), defaultProcessorFactory);
BroadcastEventProcessor eventHandler = new BroadcastEventProcessor();
eventHandler.setSuspectEventProcessorFactory(defaultProcessorFactory);
eventHandler.setLocalServer("localhost");
eventHandler.setScheduler(scheduler);
eventHandler.setSuspectQueue(suspectRunner.getRunQueue());
eventHandler.afterPropertiesSet();
AnnotationBasedEventListenerAdapter adapter =
new AnnotationBasedEventListenerAdapter(eventHandler, m_eventdIpcMgr);
m_capsd = new Capsd();
m_capsd.setCapsdDbSyncer(syncer);
m_capsd.setSuspectEventProcessorFactory(defaultProcessorFactory);
m_capsd.setCapsdConfig(capsdConfig);
m_capsd.setSuspectRunner(suspectRunner);
m_capsd.setRescanRunner(rescanRunner);
m_capsd.setScheduler(scheduler);
m_capsd.setEventListener(adapter);
m_capsd.afterPropertiesSet();
}