public class

SnmpGenericObjectServer

extends Object
java.lang.Object
   ↳ com.sun.jmx.snmp.agent.SnmpGenericObjectServer

Class Overview

This class is a utility class that transforms SNMP GET / SET requests into standard JMX getAttributes() setAttributes() requests.

The transformation relies on the metadata information provided by the SnmpGenericMetaServer object which is passed as the first parameter to every method. This SnmpGenericMetaServer object is usually a Metadata object generated by mibgen.

This class is used internally by mibgen generated metadata objects and you should never need to use it directly.

This API is a Sun Microsystems internal API and is subject to change without notice.

Summary

Fields
protected final MBeanServer server The MBean server through which the MBeans will be accessed.
Public Constructors
SnmpGenericObjectServer(MBeanServer server)
Builds a new SnmpGenericObjectServer.
Public Methods
void check(SnmpGenericMetaServer meta, ObjectName name, SnmpValue x, long id, Object data)
Checks whether a SET operation can be performed on a given SNMP variable.
void check(SnmpGenericMetaServer meta, ObjectName name, SnmpMibSubRequest req, int depth)
Checks whether an SNMP SET request can be successfully performed.
void get(SnmpGenericMetaServer meta, ObjectName name, SnmpMibSubRequest req, int depth)
Execute an SNMP GET request.
SnmpValue get(SnmpGenericMetaServer meta, ObjectName name, long id, Object data)
Get the value of an SNMP variable.
void registerTableEntry(SnmpMibTable meta, SnmpOid rowOid, ObjectName objname, Object entry)
SnmpValue set(SnmpGenericMetaServer meta, ObjectName name, SnmpValue x, long id, Object data)
Set the value of an SNMP variable.
void set(SnmpGenericMetaServer meta, ObjectName name, SnmpMibSubRequest req, int depth)
Execute an SNMP SET request.
[Expand]
Inherited Methods
From class java.lang.Object

Fields

protected final MBeanServer server

The MBean server through which the MBeans will be accessed.

Public Constructors

public SnmpGenericObjectServer (MBeanServer server)

Builds a new SnmpGenericObjectServer. Usually there will be a single object of this type per MIB.

Parameters
server The MBeanServer in which the MBean accessed by this MIB are registered.

Public Methods

public void check (SnmpGenericMetaServer meta, ObjectName name, SnmpValue x, long id, Object data)

Checks whether a SET operation can be performed on a given SNMP variable.

Parameters
meta The impacted metadata object
name The ObjectName of the impacted MBean
x The new requested SnmpValue
id The OID arc identifying the variable we're trying to set.
data User contextual data allocated through the SnmpUserDataFactory

This method calls checkSetAccess() on the meta object, and then tries to invoke the checkAttributeName() method on the MBean. If this method is not defined then it is assumed that the SET won't fail.

This method is called internally by mibgen generated objects and you should never need to call it directly.

Throws
SnmpStatusException if the requested SET operation must be rejected. Raising an exception will abort the request.
Exceptions should never be raised directly, but only by means of req.registerCheckException(VariableId,SnmpStatusException)

public void check (SnmpGenericMetaServer meta, ObjectName name, SnmpMibSubRequest req, int depth)

Checks whether an SNMP SET request can be successfully performed.

For each variable in the subrequest, this method calls checkSetAccess() on the meta object, and then tries to invoke the checkAttributeName() method on the MBean. If this method is not defined then it is assumed that the SET won't fail.

This method is called internally by mibgen generated objects and you should never need to call it directly.

Parameters
meta The metadata object impacted by the subrequest
name The ObjectName of the MBean impacted by this subrequest
req The SNMP subrequest to execute on the MBean
depth The depth of the SNMP object in the OID tree.
Throws
SnmpStatusException if the requested SET operation must be rejected. Raising an exception will abort the request.
Exceptions should never be raised directly, but only by means of req.registerCheckException(VariableId,SnmpStatusException)

public void get (SnmpGenericMetaServer meta, ObjectName name, SnmpMibSubRequest req, int depth)

Execute an SNMP GET request.

This method first builds the list of attributes that need to be retrieved from the MBean and then calls getAttributes() on the MBean server. Then it updates the SnmpMibSubRequest with the values retrieved from the MBean.

The SNMP metadata information is obtained through the given meta object, which usually is an instance of a mibgen generated class.

This method is called internally by mibgen generated objects and you should never need to call it directly.

Parameters
meta The metadata object impacted by the subrequest
name The ObjectName of the MBean impacted by this subrequest
req The SNMP subrequest to execute on the MBean
depth The depth of the SNMP object in the OID tree.
Throws
SnmpStatusException whenever an SNMP exception must be raised. Raising an exception will abort the request.
Exceptions should never be raised directly, but only by means of req.registerGetException(VariableId,SnmpStatusException)

public SnmpValue get (SnmpGenericMetaServer meta, ObjectName name, long id, Object data)

Get the value of an SNMP variable.

You should never need to use this method directly.

Parameters
meta The impacted metadata object
name The ObjectName of the impacted MBean
id The OID arc identifying the variable we're trying to set.
data User contextual data allocated through the SnmpUserDataFactory
Returns
  • The value of the variable.
Throws
SnmpStatusException whenever an SNMP exception must be raised. Raising an exception will abort the request.
Exceptions should never be raised directly, but only by means of req.registerGetException(VariableId,SnmpStatusException)

public void registerTableEntry (SnmpMibTable meta, SnmpOid rowOid, ObjectName objname, Object entry)

public SnmpValue set (SnmpGenericMetaServer meta, ObjectName name, SnmpValue x, long id, Object data)

Set the value of an SNMP variable.

You should never need to use this method directly.

Parameters
meta The impacted metadata object
name The ObjectName of the impacted MBean
x The new requested SnmpValue
id The OID arc identifying the variable we're trying to set.
data User contextual data allocated through the SnmpUserDataFactory
Returns
  • The new value of the variable after the operation.
Throws
SnmpStatusException whenever an SNMP exception must be raised. Raising an exception will abort the request.
Exceptions should never be raised directly, but only by means of req.registerSetException(VariableId,SnmpStatusException)

public void set (SnmpGenericMetaServer meta, ObjectName name, SnmpMibSubRequest req, int depth)

Execute an SNMP SET request.

This method first builds the list of attributes that need to be set on the MBean and then calls setAttributes() on the MBean server. Then it updates the SnmpMibSubRequest with the new values retrieved from the MBean.

The SNMP metadata information is obtained through the given meta object, which usually is an instance of a mibgen generated class.

This method is called internally by mibgen generated objects and you should never need to call it directly.

Parameters
meta The metadata object impacted by the subrequest
name The ObjectName of the MBean impacted by this subrequest
req The SNMP subrequest to execute on the MBean
depth The depth of the SNMP object in the OID tree.
Throws
SnmpStatusException whenever an SNMP exception must be raised. Raising an exception will abort the request.
Exceptions should never be raised directly, but only by means of req.registerGetException(VariableId,SnmpStatusException)