KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > beans > beancontext > BeanContextServiceAvailableEvent


1 /*
2  * @(#)BeanContextServiceAvailableEvent.java 1.9 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package java.beans.beancontext;
9
10 import java.beans.beancontext.BeanContextChild JavaDoc;
11 import java.beans.beancontext.BeanContextEvent JavaDoc;
12
13 import java.beans.beancontext.BeanContextServices JavaDoc;
14
15 import java.util.Iterator JavaDoc;
16
17 /**
18  * <p>
19  * This event type is used by the BeanContextServicesListener in order to
20  * identify the service being registered.
21  * </p>
22  */

23
24 public class BeanContextServiceAvailableEvent extends BeanContextEvent JavaDoc {
25
26     /**
27      * Construct a <code>BeanContextAvailableServiceEvent</code>.
28      * @param bcs The context in which the service has become available
29      * @param sc A <code>Class</code> reference to the newly available service
30      */

31     public BeanContextServiceAvailableEvent(BeanContextServices JavaDoc bcs, Class JavaDoc sc) {
32     super((BeanContext JavaDoc)bcs);
33
34     serviceClass = sc;
35     }
36
37     /**
38      * Gets the source as a reference of type <code>BeanContextServices</code>.
39      * @return The context in which the service has become available
40      */

41     public BeanContextServices JavaDoc getSourceAsBeanContextServices() {
42     return (BeanContextServices JavaDoc)getBeanContext();
43     }
44
45     /**
46      * Gets the service class that is the subject of this notification.
47      * @return A <code>Class</code> reference to the newly available service
48      */

49     public Class JavaDoc getServiceClass() { return serviceClass; }
50
51     /**
52      * Gets the list of service dependent selectors.
53      * @return the current selectors available from the service
54      */

55     public Iterator JavaDoc getCurrentServiceSelectors() {
56         return ((BeanContextServices JavaDoc)getSource()).getCurrentServiceSelectors(serviceClass);
57     }
58
59     /*
60      * fields
61      */

62
63     /**
64      * A <code>Class</code> reference to the newly available service
65      */

66     protected Class JavaDoc serviceClass;
67 }
68
69
70
71
72
Popular Tags