org.jboss.seam.solder.beanManager
Class BeanManagerLocator

java.lang.Object
  extended by org.jboss.seam.solder.beanManager.BeanManagerLocator

public class BeanManagerLocator
extends Object

A utility for use in non-managed classes, which are not able to obtain a reference to the BeanManager using injection.

BeanManagerProvider is an SPI that may be implemented to allow third parties to register custom methods of looking up the BeanManager in an external context. This class will consult implementations according to precedence.

**WARNING** This class is NOT a clever way to get the BeanManager, and should be avoided at all costs. If you need a handle to the BeanManager you should probably register an Extension instead of using this class; have you tried using @Inject?

If you think you need to use this class, chat to the community and make sure you aren't missing a trick!

Author:
Pete Muir, Nicklas Karlsson, Dan Allen
See Also:
BeanManagerProvider, BeanManagerAware

Constructor Summary
BeanManagerLocator()
           
 
Method Summary
 BeanManager getBeanManager()
          If a lookup has not yet been performed, consult registered BeanManagerProvider implementations to locate the BeanManager and return the result.
 BeanManagerProvider getLocatingProvider()
          Return the BeanManagerProvider that was used to locate the BeanManager.
 boolean isBeanManagerAvailable()
          If a lookup has not yet been performed, consult registered BeanManagerProvider implementations to locate the BeanManager and return whether it was found, caching the result.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanManagerLocator

public BeanManagerLocator()
Method Detail

getBeanManager

public BeanManager getBeanManager()
If a lookup has not yet been performed, consult registered BeanManagerProvider implementations to locate the BeanManager and return the result. If the BeanManager cannot be resolved, throw a BeanManagerUnavailableException.

Returns:
the BeanManager for the current bean archive
Throws:
BeanManagerUnavailableException - if the BeanManager cannot be resolved

isBeanManagerAvailable

public boolean isBeanManagerAvailable()
If a lookup has not yet been performed, consult registered BeanManagerProvider implementations to locate the BeanManager and return whether it was found, caching the result.

Returns:
true if the bean manager has been found, otherwise false

getLocatingProvider

public BeanManagerProvider getLocatingProvider()
Return the BeanManagerProvider that was used to locate the BeanManager. This method will not attempt a lookup.

Returns:
the BeanManagerProvider implementation


Copyright © 2008-2010 Seam Framework. All Rights Reserved.