KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > picocontainer > defaults > AbstractMonitoringLifecycleStrategy


1 /*****************************************************************************
2  * Copyright (C) PicoContainer Organization. All rights reserved. *
3  * ------------------------------------------------------------------------- *
4  * The software in this package is published under the terms of the BSD *
5  * style license a copy of which has been included with this distribution in *
6  * the LICENSE.txt file. *
7  *****************************************************************************/

8 package org.picocontainer.defaults;
9
10 import org.picocontainer.ComponentMonitor;
11
12 import java.io.Serializable JavaDoc;
13
14 /**
15  * Abstract base class for lifecycle strategy implementation supporting a {@link ComponentMonitor}.
16  *
17  * @author Jörg Schaible
18  * @since 1.2
19  */

20 public abstract class AbstractMonitoringLifecycleStrategy implements LifecycleStrategy, ComponentMonitorStrategy, Serializable JavaDoc {
21
22     private ComponentMonitor componentMonitor;
23
24     /**
25      * Construct a AbstractMonitoringLifecylceStrategy.
26      *
27      * @param monitor the componentMonitor to use
28      * @throws NullPointerException if the monitor is <code>null</code>
29      */

30     public AbstractMonitoringLifecycleStrategy(ComponentMonitor monitor) {
31         if (monitor == null) {
32             throw new NullPointerException JavaDoc("Monitor is null");
33         }
34         this.componentMonitor = monitor;
35     }
36     
37     public void changeMonitor(ComponentMonitor monitor) {
38         if (monitor == null) {
39             throw new NullPointerException JavaDoc("Monitor is null");
40         }
41         this.componentMonitor = monitor;
42     }
43
44     public ComponentMonitor currentMonitor() {
45         return componentMonitor;
46     }
47
48 }
49
Popular Tags