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

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


            }
            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 = null;

        if ( descriptor != null )
        {
            componentManager = getComponentManager( type, role, roleHint, descriptor.getRealm() );
        }
        else
        {
            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 );
                }
                // search also into descriptor realm as the key of a created component is per descriptor realm
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

        }

        PlexusContainer container = (PlexusContainer) servletContext.getAttribute( PlexusConstants.PLEXUS_KEY );
        if ( container == null )
        {
            throw new ComponentLookupException( "PlexusContainer is null." );
        }
        return container;
    }
View Full Code Here

        }

        PlexusContainer container = (PlexusContainer) servletContext.getAttribute( PlexusConstants.PLEXUS_KEY );
        if ( container == null )
        {
            throw new ComponentLookupException( "PlexusContainer is null." );
        }
        return container;
    }
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

        }

        PlexusContainer container = (PlexusContainer) servletContext.getAttribute( PlexusConstants.PLEXUS_KEY );
        if ( container == null )
        {
            throw new ComponentLookupException( "PlexusContainer is null." );
        }
        return container;
    }
View Full Code Here

                getLogger().error( "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

        }

        PlexusContainer container = (PlexusContainer) servletContext.getAttribute( PlexusConstants.PLEXUS_KEY );
        if ( container == null )
        {
            throw new ComponentLookupException( "PlexusContainer is null." );
        }
        return container;
    }
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.