本文整理匯總了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 );
}
}
示例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 );
}
}
}
}
}
示例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 );
}
}
}
}
示例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)));
}
示例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 );
}
示例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 );
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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)));
}
示例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);
}
示例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);
}
示例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);
}