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


Java XmlPlexusConfiguration类代码示例

本文整理汇总了Java中org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration的典型用法代码示例。如果您正苦于以下问题:Java XmlPlexusConfiguration类的具体用法?Java XmlPlexusConfiguration怎么用?Java XmlPlexusConfiguration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


XmlPlexusConfiguration类属于org.codehaus.plexus.configuration.xml包,在下文中一共展示了XmlPlexusConfiguration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: convertArray

import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration; //导入依赖的package包/类
private static PlexusConfiguration convertArray(ModelNode configuration, ConversionContext ctx) {
    ModelNode itemsSchema = ctx.currentSchema.get("items");
    if (!itemsSchema.isDefined()) {
        throw new IllegalArgumentException(
                "No schema found for items of a list. Cannot continue with XML-to-JSON conversion.");
    }
    PlexusConfiguration list = new XmlPlexusConfiguration(ctx.tagName);
    if (ctx.id != null) {
        list.setAttribute("id", ctx.id);
    }

    for (ModelNode childConfig : configuration.asList()) {
        ctx.tagName = "item";
        ctx.currentSchema = itemsSchema;
        ctx.id = null;
        ctx.currentPath.push("[]");
        PlexusConfiguration child = convert(childConfig, ctx);
        ctx.currentPath.pop();
        list.addChild(child);
    }
    return list;
}
 
开发者ID:revapi,项目名称:revapi,代码行数:23,代码来源:SchemaDrivenJSONToXmlConverter.java

示例2: getString

import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration; //导入依赖的package包/类
@CheckForNull
private String getString(MavenProject pom, String parameter) {
  MavenProject oldProject = session.getCurrentProject();
  try {
    // Switch to the project for which we try to resolve the property.
    session.setCurrentProject(pom);
    for (MojoExecution exec : mojoExecutions) {
      Xpp3Dom configuration = exec.getConfiguration();
      PlexusConfiguration pomConfiguration = new XmlPlexusConfiguration(configuration);
      PlexusConfiguration config = pomConfiguration.getChild(parameter);

      ExpressionEvaluator expressionEvaluator = new PluginParameterExpressionEvaluator(session, exec);
      BasicStringConverter converter = new BasicStringConverter();

      String value = converter.fromExpression(config, expressionEvaluator);
      if (value != null) {
        return value;
      }
    }
  } catch (Exception e) {
    log.warn(String.format("Failed to get parameter '%s' for goal '%s': %s", parameter, COMPILE_GOAL, e.getMessage()));
  } finally {
    session.setCurrentProject(oldProject);
  }

  return null;
}
 
开发者ID:SonarSource,项目名称:sonar-scanner-maven,代码行数:28,代码来源:JavaVersionResolver.java

示例3: execute

import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration; //导入依赖的package包/类
@Override
public void execute() throws MojoExecutionException, MojoFailureException {

    deprecationWarnings();
    initProperties(true);
    initEnvironment();

    for (XmlPlexusConfiguration process : this.processes) {
        try {
            start(process);
        } catch (Exception e) {
            throw new MojoFailureException("Unable to start", e);
        }
    }
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:16,代码来源:MultiStartMojo.java

示例4: startProject

import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected void startProject(MavenProject project, String executionId, XmlPlexusConfiguration process) throws InvalidPluginDescriptorException, PluginResolutionException, PluginDescriptorParsingException, PluginNotFoundException, PluginConfigurationException, MojoFailureException, MojoExecutionException, PluginManagerException {
    Plugin plugin = this.project.getPlugin("org.wildfly.swarm:wildfly-swarm-plugin");

    Xpp3Dom config = getConfiguration(project, executionId);
    Xpp3Dom processConfig = getProcessConfiguration(process);

    Xpp3Dom globalConfig = getGlobalConfig();
    Xpp3Dom mergedConfig = Xpp3DomUtils.mergeXpp3Dom(processConfig, config);
    mergedConfig = Xpp3DomUtils.mergeXpp3Dom(mergedConfig, globalConfig);

    PluginDescriptor pluginDescriptor = this.pluginManager.loadPlugin(plugin, project.getRemotePluginRepositories(), this.repositorySystemSession);
    MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo("start");
    MojoExecution mojoExecution = new MojoExecution(mojoDescriptor, mergedConfig);
    mavenSession.setCurrentProject(project);
    this.pluginManager.executeMojo(mavenSession, mojoExecution);

    List<SwarmProcess> launched = (List<SwarmProcess>) mavenSession.getPluginContext(pluginDescriptor, project).get(SWARM_PROCESS);

    List<SwarmProcess> procs = (List<SwarmProcess>) getPluginContext().get(SWARM_PROCESS);

    if (procs == null) {
        procs = new ArrayList<>();
        getPluginContext().put(SWARM_PROCESS, procs);
    }

    procs.addAll(launched);

    mavenSession.setCurrentProject(this.project);
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:31,代码来源:MultiStartMojo.java

示例5: getProcessConfiguration

import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration; //导入依赖的package包/类
protected Xpp3Dom getProcessConfiguration(XmlPlexusConfiguration process) {
    Xpp3Dom config = new Xpp3Dom("configuration");

    config.addChild(convert(process.getChild("properties")));
    config.addChild(convert(process.getChild("environment")));
    config.addChild(convert(process.getChild("jvmArguments")));

    return config;
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:10,代码来源:MultiStartMojo.java

示例6: execute

import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration; //导入依赖的package包/类
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
    initProperties(true);
    initEnvironment();

    for (XmlPlexusConfiguration process : this.processes) {
        try {
            start(process);
        } catch (Exception e) {
            throw new MojoFailureException("Unable to start", e);
        }
    }
}
 
开发者ID:wildfly-swarm-archive,项目名称:ARCHIVE-wildfly-swarm,代码行数:14,代码来源:MultiStartMojo.java

示例7: startProject

import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected void startProject(MavenProject project, String executionId, XmlPlexusConfiguration process) throws InvalidPluginDescriptorException, PluginResolutionException, PluginDescriptorParsingException, PluginNotFoundException, PluginConfigurationException, MojoFailureException, MojoExecutionException, PluginManagerException {
    Plugin plugin = this.project.getPlugin("org.wildfly.swarm:wildfly-swarm-plugin");

    Xpp3Dom config = getConfiguration(project, executionId);
    Xpp3Dom processConfig = getProcessConfiguration(process);

    Xpp3Dom globalConfig = getGlobalConfig();
    Xpp3Dom mergedConfig = Xpp3DomUtils.mergeXpp3Dom(processConfig, config);
    mergedConfig = Xpp3DomUtils.mergeXpp3Dom(mergedConfig, globalConfig);

    PluginDescriptor pluginDescriptor = this.pluginManager.loadPlugin(plugin, project.getRemotePluginRepositories(), this.repositorySystemSession);
    MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo("start");
    MojoExecution mojoExecution = new MojoExecution(mojoDescriptor, mergedConfig);
    mavenSession.setCurrentProject(project);
    this.pluginManager.executeMojo(mavenSession, mojoExecution);

    List<SwarmProcess> launched = (List<SwarmProcess>) mavenSession.getPluginContext(pluginDescriptor, project).get("swarm-process");

    List<SwarmProcess> procs = (List<SwarmProcess>) getPluginContext().get("swarm-process");

    if (procs == null) {
        procs = new ArrayList<>();
        getPluginContext().put("swarm-process", procs);
    }

    procs.addAll(launched);

    mavenSession.setCurrentProject(this.project);
}
 
开发者ID:wildfly-swarm-archive,项目名称:ARCHIVE-wildfly-swarm,代码行数:31,代码来源:MultiStartMojo.java

示例8: getProcessConfiguration

import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration; //导入依赖的package包/类
protected Xpp3Dom getProcessConfiguration(XmlPlexusConfiguration process) {
    Xpp3Dom config = new Xpp3Dom("configuration");

    config.addChild(convert(process.getChild("properties")));
    config.addChild(convert(process.getChild("environment")));

    return config;
}
 
开发者ID:wildfly-swarm-archive,项目名称:ARCHIVE-wildfly-swarm,代码行数:9,代码来源:MultiStartMojo.java

示例9: parsePluginDetails

import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration; //导入依赖的package包/类
private void parsePluginDetails(ArtifactInfo ai, ZipInputStream zis)
        throws XmlPullParserException, IOException, PlexusConfigurationException {
    PlexusConfiguration plexusConfig =
            new XmlPlexusConfiguration(Xpp3DomBuilder.build(new InputStreamReader(zis, Charsets.UTF_8)));

    ai.prefix = plexusConfig.getChild("goalPrefix").getValue();
    ai.goals = new ArrayList<>();
    PlexusConfiguration[] mojoConfigs = plexusConfig.getChild("mojos").getChildren("mojo");
    for (PlexusConfiguration mojoConfig : mojoConfigs) {
        ai.goals.add(mojoConfig.getChild("goal").getValue());
    }
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:13,代码来源:VfsMavenPluginArtifactInfoIndexCreator.java

示例10: getTarget

import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration; //导入依赖的package包/类
private static PlexusConfiguration getTarget( String taskName, ClassLoader classLoader )
{
    XmlPlexusConfiguration target = new XmlPlexusConfiguration( "target" );

    // let's find the implementation
    String[] implementations = PropertyUtils.getPropertyArray( taskName + ".implementations" );
    for ( String implementation : implementations )
    {
        try
        {
            String className = PropertyUtils.getProperty( taskName + "." + implementation + ".implementation" );
            classLoader.loadClass( className );

            XmlPlexusConfiguration taskdef = new XmlPlexusConfiguration( "taskdef" );
            taskdef.setAttribute( "name", taskName );
            taskdef.setAttribute( "classname", className );
            target.addChild( taskdef );

            break;
        }
        catch ( ClassNotFoundException e )
        {
            // NOOP
        }
    }

    // now return the target
    return target;
}
 
开发者ID:frincon,项目名称:openeos,代码行数:30,代码来源:PlexusConfigurationUtils.java

示例11: setDestinationDirectory

import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration; //导入依赖的package包/类
private static void setDestinationDirectory( PlexusConfiguration task, PlexusConfiguration goal,
                                             PlexusConfiguration target, MavenSession session,
                                             HibernateExpressionEvaluator evaluator )
    throws PlexusConfigurationException
{
    // first let's find out where is the destination directory
    String destdir = goal.getAttribute( "destdir" );
    if ( destdir == null )
    {
        destdir = task.getAttribute( "destdir" );
    }
    if ( destdir == null )
    {
        destdir = PropertyUtils.getProperty( goal.getName() + ".destdir" );
    }
    destdir = evaluator.evaluateString( destdir );

    // let's see it the destination directory needs to be added to sources
    if ( "true".equals( PropertyUtils.getProperty( goal.getName() + ".addtosource" ) ) )
    {
        session.getCurrentProject().addCompileSourceRoot( destdir );
    }

    // create the directory
    XmlPlexusConfiguration mkdir = new XmlPlexusConfiguration( "mkdir" );
    mkdir.setAttribute( "dir", destdir );
    target.addChild( mkdir );

    // and add it to the task
    ( (XmlPlexusConfiguration) task ).setAttribute( "destdir", destdir );
}
 
开发者ID:frincon,项目名称:openeos,代码行数:32,代码来源:PlexusConfigurationUtils.java

示例12: convertObject

import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration; //导入依赖的package包/类
private static PlexusConfiguration convertObject(ModelNode configuration, ConversionContext ctx) {
    XmlPlexusConfiguration object = new XmlPlexusConfiguration(ctx.tagName);
    if (ctx.id != null) {
        object.setAttribute("id", ctx.id);
    }

    ModelNode propertySchemas = ctx.currentSchema.get("properties");
    ModelNode additionalPropSchemas = ctx.currentSchema.get("additionalProperties");
    for (String key : configuration.keys()) {
        ModelNode childConfig = configuration.get(key);
        ModelNode childSchema = propertySchemas.get(key);
        if (!childSchema.isDefined()) {
            if (additionalPropSchemas.getType() == ModelType.BOOLEAN) {
                throw new IllegalArgumentException("Cannot determine the format for the '" + key +
                        "' JSON value during the JSON-to-XML conversion.");
            }
            childSchema = additionalPropSchemas;
        }

        ctx.currentSchema = childSchema;
        ctx.pushTag(key);
        ctx.id = null;

        if (!childSchema.isDefined()) {
            //check if this is an ignorable path
            if (ctx.ignorablePaths.contains(ctx.getCurrentPathString())) {
                ctx.currentPath.pop();
                continue;
            }
            throw new IllegalArgumentException("Could not determine the format for the '" + key +
                    "' JSON value during the JSON-to-XML conversion.");
        }

        PlexusConfiguration xmlChild = convert(childConfig, ctx);
        ctx.currentPath.pop();
        object.addChild(xmlChild);
    }
    return object;
}
 
开发者ID:revapi,项目名称:revapi,代码行数:40,代码来源:SchemaDrivenJSONToXmlConverter.java

示例13: convertSimple

import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration; //导入依赖的package包/类
private static PlexusConfiguration convertSimple(String tagName, String id, String value) {
    XmlPlexusConfiguration ret = new XmlPlexusConfiguration(tagName);
    if (id != null) {
        ret.setAttribute("id", id);
    }

    ret.setValue(value);
    return ret;
}
 
开发者ID:revapi,项目名称:revapi,代码行数:10,代码来源:SchemaDrivenJSONToXmlConverter.java

示例14: convertOldStyleConfigToXml

import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration; //导入依赖的package包/类
private static PlexusConfiguration convertOldStyleConfigToXml(Map<String, ModelNode> extensionSchemas,
                                                              ModelNode jsonConfig) {
    PlexusConfiguration xmlConfig = new XmlPlexusConfiguration("analysisConfiguration");

    extensionCheck: for (Map.Entry<String, ModelNode> e : extensionSchemas.entrySet()) {
        String extensionId = e.getKey();
        ModelNode schema = e.getValue();

        String[] extensionPath = extensionId.split("\\.");

        ModelNode config = jsonConfig;
        for (String segment : extensionPath) {
            if (!config.has(segment)) {
                continue extensionCheck;
            } else {
                config = config.get(segment);
            }
        }

        ConversionContext ctx = new ConversionContext();
        ctx.rootSchema = schema;
        ctx.currentSchema = schema;
        ctx.pushTag(extensionId);
        ctx.id = null;
        ctx.ignorablePaths = extensionSchemas.keySet().stream()
                .filter(id -> !extensionId.equals(id) && id.startsWith(extensionId))
                .collect(Collectors.toList());
        PlexusConfiguration extXml = convert(config, ctx);
        ctx.currentPath.pop();
        xmlConfig.addChild(extXml);
    }

    return xmlConfig;
}
 
开发者ID:revapi,项目名称:revapi,代码行数:35,代码来源:SchemaDrivenJSONToXmlConverter.java

示例15: convertNewStyleConfigToXml

import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration; //导入依赖的package包/类
private static PlexusConfiguration
convertNewStyleConfigToXml(Map<String, ModelNode> extensionSchemas, ModelNode jsonConfig) throws IOException {
    PlexusConfiguration xmlConfig = new XmlPlexusConfiguration("analysisConfiguration");

    for (ModelNode extConfig : jsonConfig.asList()) {
        String extensionId = extConfig.get("extension").asString();
        ModelNode configuration = extConfig.get("configuration");
        String id = extConfig.hasDefined("id") ? extConfig.get("id").asString() : null;

        ModelNode schema = extensionSchemas.get(extensionId);
        if (schema == null) {
            continue;
        }

        ConversionContext ctx = new ConversionContext();
        ctx.rootSchema = schema;
        ctx.currentSchema = schema;
        ctx.pushTag(extensionId);
        ctx.id = id;
        //we don't assign the ignorable paths, because this must not be tracked in a new-style configuration
        PlexusConfiguration extXml = convert(configuration, ctx);
        ctx.currentPath.pop();
        xmlConfig.addChild(extXml);
    }

    return xmlConfig;
}
 
开发者ID:revapi,项目名称:revapi,代码行数:28,代码来源:SchemaDrivenJSONToXmlConverter.java


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