|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.snmp4j.agent.DefaultMOServer
public class DefaultMOServer
The default MO server implementation uses a sorted map for the managed object registry.
| Constructor Summary | |
|---|---|
DefaultMOServer()
|
|
| Method Summary | |
|---|---|
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. |
java.util.SortedMap |
getRegistry()
|
UpdateStrategy |
getUpdateStrategy()
Gets the update strategy for UpdatableManagedObjects. |
boolean |
isContextSupported(org.snmp4j.smi.OctetString context)
Checks whether the supplied context is supported (registered) by this server. |
java.util.Iterator |
iterator()
Returns a read-only Iterator over the content of this server. |
void |
lock(java.lang.Object owner,
ManagedObject managedObject)
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. |
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. |
java.lang.String |
toString()
|
void |
unlock(java.lang.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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultMOServer()
| Method Detail |
|---|
public ManagedObject lookup(MOQuery query)
MOServer
lookup in interface MOServerquery - a MOQuery instance.
ManagedObject that matches the query and
null if no such object exists.
protected 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.
protected void fireLookupEvent(ManagedObject mo,
MOQuery query)
protected void fireQueryEvent(ManagedObject mo,
MOQuery query)
public org.snmp4j.smi.OctetString[] getContexts()
MOServer
getContexts in interface MOServerpublic boolean isContextSupported(org.snmp4j.smi.OctetString context)
MOServer
isContextSupported 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 java.util.SortedMap 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(org.snmp4j.agent.MOQuery).
updateStrategy - the new UpdateStrategy instance or null if no
updates should be performed.lookup(org.snmp4j.agent.MOQuery)
public void register(ManagedObject mo,
org.snmp4j.smi.OctetString context)
throws DuplicateRegistrationException
MOServer
register 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)
MOServer
unregister 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)
MOServer
addContext in interface MOServercontext - an OctetString representing the context name to add.public void removeContext(org.snmp4j.smi.OctetString context)
MOServer
removeContext in interface MOServercontext - n OctetString representing the context name to remove.
public void lock(java.lang.Object owner,
ManagedObject managedObject)
MOServer
lock in interface MOServerowner - an Object.managedObject - the ManagedObject to lock.
public void unlock(java.lang.Object owner,
ManagedObject managedObject)
MOServerNote: In debug log mode a message is locked if the lock owner does not match the current lock owner.
unlock in interface MOServerowner - an Object.managedObject - the ManagedObject to unlock.public java.util.Iterator 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)
MOServer
removeLookupListener 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)
MOServer
addContextListener in interface MOServerl - a ContextListener instance to be informed about context
changes.public void removeContextListener(ContextListener l)
MOServer
removeContextListener in interface MOServerl - a ContextListener instance.protected void fireContextChanged(ContextEvent event)
public java.lang.String toString()
toString in class java.lang.Object
|
Copyright 2005-2008 Frank Fock (SNMP4J.org) | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||