KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > avalon > excalibur > util > test > FullLifecycleComponent


1 /*
2  * Copyright (C) The Apache Software Foundation. All rights reserved.
3  *
4  * This software is published under the terms of the Apache Software License
5  * version 1.1, a copy of which has been included with this distribution in
6  * the LICENSE.txt file.
7  */

8 package org.apache.avalon.excalibur.util.test;
9
10 import org.apache.avalon.excalibur.util.ComponentStateValidator;
11 import org.apache.avalon.framework.activity.Disposable;
12 import org.apache.avalon.framework.activity.Initializable;
13 import org.apache.avalon.framework.activity.Startable;
14 import org.apache.avalon.framework.activity.Suspendable;
15 import org.apache.avalon.framework.component.Composable;
16 import org.apache.avalon.framework.component.ComponentManager;
17 import org.apache.avalon.framework.component.ComponentException;
18 import org.apache.avalon.framework.configuration.Configurable;
19 import org.apache.avalon.framework.configuration.Configuration;
20 import org.apache.avalon.framework.configuration.ConfigurationException;
21 import org.apache.avalon.framework.context.Contextualizable;
22 import org.apache.avalon.framework.context.Context;
23 import org.apache.avalon.framework.context.ContextException;
24 import org.apache.avalon.framework.logger.LogEnabled;
25 import org.apache.avalon.framework.logger.Logger;
26 import org.apache.avalon.framework.parameters.Parameterizable;
27 import org.apache.avalon.framework.parameters.Parameters;
28 import org.apache.avalon.framework.parameters.ParameterException;
29 import org.apache.avalon.framework.thread.ThreadSafe;
30
31 /**
32  * This test class is used to test the AbstractComponent facilities for you.
33  *
34  * @author <a HREF="bloritsch@apache.org">Berin Loritsch</a>
35  * @version CVS $Revision: 1.3 $ $Date: 2001/12/11 09:53:37 $
36  */

37 public final class FullLifecycleComponent
38     implements LogEnabled, Contextualizable, Parameterizable, Configurable,
39                Composable, Initializable, Startable, Suspendable, Disposable,
40                ThreadSafe
41 {
42     private ComponentStateValidator m_validator = new ComponentStateValidator( this );
43     private Logger m_logger;
44     private Context m_context;
45     private Parameters m_parameters;
46     private Configuration m_configuration;
47     private ComponentManager m_componentManager;
48
49     public void enableLogging( Logger logger )
50     {
51         m_validator.checkNotAssigned( m_logger );
52         m_validator.checkLogEnabled();
53
54         m_logger = logger;
55     }
56
57     public void contextualize( Context context )
58         throws ContextException
59     {
60         m_validator.checkNotAssigned( m_context );
61         m_validator.checkContextualized();
62
63         m_context = context;
64     }
65
66     public void parameterize( Parameters params )
67         throws ParameterException
68     {
69         m_validator.checkNotAssigned( m_parameters );
70         m_validator.checkParameterized();
71
72         m_parameters = params;
73     }
74
75     public void configure( Configuration config )
76         throws ConfigurationException
77     {
78         m_validator.checkNotAssigned( m_configuration );
79         m_validator.checkConfigured();
80
81         m_configuration = config;
82     }
83
84     public void compose( ComponentManager manager )
85         throws ComponentException
86     {
87         m_validator.checkNotAssigned( m_componentManager );
88         m_validator.checkComposed();
89     }
90
91     public void initialize()
92         throws Exception JavaDoc
93     {
94         m_validator.checkInitialized();
95     }
96
97     public void start()
98         throws Exception JavaDoc
99     {
100         m_validator.checkStarted();
101     }
102
103     public void suspend()
104     {
105         m_validator.checkSuspended();
106     }
107
108     public void resume()
109     {
110         m_validator.checkResumed();
111     }
112
113     public void stop()
114         throws Exception JavaDoc
115     {
116         m_validator.checkStopped();
117     }
118
119     public void dispose()
120     {
121         m_validator.checkDisposed();
122
123         m_logger = null;
124         m_context = null;
125         m_parameters = null;
126         m_configuration = null;
127         m_componentManager = null;
128     }
129 }
130
Popular Tags