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.SnmpMibNode;
58 import com.sun.jmx.snmp.agent.SnmpMib;
59 import com.sun.jmx.snmp.agent.SnmpMibEntry;
60 import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
61 import com.sun.jmx.snmp.agent.SnmpStandardMetaServer;
62 import com.sun.jmx.snmp.agent.SnmpMibSubRequest;
63 import com.sun.jmx.snmp.agent.SnmpMibTable;
64 import com.sun.jmx.snmp.EnumRowStatus;
65 import com.sun.jmx.snmp.SnmpDefinitions;
66 
67 /**
68  * The class is used for representing SNMP metadata for the "JvmRTInputArgsEntry" group.
69  * The group is defined with the following oid: 1.3.6.1.4.1.42.2.145.3.163.1.1.4.20.1.
70  */
71 public class JvmRTInputArgsEntryMeta extends SnmpMibEntry
72      implements Serializable, SnmpStandardMetaServer {
73 
74     static final long serialVersionUID = -7729576810347358025L;
75     /**
76      * Constructor for the metadata associated to "JvmRTInputArgsEntry".
77      */
JvmRTInputArgsEntryMeta(SnmpMib myMib, SnmpStandardObjectServer objserv)78     public JvmRTInputArgsEntryMeta(SnmpMib myMib, SnmpStandardObjectServer objserv) {
79         objectserver = objserv;
80         varList = new int[1];
81         varList[0] = 2;
82         SnmpMibNode.sort(varList);
83     }
84 
85     /**
86      * Get the value of a scalar variable
87      */
get(long var, Object data)88     public SnmpValue get(long var, Object data)
89         throws SnmpStatusException {
90         switch((int)var) {
91             case 2:
92                 return new SnmpString(node.getJvmRTInputArgsItem());
93 
94             case 1:
95                 throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
96             default:
97                 break;
98         }
99         throw new SnmpStatusException(SnmpStatusException.noSuchObject);
100     }
101 
102     /**
103      * Set the value of a scalar variable
104      */
set(SnmpValue x, long var, Object data)105     public SnmpValue set(SnmpValue x, long var, Object data)
106         throws SnmpStatusException {
107         switch((int)var) {
108             case 2:
109                 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
110 
111             case 1:
112                 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
113 
114             default:
115                 break;
116         }
117         throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
118     }
119 
120     /**
121      * Check the value of a scalar variable
122      */
check(SnmpValue x, long var, Object data)123     public void check(SnmpValue x, long var, Object data)
124         throws SnmpStatusException {
125         switch((int) var) {
126             case 2:
127                 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
128 
129             case 1:
130                 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
131 
132             default:
133                 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
134         }
135     }
136 
137     /**
138      * Allow to bind the metadata description to a specific object.
139      */
setInstance(JvmRTInputArgsEntryMBean var)140     protected void setInstance(JvmRTInputArgsEntryMBean var) {
141         node = var;
142     }
143 
144 
145     // ------------------------------------------------------------
146     //
147     // Implements the "get" method defined in "SnmpMibEntry".
148     // See the "SnmpMibEntry" Javadoc API for more details.
149     //
150     // ------------------------------------------------------------
151 
get(SnmpMibSubRequest req, int depth)152     public void get(SnmpMibSubRequest req, int depth)
153         throws SnmpStatusException {
154         objectserver.get(this,req,depth);
155     }
156 
157 
158     // ------------------------------------------------------------
159     //
160     // Implements the "set" method defined in "SnmpMibEntry".
161     // See the "SnmpMibEntry" Javadoc API for more details.
162     //
163     // ------------------------------------------------------------
164 
set(SnmpMibSubRequest req, int depth)165     public void set(SnmpMibSubRequest req, int depth)
166         throws SnmpStatusException {
167         objectserver.set(this,req,depth);
168     }
169 
170 
171     // ------------------------------------------------------------
172     //
173     // Implements the "check" method defined in "SnmpMibEntry".
174     // See the "SnmpMibEntry" Javadoc API for more details.
175     //
176     // ------------------------------------------------------------
177 
check(SnmpMibSubRequest req, int depth)178     public void check(SnmpMibSubRequest req, int depth)
179         throws SnmpStatusException {
180         objectserver.check(this,req,depth);
181     }
182 
183     /**
184      * Returns true if "arc" identifies a scalar object.
185      */
isVariable(long arc)186     public boolean isVariable(long arc) {
187 
188         switch((int)arc) {
189             case 2:
190             case 1:
191                 return true;
192             default:
193                 break;
194         }
195         return false;
196     }
197 
198     /**
199      * Returns true if "arc" identifies a readable scalar object.
200      */
isReadable(long arc)201     public boolean isReadable(long arc) {
202 
203         switch((int)arc) {
204             case 2:
205                 return true;
206             default:
207                 break;
208         }
209         return false;
210     }
211 
212 
213     // ------------------------------------------------------------
214     //
215     // Implements the "skipVariable" method defined in "SnmpMibEntry".
216     // See the "SnmpMibEntry" Javadoc API for more details.
217     //
218     // ------------------------------------------------------------
219 
skipVariable(long var, Object data, int pduVersion)220     public boolean  skipVariable(long var, Object data, int pduVersion) {
221         switch((int)var) {
222             case 1:
223                 return true;
224             default:
225                 break;
226         }
227         return super.skipVariable(var,data,pduVersion);
228     }
229 
230     /**
231      * Return the name of the attribute corresponding to the SNMP variable identified by "id".
232      */
getAttributeName(long id)233     public String getAttributeName(long id)
234         throws SnmpStatusException {
235         switch((int)id) {
236             case 2:
237                 return "JvmRTInputArgsItem";
238 
239             case 1:
240                 return "JvmRTInputArgsIndex";
241 
242             default:
243                 break;
244         }
245         throw new SnmpStatusException(SnmpStatusException.noSuchObject);
246     }
247 
248     protected JvmRTInputArgsEntryMBean node;
249     protected SnmpStandardObjectServer objectserver = null;
250 }
251