001: /**
002: * $Id: PSMBeanException.java,v 1.3 2005/02/15 14:14:34 rg149970 Exp $
003: * Copyright 2005 Sun Microsystems, Inc. All
004: * rights reserved. Use of this product is subject
005: * to license terms. Federal Acquisitions:
006: * Commercial Software -- Government Users
007: * Subject to Standard License Terms and
008: * Conditions.
009: *
010: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
011: * are trademarks or registered trademarks of Sun Microsystems,
012: * Inc. in the United States and other countries.
013: */package com.sun.portal.admin.common;
014:
015: /**
016: * A generic PS MBean error.
017: */
018: public class PSMBeanException extends Exception {
019:
020: private String errorKey;
021: private Object[] tokens = null;
022:
023: /**
024: * Constructs a new PS MBean exception with the specified error
025: * key and <code>null</code> as its detail message. The cause is
026: * not initialized, and may subsequently be initialized by a call
027: * to {@link #initCause}.
028: *
029: * @param errorKey the error key (which is saved for later
030: * retrieval by the {@link #getErrorKey()} method).
031: */
032: public PSMBeanException(String errorKey) {
033: super ();
034: this .errorKey = errorKey;
035: }
036:
037: /**
038: * Constructs a new PS MBean exception with the specified error
039: * key and detail message . The cause is not initialized, and may
040: * subsequently be initialized by a call to {@link #initCause}.
041: *
042: * @param errorKey the error key (which is saved for later
043: * retrieval by the {@link #getErrorKey()} method).
044: * @param message the detail message (which is saved for later
045: * retrieval by the {@link #getMessage()} method).
046: */
047: public PSMBeanException(String errorKey, String message) {
048: super (message);
049: this .errorKey = errorKey;
050: }
051:
052: /**
053: * Constructs a new PS MBean exception with the specified error
054: * key and object array of tokens and <code>null</code> as its detail message. The cause is
055: * not initialized, and may subsequently be initialized by a call
056: * to {@link #initCause}.
057: *
058: * @param errorKey the error key (which is saved for later
059: * retrieval by the {@link #getErrorKey()} method).
060: * @param tokens the tokens to be inserted in the localized message (which is saved for later
061: * retrieval by the {@link #getTokens()} method).
062: */
063: public PSMBeanException(String errorKey, Object[] tokens) {
064: super ();
065: this .errorKey = errorKey;
066: this .tokens = tokens;
067: }
068:
069: /**
070: * Constructs a new PS MBean exception with the specified error
071: * key, cause ,detail message of <tt>((cause == null) ?
072: * null : cause.toString())</tt> (which typically contains the
073: * class and detail message of <tt>cause</tt>)
074: *
075: * @param errorKey the error key (which is saved for later
076: * retrieval by the {@link #getErrorKey()} method).
077: * @param cause the cause (which is saved for later retrieval by
078: * the {@link #getCause()} method). (A
079: * <tt>null</tt> value is permitted, and indicates
080: * that the cause is nonexistent or unknown.)
081: */
082: public PSMBeanException(String errorKey, Throwable cause) {
083: super (cause);
084: this .errorKey = errorKey;
085: }
086:
087: /**
088: * Constructs a new PS MBean exception with the specified error
089: * key , detail message and an objecty array of tokens The cause is not initialized, and may
090: * subsequently be initialized by a call to {@link #initCause}.
091: *
092: * @param errorKey the error key (which is saved for later
093: * retrieval by the {@link #getErrorKey()} method).
094: * @param message the detail message (which is saved for later
095: * retrieval by the {@link #getMessage()} method).
096: * @param tokens the tokens to be inserted in the localized message (which is saved for later
097: * retrieval by the {@link #getTokens()} method).
098: */
099: public PSMBeanException(String errorKey, String message,
100: Object[] tokens) {
101: super (message);
102: this .errorKey = errorKey;
103: this .tokens = tokens;
104: }
105:
106: /**
107: * Constructs a new PS MBean exception with the specified error
108: * key, detail message , cause . <p>Note that the detail
109: * message associated with <code>cause</code> is <i>not</i>
110: * automatically incorporated in this exception's detail message.
111: *
112: * @param errorKey the error key (which is saved for later
113: * retrieval by the {@link #getErrorKey()} method).
114: * @param message the detail message (which is saved for later
115: * retrieval by the {@link #getMessage()} method).
116: * @param cause the cause (which is saved for later retrieval by
117: * the {@link #getCause()} method). (A
118: * <tt>null</tt> value is permitted, and indicates
119: * that the cause is nonexistent or unknown.)
120:
121: */
122: public PSMBeanException(String errorKey, String message,
123: Throwable cause) {
124: super (message, cause);
125: this .errorKey = errorKey;
126: }
127:
128: /**
129: * Constructs a new PS MBean exception with the specified error
130: * key, detail message , cause and object array of tokens. <p>Note that the detail
131: * message associated with <code>cause</code> is <i>not</i>
132: * automatically incorporated in this exception's detail message.
133: *
134: * @param errorKey the error key (which is saved for later
135: * retrieval by the {@link #getErrorKey()} method).
136: * @param message the detail message (which is saved for later
137: * retrieval by the {@link #getMessage()} method).
138: * @param cause the cause (which is saved for later retrieval by
139: * the {@link #getCause()} method). (A
140: * <tt>null</tt> value is permitted, and indicates
141: * that the cause is nonexistent or unknown.)
142: * @param tokens the tokens to be inserted in the localized message (which is saved for later
143: * retrieval by the {@link #getTokens()} method).
144: */
145: public PSMBeanException(String errorKey, String message,
146: Throwable cause, Object[] tokens) {
147: super (message, cause);
148: this .errorKey = errorKey;
149: this .tokens = tokens;
150: }
151:
152: /**
153: * Constructs a new PS MBean exception with the specified error
154: * key, cause ,detail message of <tt>((cause == null) ?
155: * null : cause.toString())</tt> (which typically contains the
156: * class and detail message of <tt>cause</tt>) and object array of tokens
157: *
158: * @param errorKey the error key (which is saved for later
159: * retrieval by the {@link #getErrorKey()} method).
160: * @param cause the cause (which is saved for later retrieval by
161: * the {@link #getCause()} method). (A
162: * <tt>null</tt> value is permitted, and indicates
163: * that the cause is nonexistent or unknown.)
164: * @param tokens the tokens to be inserted in the localized message (which is saved for later
165: * retrieval by the {@link #getTokens()} method).
166: */
167: public PSMBeanException(String errorKey, Throwable cause,
168: Object[] tokens) {
169: super (cause);
170: this .errorKey = errorKey;
171: this .tokens = tokens;
172: }
173:
174: /**
175: * Returns the error key of this PS MBean exception.
176: *
177: * @return the error key of this PS MBean exception.
178: */
179: public String getErrorKey() {
180: return errorKey;
181: }
182:
183: /**
184: * Returns the object array of tokens which can be later used to insert in
185: * localzed messages
186: *
187: * @return the tokens as an object array.
188: */
189: public Object[] getTokens() {
190: return tokens;
191: }
192:
193: }
|