|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.management.snmp.agent.SnmpMibNode com.sun.management.snmp.agent.SnmpMibTable
public abstract class SnmpMibTable
This class is the base class for SNMP table metadata.
Its responsibility is to manage a sorted array of OID indexes
according to the SNMP indexing scheme over the "real" table.
Each object of this class can be bound to an
SnmpTableEntryFactory
to which it will
forward remote entry creation requests, and invoke callbacks
when an entry has been successfully added to / removed from
the OID index array.
For each table defined in the MIB, mibgen will generate a specific
class called TableTableName that will implement the
SnmpTableEntryFactory interface, and a corresponding
TableNameMeta class that will extend this class.
The TableTableName class corresponds to the MBean view of the
table while the TableNameMeta class corresponds to the
MIB metadata view of the same table.
Objects of this class are instantiated by the generated
whole MIB class extending SnmpMib
You should never need to instantiate this class directly.
SnmpMib
,
SnmpMibEntry
,
SnmpTableEntryFactory
,
SnmpTableSupport
,
Serialized FormField Summary | |
---|---|
protected boolean |
creationEnabled
true if remote creation of entries via SET operations
is enabled. |
protected SnmpTableEntryFactory |
factory
The entry factory |
protected int |
nodeId
The id of the contained entry object. |
protected SnmpMib |
theMib
The MIB to which the metadata is linked. |
Fields inherited from class com.sun.management.snmp.agent.SnmpMibNode |
---|
noSuchInstanceException, noSuchNameException, noSuchObjectException, varList |
Constructor Summary | |
---|---|
SnmpMibTable(SnmpMib mib)
Create a new SnmpMibTable metadata node. |
Method Summary | |
---|---|
void |
addEntry(SnmpOid rowOid,
Object entry)
Add a new entry in this SnmpMibTable . |
void |
addEntry(SnmpOid oid,
ObjectName name,
Object entry)
Add a new entry in this SnmpMibTable . |
void |
addNotificationListener(NotificationListener listener,
NotificationFilter filter,
Object handback)
Enable to add an SNMP entry listener to this SnmpMibTable . |
protected void |
beginRowAction(SnmpMibSubRequest request,
SnmpOid rowOid,
int depth,
int rowAction)
This method takes care of initial RowStatus handling during the check() phase of a SET request. |
void |
check(SnmpMibSubRequest request,
int depth)
Generic handling of the check operation. |
protected abstract void |
check(SnmpMibSubRequest request,
SnmpOid rowOid,
int depth)
This method is used internally and is implemented by the SnmpMibTable subclasses generated by mibgen . |
protected void |
checkRemoveTableRow(SnmpMibSubRequest request,
SnmpOid rowOid,
int depth)
Check whether the specified row can be removed from the table. |
protected void |
checkRowStatusChange(SnmpMibSubRequest request,
SnmpOid rowOid,
int depth,
int newStatus)
Check whether the control variable of the given row can be switched to the new specified newStatus . |
protected boolean |
contains(SnmpOid oid,
Object userData)
Return true if the entry identified by the given OID index is contained in this table. |
abstract void |
createNewEntry(SnmpMibSubRequest request,
SnmpOid rowOid,
int depth)
This method is invoked when the creation of a new entry is requested by a remote SNMP manager. |
protected void |
endRowAction(SnmpMibSubRequest request,
SnmpOid rowOid,
int depth,
int rowAction)
This method takes care of final RowStatus handling during the set() phase of a SET request. |
void |
get(SnmpMibSubRequest request,
int depth)
Generic handling of the get operation. |
protected abstract void |
get(SnmpMibSubRequest request,
SnmpOid rowOid,
int depth)
This method is used internally and is implemented by the SnmpMibTable subclasses generated by mibgen . |
Object[] |
getBasicEntries()
Return the entries stored in this table SnmpMibTable . |
Object |
getEntry(SnmpOid rowOid)
Get the entry corresponding to the specified rowOid. |
ObjectName |
getEntryName(SnmpOid rowOid)
Get the ObjectName of the entry corresponding to the specified rowOid. |
protected SnmpOid |
getNextOid(Object userData)
Return the first entry OID registered in the table. |
protected SnmpOid |
getNextOid(SnmpOid oid,
Object userData)
Get the SnmpOid index of the row that follows
the given oid in the table. |
protected abstract long |
getNextVarEntryId(SnmpOid rowOid,
long var,
Object userData)
This method is used internally and is implemented by the SnmpMibTable subclasses generated by mibgen . |
protected long |
getNextVarEntryId(SnmpOid rowOid,
long var,
Object userData,
int pduVersion)
Return the next OID arc corresponding to a readable columnar object in the underlying entry OBJECT-TYPE, possibly skipping over those objects that must not or cannot be returned. |
MBeanNotificationInfo[] |
getNotificationInfo()
Return a NotificationInfo object containing the
notification class and the notification type sent by the
SnmpMibTable . |
protected int |
getRowAction(SnmpMibSubRequest request,
SnmpOid rowOid,
int depth)
Return the RowStatus code value specified in this request. |
int |
getSize()
Get the size of the table. |
boolean |
hasRowStatus()
Return true if the conceptual row contains a columnar
object used to control creation/deletion of rows in this table. |
boolean |
isCreationEnabled()
Tell whether a new entry should be created when a SET operation is received for an entry that does not exist yet. |
protected abstract boolean |
isReadableEntryId(SnmpOid rowOid,
long var,
Object userData)
This method is used internally and is implemented by the SnmpMibTable subclasses generated by mibgen . |
abstract boolean |
isRegistrationRequired()
Tell whether the specific version of this metadata generated by mibgen requires entries to be registered with
the MBeanServer. |
protected boolean |
isRowReady(SnmpOid rowOid,
Object userData)
Tell whether the specified row is ready and can be put in the notInService state. |
protected boolean |
isRowStatus(SnmpOid rowOid,
long var,
Object userData)
Return true if the columnar object identified by var
is used to control the addition/deletion of rows in this table. |
protected int |
mapRowStatus(SnmpOid rowOid,
SnmpVarBind vbstatus,
Object userData)
Map the value of the vbstatus varbind to the
corresponding RowStatus code defined in
EnumRowStatus . |
void |
registerEntryFactory(SnmpTableEntryFactory factory)
Register the factory through which table entries should be created when remote entry creation is enabled. |
void |
removeEntry(int pos,
Object entry)
Remove the specified entry from the table. |
void |
removeEntry(SnmpOid rowOid)
Remove the specified entry from the table. |
void |
removeEntry(SnmpOid rowOid,
Object entry)
Remove the specified entry from the table. |
void |
removeNotificationListener(NotificationListener listener)
Enable to remove an SNMP entry listener from this SnmpMibTable . |
protected void |
removeTableRow(SnmpMibSubRequest request,
SnmpOid rowOid,
int depth)
Remove a table row upon a remote manager request. |
void |
set(SnmpMibSubRequest request,
int depth)
Generic handling of the set operation. |
protected abstract void |
set(SnmpMibSubRequest request,
SnmpOid rowOid,
int depth)
This method is used internally and is implemented by the SnmpMibTable subclasses generated by mibgen . |
void |
setCreationEnabled(boolean remoteCreationFlag)
This method lets you dynamically switch the creation policy. |
protected SnmpValue |
setRowStatus(SnmpOid rowOid,
int newStatus,
Object userData)
Set the control variable to the specified newStatus
value. |
protected boolean |
skipEntryVariable(SnmpOid rowOid,
long var,
Object userData,
int pduVersion)
Hook for subclasses. |
protected abstract void |
validateVarEntryId(SnmpOid rowOid,
long var,
Object userData)
This method is used internally and is implemented by the SnmpMibTable subclasses generated by mibgen . |
Methods inherited from class com.sun.management.snmp.agent.SnmpMibNode |
---|
getNextIdentifier, getNextVarId, getNextVarId, getRootOid, skipVariable, sort |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int nodeId
protected SnmpMib theMib
protected boolean creationEnabled
true
if remote creation of entries via SET operations
is enabled.
[default value is false
]
protected SnmpTableEntryFactory factory
Constructor Detail |
---|
public SnmpMibTable(SnmpMib mib)
SnmpMibTable
metadata node.
mib
- The SNMP MIB to which the metadata will be linked.Method Detail |
---|
public abstract void createNewEntry(SnmpMibSubRequest request, SnmpOid rowOid, int depth) throws SnmpStatusException
setCreationEnabled(true)
and
setCreationEnabled(false)
on this object.
This method is called internally by the SNMP runtime and you should never need to call it directly. However you might want to extend it in order to implement your own specific application behavior, should the default behavior not be at your convenience.
request
- The SNMP subrequest requesting this creationrowOid
- The OID indexing the conceptual row (entry) for which
the creation was requested.depth
- The position of the columnar object arc in the OIDs
from the varbind list.
SnmpStatusException
- if the entry cannot be created.public abstract boolean isRegistrationRequired()
mibgen
requires entries to be registered with
the MBeanServer. In this case an ObjectName will have to be
passed to addEntry() in order for the table to behave correctly
(case of the generic metadata).
If that version of the metadata does not require entry to be registered, then passing an ObjectName becomes optional (null can be passed instead).
true
if registration is required by this
version of the metadata.public boolean isCreationEnabled()
false
]public void setCreationEnabled(boolean remoteCreationFlag)
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.
public boolean hasRowStatus()
true
if the conceptual row contains a columnar
object used to control creation/deletion of rows in this table.
This columnar object can be either a variable with RowStatus syntax as defined by RFC 2579, or a plain variable whose semantics is table specific.
By default, this function returns false
, and it is
assumed that the table has no such control variable.
When mibgen
is used over SMIv2 MIBs, it will generate
an hasRowStatus()
method returning true
for each table containing an object with RowStatus syntax.
When this method returns false
the default mechanism
for remote entry creation is used.
Otherwise, creation/deletion is performed as specified
by the control variable (see getRowAction() for more details).
This method is called internally when a SET request involving this table is processed.
If you need to implement a control variable which do not use
the RowStatus convention as defined by RFC 2579, you should
subclass the generated table metadata class in order to redefine
this method and make it returns true
.
You will then have to redefine the isRowStatus(), mapRowStatus(),
isRowReady(), and setRowStatus() methods to suit your specific
implementation.
true
if this table contains a control
variable (e.g. a variable with RFC 2579 RowStatus syntax),
false
if this table does not contain
any control variable.public void get(SnmpMibSubRequest request, int depth) throws SnmpStatusException
get
operation.
The default implementation of this method is to
get(request,oid,depth+1)
method.
public void get(SnmpMibSubRequest request, int depth) throws SnmpStatusException { boolean isnew = request.isNewEntry(); // if the entry does not exists, then registers an error for // each varbind involved (nb: this should not happen, since // the error should already have been detected earlier) // if (isnew) { SnmpVarBind var = null; for (Enumeration e= request.getElements(); e.hasMoreElements();) { var = (SnmpVarBind) e.nextElement(); request.registerGetException(var,noSuchNameException); } } final SnmpOid oid = request.getEntryOid(); get(request,oid,depth+1); }
You should not need to override this method in any cases, because
it will eventually call
get(SnmpMibSubRequest request, int depth)
on the generated
derivative of SnmpMibEntry
. If you need to implement
specific policies for minimizing the accesses made to some remote
underlying resources, or if you need to implement some consistency
checks between the different values provided in the varbind list,
you should then rather override
get(SnmpMibSubRequest request, int depth)
on the generated
derivative of SnmpMibEntry
.
get
in class SnmpMibNode
request
- The sub-request that must be handled by this node.depth
- The depth reached in the OID tree.
SnmpStatusException
- An error occurred while accessing
the MIB node.public void check(SnmpMibSubRequest request, int depth) throws SnmpStatusException
check
operation.
The default implementation of this method is to
check(request,oid,depth+1)
method.
public void check(SnmpMibSubRequest request, int depth) throws SnmpStatusException { final SnmpOid oid = request.getEntryOid(); final int action = getRowAction(request,oid,depth+1); beginRowAction(request,oid,depth+1,action); check(request,oid,depth+1); }
You should not need to override this method in any cases, because
it will eventually call
check(SnmpMibSubRequest request, int depth)
on the generated
derivative of SnmpMibEntry
. If you need to implement
specific policies for minimizing the accesses made to some remote
underlying resources, or if you need to implement some consistency
checks between the different values provided in the varbind list,
you should then rather override
check(SnmpMibSubRequest request, int depth)
on the generated
derivative of SnmpMibEntry
.
check
in class SnmpMibNode
request
- The sub-request that must be handled by this node.depth
- The depth reached in the OID tree.
SnmpStatusException
- An error occurred while accessing
the MIB node.public void set(SnmpMibSubRequest request, int depth) throws SnmpStatusException
set
operation.
The default implementation of this method is to
call the generated
set(request,oid,depth+1)
method.
public void set(SnmpMibSubRequest request, int depth) throws SnmpStatusException { final SnmpOid oid = request.getEntryOid(); final int action = getRowAction(request,oid,depth+1); set(request,oid,depth+1); endRowAction(request,oid,depth+1,action); }
You should not need to override this method in any cases, because
it will eventually call
set(SnmpMibSubRequest request, int depth)
on the generated
derivative of SnmpMibEntry
. If you need to implement
specific policies for minimizing the accesses made to some remote
underlying resources, or if you need to implement some consistency
checks between the different values provided in the varbind list,
you should then rather override
set(SnmpMibSubRequest request, int depth)
on the generated
derivative of SnmpMibEntry
.
set
in class SnmpMibNode
request
- The sub-request that must be handled by this node.depth
- The depth reached in the OID tree.
SnmpStatusException
- An error occurred while accessing
the MIB node.public void addEntry(SnmpOid rowOid, Object entry) throws SnmpStatusException
SnmpMibTable
.
Also triggers the addEntryCB() callback of the
SnmpTableEntryFactory
interface
if this node is bound to a factory.
This method assumes that the given entry will not be registered.
If the entry is going to be registered, or if ObjectName's are
required, then
addEntry(SnmpOid, ObjectName, Object)
should be preferred.
rowOid
- The SnmpOid
identifying the table
row to be added.entry
- The entry to add.
SnmpStatusException
- The entry couldn't be added
at the position identified by the given
rowOid
, or this version of the metadata
requires ObjectName's.public void addEntry(SnmpOid oid, ObjectName name, Object entry) throws SnmpStatusException
SnmpMibTable
.
Also triggers the addEntryCB() callback of the
SnmpTableEntryFactory
interface
if this node is bound to a factory.
oid
- The SnmpOid
identifying the table
row to be added.name
- The ObjectName with which this entry is registered.
This parameter can be omitted if isRegistrationRequired()
return false.entry
- The entry to add.
SnmpStatusException
- The entry couldn't be added
at the position identified by the given
rowOid
, or if this version of the metadata
requires ObjectName's, and the given name is null.public void removeEntry(SnmpOid rowOid, Object entry) throws SnmpStatusException
SnmpTableEntryFactory
interface
if this node is bound to a factory.
rowOid
- The SnmpOid
identifying the table
row to remove.entry
- The entry to be removed. This parameter is not used
internally, it is simply passed along to the
removeEntryCB() callback.
SnmpStatusException
- if the specified entry couldn't
be removed (if the given rowOid
is not
valid for instance).public void removeEntry(SnmpOid rowOid) throws SnmpStatusException
SnmpTableEntryFactory
interface
if this node is bound to a factory.
rowOid
- The SnmpOid
identifying the table
row to remove.
SnmpStatusException
- if the specified entry couldn't
be removed (if the given rowOid
is not
valid for instance).public void removeEntry(int pos, Object entry) throws SnmpStatusException
SnmpTableEntryFactory
interface
if this node is bound to a factory.
pos
- The position of the entry in the table.entry
- The entry to be removed. This parameter is not used
internally, it is simply passed along to the
removeEntryCB() callback.
SnmpStatusException
- if the specified entry couldn't
be removed.public Object getEntry(SnmpOid rowOid) throws SnmpStatusException
rowOid
- The SnmpOid
identifying the
row to be retrieved.
SnmpStatusException
- There is no entry with the specified
rowOid
in the table.public ObjectName getEntryName(SnmpOid rowOid) throws SnmpStatusException
rowOid
- The SnmpOid
identifying the table
row whose ObjectName we want to retrieve.
SnmpStatusException
- There is no entry with the specified
rowOid
in the table.public Object[] getBasicEntries()
SnmpMibTable
.
If the subclass generated by mibgen uses the generic way to access
the entries (i.e. if it goes through the MBeanServer) then some of
the entries may be null
. It all depends whether a non
null
entry was passed to addEntry().
Otherwise, if it uses the standard way (access the entry directly
through their standard MBean interface) this array will contain all
the entries.
public int getSize()
public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
SnmpMibTable
.
addNotificationListener
in interface NotificationBroadcaster
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
.
removeNotificationListener
in interface NotificationBroadcaster
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
.
getNotificationInfo
in interface NotificationBroadcaster
public void registerEntryFactory(SnmpTableEntryFactory factory)
factory
- The
SnmpTableEntryFactory
through
which entries will be created when a remote SNMP manager
request the creation of a new entry via an SNMP SET request.protected boolean isRowStatus(SnmpOid rowOid, long var, Object userData)
var
is used to control the addition/deletion of rows in this table.
By default, this method assumes that there is no control variable
and always return false
If this table was defined using SMIv2, and if it contains a
control variable with RowStatus syntax, mibgen
will generate a non default implementation for this method
that will identify the RowStatus control variable.
You will have to redefine this method if you need to implement control variables that do not conform to RFC 2579 RowStatus TEXTUAL-CONVENTION.
rowOid
- The SnmpOid
identifying the table
row involved in the operation.var
- The OID arc identifying the involved columnar object.userData
- A contextual object containing user-data.
This object is allocated through the
SnmpUserDataFactory
for each incoming SNMP request.protected int getRowAction(SnmpMibSubRequest request, SnmpOid rowOid, int depth) throws SnmpStatusException
The RowStatus code value should be one of the values defined
by EnumRowStatus
. These codes correspond
to RowStatus codes as defined in RFC 2579, plus the unspecified
value which is Java DMK specific.
request
- The sub-request that must be handled by this node.rowOid
- The SnmpOid
identifying the table
row involved in the operation.depth
- The depth reached in the OID tree.
SnmpStatusException
- if the value of the control variable
could not be mapped to a RowStatus code.EnumRowStatus
protected int mapRowStatus(SnmpOid rowOid, SnmpVarBind vbstatus, Object userData) throws SnmpStatusException
vbstatus
varbind to the
corresponding RowStatus code defined in
EnumRowStatus
.
These codes correspond to RowStatus codes as defined in RFC 2579,
plus the unspecified value which is Java DMK specific.
By default, this method assumes that the control variable is an Integer, and it simply returns its value without further analysis.
If this table was defined using SMIv2, and if it contains a
control variable with RowStatus syntax, mibgen
will generate a non default implementation for this method.
You will have to redefine this method if you need to implement control variables that do not conform to RFC 2579 RowStatus TEXTUAL-CONVENTION.
rowOid
- The SnmpOid
identifying the table
row involved in the operation.vbstatus
- The SnmpVarBind containing the value of the control
variable, as identified by the isRowStatus() method.userData
- A contextual object containing user-data.
This object is allocated through the
SnmpUserDataFactory
for each incoming SNMP request.
vbstatus
.
SnmpStatusException
- if the value of the control variable
could not be mapped to a RowStatus code.EnumRowStatus
protected SnmpValue setRowStatus(SnmpOid rowOid, int newStatus, Object userData) throws SnmpStatusException
newStatus
value.
This method maps the given newStatus
to the appropriate
value for the control variable, then sets the control variable in
the entry identified by rowOid
. It returns the new
value of the control variable.
By default, it is assumed that there is no control variable so this
method does nothing and simply returns null
.
If this table was defined using SMIv2, and if it contains a
control variable with RowStatus syntax, mibgen
will generate a non default implementation for this method.
You will have to redefine this method if you need to implement control variables that do not conform to RFC 2579 RowStatus TEXTUAL-CONVENTION.
rowOid
- The SnmpOid
identifying the table
row involved in the operation.newStatus
- The new status for the row: one of the
RowStatus code defined in
EnumRowStatus
. These codes
correspond to RowStatus codes as defined in RFC 2579,
plus the unspecified value which is Java DMK specific.userData
- A contextual object containing user-data.
This object is allocated through the
SnmpUserDataFactory
for each incoming SNMP request.
new SnmpInt(newStatus)
) or null
if the table do not have any control variable.
SnmpStatusException
- If the given newStatus
could not be set on the specified entry, or if the
given newStatus
is not valid.EnumRowStatus
protected boolean isRowReady(SnmpOid rowOid, Object userData) throws SnmpStatusException
This method is called only once, after all the varbind have been set on a new entry for which createAndWait was specified.
If the entry is not yet ready, this method should return false.
It will then be the responsibility of the entry to switch its
own state to notInService when it becomes ready.
No further call to isRowReady()
will be made.
By default, this method always return true.
mibgen
will not generate any specific implementation
for this method - meaning that by default, a row created using
createAndWait will always be placed in notInService
state at the end of the request.
If this table was defined using SMIv2, and if it contains a
control variable with RowStatus syntax, mibgen
will generate an implementation for this method that will
delegate the work to the metadata class modeling the conceptual
row, so that you can override the default behavior by subclassing
that metadata class.
You will have to redefine this method if this default mechanism does not suit your needs.
rowOid
- The SnmpOid
identifying the table
row involved in the operation.userData
- A contextual object containing user-data.
This object is allocated through the
SnmpUserDataFactory
for each incoming SNMP request.
true
if the row can be placed in
notInService state.
SnmpStatusException
- An error occurred while trying
to retrieve the row status, and the operation should
be aborted.EnumRowStatus
protected void checkRowStatusChange(SnmpMibSubRequest request, SnmpOid rowOid, int depth, int newStatus) throws SnmpStatusException
newStatus
.
This method is called during the check phase of a SET request when the control variable specifies active or notInService.
By default it is assumed that nothing prevents putting the row in the requested state, and this method does nothing. It is simply provided as a hook so that specific checks can be implemented.
Note that if the actual row deletion fails afterward, the atomicity of the request is no longer guaranteed.
request
- The sub-request that must be handled by this node.rowOid
- The SnmpOid
identifying the table
row involved in the operation.depth
- The depth reached in the OID tree.newStatus
- The new status for the row: one of the
RowStatus code defined in
EnumRowStatus
. These codes
correspond to RowStatus codes as defined in RFC 2579,
plus the unspecified value which is Java DMK specific.
SnmpStatusException
- if switching to this new state
would fail.protected void checkRemoveTableRow(SnmpMibSubRequest request, SnmpOid rowOid, int depth) throws SnmpStatusException
This method is called during the check phase of a SET request when the control variable specifies destroy
By default it is assumed that nothing prevents row deletion and this method does nothing. It is simply provided as a hook so that specific checks can be implemented.
Note that if the actual row deletion fails afterward, the atomicity of the request is no longer guaranteed.
request
- The sub-request that must be handled by this node.rowOid
- The SnmpOid
identifying the table
row involved in the operation.depth
- The depth reached in the OID tree.
SnmpStatusException
- if the row deletion must be
rejected.protected void removeTableRow(SnmpMibSubRequest request, SnmpOid rowOid, int depth) throws SnmpStatusException
getRowAction()
yields destroy - i.e.: it is only called when a remote
manager requests the removal of a table row.
By default, this method simply calls removeEntry(rowOid)
.
You can redefine this method if you need to implement some specific behavior when a remote row deletion is invoked.
Note that specific checks should not be implemented in this
method, but rather in checkRemoveTableRow()
.
If checkRemoveTableRow()
succeeds and this method
fails afterward, the atomicity of the original SET request can no
longer be guaranteed.
request
- The sub-request that must be handled by this node.rowOid
- The SnmpOid
identifying the table
row involved in the operation.depth
- The depth reached in the OID tree.
SnmpStatusException
- if the actual row deletion fails.
This should not happen since it would break the
atomicity of the SET request. Specific checks should
be implemented in checkRemoveTableRow()
if needed. If the entry does not exists, no exception
is generated and the method simply returns.protected void beginRowAction(SnmpMibSubRequest request, SnmpOid rowOid, int depth, int rowAction) throws SnmpStatusException
rowAction
returned by
getRowAction()
is valid.rowAction
specified it will:
createNewEntry()
(
rowAction = createAndGo or createAndWait
),checkRemoveTableRow()
(
rowAction = destroy
),checkRowStatusChange()
(
rowAction = active or notInService
),
rowAction
is not correct.In principle, you should not need to redefine this method.
beginRowAction()
is called during the check phase
of a SET request, before actual checking on the varbind list
is performed.
request
- The sub-request that must be handled by this node.rowOid
- The SnmpOid
identifying the table
row involved in the operation.depth
- The depth reached in the OID tree.rowAction
- The requested action as returned by
getRowAction()
: one of the RowStatus codes defined in
EnumRowStatus
. These codes
correspond to RowStatus codes as defined in RFC 2579,
plus the unspecified value which is Java DMK specific.
SnmpStatusException
- if the specified rowAction
is not valid or cannot be executed.
This should not happen since it would break the
atomicity of the SET request. Specific checks should
be implemented in beginRowAction()
if needed.EnumRowStatus
protected void endRowAction(SnmpMibSubRequest request, SnmpOid rowOid, int depth, int rowAction) throws SnmpStatusException
setRowStatus(active)
( rowAction = createAndGo or active
),setRowStatus(notInService or
notReady)
depending on the result of
isRowReady() (rowAction = createAndWait
),
setRowStatus(notInService)
( rowAction = notInService
),
removeTableRow()
(
rowAction = destroy
),
rowAction
is not correct. This should be avoided
since it would break SET request atomicityIn principle, you should not need to redefine this method.
endRowAction()
is called during the set() phase
of a SET request, after the actual set() on the varbind list
has been performed. The varbind containing the control variable
is updated with the value returned by setRowStatus() (if it is
not null
).
request
- The sub-request that must be handled by this node.rowOid
- The SnmpOid
identifying the table
row involved in the operation.depth
- The depth reached in the OID tree.rowAction
- The requested action as returned by
getRowAction()
: one of the RowStatus codes defined in
EnumRowStatus
. These codes
correspond to RowStatus codes as defined in RFC 2579,
plus the unspecified value which is Java DMK specific.
SnmpStatusException
- if the specified rowAction
is not valid.EnumRowStatus
protected long getNextVarEntryId(SnmpOid rowOid, long var, Object userData, int pduVersion) throws SnmpStatusException
getNextVarEntryId(com.sun.management.snmp.SnmpOid,long,
java.lang.Object)
,
until
skipEntryVariable(com.sun.management.snmp.SnmpOid,long,
java.lang.Object,int)
returns false.
rowOid
- The OID index of the row involved in the operation.var
- Id of the variable we start from, looking for the next.userData
- A contextual object containing user-data.
This object is allocated through the
SnmpUserDataFactory
for each incoming SNMP request.pduVersion
- Protocol version of the original request PDU.
SnmpStatusException
- If no id is found after the given id.protected boolean skipEntryVariable(SnmpOid rowOid, long var, Object userData, int pduVersion)
rowOid
- The OID index of the row involved in the operation.var
- Id of the variable we start from, looking for the next.userData
- A contextual object containing user-data.
This object is allocated through the
SnmpUserDataFactory
for each incoming SNMP request.pduVersion
- Protocol version of the original request PDU.
protected SnmpOid getNextOid(SnmpOid oid, Object userData) throws SnmpStatusException
SnmpOid
index of the row that follows
the given oid
in the table. The given
oid
does not need to be a valid row OID index.
oid
- The OID from which the search will begin.userData
- A contextual object containing user-data.
This object is allocated through the
SnmpUserDataFactory
for each incoming SNMP request.
SnmpOid
index.
SnmpStatusException
- There is no index following the
specified oid
in the table.protected SnmpOid getNextOid(Object userData) throws SnmpStatusException
userData
- A contextual object containing user-data.
This object is allocated through the
SnmpUserDataFactory
for each incoming SNMP request.
SnmpOid
of the first entry in the table.
SnmpStatusException
- If the table is empty.protected abstract long getNextVarEntryId(SnmpOid rowOid, long var, Object userData) throws SnmpStatusException
SnmpMibTable
subclasses generated by mibgen
.
Return the next OID arc corresponding to a readable columnar object in the underlying entry OBJECT-TYPE.
rowOid
- The OID index of the row involved in the operation.var
- Id of the variable we start from, looking for the next.userData
- A contextual object containing user-data.
This object is allocated through the
SnmpUserDataFactory
for each incoming SNMP request.
SnmpStatusException
- If no id is found after the given id.protected abstract void validateVarEntryId(SnmpOid rowOid, long var, Object userData) throws SnmpStatusException
SnmpMibTable
subclasses generated by mibgen
.
rowOid
- The OID index of the row involved in the operation.var
- The var we want to validate.userData
- A contextual object containing user-data.
This object is allocated through the
SnmpUserDataFactory
for each incoming SNMP request.
SnmpStatusException
- If this id is not valid.protected abstract boolean isReadableEntryId(SnmpOid rowOid, long var, Object userData) throws SnmpStatusException
SnmpMibTable
subclasses generated by mibgen
.
rowOid
- The OID index of the row involved in the operation.var
- The OID arc.userData
- A contextual object containing user-data.
This object is allocated through the
SnmpUserDataFactory
for each incoming SNMP request.
SnmpStatusException
- If this id is not valid.protected abstract void get(SnmpMibSubRequest request, SnmpOid rowOid, int depth) throws SnmpStatusException
SnmpMibTable
subclasses generated by mibgen
.
SnmpStatusException
protected abstract void check(SnmpMibSubRequest request, SnmpOid rowOid, int depth) throws SnmpStatusException
SnmpMibTable
subclasses generated by mibgen
.
SnmpStatusException
protected abstract void set(SnmpMibSubRequest request, SnmpOid rowOid, int depth) throws SnmpStatusException
SnmpMibTable
subclasses generated by mibgen
.
SnmpStatusException
protected boolean contains(SnmpOid oid, Object userData)
Do not call this method directly.
This method is provided has a hook for subclasses. It is called when a get/set request is received in order to determine whether the specified entry is contained in the table. You may want to override this method if you need to perform e.g. lazy evaluation of tables (you need to update the table when a request is received) or if your table is virtual.
Note that this method is called by the Runtime from within a synchronized block.
oid
- The index part of the OID we're looking for.userData
- A contextual object containing user-data.
This object is allocated through the
SnmpUserDataFactory
for each incoming SNMP request.
true
if the entry is found, false
otherwise.
|
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 |