1. /*
  2. * Copyright 2002-2004 the original author or authors.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package org.springframework.beans.factory.access;
  17. import org.springframework.beans.FatalBeanException;
  18. import org.springframework.beans.factory.BeanFactory;
  19. /**
  20. * Class used to track a reference to a BeanFactory obtained through
  21. * a BeanFactoryLocator.
  22. * @author Colin Sampaleanu
  23. * @version $Revision: 1.5 $
  24. * @see BeanFactoryLocator
  25. */
  26. public interface BeanFactoryReference {
  27. /**
  28. * Returns the BeanFactory instance held by this reference
  29. */
  30. BeanFactory getFactory();
  31. /**
  32. * <p>Indicate that the BeanFactory instance referred to by this object is not
  33. * needed any longer by the client code which obtained the ref object. Depending
  34. * on the actual implementation of BeanFactoryLocator, and the actual type of
  35. * BeanFactory, this may possibly not actually do anything; alternately in the
  36. * case of a 'closeable' BeanFactory or derived class (such as ApplicationContext)
  37. * may 'close' it, or may 'close' it once no more references remain.</p>
  38. * <p>In an EJB usage scenario this would normally be called from ejbRemove and
  39. * ejbPassivate.
  40. * @throws FatalBeanException if the BeanFactory cannot be released
  41. * @see org.springframework.beans.factory.access.BeanFactoryLocator
  42. */
  43. void release() throws FatalBeanException;
  44. }