KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > osgi > service > prefs > BackingStoreException


1 /*
2  * $Header: /cvshome/build/org.osgi.service.prefs/src/org/osgi/service/prefs/BackingStoreException.java,v 1.12 2006/07/11 13:15:55 hargrave Exp $
3  *
4  * Copyright (c) OSGi Alliance (2001, 2006). All Rights Reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18 package org.osgi.service.prefs;
19
20 /**
21  * Thrown to indicate that a preferences operation could not complete because of
22  * a failure in the backing store, or a failure to contact the backing store.
23  *
24  * @version $Revision: 1.12 $
25  */

26 public class BackingStoreException extends Exception JavaDoc {
27     static final long serialVersionUID = -1415637364122829574L;
28     /**
29      * Nested exception.
30      */

31     private final Throwable JavaDoc cause;
32
33     /**
34      * Constructs a <code>BackingStoreException</code> with the specified detail
35      * message.
36      *
37      * @param s The detail message.
38      */

39     public BackingStoreException(String JavaDoc s) {
40         super(s);
41         this.cause = null;
42     }
43     
44     /**
45      * Constructs a <code>BackingStoreException</code> with the specified detail
46      * message.
47      *
48      * @param s The detail message.
49      * @param cause The cause of the exception. May be <code>null</code>.
50      * @since 1.1
51      */

52     public BackingStoreException(String JavaDoc s, Throwable JavaDoc cause) {
53         super(s);
54         this.cause = cause;
55     }
56     
57     /**
58      * Returns the cause of this exception or <code>null</code> if no cause was
59      * specified when this exception was created.
60      *
61      * @return The cause of this exception or <code>null</code> if no cause was
62      * specified.
63      * @since 1.1
64      */

65     public Throwable JavaDoc getCause() {
66         return cause;
67     }
68
69     /**
70      * The cause of this exception can only be set when constructed.
71      *
72      * @param cause Cause of the exception.
73      * @return This object.
74      * @throws java.lang.IllegalStateException This method will always throw an
75      * <code>IllegalStateException</code> since the cause of this
76      * exception can only be set when constructed.
77      * @since 1.1
78      */

79     public Throwable JavaDoc initCause(Throwable JavaDoc cause) {
80         throw new IllegalStateException JavaDoc();
81     }
82
83 }
84
Popular Tags