Package org.codehaus.plexus.configuration.source

Examples of org.codehaus.plexus.configuration.source.ConfigurationSource


    extends AbstractCoreComponentInitializationPhase
{
    public void initializeCoreComponent( ContainerInitializationContext context )
        throws ContainerInitializationException
    {
        ConfigurationSource existingConfigurationSource = context.getContainer().getConfigurationSource();

        try
        {
            // is the user overriding the ConfigurationSource (role-hint: default) or only extending it?
            if ( context.getContainer().hasComponent( ConfigurationSource.class  ) )
            {
                // overriding

                ConfigurationSource cs = context.getContainer().lookup( ConfigurationSource.class );

                // swap the user provided configuration source with current one
                context.getContainer().setConfigurationSource( cs );
            }
            else
            {
                // extending
                List<ConfigurationSource> userConfigurationSources = context.getContainer().lookupList( ConfigurationSource.class );

                if ( userConfigurationSources.size() > 0 )
                {
                    List<ConfigurationSource> configurationSources =
                        new ArrayList<ConfigurationSource>( userConfigurationSources.size() + 1 );

                    // adding user provied ones to be able to interfere
                    configurationSources.addAll( userConfigurationSources );

                    // at the end adding the container source, to make sure config will be returned
                    // from plexus.xml if no user interference is given
                    configurationSources.add( existingConfigurationSource );

                    ConfigurationSource configurationSource = new ChainedConfigurationSource( configurationSources );

                    context.getContainer().setConfigurationSource( configurationSource );

                }
View Full Code Here


    extends AbstractCoreComponentInitializationPhase
{
    public void initializeCoreComponent( ContainerInitializationContext context )
        throws ContainerInitializationException
    {
        ConfigurationSource existingConfigurationSource = context.getContainer().getConfigurationSource();

        try
        {
            // is the user overriding the ConfigurationSource (role-hint: default) or only extending it?
            if ( context.getContainer().hasComponent( ConfigurationSource.class  ) )
            {
                // overriding

                ConfigurationSource cs = context.getContainer().lookup( ConfigurationSource.class );

                // swap the user provided configuration source with current one
                context.getContainer().setConfigurationSource( cs );
            }
            else
            {
                // extending
                List<ConfigurationSource> userConfigurationSources = context.getContainer().lookupList( ConfigurationSource.class );

                if ( userConfigurationSources.size() > 0 )
                {
                    List<ConfigurationSource> configurationSources =
                        new ArrayList<ConfigurationSource>( userConfigurationSources.size() + 1 );

                    // adding user provied ones to be able to interfere
                    configurationSources.addAll( userConfigurationSources );

                    // at the end adding the container source, to make sure config will be returned
                    // from plexus.xml if no user interference is given
                    configurationSources.add( existingConfigurationSource );

                    ConfigurationSource configurationSource = new ChainedConfigurationSource( configurationSources );

                    context.getContainer().setConfigurationSource( configurationSource );

                }
View Full Code Here

    extends AbstractCoreComponentInitializationPhase
{
    public void initializeCoreComponent( ContainerInitializationContext context )
        throws ContainerInitializationException
    {
        ConfigurationSource existingConfigurationSource = context.getContainer().getConfigurationSource();

        try
        {
            // is the user overriding the ConfigurationSource (role-hint: default) or only extending it?
            if ( context.getContainer().hasComponent( ConfigurationSource.class, PlexusConstants.PLEXUS_DEFAULT_HINT ) )
            {
                // overriding

                ConfigurationSource cs = context.getContainer().lookup( ConfigurationSource.class );

                // swap the user provided configuration source with current one
                context.getContainer().setConfigurationSource( cs );
            }
            else
            {
                // extending
                List<ConfigurationSource> userConfigurationSources = context.getContainer().lookupList( ConfigurationSource.class );

                if ( userConfigurationSources.size() > 0 )
                {
                    List<ConfigurationSource> configurationSources =
                        new ArrayList<ConfigurationSource>( userConfigurationSources.size() + 1 );

                    // adding user provied ones to be able to interfere
                    configurationSources.addAll( userConfigurationSources );

                    // at the end adding the container source, to make sure config will be returned
                    // from plexus.xml if no user interference is given
                    configurationSources.add( existingConfigurationSource );

                    ConfigurationSource configurationSource = new ChainedConfigurationSource( configurationSources );

                    context.getContainer().setConfigurationSource( configurationSource );

                }
View Full Code Here

    extends AbstractCoreComponentInitializationPhase
{
    public void initializeCoreComponent( ContainerInitializationContext context )
        throws ContainerInitializationException
    {
        ConfigurationSource configurationSource = context.getContainer().getConfigurationSource();

        // ----------------------------------------------------------------------
        // The configurationSource may have been set programmatically so we need
        // to check. If it hasn't then we will add the default container config source.
        // ----------------------------------------------------------------------
View Full Code Here

TOP

Related Classes of org.codehaus.plexus.configuration.source.ConfigurationSource

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.