KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > picocontainer > ComponentMonitor


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  * Original code by Paul Hammant & Obie Fernandez & Aslak *
9  *****************************************************************************/

10
11 package org.picocontainer;
12
13 import java.lang.reflect.Constructor JavaDoc;
14 import java.lang.reflect.Method JavaDoc;
15
16 /**
17  * A component monitor is responsible for monitoring the component instantiation
18  * and method invocation.
19  *
20  * @author Paul Hammant
21  * @author Obie Fernandez
22  * @author Aslak Hellesøy
23  * @author Mauro Talevi
24  * @version $Revision: 2971 $
25  * @since 1.2
26  */

27 public interface ComponentMonitor {
28
29     /**
30      * Event thrown as the component is being instantiated using the given constructor
31      *
32      * @param constructor the Constructor used to instantiate the component
33      */

34     void instantiating(Constructor JavaDoc constructor);
35
36     /**
37      * Event thrown after the component has been instantiated using the given constructor
38      *
39      * @param constructor the Constructor used to instantiate the component
40      * @param duration the duration in millis of the instantiation
41      * @deprecated since 1.3
42      */

43     void instantiated(Constructor JavaDoc constructor, long duration);
44
45     /**
46      * Event thrown after the component has been instantiated using the given constructor.
47      * This should be called for both Constructor and Setter DI.
48      *
49      * @param constructor the Constructor used to instantiate the component
50      * @param instantiated the component that was instantiated by PicoContainer
51      * @param injected the components during instantiation.
52      * @param duration the duration in millis of the instantiation
53      * @since 1.3
54      */

55
56     void instantiated(Constructor JavaDoc constructor, Object JavaDoc instantiated, Object JavaDoc[] injected, long duration);
57
58     /**
59      * Event thrown if the component instantiation failed using the given constructor
60      *
61      * @param constructor the Constructor used to instantiate the component
62      * @param cause the Exception detailing the cause of the failure
63      */

64     void instantiationFailed(Constructor JavaDoc constructor, Exception JavaDoc cause);
65
66     /**
67      * Event thrown as the component method is being invoked on the given instance
68      *
69      * @param method the Method invoked on the component instance
70      * @param instance the component instance
71      */

72     void invoking(Method JavaDoc method, Object JavaDoc instance);
73
74     /**
75      * Event thrown after the component method has been invoked on the given instance
76      *
77      * @param method the Method invoked on the component instance
78      * @param instance the component instance
79      * @param duration the duration in millis of the invocation
80      */

81     void invoked(Method JavaDoc method, Object JavaDoc instance, long duration);
82
83     /**
84      * Event thrown if the component method invocation failed on the given instance
85      *
86      * @param method the Method invoked on the component instance
87      * @param instance the component instance
88      * @param cause the Exception detailing the cause of the failure
89      */

90     void invocationFailed(Method JavaDoc method, Object JavaDoc instance, Exception JavaDoc cause);
91
92     /**
93      * Event thrown if a lifecycle method invocation - start, stop or dispose -
94      * failed on the given instance
95      *
96      * @param method the lifecycle Method invoked on the component instance
97      * @param instance the component instance
98      * @param cause the RuntimeException detailing the cause of the failure
99      */

100     void lifecycleInvocationFailed(Method JavaDoc method, Object JavaDoc instance, RuntimeException JavaDoc cause);
101
102
103 }
104
Popular Tags