KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sape > carbon > core > component > lifecycle > test > NonFatalExceptionTestComponent


1 /*
2  * The contents of this file are subject to the Sapient Public License
3  * Version 1.0 (the "License"); you may not use this file except in compliance
4  * with the License. You may obtain a copy of the License at
5  * http://carbon.sf.net/License.html.
6  *
7  * Software distributed under the License is distributed on an "AS IS" basis,
8  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
9  * the specific language governing rights and limitations under the License.
10  *
11  * The Original Code is The Carbon Component Framework.
12  *
13  * The Initial Developer of the Original Code is Sapient Corporation
14  *
15  * Copyright (C) 2003 Sapient Corporation. All Rights Reserved.
16  */

17
18 package org.sape.carbon.core.component.lifecycle.test;
19
20 import org.sape.carbon.core.component.ComponentConfiguration;
21 import org.sape.carbon.core.component.lifecycle.NonFatalStateTransitionException;
22
23 /**
24  * throws non fatal state transition exceptions instead of regular exceptions
25  * to test roll back functionality
26  *
27  * Copyright 2002 Sapient
28  * @since carbon 1.0
29  * @author Douglas Voet, Aug 14, 2002
30  * @version $Revision: 1.4 $($Author: dvoet $ / $Date: 2003/05/05 21:21:13 $)
31  */

32 public class NonFatalExceptionTestComponent
33     extends DestroyOnExceptionTestComponentImpl {
34
35     /**
36      * @see org.sape.carbon.core.component.lifecycle.Suspendable#resume()
37      */

38     public void resume() throws Exception JavaDoc {
39         try {
40             super.resume();
41         } catch (Exception JavaDoc e) {
42             throw new NonFatalStateTransitionException(
43                 this.getClass(),
44                 "this is just a test");
45         }
46     }
47
48     /**
49      * @see org.sape.carbon.core.component.lifecycle.Startable#start()
50      */

51     public void start() throws Exception JavaDoc {
52         try {
53             super.start();
54         } catch (Exception JavaDoc e) {
55             throw new NonFatalStateTransitionException(
56                 this.getClass(),
57                 "this is just a test");
58         }
59     }
60
61     /**
62      * @see org.sape.carbon.core.component.lifecycle.Startable#stop()
63      */

64     public void stop() throws Exception JavaDoc {
65         try {
66             super.stop();
67         } catch (Exception JavaDoc e) {
68             throw new NonFatalStateTransitionException(
69                 this.getClass(),
70                 "this is just a test");
71         }
72     }
73
74     /**
75      * @see org.sape.carbon.core.component.lifecycle.Suspendable#suspend()
76      */

77     public void suspend() throws Exception JavaDoc {
78         try {
79             super.suspend();
80         } catch (Exception JavaDoc e) {
81             throw new NonFatalStateTransitionException(
82                 this.getClass(),
83                 "this is just a test");
84         }
85     }
86
87     /**
88      * @see org.sape.carbon.core.component.lifecycle.Configurable#configure(ComponentConfiguration)
89      */

90     public void configure(ComponentConfiguration configuration)
91         throws Exception JavaDoc {
92         try {
93             super.configure(configuration);
94         } catch (Exception JavaDoc e) {
95             throw new NonFatalStateTransitionException(
96                 this.getClass(),
97                 "this is just a test");
98         }
99     }
100
101 }
102
Popular Tags