1. /*
  2. * @(#)BeanContextServiceAvailableEvent.java 1.8 03/01/23
  3. *
  4. * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.beans.beancontext;
  8. import java.beans.beancontext.BeanContextChild;
  9. import java.beans.beancontext.BeanContextEvent;
  10. import java.beans.beancontext.BeanContextServices;
  11. import java.util.Iterator;
  12. /**
  13. * <p>
  14. * This event type is used by the BeanContextServicesListener in order to
  15. * identify the service being registered.
  16. * </p>
  17. */
  18. public class BeanContextServiceAvailableEvent extends BeanContextEvent {
  19. /**
  20. * Construct a <code>BeanContextAvailableServiceEvent</code>.
  21. * @param bcs The context in which the service has become available
  22. * @param sc A <code>Class</code> reference to the newly available service
  23. */
  24. public BeanContextServiceAvailableEvent(BeanContextServices bcs, Class sc) {
  25. super((BeanContext)bcs);
  26. serviceClass = sc;
  27. }
  28. /**
  29. * Gets the source as a reference of type <code>BeanContextServices</code>.
  30. * @return The context in which the service has become available
  31. */
  32. public BeanContextServices getSourceAsBeanContextServices() {
  33. return (BeanContextServices)getBeanContext();
  34. }
  35. /**
  36. * Gets the service class that is the subject of this notification.
  37. * @return A <code>Class</code> reference to the newly available service
  38. */
  39. public Class getServiceClass() { return serviceClass; }
  40. /**
  41. * Gets the list of service dependent selectors.
  42. * @return the current selectors available from the service
  43. */
  44. public Iterator getCurrentServiceSelectors() {
  45. return ((BeanContextServices)getSource()).getCurrentServiceSelectors(serviceClass);
  46. }
  47. /*
  48. * fields
  49. */
  50. /**
  51. * A <code>Class</code> reference to the newly available service
  52. */
  53. protected Class serviceClass;
  54. }