Package org.codehaus.plexus.component.repository.exception

Examples of org.codehaus.plexus.component.repository.exception.ComponentLookupException


                    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 );
        }
        catch ( ComponentLifecycleException e )
        {
            throw new ComponentLookupException( "Unable to lookup component '" + componentKey + "', it could not be started", e );
        }

        componentManagerManager.associateComponentWithComponentManager( component, componentManager );

        return component;
View Full Code Here


        }
        catch ( UndefinedComponentManagerException e )
        {
            String message = "Cannot create component manager for " + descriptor.getComponentKey() + ", so we cannot provide a component instance.";

            throw new ComponentLookupException( message, e );
        }
        catch ( UndefinedLifecycleHandlerException e )
        {
            String message = "Cannot create component manager for " + descriptor.getComponentKey() + ", so we cannot provide a component instance.";

            throw new ComponentLookupException( message, e );
        }

        return componentManager;
    }
View Full Code Here

    public <T> T lookup( ComponentDescriptor<T> componentDescriptor ) throws ComponentLookupException
    {
        ComponentManager<T> componentManager = (ComponentManager<T>) componentManagersByComponentDescriptor.get( componentDescriptor );
        if ( componentManager == null )
        {
            throw new ComponentLookupException( "Component descriptor is not registered with PlexusContainer", componentDescriptor );
        }
        return getComponent( componentManager );
    }
View Full Code Here

    private <T> T getComponent( Class<T> type, String roleHint ) throws ComponentLookupException
    {
        ComponentManager<T> componentManager = (ComponentManager<T>) index.get( type, roleHint );
        if ( componentManager == null )
        {
            throw new ComponentLookupException( "Component descriptor cannot be found", type, roleHint );
        }
        return getComponent( componentManager );
    }
View Full Code Here

            if (cause instanceof ComponentLookupException )
            {
                throw (ComponentLookupException) cause;
            }

            throw new ComponentLookupException( e.getMessage(), descriptor, cause );
        }
        finally
        {
            popComponentStack();
        }
View Full Code Here

        {
            if ( descriptor.equals( element.getDescriptor() ) )
            {
                // HACK: add descriptor to stack before creating exception so it is in the stack
                stack.addFirst( new ComponentStackElement( descriptor ) );
                ComponentLookupException exception = new ComponentLookupException( "Creation circularity", descriptor );
                stack.removeFirst();

                throw exception;
            }
        }
View Full Code Here

            }
            return component;
        }
        catch ( ComponentInstantiationException e )
        {
            throw new ComponentLookupException(
                "Unable to lookup component '" + componentManager.getRole() + "', it could not be created.",
                componentManager.getRole(), componentManager.getRoleHint(), componentManager.getRealm(), e );
        }
        catch ( ComponentLifecycleException e )
        {
            throw new ComponentLookupException(
                "Unable to lookup component '" + componentManager.getRole() + "', it could not be started.",
                componentManager.getRole(), componentManager.getRoleHint(), componentManager.getRealm(), e );
        }
    }
View Full Code Here

    private synchronized <T> ComponentManager<T> getComponentManager( Class<T> type, String role, String roleHint, ComponentDescriptor<T> descriptor )
        throws ComponentLookupException
    {
        if ( disposingComponents )
        {
            throw new ComponentLookupException("ComponentRegistry is not active",
                role,
                roleHint );
        }

        ComponentManager<T> componentManager = getComponentManager( type, role, roleHint );
        if ( componentManager == null )
        {
            // we need to create a component manager, but first we must have a descriptor
            if ( descriptor == null )
            {
                descriptor = getComponentDescriptor( type, role, roleHint );
                if ( descriptor == null )
                {
                    throw new ComponentLookupException(
                        "Component descriptor cannot be found in the component repository",
                        role,
                        roleHint );
                }
            }
View Full Code Here

            instantiationStrategy = DEFAULT_INSTANTIATION_STRATEGY;
        }
        ComponentManagerFactory componentManagerFactory = componentManagerFactories.get( instantiationStrategy );
        if ( componentManagerFactory == null )
        {
            throw new ComponentLookupException( "Unsupported instantiation strategy: " + instantiationStrategy,
                role,
                roleHint,
                descriptor.getRealm() );
        }

        // Get the LifecycleHandler
        LifecycleHandler lifecycleHandler;
        try
        {
            lifecycleHandler = lifecycleHandlerManager.getLifecycleHandler( descriptor.getLifecycleHandler() );
        }
        catch ( UndefinedLifecycleHandlerException e )
        {
            throw new ComponentLookupException( "Undefined lifecycle handler: " + descriptor.getLifecycleHandler(),
                role,
                roleHint,
                descriptor.getRealm() );
        }
View Full Code Here

        messageBuffer.append( "Error activating profiles." );
        messageBuffer.append( "\n\nReason: " ).append( activationException.getMessage() );

        if ( DiagnosisUtils.containsInCausality( activationException, ComponentLookupException.class ) )
        {
            ComponentLookupException cle = (ComponentLookupException) DiagnosisUtils.getFromCausality(
                activationException, ComponentLookupException.class );

            messageBuffer.append( "\n\nThere was a problem retrieving one or more profile activators." );
            messageBuffer.append( "\n" ).append( cle.getMessage() );
        }

        messageBuffer.append( "\n" );

        return messageBuffer.toString();
View Full Code Here

TOP

Related Classes of org.codehaus.plexus.component.repository.exception.ComponentLookupException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.