blob: 3bfd43f6b70d9901b9de6894bfd0797ca22c3c88 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
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
26package 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//
34import java.io.Serializable;
35import java.util.Vector;
36
37// jmx imports
38//
39import javax.management.MBeanServer;
40import javax.management.ObjectName;
41import com.sun.jmx.snmp.SnmpCounter;
42import com.sun.jmx.snmp.SnmpCounter64;
43import com.sun.jmx.snmp.SnmpGauge;
44import com.sun.jmx.snmp.SnmpInt;
45import com.sun.jmx.snmp.SnmpUnsignedInt;
46import com.sun.jmx.snmp.SnmpIpAddress;
47import com.sun.jmx.snmp.SnmpTimeticks;
48import com.sun.jmx.snmp.SnmpOpaque;
49import com.sun.jmx.snmp.SnmpString;
50import com.sun.jmx.snmp.SnmpStringFixed;
51import com.sun.jmx.snmp.SnmpOid;
52import com.sun.jmx.snmp.SnmpNull;
53import com.sun.jmx.snmp.SnmpValue;
54import com.sun.jmx.snmp.SnmpVarBind;
55import com.sun.jmx.snmp.SnmpStatusException;
56
57// jdmk imports
58//
59import com.sun.jmx.snmp.agent.SnmpIndex;
60import com.sun.jmx.snmp.agent.SnmpMib;
61import com.sun.jmx.snmp.agent.SnmpMibTable;
62import com.sun.jmx.snmp.agent.SnmpMibSubRequest;
63import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
64
65/**
66 * The class is used for implementing the "JvmMemGCTable" group.
67 * The group is defined with the following oid: 1.3.6.1.4.1.42.2.145.3.163.1.1.2.101.
68 */
69public class JvmMemGCTableMeta extends SnmpMibTable implements Serializable {
70
71 /**
72 * Constructor for the table. Initialize metadata for "JvmMemGCTableMeta".
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 JvmMemGCTableMeta(SnmpMib myMib, SnmpStandardObjectServer objserv) {
76 super(myMib);
77 objectserver = objserv;
78 }
79
80
81 /**
82 * Factory method for "JvmMemGCEntry" 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) ("JvmMemGCEntry")
88 * @param tableName Name of the table in which the entries are registered ("JvmMemGCTable")
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 * "JvmMemGCEntry" conceptual row (JvmMemGCEntryMeta)
94 *
95 **/
96 protected JvmMemGCEntryMeta createJvmMemGCEntryMetaNode(String snmpEntryName, String tableName, SnmpMib mib, MBeanServer server) {
97 return new JvmMemGCEntryMeta(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 = createJvmMemGCEntryMetaNode("JvmMemGCEntry", "JvmMemGCTable", 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 JvmMemGCEntryMBean) )
148 throw new ClassCastException("Entries for Table \"" +
149 "JvmMemGCTable" + "\" must implement the \"" +
150 "JvmMemGCEntryMBean" + "\" 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 JvmMemGCEntryMBean entry = (JvmMemGCEntryMBean) 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 JvmMemGCEntryMBean entry = (JvmMemGCEntryMBean) 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 JvmMemGCEntryMBean entry = (JvmMemGCEntryMBean) 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 JvmMemGCEntryMBean entry = (JvmMemGCEntryMBean) 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 JvmMemGCEntryMeta node;
258
259 /**
260 * Reference to the object server.
261 */
262 protected SnmpStandardObjectServer objectserver;
263
264}