public final class TrapdConfigFactory extends Object implements TrapdConfig
Constructor and Description |
---|
TrapdConfigFactory(InputStream stream)
Constructor for TrapdConfigFactory.
|
Modifier and Type | Method and Description |
---|---|
int |
getBatchIntervalMs()
Messages are aggregated in batches before being dispatched.
|
int |
getBatchSize()
Messages are aggregated in batches before being dispatched.
|
TrapdConfiguration |
getConfig() |
static TrapdConfig |
getInstance()
Return the singleton instance of this factory.
|
boolean |
getNewSuspectOnTrap()
Return whether or not a newSuspect event should be sent when a trap is
received from an unknown IP address.
|
int |
getNumThreads()
Number of threads used for consuming/dispatching messages.
|
int |
getQueueSize()
Maximum number of messages to keep in memory while waiting
to be dispatched.
|
String |
getSnmpTrapAddress() |
int |
getSnmpTrapPort()
Return the port on which SNMP traps should be received.
|
List<SnmpV3User> |
getSnmpV3Users() |
static void |
init()
Load the config from the default config file and create the singleton
instance of this factory.
|
boolean |
isIncludeRawMessage() |
static void |
reload()
Reload the config from the default config file
|
static void |
setInstance(TrapdConfig config)
setInstance
|
boolean |
shouldUseAddressFromVarbind() |
void |
update(TrapdConfig config) |
public TrapdConfigFactory(InputStream stream) throws IOException
Constructor for TrapdConfigFactory.
stream
- a InputStream
object.IOException
public static void init() throws IOException
IOException
- Thrown if the specified config file cannot be readIOException
- if any.public static void reload() throws IOException
IOException
- Thrown if the specified config file cannot be read/loadedIOException
- if any.public static TrapdConfig getInstance()
IllegalStateException
- Thrown if the factory has not yet been initialized.public static void setInstance(TrapdConfig config)
setInstance
config
- a TrapdConfig
object.public String getSnmpTrapAddress()
getSnmpTrapAddress
in interface TrapdConfig
public int getSnmpTrapPort()
getSnmpTrapPort
in interface TrapdConfig
public boolean getNewSuspectOnTrap()
getNewSuspectOnTrap
in interface TrapdConfig
public List<SnmpV3User> getSnmpV3Users()
getSnmpV3Users
in interface TrapdConfig
public boolean isIncludeRawMessage()
isIncludeRawMessage
in interface TrapdConfig
public int getNumThreads()
TrapdConfig
getNumThreads
in interface TrapdConfig
public int getQueueSize()
TrapdConfig
getQueueSize
in interface TrapdConfig
public int getBatchSize()
TrapdConfig
getBatchSize
in interface TrapdConfig
public int getBatchIntervalMs()
TrapdConfig
getBatchIntervalMs
in interface TrapdConfig
public boolean shouldUseAddressFromVarbind()
shouldUseAddressFromVarbind
in interface TrapdConfig
public void update(TrapdConfig config)
update
in interface TrapdConfig
public TrapdConfiguration getConfig()
Copyright © 2021. All rights reserved.