當前位置: 首頁>>代碼示例>>Java>>正文


Java Xpp3Dom.getChildren方法代碼示例

本文整理匯總了Java中org.codehaus.plexus.util.xml.Xpp3Dom.getChildren方法的典型用法代碼示例。如果您正苦於以下問題:Java Xpp3Dom.getChildren方法的具體用法?Java Xpp3Dom.getChildren怎麽用?Java Xpp3Dom.getChildren使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.codehaus.plexus.util.xml.Xpp3Dom的用法示例。


在下文中一共展示了Xpp3Dom.getChildren方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: listProperty

import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
static @NonNull ConfigurationBuilder<String[]> listProperty(final @NonNull String multiProperty, final @NonNull String singleProperty) {
    return new ConfigurationBuilder<String[]>() {
        @Override
        public String[] build(Xpp3Dom conf, ExpressionEvaluator eval) {
            if (conf != null) {
                Xpp3Dom dom = (Xpp3Dom) conf; // MNG-4862
                Xpp3Dom source = dom.getChild(multiProperty);
                if (source != null) {
                    List<String> toRet = new ArrayList<String>();
                    Xpp3Dom[] childs = source.getChildren(singleProperty);
                    for (Xpp3Dom ch : childs) {
                        String chvalue = ch.getValue() == null ? "" : ch.getValue().trim();  //NOI18N
                        toRet.add(chvalue);  //NOI18N
                    }
                    return toRet.toArray(new String[toRet.size()]);
                }
            }
            return null;
        }
    };
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:22,代碼來源:PluginPropertyUtils.java

示例2: getNonFilteredFileExtensions

import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
private List<String> getNonFilteredFileExtensions(List<Plugin> plugins) {
    for (Plugin plugin : plugins) {
        if (MAVEN_RESOURCES_PLUGIN.equals(plugin.getArtifactId())) {
            final Object configuration = plugin.getConfiguration();
            if (configuration != null) {
                Xpp3Dom xpp3Dom = (Xpp3Dom) configuration;
                final Xpp3Dom nonFilteredFileExtensions = xpp3Dom.getChild(NON_FILTERED_FILE_EXTENSIONS);
                List<String> nonFilteredFileExtensionsList = new ArrayList<>();
                final Xpp3Dom[] children = nonFilteredFileExtensions.getChildren();
                for (Xpp3Dom child : children) {
                    nonFilteredFileExtensionsList.add(child.getValue());
                }
                return nonFilteredFileExtensionsList;
            }
        }
    }
    return null;
}
 
開發者ID:wavemaker,項目名稱:wavemaker-app-build-tools,代碼行數:19,代碼來源:AppBuildMojo.java

示例3: executePluginDef

import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
private void executePluginDef(InputStream is) throws Exception {
    Xpp3Dom pluginDef = Xpp3DomBuilder.build(is, "utf-8");
    Plugin plugin = loadPlugin(pluginDef);
    Xpp3Dom config = pluginDef.getChild("configuration");
    PluginDescriptor pluginDesc = pluginManager.loadPlugin(plugin, 
                                                           mavenProject.getRemotePluginRepositories(), 
                                                           mavenSession.getRepositorySession());
    Xpp3Dom executions = pluginDef.getChild("executions");
    
    for ( Xpp3Dom execution : executions.getChildren()) {
        Xpp3Dom goals = execution.getChild("goals");
        for (Xpp3Dom goal : goals.getChildren()) {
            MojoDescriptor desc = pluginDesc.getMojo(goal.getValue());
            pluginManager.executeMojo(mavenSession, new MojoExecution(desc, config));
        }
    }
}
 
開發者ID:apache,項目名稱:karaf-boot,代碼行數:18,代碼來源:GenerateMojo.java

示例4: findNodeWith

import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
@CheckForNull
private Xpp3Dom findNodeWith(String key) {
  String[] keyParts = key.split("/");
  Xpp3Dom node = configuration;
  for (String keyPart : keyParts) {

    if (node.getChildren(removeIndexSnippet(keyPart)).length <= getIndex(keyPart)) {
      return null;
    }

    node = node.getChildren(removeIndexSnippet(keyPart))[getIndex(keyPart)];
    if (node == null) {
      return null;
    }
  }
  return node;
}
 
開發者ID:SonarSource,項目名稱:sonar-scanner-maven,代碼行數:18,代碼來源:MavenPlugin.java

示例5: addExcludedGroups

import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
private Xpp3Dom addExcludedGroups(Xpp3Dom configNode) {
    for (Xpp3Dom config : configNode.getChildren()) {
        if ("excludedGroups".equals(config.getName())) {
            Logger.getGlobal().log(Level.INFO, "Adding excluded groups to existing ones");
            String current = config.getValue();
            // Should not add duplicate entry for NonDexIgnore
            if (current.contains("edu.illinois.NonDexIgnore")) {
                return configNode;
            }
            current = "," + current;
            // It seems there is an error if you have the variable
            // in the excludedGroups string concatenated (in any
            // position) to the concrete class we are adding to
            // the excludedGroups
            // ${excludedGroups} appears when
            // there is no excludedGroups specified in the pom
            // and potentially in other situations
            current = current.replace(",${excludedGroups}", "");
            config.setValue("edu.illinois.NonDexIgnore" + current);
            return configNode;
        }
    }
    Logger.getGlobal().log(Level.INFO, "Adding excluded groups to newly created one");
    configNode.addChild(this.makeNode("excludedGroups", "edu.illinois.NonDexIgnore"));
    return configNode;
}
 
開發者ID:TestingResearchIllinois,項目名稱:NonDex,代碼行數:27,代碼來源:NonDexSurefireExecution.java

示例6: setupArgline

import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
protected void setupArgline(Xpp3Dom configNode) {
    // create the NonDex argLine for surefire based on the current configuration
    // this adds things like where to save test reports, what directory NonDex
    // should store results in, what seed and mode should be used.
    String argLineToSet =  this.configuration.toArgLine();
    boolean added = false;
    for (Xpp3Dom config : configNode.getChildren()) {
        if ("argLine".equals(config.getName())) {
            Logger.getGlobal().log(Level.INFO, "Adding NonDex argLine to existing argLine specified by the project");
            String current = sanitizeAndRemoveEnvironmentVars(config.getValue());

            config.setValue(argLineToSet + " " + current);
            added = true;
            break;
        }
    }
    if (!added) {
        Logger.getGlobal().log(Level.INFO, "Creating new argline for Surefire");
        configNode.addChild(this.makeNode("argLine", argLineToSet));
    }

    // originalArgLine is the argLine set from Maven, not through the surefire config
    // if such an argLine exists, we modify that one also
    this.mavenProject.getProperties().setProperty("argLine",
            this.originalArgLine + " " + argLineToSet);
}
 
開發者ID:TestingResearchIllinois,項目名稱:NonDex,代碼行數:27,代碼來源:CleanSurefireExecution.java

示例7: fullClone

import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
@Nullable
protected Xpp3Dom fullClone(@Nonnull String elementName, @Nullable Xpp3Dom element) {
    if (element == null) {
        return null;
    }

    Xpp3Dom result = new Xpp3Dom(elementName);

    Xpp3Dom[] childs = element.getChildren();
    if (childs != null && childs.length > 0) {
        for (Xpp3Dom child : childs) {
            result.addChild(fullClone(child.getName(), child));
        }
    } else {
        result.setValue(element.getValue() == null ? element.getAttribute("default-value") : element.getValue());
    }

    return result;
}
 
開發者ID:jenkinsci,項目名稱:pipeline-maven-plugin,代碼行數:20,代碼來源:AbstractExecutionHandler.java

示例8: getConfigurationParametersToReport

import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
@Nonnull
@Override
protected List<String> getConfigurationParametersToReport(ExecutionEvent executionEvent) {

    MojoExecution mojoExecution = executionEvent.getMojoExecution();
    if (mojoExecution == null) {
        return Collections.emptyList();
    }

    Xpp3Dom configuration = mojoExecution.getConfiguration();
    List<String> parameters = new ArrayList<String>();
    for (Xpp3Dom configurationParameter : configuration.getChildren()) {
        parameters.add(configurationParameter.getName());
    }
    return parameters;
}
 
開發者ID:jenkinsci,項目名稱:pipeline-maven-plugin,代碼行數:17,代碼來源:CatchAllExecutionHandler.java

示例9: xppToElement

import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
private static Element xppToElement(Xpp3Dom xpp) throws RemoteException {
  Element result;
  try {
    result = new Element(xpp.getName());
  }
  catch (IllegalNameException e) {
    Maven3ServerGlobals.getLogger().info(e);
    return null;
  }

  Xpp3Dom[] children = xpp.getChildren();
  if (children == null || children.length == 0) {
    result.setText(xpp.getValue());
  }
  else {
    for (Xpp3Dom each : children) {
      Element child = xppToElement(each);
      if (child != null) result.addContent(child);
    }
  }
  return result;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:23,代碼來源:MavenModelConverter.java

示例10: xppToElement

import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
private static Element xppToElement(Xpp3Dom xpp) throws RemoteException {
  Element result;
  try {
    result = new Element(xpp.getName());
  }
  catch (IllegalNameException e) {
    Maven2ServerGlobals.getLogger().info(e);
    return null;
  }

  Xpp3Dom[] children = xpp.getChildren();
  if (children == null || children.length == 0) {
    result.setText(xpp.getValue());
  }
  else {
    for (Xpp3Dom each : children) {
      Element child = xppToElement(each);
      if (child != null) result.addContent(child);
    }
  }
  return result;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:23,代碼來源:Maven2ModelConverter.java

示例11: createRuleListWithNameSortedChildren

import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
/**
 * As Xpp3Dom is very picky about the order of children while comparing, create a new list where the children
 * are added in alphabetical order. See <a href="https://jira.codehaus.org/browse/MOJO-1931">MOJO-1931</a>.
 *
 * @param originalListFromPom order not specified
 * @return a list where children's member are alphabetically sorted.
 */
private List<Xpp3Dom> createRuleListWithNameSortedChildren( final List<Xpp3Dom> originalListFromPom )
{
    final List<Xpp3Dom> listWithSortedEntries = new ArrayList<Xpp3Dom>( originalListFromPom.size() );
    for ( Xpp3Dom unsortedXpp3Dom : originalListFromPom )
    {
        final Xpp3Dom sortedXpp3Dom = new Xpp3Dom( getRuleName() );
        final SortedMap<String, Xpp3Dom> childrenMap = new TreeMap<String, Xpp3Dom>();
        final Xpp3Dom[] children = unsortedXpp3Dom.getChildren();
        for ( Xpp3Dom child : children )
        {
            childrenMap.put( child.getName(), child );
        }
        for ( Xpp3Dom entry : childrenMap.values() )
        {
            sortedXpp3Dom.addChild( entry );
        }
        listWithSortedEntries.add( sortedXpp3Dom );
    }
    return listWithSortedEntries;
}
 
開發者ID:mojohaus,項目名稱:extra-enforcer-rules,代碼行數:28,代碼來源:RequirePropertyDiverges.java

示例12: convertXpp

import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
private static Element convertXpp(Xpp3Dom xpp3Dom) {
  Element result;
  try {
    result = new Element(xpp3Dom.getName());
  } catch (IllegalNameException e) {
    return null;
  }

  Xpp3Dom[] children = xpp3Dom.getChildren();
  if (children == null || children.length == 0) {
    result.setText(xpp3Dom.getValue());
  } else {
    for (Xpp3Dom child : children) {
      Element element = convertXpp(child);
      if (element != null) {
        result.addContent(element);
      }
    }
  }

  return result;
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:23,代碼來源:MavenModelUtil.java

示例13: getGwtModuleName

import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
/**
 * Get the GWT Maven plugin 2 <moduleName/>.
 *
 * @param mavenProject
 * @return the moduleName from configuration
 */
private String getGwtModuleName(MavenProject mavenProject) {
  if (!isGwtMavenPlugin2(mavenProject)) {
    return null;
  }

  Plugin gwtPlugin2 = getGwtMavenPlugin2(mavenProject);
  if (gwtPlugin2 == null) {
    return null;
  }

  Xpp3Dom gwtPluginConfig = (Xpp3Dom) gwtPlugin2.getConfiguration();
  if (gwtPluginConfig == null) {
    return null;
  }

  String moduleName = null;
  for (Xpp3Dom child : gwtPluginConfig.getChildren()) {
    if (child != null && GWT_MAVEN_MODULENAME.equals(child.getName())) {
      moduleName = child.getValue().trim();
    }
  }
  return moduleName;
}
 
開發者ID:gwt-plugins,項目名稱:gwt-eclipse-plugin,代碼行數:30,代碼來源:MavenProjectConfigurator.java

示例14: getGwtModuleShortName

import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
/**
 * Get the GWT Maven plugin 2 <moduleShort=Name/>.
 *
 * @param mavenProject
 * @return the moduleName from configuration
 */
private String getGwtModuleShortName(MavenProject mavenProject) {
  if (!isGwtMavenPlugin2(mavenProject)) {
    return null;
  }

  Plugin gwtPlugin2 = getGwtMavenPlugin2(mavenProject);
  if (gwtPlugin2 == null) {
    return null;
  }

  Xpp3Dom gwtPluginConfig = (Xpp3Dom) gwtPlugin2.getConfiguration();
  if (gwtPluginConfig == null) {
    return null;
  }

  String moduleName = null;
  for (Xpp3Dom child : gwtPluginConfig.getChildren()) {
    if (child != null && GWT_MAVEN_MODULESHORTNAME.equals(child.getName())) {
      moduleName = child.getValue().trim();
    }
  }
  return moduleName;
}
 
開發者ID:gwt-plugins,項目名稱:gwt-eclipse-plugin,代碼行數:30,代碼來源:MavenProjectConfigurator.java

示例15: getGwtMavenPluginHostedWebAppDirectory

import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
/**
 * Get the GWT Maven <hostedWebapp/> directory.
 *
 * @param mavenProject
 * @return the webapp directory
 */
private IPath getGwtMavenPluginHostedWebAppDirectory(MavenProject mavenProject) {
  Plugin warPlugin = getGwtMavenPlugin(mavenProject);
  if (warPlugin == null) {
    return null;
  }

  Xpp3Dom warPluginConfig = (Xpp3Dom) warPlugin.getConfiguration();
  if (warPluginConfig == null) {
    return null;
  }

  IPath warOut = null;
  for (Xpp3Dom child : warPluginConfig.getChildren()) {
    if (child != null && HOSTED_WEB_APP_DIRECTORY.equals(child.getName())) {
      String path = child.getValue().trim();
      if (!path.isEmpty()) {
        warOut = new Path(path);
      }
    }
  }

  return warOut;
}
 
開發者ID:gwt-plugins,項目名稱:gwt-eclipse-plugin,代碼行數:30,代碼來源:MavenProjectConfigurator.java


注:本文中的org.codehaus.plexus.util.xml.Xpp3Dom.getChildren方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。