| Constructor and Description |
|---|
DefaultMOServer() |
| Modifier and Type | Method and Description |
|---|---|
void |
addContext(org.snmp4j.smi.OctetString context)
Adds the supplied context to the server.
|
void |
addContextListener(ContextListener l)
Adds a context listener to the server.
|
void |
addLookupListener(MOServerLookupListener listener,
ManagedObject mo)
Adds a managed object lookup listener for the supplied managed object to
this managed object server.
|
protected void |
checkForUpdate(UpdatableManagedObject mo,
MOQuery query)
Checks
updateStrategy whether the queried managed object needs
to be updated. |
protected void |
fireContextChanged(ContextEvent event) |
protected void |
fireLookupEvent(ManagedObject mo,
MOQuery query) |
protected void |
fireQueryEvent(ManagedObject mo,
MOQuery query) |
org.snmp4j.smi.OctetString[] |
getContexts()
Returns the contexts known by the server.
|
ManagedObject |
getManagedObject(org.snmp4j.smi.OID key,
org.snmp4j.smi.OctetString context)
Returns the
ManagedObject with the specified OID
and registered in the supplied context. |
org.snmp4j.smi.OctetString[] |
getRegisteredContexts(ManagedObject managedObject)
Returns the contexts for which the supplied
ManagedObject has been
registered. |
SortedMap<MOScope,ManagedObject> |
getRegistry() |
UpdateStrategy |
getUpdateStrategy()
Gets the update strategy for
UpdatableManagedObjects. |
static org.snmp4j.smi.Variable |
getValue(MOServer server,
org.snmp4j.smi.OctetString context,
org.snmp4j.smi.OID key)
Returns the value of a particular MIB object instance using the
ManagedObjectValueAccess interface. |
boolean |
isContextSupported(org.snmp4j.smi.OctetString context)
Checks whether the supplied context is supported (registered) by this
server.
|
Iterator<Map.Entry<MOScope,ManagedObject>> |
iterator()
Returns a read-only
Iterator over the content of this server. |
boolean |
lock(Object owner,
ManagedObject managedObject)
Locks a ManagedObject by the supplied owner.
|
boolean |
lock(Object owner,
ManagedObject managedObject,
long timeoutMillis)
Locks a ManagedObject by the supplied owner.
|
ManagedObject |
lookup(MOQuery query)
Lookups the first (lexicographically ordered) managed object that matches
the supplied query.
|
void |
register(ManagedObject mo,
org.snmp4j.smi.OctetString context)
Registers a managed object for the specified context.
|
static void |
registerTableRowListener(MOServer server,
MOTableRowListener listener)
Register a single
MOTableRowListener with all tables in the
specified MOServer. |
void |
removeContext(org.snmp4j.smi.OctetString context)
Removes a context from the server.
|
void |
removeContextListener(ContextListener l)
Removes a previously added context listener.
|
boolean |
removeLookupListener(MOServerLookupListener listener,
ManagedObject mo)
Removes a managed object lookup listener for the specified managed object.
|
void |
setUpdateStrategy(UpdateStrategy updateStrategy)
Sets the update strategy for
UpdatableManagedObjects. |
static boolean |
setValue(MOServer server,
org.snmp4j.smi.OctetString context,
org.snmp4j.smi.VariableBinding newValueAndKey)
Sets the value of a particular MIB object instance using the
ManagedObjectValueAccess interface. |
String |
toString() |
void |
unlock(Object owner,
ManagedObject managedObject)
Unlocks a ManagedObject that has been locked by the specified owner.
|
void |
unregister(ManagedObject mo,
org.snmp4j.smi.OctetString context)
Removes the registration of the supplied managed object for the specified
context.
|
static void |
unregisterTableRowListener(MOServer server,
MOTableRowListener listener)
Unregister a single
MOTableRowListener with all tables in the
specified MOServer. |
public ManagedObject lookup(MOQuery query)
MOServerprotected void checkForUpdate(UpdatableManagedObject mo, MOQuery query)
updateStrategy whether the queried managed object needs
to be updated. This method is called on behalf of
lookup(MOQuery query) after fireQueryEvent(org.snmp4j.agent.ManagedObject, org.snmp4j.agent.MOQuery) and before
fireLookupEvent(org.snmp4j.agent.ManagedObject, org.snmp4j.agent.MOQuery) is being called.mo - an UpdatableManagedObject instance.query - the query that is interested in content of mo.public ManagedObject getManagedObject(org.snmp4j.smi.OID key, org.snmp4j.smi.OctetString context)
ManagedObject with the specified OID
and registered in the supplied context.
Note: The query used to lookup the managed object will indicate an intended
read-only access for the MOServerLookupEvents fired on behalf of
this method.
key - the OID identifying the key (lower bound) of the
ManagedObject.context - the optional context to look in. A null value searches
in all contexts.ManagedObject instance or null if such
an instance does not exists.public static org.snmp4j.smi.Variable getValue(MOServer server, org.snmp4j.smi.OctetString context, org.snmp4j.smi.OID key)
ManagedObjectValueAccess interface. If a ManagedObject
does not support this interface, its value cannot be returned and
null will be returned instead.server - the MOServer where to lookup the value.context - the optional context to look in. A null value searches
in all contexts.key - the OID identifying the variable instance to return. associated with OID and
context in server or null if
no such variable exists.public static boolean setValue(MOServer server, org.snmp4j.smi.OctetString context, org.snmp4j.smi.VariableBinding newValueAndKey)
ManagedObjectValueAccess interface. If a ManagedObject
does not support this interface, its value cannot be set and
false will be returned.server - the MOServer where to lookup the value.context - the optional context to look in. A null value searches
in all contexts.newValueAndKey - the OID identifying the variable instance to set and its new value. if the value has been set successfully,
false otherwise.protected void fireLookupEvent(ManagedObject mo, MOQuery query)
protected void fireQueryEvent(ManagedObject mo, MOQuery query)
public org.snmp4j.smi.OctetString[] getContexts()
MOServergetContexts in interface MOServerpublic boolean isContextSupported(org.snmp4j.smi.OctetString context)
MOServerisContextSupported in interface MOServercontext - a context name.true if the context is support (thus has previously added
by MOServer.addContext(org.snmp4j.smi.OctetString)) and false otherwise.public SortedMap<MOScope,ManagedObject> getRegistry()
public UpdateStrategy getUpdateStrategy()
UpdatableManagedObjects. If the
strategy is null no updates will be performed on behalf
of calls to lookup(org.snmp4j.agent.MOQuery).null if no
strategy is active.lookup(org.snmp4j.agent.MOQuery)public void setUpdateStrategy(UpdateStrategy updateStrategy)
UpdatableManagedObjects. If the
strategy is null no updates will be performed on behalf
of calls to lookup(MOQuery).updateStrategy - the new UpdateStrategy instance or null if no
updates should be performed.lookup(MOQuery)public void register(ManagedObject mo, org.snmp4j.smi.OctetString context) throws DuplicateRegistrationException
MOServerregister in interface MOServermo - a ManagedObject instance.context - the context name for which to register the mo or
null if the managed oject is to be registered for all
contexts (including the default context).DuplicateRegistrationException - if the registration conflicts (i.e. overlaps) with an already existing
registration.public void unregister(ManagedObject mo, org.snmp4j.smi.OctetString context)
MOServerunregister in interface MOServermo - a ManagedObject instance.context - the context name for which to unregister the mo or
null if the managed oject is to be unregistered for all
contexts (including the default context). In the latter case however,
explicit registrations for a particular context will not be removed!public void addContext(org.snmp4j.smi.OctetString context)
MOServeraddContext in interface MOServercontext - an OctetString representing the context name to add.public void removeContext(org.snmp4j.smi.OctetString context)
MOServerremoveContext in interface MOServercontext - n OctetString representing the context name to remove.public boolean lock(Object owner, ManagedObject managedObject)
MOServerpublic boolean lock(Object owner, ManagedObject managedObject, long timeoutMillis)
MOServerpublic void unlock(Object owner, ManagedObject managedObject)
MOServerNote: In debug log mode a message is locked if the lock owner does not match the current lock owner.
public Iterator<Map.Entry<MOScope,ManagedObject>> iterator()
MOServerIterator over the content of this server.
The iterator is thread safe and can be used while the server is being
modified. The remove operation of the iterator is not supported.iterator in interface MOServerIterator on the Map.Entry instances managed by
this server. Each Entry consists of an MOScope
key instance and a corresponding ManagedObject value instance.
If the ManagedObject has been registered for a specific
context, then a MOContextScope is returned as key, otherwise
the managed objects own MOScope is returned.public void addLookupListener(MOServerLookupListener listener, ManagedObject mo)
MOServerMOServerLookupListener is called
before the managed object is returned by MOServer.lookup(MOQuery query).addLookupListener in interface MOServerlistener - a MOServerLookupListener instance, for example a managed
object that needs to update its state whenever it has been looked upmo - the ManagedObject that triggers the
MOServerLookupEvent to be fired when it has been looked up.public boolean removeLookupListener(MOServerLookupListener listener, ManagedObject mo)
MOServerremoveLookupListener in interface MOServerlistener - a MOServerLookupListener instance.mo - the ManagedObject that triggered the
MOServerLookupEvent to be fired when it has been looked up.true if the listener could be removed or false
if such a listener is not registered.public void addContextListener(ContextListener l)
MOServeraddContextListener in interface MOServerl - a ContextListener instance to be informed about context
changes.public void removeContextListener(ContextListener l)
MOServerremoveContextListener in interface MOServerl - a ContextListener instance.protected void fireContextChanged(ContextEvent event)
public org.snmp4j.smi.OctetString[] getRegisteredContexts(ManagedObject managedObject)
MOServerManagedObject has been
registered.getRegisteredContexts in interface MOServermanagedObject - a ManagedObject instance.managedObject has
been registered. If the managedObject has bee registered
for all contexts, a null element is included in the array.public static void registerTableRowListener(MOServer server, MOTableRowListener listener)
MOTableRowListener with all tables in the
specified MOServer. This overall registration can be used,
for example, to apply table size limits to all tables in an agent.
See MOTableSizeLimit for details.
Note: The server must not change its registration content while this
method is being called, otherwise a
ConcurrentModificationException might be thrown.
server - a MOServer instance.listener - the MOTableRowListener instance to register.public static void unregisterTableRowListener(MOServer server, MOTableRowListener listener)
MOTableRowListener with all tables in the
specified MOServer. This overall unregistration can be used,
for example, to remove table size limits from all tables in an agent.
See MOTableSizeLimit for details.
Note: The server must not change its registration content while this
method is being called, otherwise a
ConcurrentModificationException might be thrown.
server - a MOServer instance.listener - the MOTableRowListener instance to unregister.Copyright © 2013 SNMP4J.org. All Rights Reserved.