|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.management.snmp.agent.SnmpTableSupport
public abstract class SnmpTableSupport
This class is an abstraction for an SNMP table. It is the base class for implementing SNMP tables in the MBean world.
Its responsibility is to synchronize the MBean view of the table (Table of entries) with the MIB view (array of OID indexes). Each object of this class will be bound to the Metadata object which manages the same SNMP Table within the MIB.
For each table defined in a MIB, mibgen will generate a specific class called TableTableName that will subclass this class, and a corresponding TableNameMeta class extending SnmpMibTable and corresponding to the MIB view of the same table.
Objects of this class are instantiated by MBeans representing the SNMP Group to which the table belong.
SnmpTableEntryFactory
,
SnmpMibTable
,
Serialized FormField Summary | |
---|---|
protected List |
entries
The list of entries |
protected SnmpMibTable |
meta
The associated metadata object |
protected SnmpMib |
theMib
The MIB to which this table belongs |
Constructor Summary | |
---|---|
protected |
SnmpTableSupport(SnmpMib mib)
Initializes the table. |
Method Summary | |
---|---|
protected void |
addEntry(SnmpIndex index,
Object entry)
Add an entry in this table. |
protected void |
addEntry(SnmpIndex index,
ObjectName name,
Object entry)
Add an entry in this table. |
void |
addEntryCb(int pos,
SnmpOid row,
ObjectName name,
Object entry,
SnmpMibTable meta)
This callback is called by the associated metadata object when a new table entry has been registered in the table metadata. |
void |
addNotificationListener(NotificationListener listener,
NotificationFilter filter,
Object handback)
Enables to add an SNMP entry listener to this SnmpMibTable . |
protected List |
allocateTable()
Allocates an ArrayList for storing table entries. |
protected void |
bindWithTableMeta()
Binds this table with its associated metadata, registering itself as an SnmpTableEntryFactory. |
abstract ObjectName |
buildNameFromIndex(SnmpIndex index)
Builds the default ObjectName of an entry from the SnmpIndex identifying this entry. |
abstract SnmpOid |
buildOidFromIndex(SnmpIndex index)
Builds an SnmpOid from an SnmpIndex object. |
protected abstract SnmpIndex |
buildSnmpIndex(long[] oid,
int start)
Builds an SnmpIndex object from the index part of an OID. |
SnmpIndex |
buildSnmpIndex(SnmpOid rowOid)
Builds an entry SnmpIndex from its row OID. |
abstract void |
createNewEntry(SnmpMibSubRequest request,
SnmpOid rowOid,
int depth,
SnmpMibTable meta)
Creates a new entry in the table. |
protected Object[] |
getBasicEntries()
Returns the entries in the table. |
Object |
getEntry(int pos)
Returns the entry located at the given position in the table. |
MBeanNotificationInfo[] |
getNotificationInfo()
Returns a NotificationInfo object containing the
notification class and the notification type sent by the
SnmpMibTable . |
protected abstract SnmpMibTable |
getRegisteredTableMeta(SnmpMib mib)
Returns the metadata object associated with this table. |
int |
getSize()
Returns the number of entries registered in the table. |
boolean |
isCreationEnabled()
Tells whether a new entry should be created when a SET operation is received for an entry that does not exist yet. |
boolean |
isRegistrationRequired()
Tells whether the metadata object to which this table is linked requires entries to be registered. |
protected void |
removeEntry(SnmpIndex index,
Object entry)
Remove an entry from this table. |
void |
removeEntryCb(int pos,
SnmpOid row,
ObjectName name,
Object entry,
SnmpMibTable meta)
This callback is called by the associated metadata object when a new table entry has been removed from the table metadata. |
void |
removeNotificationListener(NotificationListener listener)
Enables to remove an SNMP entry listener from this SnmpMibTable . |
void |
setCreationEnabled(boolean remoteCreationFlag)
This method lets you dynamically switch the creation policy. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected List entries
protected SnmpMibTable meta
protected SnmpMib theMib
Constructor Detail |
---|
protected SnmpTableSupport(SnmpMib mib)
mib
- The MIB to which this table belong.Method Detail |
---|
public abstract void createNewEntry(SnmpMibSubRequest request, SnmpOid rowOid, int depth, SnmpMibTable meta) throws SnmpStatusException
SnmpTableEntryFactory
interface.
You may subclass this method to implement any specific behavior
your application requires.
createNewEntry
in interface SnmpTableEntryFactory
request
- The SNMP subrequest containing the sublist of varbinds
for the new entry.rowOid
- The OID indexing the conceptual row (entry) for which
the creation was requested.depth
- The depth reached in the OID tree (the position at
which the columnar object ids start in the OIDs
included in the varbind).meta
- The metadata object impacted by the subrequest
SnmpStatusException
- if the entry cannot be created.public Object getEntry(int pos)
null
if no entry can be found at this position.public int getSize()
public void setCreationEnabled(boolean remoteCreationFlag)
setCreationEnabled()
will switch the policy of
remote entry creation via SET operations, by calling
setCreationEnabled()
on the metadata object
associated with this table.
remoteCreationFlag
- Tells whether remote entry creation must
be enabled or disabled.
setCreationEnabled(true)
will enable remote entry
creation via SET operations.setCreationEnabled(false)
will disable remote entry
creation via SET operations.By default remote entry creation via SET operation is disabled.
SnmpMibTable
public boolean isCreationEnabled()
isCreationEnabled()
on the metadata
object associated with this table.
false
]SnmpMibTable
public boolean isRegistrationRequired()
true
if the associated metadata requires entries
to be registered (mibgen generated generic metadata).public SnmpIndex buildSnmpIndex(SnmpOid rowOid) throws SnmpStatusException
rowOid
- The SnmpOid object identifying a table entry.
rowOid
.
SnmpStatusException
- if the index cannot be built from the
given OID.public abstract SnmpOid buildOidFromIndex(SnmpIndex index) throws SnmpStatusException
index
- An SnmpIndex object identifying a table entry.
SnmpStatusException
- if the given index is not valid.public abstract ObjectName buildNameFromIndex(SnmpIndex index) throws SnmpStatusException
index
- The SnmpIndex identifying the entry from which we
want to build the default ObjectName.
SnmpStatusException
- if the given index is not valid.public void addEntryCb(int pos, SnmpOid row, ObjectName name, Object entry, SnmpMibTable meta) throws SnmpStatusException
entries
list.
addEntryCb
in interface SnmpTableCallbackHandler
pos
- The position at which the new entry was inserted
in the table.row
- The row OID of the new entryname
- The ObjectName of the new entry (as specified by the
factory)entry
- The new entry (as returned by the factory)meta
- The table metadata object.
SnmpStatusException
public void removeEntryCb(int pos, SnmpOid row, ObjectName name, Object entry, SnmpMibTable meta) throws SnmpStatusException
entries
list.
removeEntryCb
in interface SnmpTableCallbackHandler
pos
- The position from which the entry was deletedrow
- The row OID of the deleted entryname
- The ObjectName of the deleted entry (may be null if
ObjectName's were not required)entry
- The deleted entry (may be null if only ObjectName's
were required)meta
- The table metadata object.
SnmpStatusException
public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
SnmpMibTable
.
listener
- The listener object which will handle the
notifications emitted by the registered MBean.filter
- The filter object. If filter is null, no filtering
will be performed before handling notifications.handback
- The context to be sent to the listener when a
notification is emitted.
IllegalArgumentException
- Listener parameter is null.public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException
SnmpMibTable
.
listener
- The listener object which will handle the
notifications emitted by the registered MBean.
This method will remove all the information related to this
listener.
ListenerNotFoundException
- The listener is not registered
in the MBean.public MBeanNotificationInfo[] getNotificationInfo()
NotificationInfo
object containing the
notification class and the notification type sent by the
SnmpMibTable
.
protected abstract SnmpIndex buildSnmpIndex(long[] oid, int start) throws SnmpStatusException
oid
- The OID from which to build the index, represented
as an array of long.start
- The position where to start from in the OID array.
SnmpStatusException
- if the given index is not valid.protected abstract SnmpMibTable getRegisteredTableMeta(SnmpMib mib)
mib
- The SnmpMib object holding the Metadata corresponding
to this table.
null
if this implementation of the
MIB doesn't support this table.protected List allocateTable()
List
interface can
be used.
null
is returned then no entry will be stored in the list
and getEntry() will always return null.protected void addEntry(SnmpIndex index, Object entry) throws SnmpStatusException
If the entry is going to be registered, then
addEntry(SnmpIndex, ObjectName, Object)
should be preferred.
This function is mainly provided for backward compatibility.
index
- The SnmpIndex built from the given entry.entry
- The entry that should be added in the table.
SnmpStatusException
- if the entry cannot be registered with
the given index.protected void addEntry(SnmpIndex index, ObjectName name, Object entry) throws SnmpStatusException
index
- The SnmpIndex built from the given entry.name
- The ObjectName with which this entry will be registered.entry
- The entry that should be added in the table.
SnmpStatusException
- if the entry cannot be registered with
the given index.protected void removeEntry(SnmpIndex index, Object entry) throws SnmpStatusException
index
- The SnmpIndex identifying the entry.entry
- The entry that should be removed in the table. This
parameter is optional and can be omitted if it doesn't
need to be passed along to the
removeEntryCb()
callback defined in the
SnmpTableCallbackHandler
interface.
SnmpStatusException
- if the entry cannot be unregistered.protected Object[] getBasicEntries()
protected void bindWithTableMeta()
|
Open Source build 02 opendmk-1.0-b02 2007.10.01_19:17:46_MEST |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |