blob: 01ea26525b6cc6984ddae5a4caa51b094c5bd78c [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;
35
36// jmx imports
37//
38import javax.management.MBeanServer;
39import com.sun.jmx.snmp.SnmpCounter;
40import com.sun.jmx.snmp.SnmpCounter64;
41import com.sun.jmx.snmp.SnmpGauge;
42import com.sun.jmx.snmp.SnmpInt;
43import com.sun.jmx.snmp.SnmpUnsignedInt;
44import com.sun.jmx.snmp.SnmpIpAddress;
45import com.sun.jmx.snmp.SnmpTimeticks;
46import com.sun.jmx.snmp.SnmpOpaque;
47import com.sun.jmx.snmp.SnmpString;
48import com.sun.jmx.snmp.SnmpStringFixed;
49import com.sun.jmx.snmp.SnmpOid;
50import com.sun.jmx.snmp.SnmpNull;
51import com.sun.jmx.snmp.SnmpValue;
52import com.sun.jmx.snmp.SnmpVarBind;
53import com.sun.jmx.snmp.SnmpStatusException;
54
55// jdmk imports
56//
57import com.sun.jmx.snmp.agent.SnmpMibNode;
58import com.sun.jmx.snmp.agent.SnmpMib;
59import com.sun.jmx.snmp.agent.SnmpMibEntry;
60import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
61import com.sun.jmx.snmp.agent.SnmpStandardMetaServer;
62import com.sun.jmx.snmp.agent.SnmpMibSubRequest;
63import com.sun.jmx.snmp.agent.SnmpMibTable;
64import com.sun.jmx.snmp.EnumRowStatus;
65import com.sun.jmx.snmp.SnmpDefinitions;
66
67/**
68 * The class is used for representing SNMP metadata for the "JvmThreadInstanceEntry" group.
69 * The group is defined with the following oid: 1.3.6.1.4.1.42.2.145.3.163.1.1.3.10.1.
70 */
71public class JvmThreadInstanceEntryMeta extends SnmpMibEntry
72 implements Serializable, SnmpStandardMetaServer {
73
74 /**
75 * Constructor for the metadata associated to "JvmThreadInstanceEntry".
76 */
77 public JvmThreadInstanceEntryMeta(SnmpMib myMib, SnmpStandardObjectServer objserv) {
78 objectserver = objserv;
79 varList = new int[10];
80 varList[0] = 9;
81 varList[1] = 8;
82 varList[2] = 7;
83 varList[3] = 6;
84 varList[4] = 5;
85 varList[5] = 4;
86 varList[6] = 3;
87 varList[7] = 11;
88 varList[8] = 2;
89 varList[9] = 10;
90 SnmpMibNode.sort(varList);
91 }
92
93 /**
94 * Get the value of a scalar variable
95 */
96 public SnmpValue get(long var, Object data)
97 throws SnmpStatusException {
98 switch((int)var) {
99 case 9:
100 return new SnmpString(node.getJvmThreadInstName());
101
102 case 8:
103 return new SnmpCounter64(node.getJvmThreadInstCpuTimeNs());
104
105 case 7:
106 return new SnmpCounter64(node.getJvmThreadInstWaitTimeMs());
107
108 case 6:
109 return new SnmpCounter64(node.getJvmThreadInstWaitCount());
110
111 case 5:
112 return new SnmpCounter64(node.getJvmThreadInstBlockTimeMs());
113
114 case 4:
115 return new SnmpCounter64(node.getJvmThreadInstBlockCount());
116
117 case 3:
118 return new SnmpString(node.getJvmThreadInstState());
119
120 case 11:
121 return new SnmpOid(node.getJvmThreadInstLockOwnerPtr());
122
123 case 2:
124 return new SnmpCounter64(node.getJvmThreadInstId());
125
126 case 10:
127 return new SnmpString(node.getJvmThreadInstLockName());
128
129 case 1:
130 throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
131 default:
132 break;
133 }
134 throw new SnmpStatusException(SnmpStatusException.noSuchObject);
135 }
136
137 /**
138 * Set the value of a scalar variable
139 */
140 public SnmpValue set(SnmpValue x, long var, Object data)
141 throws SnmpStatusException {
142 switch((int)var) {
143 case 9:
144 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
145
146 case 8:
147 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
148
149 case 7:
150 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
151
152 case 6:
153 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
154
155 case 5:
156 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
157
158 case 4:
159 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
160
161 case 3:
162 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
163
164 case 11:
165 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
166
167 case 2:
168 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
169
170 case 10:
171 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
172
173 case 1:
174 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
175
176 default:
177 break;
178 }
179 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
180 }
181
182 /**
183 * Check the value of a scalar variable
184 */
185 public void check(SnmpValue x, long var, Object data)
186 throws SnmpStatusException {
187 switch((int) var) {
188 case 9:
189 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
190
191 case 8:
192 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
193
194 case 7:
195 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
196
197 case 6:
198 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
199
200 case 5:
201 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
202
203 case 4:
204 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
205
206 case 3:
207 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
208
209 case 11:
210 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
211
212 case 2:
213 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
214
215 case 10:
216 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
217
218 case 1:
219 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
220
221 default:
222 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
223 }
224 }
225
226 /**
227 * Allow to bind the metadata description to a specific object.
228 */
229 protected void setInstance(JvmThreadInstanceEntryMBean var) {
230 node = var;
231 }
232
233
234 // ------------------------------------------------------------
235 //
236 // Implements the "get" method defined in "SnmpMibEntry".
237 // See the "SnmpMibEntry" Javadoc API for more details.
238 //
239 // ------------------------------------------------------------
240
241 public void get(SnmpMibSubRequest req, int depth)
242 throws SnmpStatusException {
243 objectserver.get(this,req,depth);
244 }
245
246
247 // ------------------------------------------------------------
248 //
249 // Implements the "set" method defined in "SnmpMibEntry".
250 // See the "SnmpMibEntry" Javadoc API for more details.
251 //
252 // ------------------------------------------------------------
253
254 public void set(SnmpMibSubRequest req, int depth)
255 throws SnmpStatusException {
256 objectserver.set(this,req,depth);
257 }
258
259
260 // ------------------------------------------------------------
261 //
262 // Implements the "check" method defined in "SnmpMibEntry".
263 // See the "SnmpMibEntry" Javadoc API for more details.
264 //
265 // ------------------------------------------------------------
266
267 public void check(SnmpMibSubRequest req, int depth)
268 throws SnmpStatusException {
269 objectserver.check(this,req,depth);
270 }
271
272 /**
273 * Returns true if "arc" identifies a scalar object.
274 */
275 public boolean isVariable(long arc) {
276
277 switch((int)arc) {
278 case 9:
279 case 8:
280 case 7:
281 case 6:
282 case 5:
283 case 4:
284 case 3:
285 case 11:
286 case 2:
287 case 10:
288 case 1:
289 return true;
290 default:
291 break;
292 }
293 return false;
294 }
295
296 /**
297 * Returns true if "arc" identifies a readable scalar object.
298 */
299 public boolean isReadable(long arc) {
300
301 switch((int)arc) {
302 case 9:
303 case 8:
304 case 7:
305 case 6:
306 case 5:
307 case 4:
308 case 3:
309 case 11:
310 case 2:
311 case 10:
312 return true;
313 default:
314 break;
315 }
316 return false;
317 }
318
319
320 // ------------------------------------------------------------
321 //
322 // Implements the "skipVariable" method defined in "SnmpMibEntry".
323 // See the "SnmpMibEntry" Javadoc API for more details.
324 //
325 // ------------------------------------------------------------
326
327 public boolean skipVariable(long var, Object data, int pduVersion) {
328 switch((int)var) {
329 case 8:
330 case 7:
331 case 6:
332 case 5:
333 case 4:
334 case 2:
335 if (pduVersion==SnmpDefinitions.snmpVersionOne) return true;
336 break;
337 case 1:
338 return true;
339 default:
340 break;
341 }
342 return super.skipVariable(var,data,pduVersion);
343 }
344
345 /**
346 * Return the name of the attribute corresponding to the SNMP variable identified by "id".
347 */
348 public String getAttributeName(long id)
349 throws SnmpStatusException {
350 switch((int)id) {
351 case 9:
352 return "JvmThreadInstName";
353
354 case 8:
355 return "JvmThreadInstCpuTimeNs";
356
357 case 7:
358 return "JvmThreadInstWaitTimeMs";
359
360 case 6:
361 return "JvmThreadInstWaitCount";
362
363 case 5:
364 return "JvmThreadInstBlockTimeMs";
365
366 case 4:
367 return "JvmThreadInstBlockCount";
368
369 case 3:
370 return "JvmThreadInstState";
371
372 case 11:
373 return "JvmThreadInstLockOwnerPtr";
374
375 case 2:
376 return "JvmThreadInstId";
377
378 case 10:
379 return "JvmThreadInstLockName";
380
381 case 1:
382 return "JvmThreadInstIndex";
383
384 default:
385 break;
386 }
387 throw new SnmpStatusException(SnmpStatusException.noSuchObject);
388 }
389
390 protected JvmThreadInstanceEntryMBean node;
391 protected SnmpStandardObjectServer objectserver = null;
392}