jdk/src/share/classes/sun/management/snmp/jvmmib/JvmRTInputArgsTableMeta.java
changeset 2 90ce3da70b43
child 5506 202f599c92aa
equal deleted inserted replaced
0:fd16c54261b3 2:90ce3da70b43
       
     1 /*
       
     2  * Copyright 2003-2004 Sun Microsystems, Inc.  All Rights Reserved.
       
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4  *
       
     5  * This code is free software; you can redistribute it and/or modify it
       
     6  * under the terms of the GNU General Public License version 2 only, as
       
     7  * published by the Free Software Foundation.  Sun designates this
       
     8  * particular file as subject to the "Classpath" exception as provided
       
     9  * by Sun in the LICENSE file that accompanied this code.
       
    10  *
       
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    14  * version 2 for more details (a copy is included in the LICENSE file that
       
    15  * accompanied this code).
       
    16  *
       
    17  * You should have received a copy of the GNU General Public License version
       
    18  * 2 along with this work; if not, write to the Free Software Foundation,
       
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    20  *
       
    21  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
       
    22  * CA 95054 USA or visit www.sun.com if you need additional information or
       
    23  * have any questions.
       
    24  */
       
    25 
       
    26 package sun.management.snmp.jvmmib;
       
    27 
       
    28 //
       
    29 // Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
       
    30 //
       
    31 
       
    32 // java imports
       
    33 //
       
    34 import java.io.Serializable;
       
    35 import java.util.Vector;
       
    36 
       
    37 // jmx imports
       
    38 //
       
    39 import javax.management.MBeanServer;
       
    40 import javax.management.ObjectName;
       
    41 import com.sun.jmx.snmp.SnmpCounter;
       
    42 import com.sun.jmx.snmp.SnmpCounter64;
       
    43 import com.sun.jmx.snmp.SnmpGauge;
       
    44 import com.sun.jmx.snmp.SnmpInt;
       
    45 import com.sun.jmx.snmp.SnmpUnsignedInt;
       
    46 import com.sun.jmx.snmp.SnmpIpAddress;
       
    47 import com.sun.jmx.snmp.SnmpTimeticks;
       
    48 import com.sun.jmx.snmp.SnmpOpaque;
       
    49 import com.sun.jmx.snmp.SnmpString;
       
    50 import com.sun.jmx.snmp.SnmpStringFixed;
       
    51 import com.sun.jmx.snmp.SnmpOid;
       
    52 import com.sun.jmx.snmp.SnmpNull;
       
    53 import com.sun.jmx.snmp.SnmpValue;
       
    54 import com.sun.jmx.snmp.SnmpVarBind;
       
    55 import com.sun.jmx.snmp.SnmpStatusException;
       
    56 
       
    57 // jdmk imports
       
    58 //
       
    59 import com.sun.jmx.snmp.agent.SnmpIndex;
       
    60 import com.sun.jmx.snmp.agent.SnmpMib;
       
    61 import com.sun.jmx.snmp.agent.SnmpMibTable;
       
    62 import com.sun.jmx.snmp.agent.SnmpMibSubRequest;
       
    63 import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
       
    64 
       
    65 /**
       
    66  * The class is used for implementing the "JvmRTInputArgsTable" group.
       
    67  * The group is defined with the following oid: 1.3.6.1.4.1.42.2.145.3.163.1.1.4.20.
       
    68  */
       
    69 public class JvmRTInputArgsTableMeta extends SnmpMibTable implements Serializable {
       
    70 
       
    71     /**
       
    72      * Constructor for the table. Initialize metadata for "JvmRTInputArgsTableMeta".
       
    73      * The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK.
       
    74      */
       
    75     public JvmRTInputArgsTableMeta(SnmpMib myMib, SnmpStandardObjectServer objserv) {
       
    76         super(myMib);
       
    77         objectserver = objserv;
       
    78     }
       
    79 
       
    80 
       
    81     /**
       
    82      * Factory method for "JvmRTInputArgsEntry" entry metadata class.
       
    83      *
       
    84      * You can redefine this method if you need to replace the default
       
    85      * generated metadata class with your own customized class.
       
    86      *
       
    87      * @param snmpEntryName Name of the SNMP Entry object (conceptual row) ("JvmRTInputArgsEntry")
       
    88      * @param tableName Name of the table in which the entries are registered ("JvmRTInputArgsTable")
       
    89      * @param mib The SnmpMib object in which this table is registered
       
    90      * @param server MBeanServer for this table entries (may be null)
       
    91      *
       
    92      * @return An instance of the metadata class generated for the
       
    93      *         "JvmRTInputArgsEntry" conceptual row (JvmRTInputArgsEntryMeta)
       
    94      *
       
    95      **/
       
    96     protected JvmRTInputArgsEntryMeta createJvmRTInputArgsEntryMetaNode(String snmpEntryName, String tableName, SnmpMib mib, MBeanServer server)  {
       
    97         return new JvmRTInputArgsEntryMeta(mib, objectserver);
       
    98     }
       
    99 
       
   100 
       
   101     // ------------------------------------------------------------
       
   102     //
       
   103     // Implements the "createNewEntry" method defined in "SnmpMibTable".
       
   104     // See the "SnmpMibTable" Javadoc API for more details.
       
   105     //
       
   106     // ------------------------------------------------------------
       
   107 
       
   108     public void createNewEntry(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
       
   109         throws SnmpStatusException {
       
   110         if (factory != null)
       
   111             factory.createNewEntry(req, rowOid, depth, this);
       
   112         else
       
   113             throw new SnmpStatusException(
       
   114                 SnmpStatusException.snmpRspNoAccess);
       
   115     }
       
   116 
       
   117 
       
   118 
       
   119     // ------------------------------------------------------------
       
   120     //
       
   121     // Implements the "isRegistrationRequired" method defined in "SnmpMibTable".
       
   122     // See the "SnmpMibTable" Javadoc API for more details.
       
   123     //
       
   124     // ------------------------------------------------------------
       
   125 
       
   126     public boolean isRegistrationRequired()  {
       
   127         return false;
       
   128     }
       
   129 
       
   130 
       
   131 
       
   132     public void registerEntryNode(SnmpMib mib, MBeanServer server)  {
       
   133         node = createJvmRTInputArgsEntryMetaNode("JvmRTInputArgsEntry", "JvmRTInputArgsTable", mib, server);
       
   134     }
       
   135 
       
   136 
       
   137     // ------------------------------------------------------------
       
   138     //
       
   139     // Implements the "addEntry" method defined in "SnmpMibTable".
       
   140     // See the "SnmpMibTable" Javadoc API for more details.
       
   141     //
       
   142     // ------------------------------------------------------------
       
   143 
       
   144     public synchronized void addEntry(SnmpOid rowOid, ObjectName objname,
       
   145                  Object entry)
       
   146         throws SnmpStatusException {
       
   147         if (! (entry instanceof JvmRTInputArgsEntryMBean) )
       
   148             throw new ClassCastException("Entries for Table \"" +
       
   149                            "JvmRTInputArgsTable" + "\" must implement the \"" +
       
   150                            "JvmRTInputArgsEntryMBean" + "\" interface.");
       
   151         super.addEntry(rowOid, objname, entry);
       
   152     }
       
   153 
       
   154 
       
   155     // ------------------------------------------------------------
       
   156     //
       
   157     // Implements the "get" method defined in "SnmpMibTable".
       
   158     // See the "SnmpMibTable" Javadoc API for more details.
       
   159     //
       
   160     // ------------------------------------------------------------
       
   161 
       
   162     public void get(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
       
   163         throws SnmpStatusException {
       
   164         JvmRTInputArgsEntryMBean entry = (JvmRTInputArgsEntryMBean) getEntry(rowOid);
       
   165         synchronized (this) {
       
   166             node.setInstance(entry);
       
   167             node.get(req,depth);
       
   168         }
       
   169     }
       
   170 
       
   171     // ------------------------------------------------------------
       
   172     //
       
   173     // Implements the "set" method defined in "SnmpMibTable".
       
   174     // See the "SnmpMibTable" Javadoc API for more details.
       
   175     //
       
   176     // ------------------------------------------------------------
       
   177 
       
   178     public void set(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
       
   179         throws SnmpStatusException {
       
   180         if (req.getSize() == 0) return;
       
   181 
       
   182         JvmRTInputArgsEntryMBean entry = (JvmRTInputArgsEntryMBean) getEntry(rowOid);
       
   183         synchronized (this) {
       
   184             node.setInstance(entry);
       
   185             node.set(req,depth);
       
   186         }
       
   187     }
       
   188 
       
   189     // ------------------------------------------------------------
       
   190     //
       
   191     // Implements the "check" method defined in "SnmpMibTable".
       
   192     // See the "SnmpMibTable" Javadoc API for more details.
       
   193     //
       
   194     // ------------------------------------------------------------
       
   195 
       
   196     public void check(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
       
   197         throws SnmpStatusException {
       
   198         if (req.getSize() == 0) return;
       
   199 
       
   200         JvmRTInputArgsEntryMBean entry = (JvmRTInputArgsEntryMBean) getEntry(rowOid);
       
   201         synchronized (this) {
       
   202             node.setInstance(entry);
       
   203             node.check(req,depth);
       
   204         }
       
   205     }
       
   206 
       
   207     /**
       
   208      * check that the given "var" identifies a columnar object.
       
   209      */
       
   210     public void validateVarEntryId( SnmpOid rowOid, long var, Object data )
       
   211         throws SnmpStatusException {
       
   212         node.validateVarId(var, data);
       
   213     }
       
   214 
       
   215     /**
       
   216      * Returns true if "var" identifies a readable scalar object.
       
   217      */
       
   218     public boolean isReadableEntryId( SnmpOid rowOid, long var, Object data )
       
   219         throws SnmpStatusException {
       
   220         return node.isReadable(var);
       
   221     }
       
   222 
       
   223     /**
       
   224      * Returns the arc of the next columnar object following "var".
       
   225      */
       
   226     public long getNextVarEntryId( SnmpOid rowOid, long var, Object data )
       
   227         throws SnmpStatusException {
       
   228         long nextvar = node.getNextVarId(var, data);
       
   229         while (!isReadableEntryId(rowOid, nextvar, data))
       
   230             nextvar = node.getNextVarId(nextvar, data);
       
   231         return nextvar;
       
   232     }
       
   233 
       
   234     // ------------------------------------------------------------
       
   235     //
       
   236     // Implements the "skipEntryVariable" method defined in "SnmpMibTable".
       
   237     // See the "SnmpMibTable" Javadoc API for more details.
       
   238     //
       
   239     // ------------------------------------------------------------
       
   240 
       
   241     public boolean skipEntryVariable( SnmpOid rowOid, long var, Object data, int pduVersion) {
       
   242         try {
       
   243             JvmRTInputArgsEntryMBean entry = (JvmRTInputArgsEntryMBean) getEntry(rowOid);
       
   244             synchronized (this) {
       
   245                 node.setInstance(entry);
       
   246                 return node.skipVariable(var, data, pduVersion);
       
   247             }
       
   248         } catch (SnmpStatusException x) {
       
   249             return false;
       
   250         }
       
   251     }
       
   252 
       
   253 
       
   254     /**
       
   255      * Reference to the entry metadata.
       
   256      */
       
   257     private JvmRTInputArgsEntryMeta node;
       
   258 
       
   259     /**
       
   260      * Reference to the object server.
       
   261      */
       
   262     protected SnmpStandardObjectServer objectserver;
       
   263 
       
   264 }