Package org.codehaus.plexus.util.xml

Examples of org.codehaus.plexus.util.xml.Xpp3Dom


                    {
                        multiSourcePlugin = plugin;
                        break;
                    }
                }
                final Xpp3Dom configuration = this.getConfiguration(multiSourcePlugin);
                if (configuration != null && configuration.getChildCount() > 0)
                {
                    final Xpp3Dom directories = configuration.getChild(0);
                    if (directories != null)
                    {
                        final int childCount = directories.getChildCount();
                        if (childCount > 0)
                        {
                            final String baseDirectory =
                                ResourceUtils.normalizePath(ObjectUtils.toString(project.getBasedir()) + '/');
                            final Xpp3Dom[] children = directories.getChildren();
                            for (int ctr = 0; ctr < childCount; ctr++)
                            {
                                final Xpp3Dom child = children[ctr];
                                if (child != null)
                                {
                                    String directoryValue = ResourceUtils.normalizePath(child.getValue());
                                    if (directoryValue != null)
                                    {
                                        if (!directoryValue.startsWith(baseDirectory))
                                        {
                                            directoryValue =
View Full Code Here


     * @param plugin the plugin from which the retrieve the configuration.
     * @return the plugin's configuration, or null if not found.
     */
    private Xpp3Dom getConfiguration(final Plugin plugin)
    {
        Xpp3Dom configuration = null;
        if (plugin != null)
        {
            if (plugin.getConfiguration() != null)
            {
                configuration = (Xpp3Dom)plugin.getConfiguration();
View Full Code Here

    private String getBundlePluginConfiguration(final String key) {
        String value = null;
        Plugin bundlePlugin = this.getBundlePlugin();
        if ( bundlePlugin != null ) {
            final Xpp3Dom config = (Xpp3Dom) bundlePlugin.getConfiguration();
            if ( config != null) {
                final Xpp3Dom instructionsConfig = config.getChild(BUNDLE_PLUGIN_INSTRUCTIONS);
                if ( instructionsConfig != null) {
                    final Xpp3Dom keyConfig = instructionsConfig.getChild(key);
                    if ( keyConfig != null ) {
                        return keyConfig.getValue();
                    }
                }
            }
        }
        return value;
View Full Code Here

                                    server.getPassphrase() );
            authSelector.add( server.getId(), auth );

            if ( server.getConfiguration() != null )
            {
                Xpp3Dom dom = (Xpp3Dom) server.getConfiguration();
                for ( int i = dom.getChildCount() - 1; i >= 0; i-- )
                {
                    Xpp3Dom child = dom.getChild( i );
                    if ( "wagonProvider".equals( child.getName() ) )
                    {
                        dom.removeChild( i );
                    }
                }
View Full Code Here

    private void filterChildren( int position )
    {
        for ( ; position > filteredChildren.size() && filteredIndex < children.length; filteredIndex++ )
        {
            Xpp3Dom child = children[filteredIndex];
            if ( testNode( child ) )
            {
                filteredChildren.add( child );
            }
        }
View Full Code Here

        return null;
    }

    public static Xpp3Dom convert( MojoDescriptor mojoDescriptor )
    {
        Xpp3Dom dom = new Xpp3Dom( "configuration" );

        PlexusConfiguration c = mojoDescriptor.getMojoConfiguration();

        PlexusConfiguration[] ces = c.getChildren();

        if ( ces != null )
        {
            for ( PlexusConfiguration ce : ces )
            {
                String value = ce.getValue( null );
                String defaultValue = ce.getAttribute( "default-value", null );
                if ( value != null || defaultValue != null )
                {
                    Xpp3Dom e = new Xpp3Dom( ce.getName() );
                    e.setValue( value );
                    if ( defaultValue != null )
                    {
                        e.setAttribute( "default-value", defaultValue );
                    }
                    dom.addChild( e );
                }
            }
        }
View Full Code Here

        File pom = getProject( "project-with-additional-lifecycle-elements" );
        MavenSession session = createMavenSession( pom );
        MojoDescriptor mojoDescriptor =
            mojoDescriptorCreator.getMojoDescriptor( "org.apache.maven.its.plugins:maven-it-plugin:0.1:java", session,
                                                     session.getCurrentProject() );
        Xpp3Dom dom = MojoDescriptorCreator.convert( mojoDescriptor );
        System.out.println( dom );
    }
View Full Code Here

        }
        return prjArtifact.getFile();
    }

    private static String nodeValue(final Xpp3Dom config, final String name, final String defaultValue) {
        final Xpp3Dom node = (config == null ? null : config.getChild(name));
        if (node != null) {
            return node.getValue();
        } else {
            return defaultValue;
        }
    }
View Full Code Here

                }
            }
        }

        private void readConfiguration() throws IOException {
            Xpp3Dom configuration = (Xpp3Dom) plugin.getConfiguration();
            defaultBundleList = null;
            jarWebSupport = null;
            includeDefaultBundles = true;
            bundleListFile = new File(project.getBasedir(), "src/main/bundles/list.xml");
            if (configuration != null) {
                includeDefaultBundles = nodeValue(configuration, "includeDefaultBundles", true);
                Xpp3Dom defaultBundleListConfig = configuration.getChild("defaultBundleList");
                if (defaultBundleListConfig != null) {
                    defaultBundleList = new ArtifactDefinition(defaultBundleListConfig);
                }
                Xpp3Dom jarWebSupportConfig = configuration.getChild("jarWebSupport");
                if (jarWebSupportConfig != null) {
                    jarWebSupport = new ArtifactDefinition(jarWebSupportConfig);
                }
                Xpp3Dom bundleListFileConfig = configuration.getChild("bundleListFile");
                if (bundleListFileConfig != null) {
                    bundleListFile = new File(project.getBasedir(), bundleListFileConfig.getValue());
                }

                configureAdditionalBundles(configuration);
            }

            for (PluginExecution execution : plugin.getExecutions()) {
                Xpp3Dom executionConfiguration = (Xpp3Dom) execution.getConfiguration();
                if (executionConfiguration != null) {
                    configureAdditionalBundles(executionConfiguration);
                }
            }
View Full Code Here

                }
            });
        }

        private void configureAdditionalBundles(Xpp3Dom configuration) {
            Xpp3Dom additionalBundlesConfig = configuration.getChild("additionalBundles");
            if (additionalBundlesConfig != null) {
                Xpp3Dom[] bundleConfigs = additionalBundlesConfig.getChildren("bundle");
                if (bundleConfigs != null) {
                    for (Xpp3Dom bundleConfig : bundleConfigs) {
                        additionalBundles.add(new ArtifactDefinition(bundleConfig));
                    }
                }
View Full Code Here

TOP

Related Classes of org.codehaus.plexus.util.xml.Xpp3Dom

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.