KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)file SnmpStatusException.java
3  * @(#)author Sun Microsystems, Inc.
4  * @(#)version 4.9
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
12
13 package com.sun.jmx.snmp;
14
15
16 // "@(#)SnmpStatusException.java 3.2 98/11/05 SMI"
17

18
19
20 /**
21  * Reports an error which occurred during a get/set operation on a mib node.
22  *
23  * This exception includes a status error code as defined in the SNMP protocol.
24  *
25  * <p><b>This API is a Sun Microsystems internal API and is subject
26  * to change without notice.</b></p>
27  * @version 3.2 11/05/98
28  * @author Sun Microsystems, Inc
29  */

30
31 public class SnmpStatusException extends Exception JavaDoc implements SnmpDefinitions {
32
33
34     /**
35      * Error code as defined in RFC 1448 for: <CODE>noSuchName</CODE>.
36      */

37     public static final int noSuchName = 2 ;
38   
39     /**
40      * Error code as defined in RFC 1448 for: <CODE>badValue</CODE>.
41      */

42     public static final int badValue = 3 ;
43   
44     /**
45      * Error code as defined in RFC 1448 for: <CODE>readOnly</CODE>.
46      */

47     public static final int readOnly = 4 ;
48   
49    
50     /**
51      * Error code as defined in RFC 1448 for: <CODE>noAccess</CODE>.
52      */

53     public static final int noAccess = 6 ;
54   
55     /**
56      * Error code for reporting a no such instance error.
57      */

58     public static final int noSuchInstance = 0xE0;
59   
60     /**
61      * Error code for reporting a no such object error.
62      */

63     public static final int noSuchObject = 0xE1;
64   
65     /**
66      * Constructs a new <CODE>SnmpStatusException</CODE> with the specified status error.
67      * @param status The error status.
68      */

69     public SnmpStatusException(int status) {
70     errorStatus = status ;
71     }
72
73     /**
74      * Constructs a new <CODE>SnmpStatusException</CODE> with the specified status error and status index.
75      * @param status The error status.
76      * @param index The error index.
77      */

78     public SnmpStatusException(int status, int index) {
79     errorStatus = status ;
80     errorIndex = index ;
81     }
82   
83     /**
84      * Constructs a new <CODE>SnmpStatusException</CODE> with an error message.
85      * The error status is set to 0 (noError) and the index to -1.
86      * @param s The error message.
87      */

88     public SnmpStatusException(String JavaDoc s) {
89     super(s);
90     }
91   
92     /**
93      * Constructs a new <CODE>SnmpStatusException</CODE> with an error index.
94      * @param x The original <CODE>SnmpStatusException</CODE>.
95      * @param index The error index.
96      */

97     public SnmpStatusException(SnmpStatusException x, int index) {
98     super(x.getMessage());
99     errorStatus= x.errorStatus;
100     errorIndex= index;
101     }
102
103     /**
104      * Return the error status.
105      * @return The error status.
106      */

107     public int getStatus() {
108     return errorStatus ;
109     }
110   
111     /**
112      * Returns the index of the error.
113      * A value of -1 means that the index is not known/applicable.
114      * @return The error index.
115      */

116     public int getErrorIndex() {
117     return errorIndex;
118     }
119
120   
121     // PRIVATE VARIABLES
122
//--------------------
123

124     /**
125      * Status of the error.
126      * @serial
127      */

128     private int errorStatus = 0 ;
129   
130     /**
131      * Index of the error.
132      * If different from -1, indicates the index where the error occurs.
133      * @serial
134      */

135     private int errorIndex= -1;
136
137 }
138
139
140
141
Popular Tags