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