当前位置: 首页>>代码示例>>Java>>正文


Java Xpp3Dom.mergeXpp3Dom方法代码示例

本文整理汇总了Java中org.codehaus.plexus.util.xml.Xpp3Dom.mergeXpp3Dom方法的典型用法代码示例。如果您正苦于以下问题:Java Xpp3Dom.mergeXpp3Dom方法的具体用法?Java Xpp3Dom.mergeXpp3Dom怎么用?Java Xpp3Dom.mergeXpp3Dom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.codehaus.plexus.util.xml.Xpp3Dom的用法示例。


在下文中一共展示了Xpp3Dom.mergeXpp3Dom方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: mergeConfigurationContainer_Configuration

import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
protected void mergeConfigurationContainer_Configuration( ConfigurationContainer target,
                                                          ConfigurationContainer source, boolean sourceDominant,
                                                          Map<Object, Object> context )
{
    Xpp3Dom src = (Xpp3Dom) source.getConfiguration();
    if ( src != null )
    {
        Xpp3Dom tgt = (Xpp3Dom) target.getConfiguration();
        if ( sourceDominant || tgt == null )
        {
            tgt = Xpp3Dom.mergeXpp3Dom( new Xpp3Dom( src ), tgt );
        }
        else
        {
            tgt = Xpp3Dom.mergeXpp3Dom( tgt, src );
        }
        target.setConfiguration( tgt );
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:20,代码来源:ModelMerger.java

示例2: expandPluginConfiguration

import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
public void expandPluginConfiguration( Model model, ModelBuildingRequest request, ModelProblemCollector problems )
{
    Reporting reporting = model.getReporting();

    if ( reporting != null )
    {
        for ( ReportPlugin reportPlugin : reporting.getPlugins() )
        {
            Xpp3Dom parentDom = (Xpp3Dom) reportPlugin.getConfiguration();

            if ( parentDom != null )
            {
                for ( ReportSet execution : reportPlugin.getReportSets() )
                {
                    Xpp3Dom childDom = (Xpp3Dom) execution.getConfiguration();
                    childDom = Xpp3Dom.mergeXpp3Dom( childDom, new Xpp3Dom( parentDom ) );
                    execution.setConfiguration( childDom );
                }
            }
        }
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:23,代码来源:DefaultReportConfigurationExpander.java

示例3: expand

import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
private void expand( List<Plugin> plugins )
{
    for ( Plugin plugin : plugins )
    {
        Xpp3Dom pluginConfiguration = (Xpp3Dom) plugin.getConfiguration();

        if ( pluginConfiguration != null )
        {
            for ( PluginExecution execution : plugin.getExecutions() )
            {
                Xpp3Dom executionConfiguration = (Xpp3Dom) execution.getConfiguration();

                executionConfiguration =
                    Xpp3Dom.mergeXpp3Dom( executionConfiguration, new Xpp3Dom( pluginConfiguration ) );

                execution.setConfiguration( executionConfiguration );
            }
        }
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:21,代码来源:DefaultPluginConfigurationExpander.java

示例4: extractAndMerge

import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
/**
 * Extract the Mojo specific configuration from the incoming plugin configuration from Maven by looking at an enclosing element with the goal name. Use this and merge it with the default Mojo
 * configuration and use this to apply values to the Mojo.
 * 
 * @param goal
 * @param pluginConfigurationFromMaven
 * @param defaultMojoConfiguration
 * @return
 * @throws ComponentConfigurationException
 */
PlexusConfiguration extractAndMerge(String goal, PlexusConfiguration pluginConfigurationFromMaven, PlexusConfiguration defaultMojoConfiguration) throws ComponentConfigurationException {
  //
  // We need to extract the specific configuration for this goal out of the POM configuration
  //
  PlexusConfiguration mojoConfigurationFromPom = new XmlPlexusConfiguration("configuration");
  for (PlexusConfiguration element : pluginConfigurationFromMaven.getChildren()) {
    if (element.getName().equals(goal)) {
      for (PlexusConfiguration goalConfigurationElements : element.getChildren()) {
        mojoConfigurationFromPom.addChild(goalConfigurationElements);
      }
    }
  }
  return new XmlPlexusConfiguration(Xpp3Dom.mergeXpp3Dom(convert(mojoConfigurationFromPom), convert(defaultMojoConfiguration)));
}
 
开发者ID:takari,项目名称:takari-lifecycle,代码行数:25,代码来源:MojoConfigurationProcessor.java

示例5: mergePluginExecutionDefinitions

import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
private static void mergePluginExecutionDefinitions( PluginExecution child, PluginExecution parent )
{
    if ( child.getPhase() == null )
    {
        child.setPhase( parent.getPhase() );
    }

    List<String> parentGoals = parent.getGoals();
    List<String> childGoals = child.getGoals();

    List<String> goals = new ArrayList<String>();

    if ( ( childGoals != null ) && !childGoals.isEmpty() )
    {
        goals.addAll( childGoals );
    }

    if ( parentGoals != null )
    {
        for (  String goal : parentGoals )
        {
            if ( !goals.contains( goal ) )
            {
                goals.add( goal );
            }
        }
    }

    child.setGoals( goals );

    Xpp3Dom childConfiguration = (Xpp3Dom) child.getConfiguration();
    Xpp3Dom parentConfiguration = (Xpp3Dom) parent.getConfiguration();

    childConfiguration = Xpp3Dom.mergeXpp3Dom( childConfiguration, parentConfiguration );

    child.setConfiguration( childConfiguration );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:38,代码来源:ModelUtils.java

示例6: mergeReportSetDefinitions

import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
private static void mergeReportSetDefinitions( ReportSet child, ReportSet parent )
{
    List parentReports = parent.getReports();
    List childReports = child.getReports();

    List reports = new ArrayList();

    if ( ( childReports != null ) && !childReports.isEmpty() )
    {
        reports.addAll( childReports );
    }

    if ( parentReports != null )
    {
        for ( Iterator i = parentReports.iterator(); i.hasNext(); )
        {
            String report = (String) i.next();

            if ( !reports.contains( report ) )
            {
                reports.add( report );
            }
        }
    }

    child.setReports( reports );

    Xpp3Dom childConfiguration = (Xpp3Dom) child.getConfiguration();
    Xpp3Dom parentConfiguration = (Xpp3Dom) parent.getConfiguration();

    childConfiguration = Xpp3Dom.mergeXpp3Dom( childConfiguration, parentConfiguration );

    child.setConfiguration( childConfiguration );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:35,代码来源:DefaultModelInheritanceAssembler.java

示例7: replaceWebSourcePaths

import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
private void replaceWebSourcePaths(File projectDir, List sourceRoots,
		Xpp3Dom projectDOM) throws XmlPullParserException {
	// /jpr:project
	// /hash[@n="oracle.jdeveloper.model.J2eeSettings"]
	// /hash[@n="webContentSet"]
	// /list[@n="url-path"]
	Xpp3Dom pathsDOM = findNamedChild(projectDOM, "hash",
			"oracle.jdeveloper.model.J2eeSettings");
	Xpp3Dom contentSetDOM = findNamedChild(pathsDOM, "hash",
			"webContentSet");
	Xpp3Dom sourceDOM = findNamedChild(contentSetDOM, "list", "url-path");

	//
	// <url path="[relative-path-to-source-root]" />
	//
	Xpp3Dom targetDOM = new Xpp3Dom("list");
	for (Iterator i = sourceRoots.iterator(); i.hasNext();) {
		File sourceRoot = new File((String) i.next());
		String relativeRoot = getRelativeDir(projectDir, sourceRoot);
		Xpp3Dom urlDOM = new Xpp3Dom("url");
		urlDOM.setAttribute("path", relativeRoot);
		targetDOM.addChild(urlDOM);
	}

	// TODO: use a better merge algorithm
	removeChildren(sourceDOM);

	// make sure to pass Boolean.FALSE to allow
	// multiple child elements with the same name
	Xpp3Dom.mergeXpp3Dom(sourceDOM, targetDOM, Boolean.FALSE);
}
 
开发者ID:alessandroleite,项目名称:maven-jdev-plugin,代码行数:32,代码来源:JDeveloperMojo.java

示例8: replaceResourcePaths

import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
private void replaceResourcePaths(File projectDir, List resourceRoots,
		Xpp3Dom projectDOM) throws XmlPullParserException {
	// /jpr:project
	// /hash[@n="oracle.ide.model.ResourcePaths"]
	// /hash[@n="resourcesContentSet"]
	// /list[@n="url-path"]

	Xpp3Dom pathsDOM = findNamedChild(projectDOM, "hash",
			"oracle.ide.model.ResourcePaths");
	Xpp3Dom contentSetDOM = findNamedChild(pathsDOM, "hash",
			"resourcesContentSet");
	Xpp3Dom sourceDOM = findNamedChild(contentSetDOM, "list", "url-path");

	//
	// <url path="[relative-path-to-source-root]" />
	//
	Xpp3Dom targetDOM = new Xpp3Dom("list");
	for (Iterator i = resourceRoots.iterator(); i.hasNext();) {
		Resource resource = (Resource) i.next();
		File resourceRoot = new File(resource.getDirectory());
		String relativeRoot = getRelativeDir(projectDir, resourceRoot);
		Xpp3Dom urlDOM = new Xpp3Dom("url");
		urlDOM.setAttribute("path", relativeRoot);
		targetDOM.addChild(urlDOM);
	}

	// TODO: use a better merge algorithm
	removeChildren(sourceDOM);

	// make sure to pass Boolean.FALSE to allow
	// multiple child elements with the same name
	Xpp3Dom.mergeXpp3Dom(sourceDOM, targetDOM, Boolean.FALSE);
}
 
开发者ID:alessandroleite,项目名称:maven-jdev-plugin,代码行数:34,代码来源:JDeveloperMojo.java

示例9: replaceWebSourcePaths

import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
private void replaceWebSourcePaths(File projectDir, List sourceRoots, Xpp3Dom projectDOM) throws XmlPullParserException {
	
	// /jpr:project
	// /hash[@n="oracle.jdeveloper.model.J2eeSettings"]
	// /hash[@n="webContentSet"]
	// /list[@n="url-path"]
	Xpp3Dom pathsDOM = findNamedChild(projectDOM, "hash", "oracle.jdeveloper.model.J2eeSettings");
	Xpp3Dom contentSetDOM = findNamedChild(pathsDOM, "hash", "webContentSet");
	Xpp3Dom sourceDOM = findNamedChild(contentSetDOM, "list", "url-path");
	
	
	if (!this.isWebProject())
	{
		removeChildren(pathsDOM);
		return;
	}

	//
	// <url path="[relative-path-to-source-root]" />
	//
	Xpp3Dom targetDOM = new Xpp3Dom("list");
	for (Iterator i = sourceRoots.iterator(); i.hasNext();) {
		File sourceRoot = new File((String) i.next());
		String relativeRoot = getRelativeDir(projectDir, sourceRoot);
		Xpp3Dom urlDOM = new Xpp3Dom("url");
		urlDOM.setAttribute("path", relativeRoot);
		targetDOM.addChild(urlDOM);
	}

	// TODO: use a better merge algorithm
	removeChildren(sourceDOM);

	// make sure to pass Boolean.FALSE to allow
	// multiple child elements with the same name
	Xpp3Dom.mergeXpp3Dom(sourceDOM, targetDOM, Boolean.FALSE);
}
 
开发者ID:alessandroleite,项目名称:maven-jdev-plugin,代码行数:37,代码来源:JDeveloperMojo.java

示例10: getPlugin

import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
/**
 * Returns a plugin from a pom based on its group id and artifact id
 * <p>
 * It searches in the build section, then the reporting section and finally the pluginManagement section
 * </p>
 *
 * @param pom the project pom
 * @param groupId the plugin group id
 * @param artifactId the plugin artifact id
 * @return the plugin if it exists, null otherwise
 */
@CheckForNull
public static MavenPlugin getPlugin(MavenProject pom, String groupId, String artifactId) {
  Object pluginConfiguration = null;

  // look for plugin in <build> section
  Plugin plugin = getPlugin(pom.getBuildPlugins(), groupId, artifactId);

  if (plugin != null) {
    pluginConfiguration = plugin.getConfiguration();
  } else {
    // look for plugin in reporting
    Reporting reporting = pom.getModel().getReporting();
    if (reporting != null) {
      ReportPlugin reportPlugin = getReportPlugin(reporting.getPlugins(), groupId, artifactId);
      if (reportPlugin != null) {
        pluginConfiguration = reportPlugin.getConfiguration();
      }
    }
  }

  // look for plugin in <pluginManagement> section
  PluginManagement pluginManagement = pom.getPluginManagement();
  if (pluginManagement != null) {
    Plugin pluginFromManagement = getPlugin(pluginManagement.getPlugins(), groupId, artifactId);
    if (pluginFromManagement != null) {
      Object pluginConfigFromManagement = pluginFromManagement.getConfiguration();
      if (pluginConfiguration == null) {
        pluginConfiguration = pluginConfigFromManagement;
      } else if (pluginConfigFromManagement != null) {
        Xpp3Dom.mergeXpp3Dom((Xpp3Dom) pluginConfiguration, (Xpp3Dom) pluginConfigFromManagement);
      }
    }
  }

  if (pluginConfiguration != null) {
    return new MavenPlugin(pluginConfiguration);
  }
  return null;

}
 
开发者ID:SonarSource,项目名称:sonar-scanner-maven,代码行数:52,代码来源:MavenPlugin.java

示例11: mergePlexusConfiguration

import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
PlexusConfiguration mergePlexusConfiguration(PlexusConfiguration dominant, PlexusConfiguration recessive) throws ComponentConfigurationException {
  return new XmlPlexusConfiguration(Xpp3Dom.mergeXpp3Dom(convert(dominant), convert(recessive)));
}
 
开发者ID:takari,项目名称:takari-lifecycle,代码行数:4,代码来源:MojoConfigurationProcessor.java

示例12: replaceProjects

import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
private void replaceProjects(File workspaceDir, Xpp3Dom workspaceDOM)
		throws XmlPullParserException {
	// /jws:workspace
	// /list[@n="listOfChildren"]
	Xpp3Dom sourceDOM = workspaceDOM.getChild("list");

	// <hash>
	// <value n="nodeClass" v="oracle.jdeveloper.model.JProject"/>
	// <url n="URL" path="[workspace-relative-path-to-project.jpr]"/>
	// </hash>
	Xpp3Dom targetDOM = new Xpp3Dom("list");

	for (Iterator i = project.getCollectedProjects().iterator(); i
			.hasNext();) {
		MavenProject collectedProject = (MavenProject) i.next();
		boolean projHasTests = false;

		// Added in V11
		if (_releaseMajor >= 11) {
			Properties props = collectedProject.getProperties();
			String hasTests = (String) props.get(_PROPERTY_HAS_TESTS);
			projHasTests = "true".equalsIgnoreCase(hasTests);
		}

		getLog().info(
				"projHasTests is "
						+ Boolean.valueOf(projHasTests).toString());

		// if a child project is also a workspace, then don't
		// put it in the .jws file. It will have its own .jws
		// file.
		if (!"pom".equals(collectedProject.getPackaging())) {
			File projectFile = getJProjectFile(collectedProject);

			targetDOM.addChild(createProjectReferenceDOM(workspaceDir,
					projectFile));

			File testProjectFile = getJProjectTestFile(collectedProject);

			/*
			 * * In V11, we don't create a <projname>-test.jpr if* a project
			 * does not have any tests.
			 */
			if (_releaseMajor >= 11) {
				if (projHasTests) {
					targetDOM.addChild(createProjectReferenceDOM(
							workspaceDir, testProjectFile));
				}
			} else {
				targetDOM.addChild(createProjectReferenceDOM(workspaceDir,
						testProjectFile));
			}
		}
	}

	// TODO: use a better merge algorithm
	removeChildren(sourceDOM);

	// make sure to pass Boolean.FALSE to allow
	// multiple child elements with the same name
	Xpp3Dom.mergeXpp3Dom(sourceDOM, targetDOM, Boolean.FALSE);
}
 
开发者ID:alessandroleite,项目名称:maven-jdev-plugin,代码行数:63,代码来源:JDeveloperMojo.java

示例13: replaceDependencies

import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
private void replaceDependencies(File projectDir, List dependencies,
		Xpp3Dom projectDOM) throws XmlPullParserException {
	// /jpr:project
	// /hash[@n="oracle.ide.model.DependencyConfiguration"]
	// /list[@n="dependencyList"]
	Xpp3Dom configDOM = findNamedChild(projectDOM, "hash",
			"oracle.ide.model.DependencyConfiguration");
	Xpp3Dom sourceDOM = findNamedChild(configDOM, "list", "dependencyList");

	Xpp3Dom targetDOM = new Xpp3Dom("list");
	
	for (Iterator i = dependencies.iterator(); i.hasNext();) {
		Dependency dependency = (Dependency) i.next();
		
		MavenProject dependentProject = findDependentProject(dependency.getManagementKey());
	
		if (dependentProject != null) {
			
			File dependentProjectFile = getJProjectFile(dependentProject);
			String relativePath = getRelativeFile(projectDir, dependentProjectFile);

			Xpp3Dom hashDOM = new Xpp3Dom("hash");
			Xpp3Dom valueDOM = new Xpp3Dom("value");
			valueDOM.setAttribute("n", "class");
			valueDOM.setAttribute("v","oracle.jdeveloper.library.ProjectLibrary");
			Xpp3Dom srcOwnValDOM = new Xpp3Dom("value");
			srcOwnValDOM.setAttribute("n", "sourceOwnerURL");
			Xpp3Dom urlDOM = new Xpp3Dom("url");
			urlDOM.setAttribute("n", "sourceURL");
			urlDOM.setAttribute("path", relativePath);
			hashDOM.addChild(valueDOM);
			hashDOM.addChild(srcOwnValDOM);
			hashDOM.addChild(urlDOM);
			targetDOM.addChild(hashDOM);
			
			this.getLog().info("----- Runtime information ---- " + this.runtimeInformation.getApplicationVersion().getMinorVersion());
			
			if (true)
				throw new RuntimeException("" + this.downloadSources);
			
			System.out.println("=============== Download source " + this.downloadSources);
			
			this.getLog().info(" Download sources? " + this.downloadSources);
			if (this.downloadSources)
			{
				
				Artifact artifact =
	                IdeUtils.createArtifactWithClassifier( dependency.getGroupId(), dependency.getArtifactId(),
	                                                       dependency.getVersion(), dependency.getClassifier(),
	                                                       "sources", artifactFactory );
				
				if (artifact.isResolved()) 
				{
					this.getLog().info("The source code of artifact " + dependency.getArtifactId() + " was found.");
					
				}
			}
		}
	}

	// TODO: use a better merge algorithm
	removeChildren(sourceDOM);

	// make sure to pass Boolean.FALSE to allow
	// multiple child elements with the same name
	Xpp3Dom.mergeXpp3Dom(sourceDOM, targetDOM, Boolean.FALSE);
}
 
开发者ID:alessandroleite,项目名称:maven-jdev-plugin,代码行数:68,代码来源:JDeveloperMojo.java

示例14: replaceDependencies

import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
private void replaceDependencies(File projectDir, List dependencies,
		Xpp3Dom projectDOM) throws XmlPullParserException {
	// /jpr:project
	// /hash[@n="oracle.ide.model.DependencyConfiguration"]
	// /list[@n="dependencyList"]
	Xpp3Dom configDOM = findNamedChild(projectDOM, "hash",
			"oracle.ide.model.DependencyConfiguration");
	Xpp3Dom sourceDOM = findNamedChild(configDOM, "list", "dependencyList");

	Xpp3Dom targetDOM = new Xpp3Dom("list");
	for (Iterator i = dependencies.iterator(); i.hasNext();) {
		Dependency dependency = (Dependency) i.next();
		MavenProject dependentProject = findDependentProject(dependency
				.getManagementKey());
		if (dependentProject != null) {
			File dependentProjectFile = getJProjectFile(dependentProject);
			String relativePath = getRelativeFile(projectDir,
					dependentProjectFile);

			Xpp3Dom hashDOM = new Xpp3Dom("hash");
			Xpp3Dom valueDOM = new Xpp3Dom("value");
			valueDOM.setAttribute("n", "class");
			valueDOM.setAttribute("v",
					"oracle.jdeveloper.library.ProjectLibrary");
			Xpp3Dom srcOwnValDOM = new Xpp3Dom("value");
			srcOwnValDOM.setAttribute("n", "sourceOwnerURL");
			Xpp3Dom urlDOM = new Xpp3Dom("url");
			urlDOM.setAttribute("n", "sourceURL");
			urlDOM.setAttribute("path", relativePath);
			hashDOM.addChild(valueDOM);
			hashDOM.addChild(srcOwnValDOM);
			hashDOM.addChild(urlDOM);
			targetDOM.addChild(hashDOM);
		}
	}

	// TODO: use a better merge algorithm
	removeChildren(sourceDOM);

	// make sure to pass Boolean.FALSE to allow
	// multiple child elements with the same name
	Xpp3Dom.mergeXpp3Dom(sourceDOM, targetDOM, Boolean.FALSE);
}
 
开发者ID:alessandroleite,项目名称:maven-jdev-plugin,代码行数:44,代码来源:JDeveloperMojo.java


注:本文中的org.codehaus.plexus.util.xml.Xpp3Dom.mergeXpp3Dom方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。