KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > jmx > snmp > SnmpParams


1 /*
2  * @(#)file SnmpParams.java
3  * @(#)author Sun Microsystems, Inc.
4  * @(#)version 1.14
5  * @(#)date 08/02/09
6  *
7  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
8  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
9  *
10  */

11 package com.sun.jmx.snmp;
12
13 import com.sun.jmx.snmp.SnmpDefinitions;
14
15 /**
16  * This class is the base class of all parameters that are used when making SNMP requests to an <CODE>SnmpPeer</CODE>.
17  * <p><b>This API is a Sun Microsystems internal API and is subject
18  * to change without notice.</b></p>
19  * @since 1.5
20  */

21 public abstract class SnmpParams implements SnmpDefinitions {
22     private int protocolVersion = snmpVersionOne;
23     SnmpParams(int version) {
24     protocolVersion = version;
25     }
26
27     SnmpParams() {}
28     /**
29      * Checks whether parameters are in place for an SNMP <CODE>set</CODE> operation.
30      * @return <CODE>true</CODE> if parameters are in place, <CODE>false</CODE> otherwise.
31      */

32     public abstract boolean allowSnmpSets();
33     /**
34      * Returns the version of the protocol to use.
35      * The returned value is:
36      * <UL>
37      * <LI>{@link com.sun.jmx.snmp.SnmpDefinitions#snmpVersionOne snmpVersionOne} if the protocol is SNMPv1
38      * <LI>{@link com.sun.jmx.snmp.SnmpDefinitions#snmpVersionTwo snmpVersionTwo} if the protocol is SNMPv2
39      * <LI>{@link com.sun.jmx.snmp.SnmpDefinitions#snmpVersionThree snmpVersionThree} if the protocol is SNMPv3
40      * </UL>
41      * @return The version of the protocol to use.
42      */

43     public int getProtocolVersion() {
44         return protocolVersion ;
45     }
46
47     /**
48      * Sets the version of the protocol to be used.
49      * The version should be identified using the definitions
50      * contained in
51      * {@link com.sun.jmx.snmp.SnmpDefinitions SnmpDefinitions}.
52      * <BR>For instance if you wish to use SNMPv2, you can call the method as follows:
53      * <BLOCKQUOTE><PRE>
54      * setProtocolVersion(SnmpDefinitions.snmpVersionTwo);
55      * </PRE></BLOCKQUOTE>
56      * @param protocolversion The version of the protocol to be used.
57      */

58
59     public void setProtocolVersion(int protocolversion) {
60         this.protocolVersion = protocolversion ;
61     }
62 }
63
Popular Tags