001/**
002 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003 *
004 * Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved
005 *
006 * The contents of this file are subject to the terms
007 * of the Common Development and Distribution License
008 * (the License). You may not use this file except in
009 * compliance with the License.
010 *
011 * You can obtain a copy of the License at
012 * https://opensso.dev.java.net/public/CDDLv1.0.html or
013 * opensso/legal/CDDLv1.0.txt
014 * See the License for the specific language governing
015 * permission and limitations under the License.
016 *
017 * When distributing Covered Code, include this CDDL
018 * Header Notice in each file and include the License file
019 * at opensso/legal/CDDLv1.0.txt.
020 * If applicable, add the following below the CDDL Header,
021 * with the fields enclosed by brackets [] replaced by
022 * your own identifying information:
023 * "Portions Copyrighted [year] [name of copyright owner]"
024 *
025 * $Id: LogException.java,v 1.3 2008/06/25 05:41:32 qcheng Exp $
026 *
027 */
028
029package com.iplanet.log;
030
031/** 
032 * The applications may encounter errors when they are denied for 
033 * a log access because they don't have the access privileges or
034 * when they do not have a valid session. The applications may also
035 * encounter errors when the logging server is not able response to
036 * the applications' request or for some other reasons. This 
037 * LogException class provides the method for detecting such errors.
038 *
039 * @supported.all.api
040 */
041public class LogException extends Exception {
042
043    /**
044     * Invalid session.
045     */
046    static public final int INVALID_SESSION = 500;
047
048    /**
049     * Log already exists.
050     */
051    static public final int ALREADY_EXISTS = 501;
052
053    /**
054     * Log is in inactive state, preventing log submission.
055     */
056    static public final int INACTIVE = 502;
057
058    /**
059     * Log handler error.
060     */
061    static public final int LOG_HANDLER_ERROR = 503;
062
063    /**
064     * Log submission error.
065     */
066    static public final int WRITE_ERROR = 504;
067
068    /**
069     * Log Retrieval error.
070     */
071    static public final int READ_ERROR = 505;
072
073    /**
074     * Log deletion error.
075     */
076    static public final int DELETE_ERROR = 506;
077
078    /**
079     * Log list does not exist.
080     */
081    static public final int LIST_NOT_EXISTS = 507;
082
083    /**
084     * Log type error.
085     */
086    static public final int TYPE_ERROR = 508;
087
088    /**
089     * Log creation privilege is denied.
090     */
091    static public final int CREATE_ACCESS_DENIED = 509;
092
093    /**
094     * Log submition privilege is denied.
095     */
096    static public final int WRITE_ACCESS_DENIED = 510;
097
098    /**
099     * Log retrieval privilege is denied.
100     */
101    static public final int READ_ACCESS_DENIED = 511;
102
103    /**
104     * Log listing privilege is denied.
105     */
106    static public final int LIST_ACCESS_DENIED = 512;
107
108    /**
109     * Log profile error.
110     */
111    static public final int PROFILE_ERROR = 513;
112
113    /**
114     * No such log exists.
115     */
116    static public final int LOG_NOT_FOUND = 514;
117
118    /**
119     * No such log segment exists.
120     */
121    static public final int NO_SUCH_SEGMENT_EXISTS = 515;
122
123    /**
124     * Log deletion privilege is denied.
125     */
126    static public final int DELETE_ACCESS_DENIED = 516;
127
128    /**
129     * Log name is in valid.
130     */
131    static public final int INVALID_LOG_NAME = 517;
132
133    /**
134     * Log retrieval size (in bytes) exceeds the maximum allowed.
135     */
136    static public final int READ_EXCEEDS_MAX = 518;
137
138    /**
139     * Log JDBC driver loading failed.
140    static public final int DRIVER_LOAD_FAILED = 519;
141
142    /**
143     * Log JDBC driver null location.
144     */
145    static public final int NULL_LOCATION = 520;
146
147    /**
148     * Log JDBC driver connection failed.
149     */
150    static public final int CONNECTION_FALIED = 521;
151
152    /**
153     * Log JDBC null pointer.
154     */
155    static public final int NULL_POINTER = 522;
156
157    /**
158     * Log SQL error
159    * /
160    static public final int SQL_ERROR = 523;
161 
162    /**
163     * Other unknown fatal error.
164     */
165    static public final int FATAL_ERROR = 699;
166
167    private int excep_type;
168
169    /**
170     * Constructs a log exception.
171     */
172    public LogException() {
173        super();
174    }
175
176    /**
177     * Constructs a log exception. 
178     *
179     * @param msg Log exception message.
180     */
181    public LogException(String msg) {
182        super(msg);
183        excep_type = 0;
184    }
185
186    /**
187     * Constructs a log exception.
188     *
189     * @param msg Exception message.
190     * @param type Log exception type.
191     */
192    public LogException(String msg, int type) {
193        super(msg);
194        excep_type = type;
195    }
196
197    /**
198     * Returns log exception type. 
199     *
200     * @return Log exception type. 
201     */
202    public int getType() {
203        return excep_type;
204    }
205}
206