001: /*
002: * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004: *
005: * This code is free software; you can redistribute it and/or modify it
006: * under the terms of the GNU General Public License version 2 only, as
007: * published by the Free Software Foundation. Sun designates this
008: * particular file as subject to the "Classpath" exception as provided
009: * by Sun in the LICENSE file that accompanied this code.
010: *
011: * This code is distributed in the hope that it will be useful, but WITHOUT
012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014: * version 2 for more details (a copy is included in the LICENSE file that
015: * accompanied this code).
016: *
017: * You should have received a copy of the GNU General Public License version
018: * 2 along with this work; if not, write to the Free Software Foundation,
019: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020: *
021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022: * CA 95054 USA or visit www.sun.com if you need additional information or
023: * have any questions.
024: */
025:
026: package sun.management.snmp.jvmmib;
027:
028: //
029: // Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
030: //
031:
032: // java imports
033: //
034: import java.io.Serializable;
035: import java.util.Vector;
036:
037: // jmx imports
038: //
039: import javax.management.MBeanServer;
040: import javax.management.ObjectName;
041: import com.sun.jmx.snmp.SnmpCounter;
042: import com.sun.jmx.snmp.SnmpCounter64;
043: import com.sun.jmx.snmp.SnmpGauge;
044: import com.sun.jmx.snmp.SnmpInt;
045: import com.sun.jmx.snmp.SnmpUnsignedInt;
046: import com.sun.jmx.snmp.SnmpIpAddress;
047: import com.sun.jmx.snmp.SnmpTimeticks;
048: import com.sun.jmx.snmp.SnmpOpaque;
049: import com.sun.jmx.snmp.SnmpString;
050: import com.sun.jmx.snmp.SnmpStringFixed;
051: import com.sun.jmx.snmp.SnmpOid;
052: import com.sun.jmx.snmp.SnmpNull;
053: import com.sun.jmx.snmp.SnmpValue;
054: import com.sun.jmx.snmp.SnmpVarBind;
055: import com.sun.jmx.snmp.SnmpStatusException;
056:
057: // jdmk imports
058: //
059: import com.sun.jmx.snmp.agent.SnmpIndex;
060: import com.sun.jmx.snmp.agent.SnmpMib;
061: import com.sun.jmx.snmp.agent.SnmpMibTable;
062: import com.sun.jmx.snmp.agent.SnmpMibSubRequest;
063: import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
064:
065: /**
066: * The class is used for implementing the "JvmRTLibraryPathTable" group.
067: * The group is defined with the following oid: 1.3.6.1.4.1.42.2.145.3.163.1.1.4.23.
068: */
069: public class JvmRTLibraryPathTableMeta extends SnmpMibTable implements
070: Serializable {
071:
072: /**
073: * Constructor for the table. Initialize metadata for "JvmRTLibraryPathTableMeta".
074: * The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK.
075: */
076: public JvmRTLibraryPathTableMeta(SnmpMib myMib,
077: SnmpStandardObjectServer objserv) {
078: super (myMib);
079: objectserver = objserv;
080: }
081:
082: /**
083: * Factory method for "JvmRTLibraryPathEntry" entry metadata class.
084: *
085: * You can redefine this method if you need to replace the default
086: * generated metadata class with your own customized class.
087: *
088: * @param snmpEntryName Name of the SNMP Entry object (conceptual row) ("JvmRTLibraryPathEntry")
089: * @param tableName Name of the table in which the entries are registered ("JvmRTLibraryPathTable")
090: * @param mib The SnmpMib object in which this table is registered
091: * @param server MBeanServer for this table entries (may be null)
092: *
093: * @return An instance of the metadata class generated for the
094: * "JvmRTLibraryPathEntry" conceptual row (JvmRTLibraryPathEntryMeta)
095: *
096: **/
097: protected JvmRTLibraryPathEntryMeta createJvmRTLibraryPathEntryMetaNode(
098: String snmpEntryName, String tableName, SnmpMib mib,
099: MBeanServer server) {
100: return new JvmRTLibraryPathEntryMeta(mib, objectserver);
101: }
102:
103: // ------------------------------------------------------------
104: //
105: // Implements the "createNewEntry" method defined in "SnmpMibTable".
106: // See the "SnmpMibTable" Javadoc API for more details.
107: //
108: // ------------------------------------------------------------
109:
110: public void createNewEntry(SnmpMibSubRequest req, SnmpOid rowOid,
111: int depth) throws SnmpStatusException {
112: if (factory != null)
113: factory.createNewEntry(req, rowOid, depth, this );
114: else
115: throw new SnmpStatusException(
116: SnmpStatusException.snmpRspNoAccess);
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: public void registerEntryNode(SnmpMib mib, MBeanServer server) {
131: node = createJvmRTLibraryPathEntryMetaNode(
132: "JvmRTLibraryPathEntry", "JvmRTLibraryPathTable", mib,
133: server);
134: }
135:
136: // ------------------------------------------------------------
137: //
138: // Implements the "addEntry" method defined in "SnmpMibTable".
139: // See the "SnmpMibTable" Javadoc API for more details.
140: //
141: // ------------------------------------------------------------
142:
143: public synchronized void addEntry(SnmpOid rowOid,
144: ObjectName objname, Object entry)
145: throws SnmpStatusException {
146: if (!(entry instanceof JvmRTLibraryPathEntryMBean))
147: throw new ClassCastException("Entries for Table \""
148: + "JvmRTLibraryPathTable"
149: + "\" must implement the \""
150: + "JvmRTLibraryPathEntryMBean" + "\" interface.");
151: super .addEntry(rowOid, objname, entry);
152: }
153:
154: // ------------------------------------------------------------
155: //
156: // Implements the "get" method defined in "SnmpMibTable".
157: // See the "SnmpMibTable" Javadoc API for more details.
158: //
159: // ------------------------------------------------------------
160:
161: public void get(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
162: throws SnmpStatusException {
163: JvmRTLibraryPathEntryMBean entry = (JvmRTLibraryPathEntryMBean) getEntry(rowOid);
164: synchronized (this ) {
165: node.setInstance(entry);
166: node.get(req, depth);
167: }
168: }
169:
170: // ------------------------------------------------------------
171: //
172: // Implements the "set" method defined in "SnmpMibTable".
173: // See the "SnmpMibTable" Javadoc API for more details.
174: //
175: // ------------------------------------------------------------
176:
177: public void set(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
178: throws SnmpStatusException {
179: if (req.getSize() == 0)
180: return;
181:
182: JvmRTLibraryPathEntryMBean entry = (JvmRTLibraryPathEntryMBean) 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)
199: return;
200:
201: JvmRTLibraryPathEntryMBean entry = (JvmRTLibraryPathEntryMBean) getEntry(rowOid);
202: synchronized (this ) {
203: node.setInstance(entry);
204: node.check(req, depth);
205: }
206: }
207:
208: /**
209: * check that the given "var" identifies a columnar object.
210: */
211: public void validateVarEntryId(SnmpOid rowOid, long var, Object data)
212: throws SnmpStatusException {
213: node.validateVarId(var, data);
214: }
215:
216: /**
217: * Returns true if "var" identifies a readable scalar object.
218: */
219: public boolean isReadableEntryId(SnmpOid rowOid, long var,
220: Object data) throws SnmpStatusException {
221: return node.isReadable(var);
222: }
223:
224: /**
225: * Returns the arc of the next columnar object following "var".
226: */
227: public long getNextVarEntryId(SnmpOid rowOid, long var, Object data)
228: throws SnmpStatusException {
229: long nextvar = node.getNextVarId(var, data);
230: while (!isReadableEntryId(rowOid, nextvar, data))
231: nextvar = node.getNextVarId(nextvar, data);
232: return nextvar;
233: }
234:
235: // ------------------------------------------------------------
236: //
237: // Implements the "skipEntryVariable" method defined in "SnmpMibTable".
238: // See the "SnmpMibTable" Javadoc API for more details.
239: //
240: // ------------------------------------------------------------
241:
242: public boolean skipEntryVariable(SnmpOid rowOid, long var,
243: Object data, int pduVersion) {
244: try {
245: JvmRTLibraryPathEntryMBean entry = (JvmRTLibraryPathEntryMBean) getEntry(rowOid);
246: synchronized (this ) {
247: node.setInstance(entry);
248: return node.skipVariable(var, data, pduVersion);
249: }
250: } catch (SnmpStatusException x) {
251: return false;
252: }
253: }
254:
255: /**
256: * Reference to the entry metadata.
257: */
258: private JvmRTLibraryPathEntryMeta node;
259:
260: /**
261: * Reference to the object server.
262: */
263: protected SnmpStandardObjectServer objectserver;
264:
265: }
|