Package org.codehaus.plexus.component.factory

Examples of org.codehaus.plexus.component.factory.ComponentInstantiationException


            component = componentFactory.newInstance( componentDescriptor, plexusRealm, this );
        }
        catch ( UndefinedComponentFactoryException e )
        {
            throw new ComponentInstantiationException( "Unable to create component as factory '" + componentFactoryId + "' could not be found", e );
        }
        finally
        {
            // the java factory is a special case, without a component manager.
            // Don't bother releasing the java factory.
View Full Code Here


            int modifiers = implementationClass.getModifiers();

            if ( Modifier.isInterface( modifiers ) )
            {
                throw new ComponentInstantiationException( "Cannot instanciate implementation '" + implementation + "' because the class is a interface." );
            }

            if ( Modifier.isAbstract( modifiers ) )
            {
                throw new ComponentInstantiationException( "Cannot instanciate implementation '" + implementation + "' because the class is abstract." );
            }

            Object instance = implementationClass.newInstance();

            return instance;
View Full Code Here

        componentClassRealm.display();

        String msg = "Could not instanciate component: " + componentDescriptor.getHumanReadableKey();

        return new ComponentInstantiationException( msg, e );
    }
View Full Code Here

            // reuse original exception message.. the ones from XBean contain a lot of information
            if ( cause != null )
            {
                // wrap real cause if we got one
                throw new ComponentInstantiationException( e.getMessage(), cause );
            }
            else
            {
                throw new ComponentInstantiationException( e.getMessage() );
            }
        }
        catch ( UndefinedComponentFactoryException e )
        {
            throw new ComponentInstantiationException( e );
        }
        finally
        {
            Thread.currentThread().setContextClassLoader( oldClassLoader );
        }
View Full Code Here

                    for (String name : configuration.getAttributeNames()) {
                        String value;
                        try {
                            value = configuration.getAttribute(name);
                        } catch (PlexusConfigurationException e) {
                            throw new ComponentInstantiationException("Error getting value for attribute " + name, e);
                        }
                        name = fromXML(name);
                        recipe.setProperty(name, value);
                    }
                    for (PlexusConfiguration child : configuration.getChildren()) {
View Full Code Here

                mapOrientedComponent.addComponentRequirement(requirement, value);
            }
            catch ( ComponentLookupException e )
            {
                throw new ComponentInstantiationException( "Error looking up requirement of MapOrientedComponent ", e );
            }
            catch ( ComponentConfigurationException e )
            {
                throw new ComponentInstantiationException( "Error adding requirement to MapOrientedComponent ", e );
            }
        }

        MapConverter converter = new MapConverter();
        ConverterLookup converterLookup = new DefaultConverterLookup();
        DefaultExpressionEvaluator expressionEvaluator = new DefaultExpressionEvaluator();
        PlexusConfiguration configuration = container.getConfigurationSource().getConfiguration( descriptor );

        if ( configuration != null )
        {
            try
            {
                Map context = (Map) converter.fromConfiguration(converterLookup,
                                                                configuration,
                                                                null,
                                                                null,
                                                                realm,
                                                                expressionEvaluator,
                                                                null );

                mapOrientedComponent.setComponentConfiguration( context );
            }
            catch ( ComponentConfigurationException e )
            {
                throw new ComponentInstantiationException( "Error adding configuration to MapOrientedComponent ", e );
            }
        }
    }
View Full Code Here

            String message = "Creation circularity: ";
            for ( ComponentDescriptor<?> componentDescriptor : circularity )
            {
                message += "\n\t[" + componentDescriptor.getRole() + ", " + componentDescriptor.getRoleHint() + "]";
            }
            throw new ComponentInstantiationException( message );
        }
        stack.add( descriptor );
        try
        {
            if (listener != null) {
View Full Code Here

                    for (String name : configuration.getAttributeNames()) {
                        String value;
                        try {
                            value = configuration.getAttribute(name);
                        } catch (PlexusConfigurationException e) {
                            throw new ComponentInstantiationException("Error getting value for attribute " + name, e);
                        }
                        name = fromXML(name);
                        recipe.setProperty(name, value);
                    }
                    for (PlexusConfiguration child : configuration.getChildren()) {
View Full Code Here

            component = componentFactory.newInstance( componentDescriptor, plexusRealm, this );
        }
        catch ( UndefinedComponentFactoryException e )
        {
            throw new ComponentInstantiationException( "Unable to create component as factory '" + componentFactoryId + "' could not be found", e );
        }
        finally
        {
            // the java factory is a special case, without a component manager.
            // Don't bother releasing the java factory.
View Full Code Here

            int modifiers = implementationClass.getModifiers();

            if ( Modifier.isInterface( modifiers ) )
            {
                throw new ComponentInstantiationException(
                    "Cannot instantiate implementation '" + implementation + "' because the class is a interface." );
            }

            if ( Modifier.isAbstract( modifiers ) )
            {
                throw new ComponentInstantiationException(
                    "Cannot instantiate implementation '" + implementation + "' because the class is abstract." );
            }

            Object instance = implementationClass.newInstance();
View Full Code Here

TOP

Related Classes of org.codehaus.plexus.component.factory.ComponentInstantiationException

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.