01: /*
02: * The contents of this file are subject to the Sapient Public License
03: * Version 1.0 (the "License"); you may not use this file except in compliance
04: * with the License. You may obtain a copy of the License at
05: * http://carbon.sf.net/License.html.
06: *
07: * Software distributed under the License is distributed on an "AS IS" basis,
08: * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
09: * 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,
37: Initializable {
38: /**
39: * Initialize the component. Called immediately after the Component's
40: * constructor. On return, the container may start the component.
41: * <p>
42: * This implementation waits on ComponentKeeperTest.TEST_LOCK. It will
43: * be notified by the test harness when it can complete its initialization.
44: *
45: * @throws LifecycleException
46: */
47: public void initialize(Component this Component) {
48: try {
49: synchronized (ComponentKeeperTest.TEST_LOCK) {
50: ComponentKeeperTest.TEST_LOCK.wait();
51: }
52: } catch (InterruptedException ie) {
53: throw new StateTransitionException(this .getClass(),
54: "Caught InterruptedException", ie);
55: }
56: }
57: }
|