public Object lookup( String componentKey )
throws ComponentLookupException
{
Object component = null;
ComponentManager componentManager = componentManagerManager.findComponentManagerByComponentKey( componentKey );
// The first time we lookup a component a component manager will not exist so we ask the
// component manager manager to create a component manager for us.
if ( componentManager == null )
{
ComponentDescriptor descriptor = componentRepository.getComponentDescriptor( componentKey );
if ( descriptor == null )
{
if ( parentContainer != null )
{
return parentContainer.lookup( componentKey );
}
// don't need this AND an exception...we'll put it at the debug output level, rather than error...
if ( getLogger().isDebugEnabled() )
{
getLogger().debug( "Nonexistent component: " + componentKey );
}
String message = "Component descriptor cannot be found in the component repository: " + componentKey + ".";
throw new ComponentLookupException( message );
}
componentManager = createComponentManager( descriptor );
}
try
{
component = componentManager.getComponent();
}
catch ( ComponentInstantiationException e )
{
throw new ComponentLookupException( "Unable to lookup component '" + componentKey + "', it could not be created", e );
}