public class SnmpFactory extends Object
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this factory, releasing any resources it might be holding.
|
SimpleSnmpTargetConfig |
getDefaultTargetConfig()
Gets the default configuration that will be used for new context
instances created by this factory.
|
ExecutorService |
getExecutorService()
Gets the executor service that should be used for short-lived tasks.
|
SnmpFactoryConfig |
getFactoryConfig()
Gets the factory configuration associated with this instance.
|
static SnmpFactory |
getInstance()
Gets the singleton factory instance.
|
static SnmpFactory |
getInstance(SnmpFactoryConfig config,
ThreadFactory threadFactory)
Gets the singleton factory instance.
|
static SnmpFactory |
getInstance(ThreadFactory threadFactory)
Gets the singleton factory instance.
|
ScheduledExecutorService |
getScheduledExecutorService()
Gets the executor service that should be used for scheduled tasks.
|
ThreadFactory |
getThreadFactory()
Gets the thread factory that should be used to create threads for long
running tasks.
|
SnmpContext |
newContext(SnmpTarget target)
Gets a new SNMPv2c context using the first available provider, default
MIB, and the factory's default configuration.
|
SnmpContext |
newContext(SnmpTarget target,
Mib mib)
Gets a new SNMPv2c context using the first available provider and the
factory's default configuration.
|
SnmpContext |
newContext(SnmpTarget target,
Mib mib,
SnmpTargetConfig config,
String providerName)
Gets a new SNMPv2c context using the named provider.
|
SnmpContext |
newContext(SnmpTarget target,
SnmpTargetConfig config)
Gets a new SNMPv2c context using the first available provider.
|
SnmpListener |
newListener(int port,
Mib mib)
Creates a new listener that listens on any local address using the
first available provider.
|
SnmpListener |
newListener(Mib mib)
Creates a new listener that listens on the default notification port
with any local address, using the first available provider.
|
SnmpListener |
newListener(String address,
int port,
Mib mib)
Creates a new listener using the first available provider.
|
SnmpListener |
newListener(String address,
int port,
Mib mib,
String providerName)
Creates a new listener using the named provider.
|
void |
setDefaultTargetConfig(SimpleSnmpTargetConfig config)
Sets the default configuration that will be used for new context
instances created by this factory.
|
public static SnmpFactory getInstance()
public static SnmpFactory getInstance(ThreadFactory threadFactory)
threadFactory
- thread factory that will be used to create threads
as needed for components produced by this factorypublic static SnmpFactory getInstance(SnmpFactoryConfig config, ThreadFactory threadFactory)
config
- factory configurationthreadFactory
- thread factory that will be used to create threads
as needed for components produced by this factorypublic ExecutorService getExecutorService()
public ScheduledExecutorService getScheduledExecutorService()
public ThreadFactory getThreadFactory()
public SnmpFactoryConfig getFactoryConfig()
public void close() throws InterruptedException
InterruptedException
public SimpleSnmpTargetConfig getDefaultTargetConfig()
public void setDefaultTargetConfig(SimpleSnmpTargetConfig config)
config
- the value to setpublic SnmpContext newContext(SnmpTarget target)
target
- target agentpublic SnmpContext newContext(SnmpTarget target, Mib mib)
target
- target agentmib
- MIB that will be passed into the contextpublic SnmpContext newContext(SnmpTarget target, SnmpTargetConfig config)
target
- target agentconfig
- SNMP configuration for the contextpublic SnmpContext newContext(SnmpTarget target, Mib mib, SnmpTargetConfig config, String providerName)
target
- target agentmib
- MIB that will be passed into the contextconfig
- SNMP configuration for the contextproviderName
- name of the desired providerProviderNotFoundException
- if the named provider cannot be
found on the class pathpublic SnmpListener newListener(Mib mib)
mib
- MIB that will be passed into the listenerpublic SnmpListener newListener(int port, Mib mib)
port
- port on which to listenmib
- MIB that will be passed into the listenerpublic SnmpListener newListener(String address, int port, Mib mib)
address
- local address on which to listen or null
to bind to
any local addressport
- port on which to listenmib
- MIB that will be passed into the listenerpublic SnmpListener newListener(String address, int port, Mib mib, String providerName)
address
- local address on which to listen or null
to bind to
any local addressport
- port on which to listenmib
- MIB that will be passed into the listenerproviderName
- name of the desired provider or null
to
use first available providerCopyright © 2012–2015. All rights reserved.