1. /*
  2. * @(#)BeanContextServiceAvailableEvent.java 1.4 01/11/29
  3. *
  4. * Copyright 2002 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 BeanContextServiceEvent
  21. */
  22. public BeanContextServiceAvailableEvent(BeanContextServices bcs, Class sc) {
  23. super((BeanContext)bcs);
  24. serviceClass = sc;
  25. }
  26. /**
  27. * get the source as a reference of type BeanContextServices
  28. */
  29. public BeanContextServices getSourceAsBeanContextServices() {
  30. return (BeanContextServices)getBeanContext();
  31. }
  32. /**
  33. * get the service class that is the subject of this notification
  34. */
  35. public Class getServiceClass() { return serviceClass; }
  36. /**
  37. * @return the current selectors available from the service
  38. */
  39. public Iterator getCurrentServiceSelectors() {
  40. return ((BeanContextServices)getSource()).getCurrentServiceSelectors(serviceClass);
  41. }
  42. /*
  43. * fields
  44. */
  45. protected Class serviceClass;
  46. }