Package org.codehaus.plexus.configuration.xml

Examples of org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration


    public void setUpMocks() throws Exception {
        PluginDescriptor mavenDependencyPluginDescriptor = new PluginDescriptor();

        copyDependenciesMojoDescriptor = new MojoDescriptor();
        copyDependenciesMojoDescriptor.setGoal("copy-dependencies");
        copyDependenciesMojoDescriptor.setConfiguration(new XmlPlexusConfiguration("configuration"));
        copyDependenciesMojoDescriptor.setPluginDescriptor(mavenDependencyPluginDescriptor);

        mavenDependencyPluginDescriptor.addMojo(copyDependenciesMojoDescriptor);

        when(session.getRepositorySession()).thenReturn(repositorySession);
View Full Code Here


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

                    ComponentConfigurator componentConfigurator = null;
                    try
                    {
                        // FIXME role-hint basic ?
View Full Code Here

    public static PlexusConfiguration buildConfiguration( String resourceName, Reader configuration )
        throws PlexusConfigurationException
    {
        try
        {
            return new XmlPlexusConfiguration( Xpp3DomBuilder.build( configuration ) );
        }
        catch ( XmlPullParserException e )
        {
            throw new PlexusConfigurationException( "Failed to parse configuration resource: \'" + resourceName + "\'\nError was: \'" + e.getLocalizedMessage() + "\'", e );
        }
View Full Code Here

    // components                         | user
    // -----------------------------------+-----------------------------------------------------------------

    public static PlexusConfiguration merge( PlexusConfiguration user, PlexusConfiguration system )
    {
        XmlPlexusConfiguration mergedConfiguration = new XmlPlexusConfiguration( "plexus" );

        // ----------------------------------------------------------------------
        // Load on start
        // ----------------------------------------------------------------------

        PlexusConfiguration loadOnStart = user.getChild( "load-on-start" );

        if ( loadOnStart.getChildCount() != 0 )
        {
            mergedConfiguration.addChild( loadOnStart );
        }

        // ----------------------------------------------------------------------
        // System properties
        // ----------------------------------------------------------------------

        PlexusConfiguration systemProperties = user.getChild( "system-properties" );

        if ( systemProperties.getChildCount() != 0 )
        {
            mergedConfiguration.addChild( systemProperties );
        }

        // ----------------------------------------------------------------------
        // Configurations directory
        // ----------------------------------------------------------------------

        PlexusConfiguration[] configurationsDirectories = user.getChildren( "configurations-directory" );

        if ( configurationsDirectories.length != 0 )
        {
            for ( int i = 0; i < configurationsDirectories.length; i++ )
            {
                mergedConfiguration.addChild( configurationsDirectories[i] );
            }
        }

        // ----------------------------------------------------------------------
        // Logging
        // ----------------------------------------------------------------------

        PlexusConfiguration logging = user.getChild( "logging" );

        if ( logging.getChildCount() != 0 )
        {
            mergedConfiguration.addChild( logging );
        }
        else
        {
            mergedConfiguration.addChild( system.getChild( "logging" ) );
        }

        // ----------------------------------------------------------------------
        // Component repository
        // ----------------------------------------------------------------------

        PlexusConfiguration componentRepository = user.getChild( "component-repository" );

        if ( componentRepository.getChildCount() != 0 )
        {
            mergedConfiguration.addChild( componentRepository );
        }
        else
        {
            mergedConfiguration.addChild( system.getChild( "component-repository" ) );
        }

        // ----------------------------------------------------------------------
        // Resources
        // ----------------------------------------------------------------------

        copyResources( system, mergedConfiguration );

        copyResources( user, mergedConfiguration );

        // ----------------------------------------------------------------------
        // Component manager manager
        // ----------------------------------------------------------------------

        mergedConfiguration.addChild( system.getChild( "component-manager-manager" ) );

        // ----------------------------------------------------------------------
        // Component discoverer manager
        // ----------------------------------------------------------------------

        PlexusConfiguration componentDiscovererManager =  user.getChild( "component-discoverer-manager" );

        if ( componentDiscovererManager.getChildCount() != 0 )
        {
            mergedConfiguration.addChild( componentDiscovererManager );

            copyComponentDiscoverers( system.getChild( "component-discoverer-manager" ), componentDiscovererManager );
        }
        else
        {
            mergedConfiguration.addChild( system.getChild( "component-discoverer-manager" ) );
        }

        // ----------------------------------------------------------------------
        // Component factory manager
        // ----------------------------------------------------------------------

        PlexusConfiguration componentFactoryManager =  user.getChild( "component-factory-manager" );

        if ( componentFactoryManager.getChildCount() != 0 )
        {
            mergedConfiguration.addChild( componentFactoryManager );

            copyComponentFactories( system.getChild( "component-factory-manager" ), componentFactoryManager );
        }
        else
        {
            mergedConfiguration.addChild( system.getChild( "component-factory-manager" ) );
        }

        // ----------------------------------------------------------------------
        // Lifecycle handler managers
        // ----------------------------------------------------------------------

        PlexusConfiguration lifecycleHandlerManager = user.getChild( "lifecycle-handler-manager" );

        if ( lifecycleHandlerManager.getChildCount() != 0 )
        {
            mergedConfiguration.addChild( lifecycleHandlerManager );

            copyLifecycles( system.getChild( "lifecycle-handler-manager" ), lifecycleHandlerManager );
        }
        else
        {
            mergedConfiguration.addChild( system.getChild( "lifecycle-handler-manager" ) );
        }

        // ----------------------------------------------------------------------
        // Component factory manager
        // ----------------------------------------------------------------------

        PlexusConfiguration componentComposerManager =  user.getChild( "component-composer-manager" );

        if ( componentComposerManager.getChildCount() != 0 )
        {
            mergedConfiguration.addChild( componentComposerManager );

            copyComponentComposers( system.getChild( "component-composer-manager" ), componentComposerManager );
        }
        else
        {
            mergedConfiguration.addChild( system.getChild( "component-composer-manager" ) );
        }

        // ----------------------------------------------------------------------
        // Components
        // ----------------------------------------------------------------------
        // We grab the system components first and then add the user defined
        // components so that user defined components will win. When component
        // descriptors are processed the last definition wins because the component
        // descriptors are stored in a Map in the component repository.
        // ----------------------------------------------------------------------

        PlexusConfiguration components = system.getChild( "components" );

        mergedConfiguration.addChild( components );

        copyComponents( user.getChild( "components" ), components );

        return mergedConfiguration;
    }
View Full Code Here

    private static void copyResources( PlexusConfiguration source, PlexusConfiguration destination )
    {
        PlexusConfiguration handlers[] = source.getChild( "resources" ).getChildren();

        XmlPlexusConfiguration dest = (XmlPlexusConfiguration) destination.getChild( "resources" );

        for ( int i = 0; i < handlers.length; i++ )
        {
            dest.addChild( handlers[i] );
        }
    }
View Full Code Here

    private static void copyComponentDiscoverers( PlexusConfiguration source, PlexusConfiguration destination )
    {
        PlexusConfiguration handlers[] = source.getChild( "component-discoverers" ).getChildren( "component-discoverer" );

        XmlPlexusConfiguration dest = (XmlPlexusConfiguration) destination.getChild( "component-discoverers" );

        for ( int i = 0; i < handlers.length; i++ )
        {
            dest.addChild( handlers[i] );
        }
    }
View Full Code Here

    private static void copyComponentFactories( PlexusConfiguration source, PlexusConfiguration destination )
    {
        PlexusConfiguration handlers[] = source.getChild( "component-factories" ).getChildren( "component-factory" );

        XmlPlexusConfiguration dest = (XmlPlexusConfiguration) destination.getChild( "component-factories" );

        for ( int i = 0; i < handlers.length; i++ )
        {
            dest.addChild( handlers[i] );
        }
    }
View Full Code Here

    private static void copyComponentComposers( PlexusConfiguration source, PlexusConfiguration destination )
    {
        PlexusConfiguration composers[] = source.getChild( "component-composers" ).getChildren( "component-composer" );

        XmlPlexusConfiguration dest = (XmlPlexusConfiguration) destination.getChild( "component-composers" );

        for ( int i = 0; i < composers.length; i++ )
        {
            dest.addChild( composers[i] );
        }
    }
View Full Code Here

    private static void copyLifecycles( PlexusConfiguration source, PlexusConfiguration destination )
    {
        PlexusConfiguration handlers[] = source.getChild( "lifecycle-handlers" ).getChildren( "lifecycle-handler" );

        XmlPlexusConfiguration dest = (XmlPlexusConfiguration) destination.getChild( "lifecycle-handlers" );

        for ( int i = 0; i < handlers.length; i++ )
        {
            dest.addChild( handlers[i] );
        }
    }
View Full Code Here

    // ----------------------------------------------------------------------

    public PlexusConfiguration process( PlexusConfiguration configuration, Map variables )
        throws ConfigurationResourceNotFoundException, ConfigurationProcessingException
    {
        XmlPlexusConfiguration processed = new XmlPlexusConfiguration( "configuration" );

        walk( configuration, processed, variables );

        return processed;
    }
View Full Code Here

TOP

Related Classes of org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration

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.