1. /*
  2. * @(#)BeanContextServices.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.util.Iterator;
  9. import java.util.TooManyListenersException;
  10. import java.beans.beancontext.BeanContext;
  11. import java.beans.beancontext.BeanContextServiceProvider;
  12. import java.beans.beancontext.BeanContextServicesListener;
  13. /**
  14. * <p>
  15. * The BeanContextServices interface provides a mechanism for a BeanContext
  16. * to expose generic "services" to the BeanContextChild objects within.
  17. * </p>
  18. */
  19. public interface BeanContextServices extends BeanContext, BeanContextServicesListener {
  20. /**
  21. * add a service to this BeanContext
  22. */
  23. boolean addService(Class serviceClass, BeanContextServiceProvider serviceProvider);
  24. /**
  25. * remove a service from this BeanContext
  26. */
  27. void revokeService(Class serviceClass, BeanContextServiceProvider serviceProvider, boolean revokeCurrentServicesNow);
  28. /**
  29. * @return true iff the service is available.
  30. */
  31. boolean hasService(Class serviceClass);
  32. /**
  33. * @return a reference to this context's named Service as requested or null
  34. */
  35. Object getService(BeanContextChild child, Object requestor, Class serviceClass, Object serviceSelector, BeanContextServiceRevokedListener bcsrl) throws TooManyListenersException;
  36. /**
  37. * release the service reference
  38. */
  39. void releaseService(BeanContextChild child, Object requestor, Object service);
  40. /**
  41. * return the currently available services
  42. */
  43. Iterator getCurrentServiceClasses();
  44. /**
  45. * @return the currently available service selectors for the named serviceClass
  46. */
  47. Iterator getCurrentServiceSelectors(Class serviceClass);
  48. /**
  49. * add a BeanContextServicesListener to this BeanContext
  50. */
  51. void addBeanContextServicesListener(BeanContextServicesListener bcsl);
  52. /**
  53. * remove a BeanContextServicesListener from this BeanContext
  54. */
  55. void removeBeanContextServicesListener(BeanContextServicesListener bcsl);
  56. }