jdk/src/share/classes/sun/management/snmp/jvmmib/JvmThreadingMeta.java
author mchung
Tue, 17 Jan 2012 15:55:40 -0800
changeset 11530 a9d059c15b80
parent 5506 202f599c92aa
child 14342 8435a30053c1
permissions -rw-r--r--
7117570: Warnings in sun.mangement.* and its subpackages Reviewed-by: mchung, dsamersoff Contributed-by: kurchi.subhra.hazra@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package sun.management.snmp.jvmmib;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
//
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
//
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
// java imports
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
//
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import java.io.Serializable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
// jmx imports
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
//
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
import javax.management.MBeanServer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
import com.sun.jmx.snmp.SnmpCounter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
import com.sun.jmx.snmp.SnmpCounter64;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
import com.sun.jmx.snmp.SnmpGauge;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
import com.sun.jmx.snmp.SnmpInt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
import com.sun.jmx.snmp.SnmpUnsignedInt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
import com.sun.jmx.snmp.SnmpIpAddress;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
import com.sun.jmx.snmp.SnmpTimeticks;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
import com.sun.jmx.snmp.SnmpOpaque;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
import com.sun.jmx.snmp.SnmpString;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
import com.sun.jmx.snmp.SnmpStringFixed;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
import com.sun.jmx.snmp.SnmpOid;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
import com.sun.jmx.snmp.SnmpNull;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
import com.sun.jmx.snmp.SnmpValue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
import com.sun.jmx.snmp.SnmpVarBind;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
import com.sun.jmx.snmp.SnmpStatusException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
// jdmk imports
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
//
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
import com.sun.jmx.snmp.agent.SnmpMib;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
import com.sun.jmx.snmp.agent.SnmpMibGroup;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
import com.sun.jmx.snmp.agent.SnmpStandardMetaServer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
import com.sun.jmx.snmp.agent.SnmpMibSubRequest;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
import com.sun.jmx.snmp.agent.SnmpMibTable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
import com.sun.jmx.snmp.EnumRowStatus;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
import com.sun.jmx.snmp.SnmpDefinitions;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * The class is used for representing SNMP metadata for the "JvmThreading" group.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 * The group is defined with the following oid: 1.3.6.1.4.1.42.2.145.3.163.1.1.3.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
public class JvmThreadingMeta extends SnmpMibGroup
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     implements Serializable, SnmpStandardMetaServer {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
11530
a9d059c15b80 7117570: Warnings in sun.mangement.* and its subpackages
mchung
parents: 5506
diff changeset
    73
    static final long serialVersionUID = 5223833578005322854L;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     * Constructor for the metadata associated to "JvmThreading".
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    public JvmThreadingMeta(SnmpMib myMib, SnmpStandardObjectServer objserv) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
        objectserver = objserv;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
            registerObject(6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
            registerObject(5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
            registerObject(4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
            registerObject(3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
            registerObject(2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
            registerObject(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
            registerObject(10);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
            registerObject(7);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        } catch (IllegalAccessException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
            throw new RuntimeException(e.getMessage());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     * Get the value of a scalar variable
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    public SnmpValue get(long var, Object data)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
        throws SnmpStatusException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
        switch((int)var) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
            case 6:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
                return new SnmpInt(node.getJvmThreadCpuTimeMonitoring());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
            case 5:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
                return new SnmpInt(node.getJvmThreadContentionMonitoring());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
            case 4:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
                return new SnmpCounter64(node.getJvmThreadTotalStartedCount());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
            case 3:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
                return new SnmpCounter(node.getJvmThreadPeakCount());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
            case 2:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
                return new SnmpGauge(node.getJvmThreadDaemonCount());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
            case 1:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
                return new SnmpGauge(node.getJvmThreadCount());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
            case 10: {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
                throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
            case 7:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
                return new SnmpCounter64(node.getJvmThreadPeakCountReset());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
            default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
        throw new SnmpStatusException(SnmpStatusException.noSuchObject);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * Set the value of a scalar variable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
    public SnmpValue set(SnmpValue x, long var, Object data)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
        throws SnmpStatusException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
        switch((int)var) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
            case 6:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
                if (x instanceof SnmpInt) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
                    try  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
                        node.setJvmThreadCpuTimeMonitoring( new EnumJvmThreadCpuTimeMonitoring (((SnmpInt)x).toInteger()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
                    } catch(IllegalArgumentException e)  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
                        throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
                    return new SnmpInt(node.getJvmThreadCpuTimeMonitoring());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
                } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
                    throw new SnmpStatusException(SnmpStatusException.snmpRspWrongType);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
            case 5:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
                if (x instanceof SnmpInt) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
                    try  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
                        node.setJvmThreadContentionMonitoring( new EnumJvmThreadContentionMonitoring (((SnmpInt)x).toInteger()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
                    } catch(IllegalArgumentException e)  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
                        throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
                    return new SnmpInt(node.getJvmThreadContentionMonitoring());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
                } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
                    throw new SnmpStatusException(SnmpStatusException.snmpRspWrongType);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
            case 4:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
                throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
            case 3:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
                throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
            case 2:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
                throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
            case 1:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
                throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
            case 10: {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
                throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
            case 7:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
                if (x instanceof SnmpCounter64) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
                    node.setJvmThreadPeakCountReset(((SnmpCounter64)x).toLong());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
                    return new SnmpCounter64(node.getJvmThreadPeakCountReset());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
                } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
                    throw new SnmpStatusException(SnmpStatusException.snmpRspWrongType);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
            default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     * Check the value of a scalar variable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
    public void check(SnmpValue x, long var, Object data)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
        throws SnmpStatusException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        switch((int) var) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
            case 6:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
                if (x instanceof SnmpInt) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
                    try  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
                        node.checkJvmThreadCpuTimeMonitoring( new EnumJvmThreadCpuTimeMonitoring (((SnmpInt)x).toInteger()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
                    } catch(IllegalArgumentException e)  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
                        throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
                } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
                    throw new SnmpStatusException(SnmpStatusException.snmpRspWrongType);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
            case 5:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
                if (x instanceof SnmpInt) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
                    try  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
                        node.checkJvmThreadContentionMonitoring( new EnumJvmThreadContentionMonitoring (((SnmpInt)x).toInteger()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
                    } catch(IllegalArgumentException e)  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
                        throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
                } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
                    throw new SnmpStatusException(SnmpStatusException.snmpRspWrongType);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
            case 4:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
                throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
            case 3:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
                throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
            case 2:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
                throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
            case 1:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
                throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
            case 10: {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
                throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
            case 7:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
                if (x instanceof SnmpCounter64) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
                    node.checkJvmThreadPeakCountReset(((SnmpCounter64)x).toLong());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
                } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
                    throw new SnmpStatusException(SnmpStatusException.snmpRspWrongType);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
            default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
                throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     * Allow to bind the metadata description to a specific object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    protected void setInstance(JvmThreadingMBean var) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
        node = var;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
    // ------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
    //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
    // Implements the "get" method defined in "SnmpMibGroup".
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
    // See the "SnmpMibGroup" Javadoc API for more details.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
    //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
    // ------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
    public void get(SnmpMibSubRequest req, int depth)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
        throws SnmpStatusException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
        objectserver.get(this,req,depth);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
    // ------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
    //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
    // Implements the "set" method defined in "SnmpMibGroup".
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
    // See the "SnmpMibGroup" Javadoc API for more details.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
    //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
    // ------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
    public void set(SnmpMibSubRequest req, int depth)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
        throws SnmpStatusException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
        objectserver.set(this,req,depth);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
    // ------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
    //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
    // Implements the "check" method defined in "SnmpMibGroup".
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
    // See the "SnmpMibGroup" Javadoc API for more details.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
    //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
    // ------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
    public void check(SnmpMibSubRequest req, int depth)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
        throws SnmpStatusException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
        objectserver.check(this,req,depth);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
     * Returns true if "arc" identifies a scalar object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
    public boolean isVariable(long arc) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
        switch((int)arc) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
            case 6:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
            case 5:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
            case 4:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
            case 3:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
            case 2:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
            case 1:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
            case 7:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
                return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
            default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
        return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
     * Returns true if "arc" identifies a readable scalar object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
    public boolean isReadable(long arc) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
        switch((int)arc) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
            case 6:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
            case 5:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
            case 4:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
            case 3:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
            case 2:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
            case 1:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
            case 7:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
                return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
            default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
        return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
    // ------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
    //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
    // Implements the "skipVariable" method defined in "SnmpMibGroup".
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
    // See the "SnmpMibGroup" Javadoc API for more details.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
    //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
    // ------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
    public boolean  skipVariable(long var, Object data, int pduVersion) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
        switch((int)var) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
            case 4:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
            case 7:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
                if (pduVersion==SnmpDefinitions.snmpVersionOne) return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
            default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
        return super.skipVariable(var,data,pduVersion);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
     * Return the name of the attribute corresponding to the SNMP variable identified by "id".
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
    public String getAttributeName(long id)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
        throws SnmpStatusException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
        switch((int)id) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
            case 6:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
                return "JvmThreadCpuTimeMonitoring";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
            case 5:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
                return "JvmThreadContentionMonitoring";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
            case 4:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
                return "JvmThreadTotalStartedCount";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
            case 3:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
                return "JvmThreadPeakCount";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
            case 2:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
                return "JvmThreadDaemonCount";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
            case 1:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
                return "JvmThreadCount";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
            case 10: {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
                throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
            case 7:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
                return "JvmThreadPeakCountReset";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
            default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
        throw new SnmpStatusException(SnmpStatusException.noSuchObject);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
     * Returns true if "arc" identifies a table object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
    public boolean isTable(long arc) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
        switch((int)arc) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
            case 10:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
                return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
            default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
        return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
     * Returns the table object identified by "arc".
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
    public SnmpMibTable getTable(long arc) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
        switch((int)arc) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
            case 10:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
                return tableJvmThreadInstanceTable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
        default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
        return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
     * Register the group's SnmpMibTable objects with the meta-data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
    public void registerTableNodes(SnmpMib mib, MBeanServer server) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
        tableJvmThreadInstanceTable = createJvmThreadInstanceTableMetaNode("JvmThreadInstanceTable", "JvmThreading", mib, server);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
        if ( tableJvmThreadInstanceTable != null)  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
            tableJvmThreadInstanceTable.registerEntryNode(mib,server);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
            mib.registerTableMeta("JvmThreadInstanceTable", tableJvmThreadInstanceTable);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
     * Factory method for "JvmThreadInstanceTable" table metadata class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
     * You can redefine this method if you need to replace the default
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
     * generated metadata class with your own customized class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
     * @param tableName Name of the table object ("JvmThreadInstanceTable")
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
     * @param groupName Name of the group to which this table belong ("JvmThreading")
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
     * @param mib The SnmpMib object in which this table is registered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
     * @param server MBeanServer for this table entries (may be null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
     * @return An instance of the metadata class generated for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
     *         "JvmThreadInstanceTable" table (JvmThreadInstanceTableMeta)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
     **/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
    protected JvmThreadInstanceTableMeta createJvmThreadInstanceTableMetaNode(String tableName, String groupName, SnmpMib mib, MBeanServer server)  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
        return new JvmThreadInstanceTableMeta(mib, objectserver);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
    protected JvmThreadingMBean node;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
    protected SnmpStandardObjectServer objectserver = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
    protected JvmThreadInstanceTableMeta tableJvmThreadInstanceTable = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
}