1. /*
  2. * @(#)BeanContextServiceProvider.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. /**
  10. * <p>
  11. * One of the primary functions of a BeanContext is to act a as rendezvous
  12. * between JavaBeans, and BeanContextServiceProviders.
  13. * </p>
  14. * <p>
  15. * A JavaBean nested within a BeanContext, may ask that BeanContext to
  16. * provide an instance of a "service", based upon a reference to a Java
  17. * Class object that represents that service.
  18. * </p>
  19. * <p>
  20. * If such a service has been registered with the context, or one of its
  21. * nesting context's, in the case where a context delegate to its context
  22. * to satisfy a service request, then the BeanContextServiceProvider associated with
  23. * the service is asked to provide an instance of that service.
  24. * </p>
  25. * <p>
  26. * The ServcieProvider may always return the same instance, or it may
  27. * construct a new instance for each request.
  28. * </p>
  29. */
  30. public interface BeanContextServiceProvider {
  31. /**
  32. * request an instance of a service,
  33. *
  34. * @param requestor The object requesting the service
  35. * @param serviceClass The service requested
  36. * @param serviceSelector Additional parameterisation of the service
  37. */
  38. Object getService(BeanContextServices bcs, Object requestor, Class serviceClass, Object serviceSelector);
  39. /**
  40. * release the service
  41. */
  42. public void releaseService(BeanContextServices bcs, Object requestor, Object service);
  43. /**
  44. * @return the current service selectors for the specified serviceClass
  45. */
  46. Iterator getCurrentServiceSelectors(BeanContextServices bcs, Class serviceClass);
  47. }