Package org.codehaus.plexus.component.configurator

Examples of org.codehaus.plexus.component.configurator.ComponentConfigurator


            if ( StringUtils.isEmpty( configuratorId ) )
            {
                configuratorId = DEFAULT_CONFIGURATOR_ID;
            }

            ComponentConfigurator componentConfigurator =
                (ComponentConfigurator) manager.getContainer().lookup( ComponentConfigurator.ROLE, configuratorId, lookupRealm );

            if ( descriptor.hasConfiguration() )
            {
                ClassRealm realm =
                    manager.getContainer().getComponentRealm( manager.getComponentDescriptor().getRealmId() );

                //PLXAPI: we should probably be using the component realm.
                componentConfigurator.configureComponent( object, manager.getComponentDescriptor().getConfiguration(),
                                                          realm );
            }
        }
        catch ( ComponentLookupException e )
        {
View Full Code Here


            if ( id != null && id.equals( repositoryId ) && ( server.getConfiguration() != null ) )
            {
                final PlexusConfiguration plexusConf =
                    new XmlPlexusConfiguration( (Xpp3Dom) server.getConfiguration() );

                ComponentConfigurator componentConfigurator = null;
                try
                {
                    componentConfigurator =
                        (ComponentConfigurator) container.lookup( ComponentConfigurator.ROLE, "basic" );
                    if ( isMaven3OrMore() )
                    {
                        componentConfigurator.configureComponent( wagon, plexusConf,
                                                                  container.getContainerRealm() );
                    }
                    else
                    {
                        configureWagonWithMaven2( componentConfigurator, wagon, plexusConf, container );
View Full Code Here

    private void configureComponent( final Object component, final Xpp3Dom config,
                                     final AssemblerConfigurationSource configSource )
        throws ComponentLookupException, ComponentConfigurationException
    {
        final ComponentConfigurator configurator =
            (ComponentConfigurator) container.lookup( ComponentConfigurator.ROLE, "basic" );

        final ConfigurationListener listener = new DebugConfigurationListener( getLogger() );

        final ExpressionEvaluator expressionEvaluator = new AssemblyExpressionEvaluator( configSource );
View Full Code Here

        configureMojo(mojo, new FileInputStream(pom));
        return mojo;
    }

    private void configureMojo(Object mojo, InputStream is) throws Exception {
        ComponentConfigurator configurator = new BasicComponentConfigurator();
        ExpressionEvaluator evaluator = new DefaultExpressionEvaluator();
        Xpp3Dom dom = Xpp3DomBuilder.build(is, "UTF-8")
                .getChild("build")
                .getChild("plugins")
                .getChild("plugin")
                .getChild("configuration");
        PlexusConfiguration config = new XmlPlexusConfiguration(dom);
        ClassRealm realm = new ClassWorld()
                .newRealm(null, getClass().getClassLoader());
        configurator.configureComponent(mojo, config, evaluator, realm);
    }
View Full Code Here

    private void populatePluginFields( Object mojo, MojoDescriptor mojoDescriptor, ClassRealm pluginRealm,
                                       PlexusConfiguration configuration, ExpressionEvaluator expressionEvaluator )
        throws PluginConfigurationException
    {
        ComponentConfigurator configurator = null;

        String configuratorId = mojoDescriptor.getComponentConfigurator();

        if ( StringUtils.isEmpty( configuratorId ) )
        {
            configuratorId = "basic";
        }

        try
        {
            // TODO: could the configuration be passed to lookup and the configurator known to plexus via the descriptor
            // so that this method could entirely be handled by a plexus lookup?
            configurator = container.lookup( ComponentConfigurator.class, configuratorId );

            ConfigurationListener listener = new DebugConfigurationListener( logger );

            logger.debug( "Configuring mojo '" + mojoDescriptor.getId() + "' with " + configuratorId
                + " configurator -->" );

            configurator.configureComponent( mojo, configuration, expressionEvaluator, pluginRealm, listener );

            logger.debug( "-- end configuration --" );
        }
        catch ( ComponentConfigurationException e )
        {
View Full Code Here

TOP

Related Classes of org.codehaus.plexus.component.configurator.ComponentConfigurator

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.