|
HOME | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.ireasoning.protocol.snmp.DefaultAgentConfig
com.ireasoning.protocol.snmp.SnmpAgentConfig
This class represents agent's XML configuration data.
Any changes to the state of this object will result in invocation of save(). So you do not have
to call save() method explicitly in most cases.
Sample Code:
SnmpAgentConfig config = new SnmpAgentConfig("d:/config/snmpagent.xml");
config.reloadConfig();
...
| Constructor Summary | |
SnmpAgentConfig()
Default config file |
|
SnmpAgentConfig(java.lang.Object fileName)
Constructs a SnmpAgentConfig object and loads the passed fileName |
|
SnmpAgentConfig(SnmpAgentConfig conf)
Copy constructor |
|
| Method Summary | |
protected boolean |
doAddGroup(java.util.Map attrs)
Adds a group, views associated with this group should already exist. |
protected boolean |
doAddProxy(ProxyEntry entry)
Adds a new proxy to the config settings |
protected boolean |
doAddTrapSink(java.util.Map attributes)
Adds a trapSink or snmpV3TrapSink element |
protected boolean |
doAddUser(java.util.Map attrs)
Adds a user. |
protected boolean |
doAddView(java.util.Map attrs)
Adds a view |
protected java.util.Map |
doGetPropertiesProps()
Returns a Map object which stores the attributes of properties node |
protected java.util.Map[] |
doGetProxyProps()
Return proxies' properties |
protected java.util.Map[] |
doGetSnmpV3TrapSinkProps()
Returns trapsinks' properties |
protected java.util.Map |
doGetTrapProxyProps()
Returns trap proxy's properties |
protected java.util.Map[] |
doGetTrapSinkProps()
Returns non-SNMPv3 trapsinks' properties |
protected void |
doReloadConfig()
Reloads config settings |
protected boolean |
doRemoveGroup(java.lang.String groupName)
Removes a group. |
protected boolean |
doRemoveProxy(ProxyEntry entry)
Adds a new proxy to the config settings |
protected boolean |
doRemoveTrapSink(java.lang.String trapSinkHostName,
int trapSinkPort,
int trapSinkVersion)
Removes a trapSink or snmpV3TrapSink element |
protected boolean |
doRemoveUser(java.lang.String userName)
Removes a user |
protected boolean |
doRemoveView(java.lang.String viewName)
Removes a view. |
protected void |
doSave()
Saves config file. |
java.util.Map[] |
getCommunityViews()
Returns communityView's properties |
java.lang.String |
getFileName()
Returns the config file name |
java.util.Map |
getGroupAttributes(java.lang.String groupName)
Returns the group's properties |
java.util.Map[] |
getGroups()
Returns groups' properties |
java.io.InputStream |
getInputStream()
Returns the InputStream of config. |
long |
getSaveDelayTime()
|
java.util.Map |
getUserAttributes(java.lang.String userName)
Returns properties of a user whose name is the passed userName |
java.util.Map[] |
getUsers()
Returns users' properties |
java.util.Map[] |
getViewAttributes(java.lang.String viewName)
|
java.util.Map[] |
getViews()
Returns views' properties |
protected void |
postReloadConfig()
It's invoked after reloadConfig() method is called |
void |
reloadConfig(java.io.InputStream istream)
Reloads config from an InputStream object. |
void |
save(java.io.OutputStream ostream)
Saves config file. |
protected boolean |
setAttributeValue(java.lang.String elementName,
java.util.Map keyvals,
java.lang.String attributeName,
java.lang.String attributeValue)
Sets element node's attribute's value. |
void |
setSaveDelayTime(long time)
Delays for a while then do save. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public SnmpAgentConfig()
public SnmpAgentConfig(java.lang.Object fileName)
throws java.io.IOException
SnmpAgentConfig object and loads the passed fileName
public SnmpAgentConfig(SnmpAgentConfig conf)
throws java.io.IOException
| Method Detail |
public java.lang.String getFileName()
It returns null if config was loaded from an InputStream object.
public java.io.InputStream getInputStream()
It returns null if config was loaded from a file.
protected boolean setAttributeValue(java.lang.String elementName,
java.util.Map keyvals,
java.lang.String attributeName,
java.lang.String attributeValue)
setAttributeValue in class DefaultAgentConfigkeyvals - key/value pairs used to distinguish nodes with identical node nameselementName - element nameattributeName - attribute's nameattributeValue - attribute's valueprotected boolean doAddTrapSink(java.util.Map attributes)
DefaultAgentConfig
doAddTrapSink in class DefaultAgentConfigattributes - a Map object containing the name/value of attributes, such as "verion" -- "2"
protected boolean doRemoveTrapSink(java.lang.String trapSinkHostName,
int trapSinkPort,
int trapSinkVersion)
DefaultAgentConfig
doRemoveTrapSink in class DefaultAgentConfigtrapSinkHostName - host name or ip address of trap receivertrapSinkPort - port number of trap receivertrapSinkVersion - version of trapSink. 1: SNMPv1, 2: SNMPv2c, 3: SNMPv3
public java.util.Map[] getViews()
DefaultAgentConfig
getViews in class DefaultAgentConfigpublic java.util.Map[] getViewAttributes(java.lang.String viewName)
protected boolean doAddView(java.util.Map attrs)
DefaultAgentConfig
doAddView in class DefaultAgentConfigattrs - a map containing view's attributes
protected boolean doRemoveView(java.lang.String viewName)
DefaultAgentConfig
doRemoveView in class DefaultAgentConfigpublic java.util.Map[] getGroups()
getGroups in class DefaultAgentConfigpublic java.util.Map getGroupAttributes(java.lang.String groupName)
groupName - group's nameprotected boolean doAddGroup(java.util.Map attrs)
DefaultAgentConfig
doAddGroup in class DefaultAgentConfigprotected boolean doRemoveGroup(java.lang.String groupName)
doRemoveGroup in class DefaultAgentConfigpublic java.util.Map[] getCommunityViews()
getCommunityViews in class DefaultAgentConfigpublic java.util.Map[] getUsers()
getUsers in class DefaultAgentConfigpublic java.util.Map getUserAttributes(java.lang.String userName)
userName
userName - user's nameprotected boolean doAddUser(java.util.Map attrs)
doAddUser in class DefaultAgentConfigattrs - user's attributes, such as "name", "authPassword", "privPassword", etc
protected boolean doRemoveUser(java.lang.String userName)
doRemoveUser in class DefaultAgentConfigpublic void setSaveDelayTime(long time)
time - delay time, in milliseconds. If it's 0, save() will be invoked right away. If it's a negative number, save() will never occur.DefaultAgentConfig.save()public long getSaveDelayTime()
public void save(java.io.OutputStream ostream)
throws java.io.IOException
ostream - OutputStream object for saving config. If it's null, config can't be saved.
ostream will be closed when save is finished
java.io.IOExceptionsetSaveDelayTime(long)
protected void doSave()
throws java.io.IOException
doSave in class DefaultAgentConfigjava.io.IOExceptionsetSaveDelayTime(long)
public void reloadConfig(java.io.InputStream istream)
throws java.io.IOException
istream - an InputStream object from which config is loaded
java.io.IOExceptionDefaultAgentConfig.reloadConfig()
protected void doReloadConfig()
throws java.io.IOException
DefaultAgentConfig
doReloadConfig in class DefaultAgentConfigjava.io.IOExceptionprotected void postReloadConfig()
DefaultAgentConfig
postReloadConfig in class DefaultAgentConfigprotected java.util.Map doGetPropertiesProps()
DefaultAgentConfig
doGetPropertiesProps in class DefaultAgentConfigprotected java.util.Map[] doGetTrapSinkProps()
doGetTrapSinkProps in class DefaultAgentConfigprotected java.util.Map doGetTrapProxyProps()
DefaultAgentConfig
doGetTrapProxyProps in class DefaultAgentConfigprotected java.util.Map[] doGetProxyProps()
DefaultAgentConfig
doGetProxyProps in class DefaultAgentConfigprotected java.util.Map[] doGetSnmpV3TrapSinkProps()
doGetSnmpV3TrapSinkProps in class DefaultAgentConfigprotected boolean doAddProxy(ProxyEntry entry)
doAddProxy in class DefaultAgentConfigprotected boolean doRemoveProxy(ProxyEntry entry)
doRemoveProxy in class DefaultAgentConfig
|
HOME | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||