KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sape > carbon > core > component > test > LongInitComponentImpl


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.test;
19
20 import org.sape.carbon.core.component.Component;
21 import org.sape.carbon.core.component.lifecycle.Initializable;
22 import org.sape.carbon.core.component.lifecycle.StateTransitionException;
23
24 /**
25  * This component is used in the ComponentKeeperTest. The component that
26  * uses this class as its functional implementation is
27  * <code>ComponentKeeperTest.LONG_INIT_COMPONENT</code>. The purpose
28  * of this component is to take a long time to initialize.
29  *
30  * Copyright 2002 Sapient
31  * @see org.sape.carbon.core.component.test.ComponentKeeperTest
32  * @since carbon 1.0
33  * @author Douglas Voet, Febuary 2002
34  * @version $Revision: 1.8 $($Author: dvoet $ / $Date: 2003/05/05 21:21:15 $)
35  */

36 public class LongInitComponentImpl implements LongInitComponent, Initializable {
37     /**
38      * Initialize the component. Called immediately after the Component's
39      * constructor. On return, the container may start the component.
40      * <p>
41      * This implementation waits on ComponentKeeperTest.TEST_LOCK. It will
42      * be notified by the test harness when it can complete its initialization.
43      *
44      * @throws LifecycleException
45      */

46     public void initialize(Component thisComponent) {
47         try {
48             synchronized(ComponentKeeperTest.TEST_LOCK) {
49                 ComponentKeeperTest.TEST_LOCK.wait();
50             }
51         } catch(InterruptedException JavaDoc ie) {
52             throw new StateTransitionException(
53                 this.getClass(),"Caught InterruptedException",ie);
54         }
55     }
56 }
57
Popular Tags