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 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 "JvmMemPoolTable" group. |
|
67 * The group is defined with the following oid: 1.3.6.1.4.1.42.2.145.3.163.1.1.2.110. |
|
68 */ |
|
69 public class JvmMemPoolTableMeta extends SnmpMibTable implements Serializable { |
|
70 |
|
71 static final long serialVersionUID = -2799470815264898659L; |
|
72 |
|
73 /** |
|
74 * Constructor for the table. Initialize metadata for "JvmMemPoolTableMeta". |
|
75 * The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK. |
|
76 */ |
|
77 public JvmMemPoolTableMeta(SnmpMib myMib, SnmpStandardObjectServer objserv) { |
|
78 super(myMib); |
|
79 objectserver = objserv; |
|
80 } |
|
81 |
|
82 |
|
83 /** |
|
84 * Factory method for "JvmMemPoolEntry" entry metadata class. |
|
85 * |
|
86 * You can redefine this method if you need to replace the default |
|
87 * generated metadata class with your own customized class. |
|
88 * |
|
89 * @param snmpEntryName Name of the SNMP Entry object (conceptual row) ("JvmMemPoolEntry") |
|
90 * @param tableName Name of the table in which the entries are registered ("JvmMemPoolTable") |
|
91 * @param mib The SnmpMib object in which this table is registered |
|
92 * @param server MBeanServer for this table entries (may be null) |
|
93 * |
|
94 * @return An instance of the metadata class generated for the |
|
95 * "JvmMemPoolEntry" conceptual row (JvmMemPoolEntryMeta) |
|
96 * |
|
97 **/ |
|
98 protected JvmMemPoolEntryMeta createJvmMemPoolEntryMetaNode(String snmpEntryName, String tableName, SnmpMib mib, MBeanServer server) { |
|
99 return new JvmMemPoolEntryMeta(mib, objectserver); |
|
100 } |
|
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, int depth) |
|
111 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 // ------------------------------------------------------------ |
|
122 // |
|
123 // Implements the "isRegistrationRequired" method defined in "SnmpMibTable". |
|
124 // See the "SnmpMibTable" Javadoc API for more details. |
|
125 // |
|
126 // ------------------------------------------------------------ |
|
127 |
|
128 public boolean isRegistrationRequired() { |
|
129 return false; |
|
130 } |
|
131 |
|
132 |
|
133 |
|
134 public void registerEntryNode(SnmpMib mib, MBeanServer server) { |
|
135 node = createJvmMemPoolEntryMetaNode("JvmMemPoolEntry", "JvmMemPoolTable", mib, server); |
|
136 } |
|
137 |
|
138 |
|
139 // ------------------------------------------------------------ |
|
140 // |
|
141 // Implements the "addEntry" method defined in "SnmpMibTable". |
|
142 // See the "SnmpMibTable" Javadoc API for more details. |
|
143 // |
|
144 // ------------------------------------------------------------ |
|
145 |
|
146 public synchronized void addEntry(SnmpOid rowOid, ObjectName objname, |
|
147 Object entry) |
|
148 throws SnmpStatusException { |
|
149 if (! (entry instanceof JvmMemPoolEntryMBean) ) |
|
150 throw new ClassCastException("Entries for Table \"" + |
|
151 "JvmMemPoolTable" + "\" must implement the \"" + |
|
152 "JvmMemPoolEntryMBean" + "\" interface."); |
|
153 super.addEntry(rowOid, objname, entry); |
|
154 } |
|
155 |
|
156 |
|
157 // ------------------------------------------------------------ |
|
158 // |
|
159 // Implements the "get" method defined in "SnmpMibTable". |
|
160 // See the "SnmpMibTable" Javadoc API for more details. |
|
161 // |
|
162 // ------------------------------------------------------------ |
|
163 |
|
164 public void get(SnmpMibSubRequest req, SnmpOid rowOid, int depth) |
|
165 throws SnmpStatusException { |
|
166 JvmMemPoolEntryMBean entry = (JvmMemPoolEntryMBean) getEntry(rowOid); |
|
167 synchronized (this) { |
|
168 node.setInstance(entry); |
|
169 node.get(req,depth); |
|
170 } |
|
171 } |
|
172 |
|
173 // ------------------------------------------------------------ |
|
174 // |
|
175 // Implements the "set" method defined in "SnmpMibTable". |
|
176 // See the "SnmpMibTable" Javadoc API for more details. |
|
177 // |
|
178 // ------------------------------------------------------------ |
|
179 |
|
180 public void set(SnmpMibSubRequest req, SnmpOid rowOid, int depth) |
|
181 throws SnmpStatusException { |
|
182 if (req.getSize() == 0) return; |
|
183 |
|
184 JvmMemPoolEntryMBean entry = (JvmMemPoolEntryMBean) getEntry(rowOid); |
|
185 synchronized (this) { |
|
186 node.setInstance(entry); |
|
187 node.set(req,depth); |
|
188 } |
|
189 } |
|
190 |
|
191 // ------------------------------------------------------------ |
|
192 // |
|
193 // Implements the "check" method defined in "SnmpMibTable". |
|
194 // See the "SnmpMibTable" Javadoc API for more details. |
|
195 // |
|
196 // ------------------------------------------------------------ |
|
197 |
|
198 public void check(SnmpMibSubRequest req, SnmpOid rowOid, int depth) |
|
199 throws SnmpStatusException { |
|
200 if (req.getSize() == 0) return; |
|
201 |
|
202 JvmMemPoolEntryMBean entry = (JvmMemPoolEntryMBean) getEntry(rowOid); |
|
203 synchronized (this) { |
|
204 node.setInstance(entry); |
|
205 node.check(req,depth); |
|
206 } |
|
207 } |
|
208 |
|
209 /** |
|
210 * check that the given "var" identifies a columnar object. |
|
211 */ |
|
212 public void validateVarEntryId( SnmpOid rowOid, long var, Object data ) |
|
213 throws SnmpStatusException { |
|
214 node.validateVarId(var, data); |
|
215 } |
|
216 |
|
217 /** |
|
218 * Returns true if "var" identifies a readable scalar object. |
|
219 */ |
|
220 public boolean isReadableEntryId( SnmpOid rowOid, long var, Object data ) |
|
221 throws SnmpStatusException { |
|
222 return node.isReadable(var); |
|
223 } |
|
224 |
|
225 /** |
|
226 * Returns the arc of the next columnar object following "var". |
|
227 */ |
|
228 public long getNextVarEntryId( SnmpOid rowOid, long var, Object data ) |
|
229 throws SnmpStatusException { |
|
230 long nextvar = node.getNextVarId(var, data); |
|
231 while (!isReadableEntryId(rowOid, nextvar, data)) |
|
232 nextvar = node.getNextVarId(nextvar, data); |
|
233 return nextvar; |
|
234 } |
|
235 |
|
236 // ------------------------------------------------------------ |
|
237 // |
|
238 // Implements the "skipEntryVariable" method defined in "SnmpMibTable". |
|
239 // See the "SnmpMibTable" Javadoc API for more details. |
|
240 // |
|
241 // ------------------------------------------------------------ |
|
242 |
|
243 public boolean skipEntryVariable( SnmpOid rowOid, long var, Object data, int pduVersion) { |
|
244 try { |
|
245 JvmMemPoolEntryMBean entry = (JvmMemPoolEntryMBean) 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 /** |
|
257 * Reference to the entry metadata. |
|
258 */ |
|
259 private JvmMemPoolEntryMeta node; |
|
260 |
|
261 /** |
|
262 * Reference to the object server. |
|
263 */ |
|
264 protected SnmpStandardObjectServer objectserver; |
|
265 |
|
266 } |
|