com.sun.management.snmp.usm.usmmib
Class UsmUserTableMeta

java.lang.Object
  extended by com.sun.management.snmp.agent.SnmpMibNode
      extended by com.sun.management.snmp.agent.SnmpMibTable
          extended by com.sun.management.snmp.usm.usmmib.UsmUserTableMeta
All Implemented Interfaces:
Serializable, NotificationBroadcaster

public class UsmUserTableMeta
extends SnmpMibTable
implements Serializable

The class is used for implementing the "UsmUserTable" group. The group is defined with the following oid: 1.3.6.1.6.3.15.1.2.2.

Since:
Java DMK 5.1
See Also:
Serialized Form

Field Summary
protected  SnmpStandardObjectServer objectserver
          Reference to the object server.
 
Fields inherited from class com.sun.management.snmp.agent.SnmpMibTable
creationEnabled, factory, nodeId, theMib
 
Fields inherited from class com.sun.management.snmp.agent.SnmpMibNode
noSuchInstanceException, noSuchNameException, noSuchObjectException, varList
 
Constructor Summary
UsmUserTableMeta(SnmpMib myMib, SnmpStandardObjectServer objserv)
          Constructor for the table.
 
Method Summary
 void addEntry(SnmpOid rowOid, ObjectName objname, Object entry)
          Add a new entry in this SnmpMibTable.
 void check(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
          This method is used internally and is implemented by the SnmpMibTable subclasses generated by mibgen.
 void createNewEntry(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
          This method is invoked when the creation of a new entry is requested by a remote SNMP manager.
protected  UsmUserEntryMeta createUsmUserEntryMetaNode(String snmpEntryName, String tableName, SnmpMib mib, MBeanServer server)
          Factory method for "UsmUserEntry" entry metadata class.
 void get(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
          This method is used internally and is implemented by the SnmpMibTable subclasses generated by mibgen.
 long getNextVarEntryId(SnmpOid rowOid, long var, Object data)
          Returns the arc of the next columnar object following "var".
 int getRowStatus(SnmpOid rowOid, Object userData)
           
 boolean hasRowStatus()
          Return true if the conceptual row contains a columnar object used to control creation/deletion of rows in this table.
 boolean isReadableEntryId(SnmpOid rowOid, long var, Object data)
          Returns true if "var" identifies a readable scalar object.
 boolean isRegistrationRequired()
          Tell whether the specific version of this metadata generated by mibgen requires entries to be registered with the MBeanServer.
 boolean isRowReady(SnmpOid rowOid, Object userData)
          Tell whether the specified row is ready and can be put in the notInService state.
 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.
 int mapRowStatus(SnmpOid rowOid, SnmpVarBind vbstatus, Object userData)
          Map the value of the vbstatus varbind to the corresponding RowStatus code defined in EnumRowStatus.
 void registerEntryNode(SnmpMib mib, MBeanServer server)
           
 void set(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
          This method is used internally and is implemented by the SnmpMibTable subclasses generated by mibgen.
 SnmpValue setRowStatus(SnmpOid rowOid, int status, Object userData)
          Set the control variable to the specified newStatus value.
 void validateVarEntryId(SnmpOid rowOid, long var, Object data)
          check that the given "var" identifies a columnar object.
 
Methods inherited from class com.sun.management.snmp.agent.SnmpMibTable
addEntry, addNotificationListener, beginRowAction, check, checkRemoveTableRow, checkRowStatusChange, contains, endRowAction, get, getBasicEntries, getEntry, getEntryName, getNextOid, getNextOid, getNextVarEntryId, getNotificationInfo, getRowAction, getSize, isCreationEnabled, registerEntryFactory, removeEntry, removeEntry, removeEntry, removeNotificationListener, removeTableRow, set, setCreationEnabled, skipEntryVariable
 
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

objectserver

protected SnmpStandardObjectServer objectserver
Reference to the object server.

Constructor Detail

UsmUserTableMeta

public UsmUserTableMeta(SnmpMib myMib,
                        SnmpStandardObjectServer objserv)
Constructor for the table. Initialize metadata for "UsmUserTableMeta". The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK.

Method Detail

createUsmUserEntryMetaNode

protected UsmUserEntryMeta createUsmUserEntryMetaNode(String snmpEntryName,
                                                      String tableName,
                                                      SnmpMib mib,
                                                      MBeanServer server)
Factory method for "UsmUserEntry" entry metadata class. You can redefine this method if you need to replace the default generated metadata class with your own customized class.

Parameters:
snmpEntryName - Name of the SNMP Entry object (conceptual row) ("UsmUserEntry")
tableName - Name of the table in which the entries are registered ("UsmUserTable")
mib - The SnmpMib object in which this table is registered
server - MBeanServer for this table entries (may be null)
Returns:
An instance of the metadata class generated for the "UsmUserEntry" conceptual row (UsmUserEntryMeta)

createNewEntry

public void createNewEntry(SnmpMibSubRequest req,
                           SnmpOid rowOid,
                           int depth)
                    throws SnmpStatusException
Description copied from class: SnmpMibTable
This method is invoked when the creation of a new entry is requested by a remote SNMP manager.
By default, remote entry creation is disabled - and this method will not be called. You can dynamically switch the entry creation policy by calling 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.

Specified by:
createNewEntry in class SnmpMibTable
Parameters:
req - The SNMP subrequest requesting this creation
rowOid - 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.
Throws:
SnmpStatusException - if the entry cannot be created.

isRegistrationRequired

public boolean isRegistrationRequired()
Description copied from class: SnmpMibTable
Tell whether the specific version of this metadata generated by 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).

Specified by:
isRegistrationRequired in class SnmpMibTable
Returns:
true if registration is required by this version of the metadata.

registerEntryNode

public void registerEntryNode(SnmpMib mib,
                              MBeanServer server)

addEntry

public void addEntry(SnmpOid rowOid,
                     ObjectName objname,
                     Object entry)
              throws SnmpStatusException
Description copied from class: SnmpMibTable
Add a new entry in this SnmpMibTable. Also triggers the addEntryCB() callback of the SnmpTableEntryFactory interface if this node is bound to a factory.

Overrides:
addEntry in class SnmpMibTable
Parameters:
rowOid - The SnmpOid identifying the table row to be added.
objname - The ObjectName with which this entry is registered. This parameter can be omitted if isRegistrationRequired() return false.
entry - The entry to add.
Throws:
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.

isRowStatus

public boolean isRowStatus(SnmpOid rowOid,
                           long var,
                           Object userData)
Description copied from class: SnmpMibTable
Return true if the columnar object identified by 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.

Overrides:
isRowStatus in class SnmpMibTable
Parameters:
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.

hasRowStatus

public boolean hasRowStatus()
Description copied from class: SnmpMibTable
Return 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.

Overrides:
hasRowStatus in class SnmpMibTable
Returns:
  • 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.

  • setRowStatus

    public SnmpValue setRowStatus(SnmpOid rowOid,
                                  int status,
                                  Object userData)
                           throws SnmpStatusException
    Description copied from class: SnmpMibTable
    Set the control variable to the specified 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.

    Overrides:
    setRowStatus in class SnmpMibTable
    Parameters:
    rowOid - The SnmpOid identifying the table row involved in the operation.
    status - 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.
    Returns:
    The new value of the control variable (usually new SnmpInt(newStatus)) or null if the table do not have any control variable.
    Throws:
    SnmpStatusException - If the given newStatus could not be set on the specified entry, or if the given newStatus is not valid.
    See Also:
    EnumRowStatus

    isRowReady

    public boolean isRowReady(SnmpOid rowOid,
                              Object userData)
                       throws SnmpStatusException
    Description copied from class: SnmpMibTable
    Tell whether the specified row is ready and can be put in the notInService state.

    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.

    Overrides:
    isRowReady in class SnmpMibTable
    Parameters:
    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.
    Returns:
    true if the row can be placed in notInService state.
    Throws:
    SnmpStatusException - An error occurred while trying to retrieve the row status, and the operation should be aborted.
    See Also:
    EnumRowStatus

    mapRowStatus

    public int mapRowStatus(SnmpOid rowOid,
                            SnmpVarBind vbstatus,
                            Object userData)
                     throws SnmpStatusException
    Description copied from class: SnmpMibTable
    Map the value of the 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.

    Overrides:
    mapRowStatus in class SnmpMibTable
    Parameters:
    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.
    Returns:
    The RowStatus code mapped from the value contained in vbstatus.
    Throws:
    SnmpStatusException - if the value of the control variable could not be mapped to a RowStatus code.
    See Also:
    EnumRowStatus

    getRowStatus

    public int getRowStatus(SnmpOid rowOid,
                            Object userData)
                     throws SnmpStatusException
    Throws:
    SnmpStatusException

    get

    public void get(SnmpMibSubRequest req,
                    SnmpOid rowOid,
                    int depth)
             throws SnmpStatusException
    Description copied from class: SnmpMibTable
    This method is used internally and is implemented by the SnmpMibTable subclasses generated by mibgen.

    Specified by:
    get in class SnmpMibTable
    Throws:
    SnmpStatusException

    set

    public void set(SnmpMibSubRequest req,
                    SnmpOid rowOid,
                    int depth)
             throws SnmpStatusException
    Description copied from class: SnmpMibTable
    This method is used internally and is implemented by the SnmpMibTable subclasses generated by mibgen.

    Specified by:
    set in class SnmpMibTable
    Throws:
    SnmpStatusException

    check

    public void check(SnmpMibSubRequest req,
                      SnmpOid rowOid,
                      int depth)
               throws SnmpStatusException
    Description copied from class: SnmpMibTable
    This method is used internally and is implemented by the SnmpMibTable subclasses generated by mibgen.

    Specified by:
    check in class SnmpMibTable
    Throws:
    SnmpStatusException

    validateVarEntryId

    public void validateVarEntryId(SnmpOid rowOid,
                                   long var,
                                   Object data)
                            throws SnmpStatusException
    check that the given "var" identifies a columnar object.

    Specified by:
    validateVarEntryId in class SnmpMibTable
    Parameters:
    rowOid - The OID index of the row involved in the operation.
    var - The var we want to validate.
    data - A contextual object containing user-data. This object is allocated through the SnmpUserDataFactory for each incoming SNMP request.
    Throws:
    SnmpStatusException - If this id is not valid.

    isReadableEntryId

    public boolean isReadableEntryId(SnmpOid rowOid,
                                     long var,
                                     Object data)
                              throws SnmpStatusException
    Returns true if "var" identifies a readable scalar object.

    Specified by:
    isReadableEntryId in class SnmpMibTable
    Parameters:
    rowOid - The OID index of the row involved in the operation.
    var - The OID arc.
    data - A contextual object containing user-data. This object is allocated through the SnmpUserDataFactory for each incoming SNMP request.
    Throws:
    SnmpStatusException - If this id is not valid.

    getNextVarEntryId

    public long getNextVarEntryId(SnmpOid rowOid,
                                  long var,
                                  Object data)
                           throws SnmpStatusException
    Returns the arc of the next columnar object following "var".

    Specified by:
    getNextVarEntryId in class SnmpMibTable
    Parameters:
    rowOid - The OID index of the row involved in the operation.
    var - Id of the variable we start from, looking for the next.
    data - A contextual object containing user-data. This object is allocated through the SnmpUserDataFactory for each incoming SNMP request.
    Returns:
    The next columnar object id.
    Throws:
    SnmpStatusException - If no id is found after the given id.

    Open Source build 02
    opendmk-1.0-b02 2007.10.01_19:17:46_MEST

    Copyright 1998-2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.