1 /* |
|
2 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. 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. Oracle designates this |
|
8 * particular file as subject to the "Classpath" exception as provided |
|
9 * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 * or visit www.oracle.com if you need additional information or have any |
|
23 * 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 |
|
36 // jmx imports |
|
37 // |
|
38 import javax.management.MBeanServer; |
|
39 import com.sun.jmx.snmp.SnmpCounter; |
|
40 import com.sun.jmx.snmp.SnmpCounter64; |
|
41 import com.sun.jmx.snmp.SnmpGauge; |
|
42 import com.sun.jmx.snmp.SnmpInt; |
|
43 import com.sun.jmx.snmp.SnmpUnsignedInt; |
|
44 import com.sun.jmx.snmp.SnmpIpAddress; |
|
45 import com.sun.jmx.snmp.SnmpTimeticks; |
|
46 import com.sun.jmx.snmp.SnmpOpaque; |
|
47 import com.sun.jmx.snmp.SnmpString; |
|
48 import com.sun.jmx.snmp.SnmpStringFixed; |
|
49 import com.sun.jmx.snmp.SnmpOid; |
|
50 import com.sun.jmx.snmp.SnmpNull; |
|
51 import com.sun.jmx.snmp.SnmpValue; |
|
52 import com.sun.jmx.snmp.SnmpVarBind; |
|
53 import com.sun.jmx.snmp.SnmpStatusException; |
|
54 |
|
55 // jdmk imports |
|
56 // |
|
57 import com.sun.jmx.snmp.agent.SnmpMib; |
|
58 import com.sun.jmx.snmp.agent.SnmpMibGroup; |
|
59 import com.sun.jmx.snmp.agent.SnmpStandardObjectServer; |
|
60 import com.sun.jmx.snmp.agent.SnmpStandardMetaServer; |
|
61 import com.sun.jmx.snmp.agent.SnmpMibSubRequest; |
|
62 import com.sun.jmx.snmp.agent.SnmpMibTable; |
|
63 import com.sun.jmx.snmp.EnumRowStatus; |
|
64 import com.sun.jmx.snmp.SnmpDefinitions; |
|
65 |
|
66 /** |
|
67 * The class is used for representing SNMP metadata for the "JvmCompilation" group. |
|
68 * The group is defined with the following oid: 1.3.6.1.4.1.42.2.145.3.163.1.1.5. |
|
69 */ |
|
70 public class JvmCompilationMeta extends SnmpMibGroup |
|
71 implements Serializable, SnmpStandardMetaServer { |
|
72 |
|
73 static final long serialVersionUID = -95492874115033638L; |
|
74 /** |
|
75 * Constructor for the metadata associated to "JvmCompilation". |
|
76 */ |
|
77 public JvmCompilationMeta(SnmpMib myMib, SnmpStandardObjectServer objserv) { |
|
78 objectserver = objserv; |
|
79 try { |
|
80 registerObject(3); |
|
81 registerObject(2); |
|
82 registerObject(1); |
|
83 } catch (IllegalAccessException e) { |
|
84 throw new RuntimeException(e.getMessage()); |
|
85 } |
|
86 } |
|
87 |
|
88 /** |
|
89 * Get the value of a scalar variable |
|
90 */ |
|
91 public SnmpValue get(long var, Object data) |
|
92 throws SnmpStatusException { |
|
93 switch((int)var) { |
|
94 case 3: |
|
95 return new SnmpInt(node.getJvmJITCompilerTimeMonitoring()); |
|
96 |
|
97 case 2: |
|
98 return new SnmpCounter64(node.getJvmJITCompilerTimeMs()); |
|
99 |
|
100 case 1: |
|
101 return new SnmpString(node.getJvmJITCompilerName()); |
|
102 |
|
103 default: |
|
104 break; |
|
105 } |
|
106 throw new SnmpStatusException(SnmpStatusException.noSuchObject); |
|
107 } |
|
108 |
|
109 /** |
|
110 * Set the value of a scalar variable |
|
111 */ |
|
112 public SnmpValue set(SnmpValue x, long var, Object data) |
|
113 throws SnmpStatusException { |
|
114 switch((int)var) { |
|
115 case 3: |
|
116 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable); |
|
117 |
|
118 case 2: |
|
119 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable); |
|
120 |
|
121 case 1: |
|
122 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable); |
|
123 |
|
124 default: |
|
125 break; |
|
126 } |
|
127 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable); |
|
128 } |
|
129 |
|
130 /** |
|
131 * Check the value of a scalar variable |
|
132 */ |
|
133 public void check(SnmpValue x, long var, Object data) |
|
134 throws SnmpStatusException { |
|
135 switch((int) var) { |
|
136 case 3: |
|
137 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable); |
|
138 |
|
139 case 2: |
|
140 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable); |
|
141 |
|
142 case 1: |
|
143 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable); |
|
144 |
|
145 default: |
|
146 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable); |
|
147 } |
|
148 } |
|
149 |
|
150 /** |
|
151 * Allow to bind the metadata description to a specific object. |
|
152 */ |
|
153 protected void setInstance(JvmCompilationMBean var) { |
|
154 node = var; |
|
155 } |
|
156 |
|
157 |
|
158 // ------------------------------------------------------------ |
|
159 // |
|
160 // Implements the "get" method defined in "SnmpMibGroup". |
|
161 // See the "SnmpMibGroup" Javadoc API for more details. |
|
162 // |
|
163 // ------------------------------------------------------------ |
|
164 |
|
165 public void get(SnmpMibSubRequest req, int depth) |
|
166 throws SnmpStatusException { |
|
167 objectserver.get(this,req,depth); |
|
168 } |
|
169 |
|
170 |
|
171 // ------------------------------------------------------------ |
|
172 // |
|
173 // Implements the "set" method defined in "SnmpMibGroup". |
|
174 // See the "SnmpMibGroup" Javadoc API for more details. |
|
175 // |
|
176 // ------------------------------------------------------------ |
|
177 |
|
178 public void set(SnmpMibSubRequest req, int depth) |
|
179 throws SnmpStatusException { |
|
180 objectserver.set(this,req,depth); |
|
181 } |
|
182 |
|
183 |
|
184 // ------------------------------------------------------------ |
|
185 // |
|
186 // Implements the "check" method defined in "SnmpMibGroup". |
|
187 // See the "SnmpMibGroup" Javadoc API for more details. |
|
188 // |
|
189 // ------------------------------------------------------------ |
|
190 |
|
191 public void check(SnmpMibSubRequest req, int depth) |
|
192 throws SnmpStatusException { |
|
193 objectserver.check(this,req,depth); |
|
194 } |
|
195 |
|
196 /** |
|
197 * Returns true if "arc" identifies a scalar object. |
|
198 */ |
|
199 public boolean isVariable(long arc) { |
|
200 |
|
201 switch((int)arc) { |
|
202 case 3: |
|
203 case 2: |
|
204 case 1: |
|
205 return true; |
|
206 default: |
|
207 break; |
|
208 } |
|
209 return false; |
|
210 } |
|
211 |
|
212 /** |
|
213 * Returns true if "arc" identifies a readable scalar object. |
|
214 */ |
|
215 public boolean isReadable(long arc) { |
|
216 |
|
217 switch((int)arc) { |
|
218 case 3: |
|
219 case 2: |
|
220 case 1: |
|
221 return true; |
|
222 default: |
|
223 break; |
|
224 } |
|
225 return false; |
|
226 } |
|
227 |
|
228 |
|
229 // ------------------------------------------------------------ |
|
230 // |
|
231 // Implements the "skipVariable" method defined in "SnmpMibGroup". |
|
232 // See the "SnmpMibGroup" Javadoc API for more details. |
|
233 // |
|
234 // ------------------------------------------------------------ |
|
235 |
|
236 public boolean skipVariable(long var, Object data, int pduVersion) { |
|
237 switch((int)var) { |
|
238 case 2: |
|
239 if (pduVersion==SnmpDefinitions.snmpVersionOne) return true; |
|
240 break; |
|
241 default: |
|
242 break; |
|
243 } |
|
244 return super.skipVariable(var,data,pduVersion); |
|
245 } |
|
246 |
|
247 /** |
|
248 * Return the name of the attribute corresponding to the SNMP variable identified by "id". |
|
249 */ |
|
250 public String getAttributeName(long id) |
|
251 throws SnmpStatusException { |
|
252 switch((int)id) { |
|
253 case 3: |
|
254 return "JvmJITCompilerTimeMonitoring"; |
|
255 |
|
256 case 2: |
|
257 return "JvmJITCompilerTimeMs"; |
|
258 |
|
259 case 1: |
|
260 return "JvmJITCompilerName"; |
|
261 |
|
262 default: |
|
263 break; |
|
264 } |
|
265 throw new SnmpStatusException(SnmpStatusException.noSuchObject); |
|
266 } |
|
267 |
|
268 /** |
|
269 * Returns true if "arc" identifies a table object. |
|
270 */ |
|
271 public boolean isTable(long arc) { |
|
272 |
|
273 switch((int)arc) { |
|
274 default: |
|
275 break; |
|
276 } |
|
277 return false; |
|
278 } |
|
279 |
|
280 /** |
|
281 * Returns the table object identified by "arc". |
|
282 */ |
|
283 public SnmpMibTable getTable(long arc) { |
|
284 return null; |
|
285 } |
|
286 |
|
287 /** |
|
288 * Register the group's SnmpMibTable objects with the meta-data. |
|
289 */ |
|
290 public void registerTableNodes(SnmpMib mib, MBeanServer server) { |
|
291 } |
|
292 |
|
293 protected JvmCompilationMBean node; |
|
294 protected SnmpStandardObjectServer objectserver = null; |
|
295 } |
|