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


Java Results.fail方法代码示例

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


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

示例1: execute

import org.jboss.forge.addon.ui.result.Results; //导入方法依赖的package包/类
@Override
public Result execute(UIExecutionContext context) throws Exception
{
   Project project = getSelectedProject(context);
   UIOutput output = context.getUIContext().getProvider().getOutput();
   PackagingFacet packagingFacet = project.getFacet(PackagingFacet.class);
   try
   {
      packagingFacet.createBuilder().addArguments("wildfly-swarm:run").runTests(false).build(output.out(),
               output.err());
   }
   catch (BuildException ie)
   {
      if (!(ie.getCause() instanceof InterruptedException))
      {
         return Results.fail("Error while running the build", ie.getCause());
      }
   }
   return Results.success();
}
 
开发者ID:forge,项目名称:wildfly-swarm-addon,代码行数:21,代码来源:RunCommand.java

示例2: execute

import org.jboss.forge.addon.ui.result.Results; //导入方法依赖的package包/类
@Override
public Result execute(UIExecutionContext context) throws Exception {
    UIContext uiContext = context.getUIContext();
    Map<Object, Object> attributeMap = uiContext.getAttributeMap();

    List<GitClonedRepoDetails> clonedRepos = (List<GitClonedRepoDetails>) attributeMap.get(AttributeMapKeys.GIT_CLONED_REPOS);
    if (clonedRepos != null) {
        for (GitClonedRepoDetails clonedRepo : clonedRepos) {
            Git git = clonedRepo.getGit();
            String gitUrl = clonedRepo.getGitUrl();
            UserDetails userDetails = clonedRepo.getUserDetails();
            File basedir = clonedRepo.getDirectory();
            String message = "Adding pipeline";
            try {
                LOG.info("Performing a git commit and push on URI " + gitUrl);
                gitAddCommitAndPush(git, gitUrl, userDetails, basedir, message);
            } catch (GitAPIException e) {
                return Results.fail("Failed to commit and push repository " + clonedRepo.getGitRepoName() + " due to " + e, e);
            } finally {
                removeTemporaryFiles(basedir);
            }
        }
    }
    return Results.success();
}
 
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:26,代码来源:GitCommitAndPushStep.java

示例3: execute

import org.jboss.forge.addon.ui.result.Results; //导入方法依赖的package包/类
@Override
public Result execute(UIExecutionContext context) throws Exception {
    StopWatch watch = new StopWatch();

    log.debug("Starting to setup fabric8 project");

    Project project = getSelectedProject(context.getUIContext());
    if (project == null) {
        return Results.fail("No pom.xml available so cannot edit the project!");
    }

    // setup fabric8-maven-plugin
    setupFabricMavenPlugin(project);
    log.debug("fabric8-maven-plugin now setup");

    // make sure we have resources as we need it later
    facetFactory.install(project, ResourcesFacet.class);

    log.info("execute took " + watch.taken());
    return Results.success();
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:22,代码来源:Fabric8SetupStep.java

示例4: execute

import org.jboss.forge.addon.ui.result.Results; //导入方法依赖的package包/类
@Override
public Result execute(UIExecutionContext uiExecutionContext) throws Exception {
    configuration.setProperty("CamelJolokiaUrl", url.getValue());
    // username and password is optional
    configuration.setProperty("CamelJolokiaUsername", username.getValue());
    configuration.setProperty("CamelJolokiaPassword", password.getValue());

    // ping to see if the connection works
    JolokiaCamelController controller = new DefaultJolokiaCamelController();
    controller.connect(url.getValue(), username.getValue(), password.getValue());

    boolean ok = controller.ping();
    if (ok) {
        return Results.success("Connected to " + url.getValue() + (username.getValue() != null ? " using " + username.getValue() : ""));
    } else {
        return Results.fail("Error connecting to " + url.getValue());
    }
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:19,代码来源:ConnectCommand.java

示例5: execute

import org.jboss.forge.addon.ui.result.Results; //导入方法依赖的package包/类
@Override
public Result execute(UIExecutionContext context) throws Exception {
    String scheme = name.getValue();

    // maybe the connector has already been added to the catalog
    String json = camelCatalog.componentJSonSchema(scheme);
    if (json == null) {
        // discover classpath and find all the connectors and add them to the catalog
        Project project = getSelectedProjectOrNull(context.getUIContext());
        if (project != null) {
            discoverCustomCamelComponentsOnClasspathAndAddToCatalog(camelCatalog, project);
        }
        // load schema again
        json = camelCatalog.componentJSonSchema(scheme);
    }

    if (json != null) {
        return Results.success(json);
    } else {
        return Results.fail("Connector " + scheme + " not found");
    }
}
 
开发者ID:fabric8io,项目名称:django,代码行数:23,代码来源:ConnectorDetailsCommand.java

示例6: execute

import org.jboss.forge.addon.ui.result.Results; //导入方法依赖的package包/类
@Override
public Result execute(UIExecutionContext uiExecutionContext) throws Exception {
    String url = getJolokiaUrl();
    if (url == null) {
        return Results.fail("Not connected to remote jolokia agent. Use camel-connect command first");
    }

    String username = configuration.getString("CamelJolokiaUsername");

    JolokiaCamelController controller = getController();

    // ping to see if the connection works
    boolean ok = controller.ping();
    if (ok) {
        return Results.success("Connected to " + url + (username != null ? " using " + username : ""));
    } else {
        return Results.fail("Error connecting to " + url);
    }
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:20,代码来源:ConnectedCommand.java

示例7: execute

import org.jboss.forge.addon.ui.result.Results; //导入方法依赖的package包/类
@Override
public Result execute(UIExecutionContext context) throws Exception {

    griffonFacet = griffonVersion.getValue();

    FrameworkTypes frameworkTypeValue = frameworkType.getValue();
    LanguageTypes languageTypeValue = languageType.getValue();

    griffonFacet.setLanguage(languageTypeValue);
    griffonFacet.setFramework(frameworkTypeValue);

    if (facetFactory.install(getSelectedProject(context.getUIContext()), griffonFacet)) {
        return Results.success(properties.getMessage("plugin.install.success"));
    }

    return Results.fail(properties.getMessage("plugin.install.failure"));
}
 
开发者ID:jughyd,项目名称:griffon-forge-addon,代码行数:18,代码来源:SetupCommand.java

示例8: execute

import org.jboss.forge.addon.ui.result.Results; //导入方法依赖的package包/类
@Override
public Result execute(UIExecutionContext context) throws Exception
{
    if (!context.getPrompt().promptBoolean(
        "Are you sure you want to continue? This command will delete current directories: addons, bin, lib, rules/migration-core"))
    {
        return Results.fail("Updating distribution was aborted.");
    }

    // Find the latest version.
    Coordinate latestDist = this.updater.getLatestReleaseOf("org.jboss.windup", "windup-distribution");
    Version latestVersion = SingleVersion.valueOf(latestDist.getVersion());
    Version installedVersion = currentAddon.getId().getVersion();
    if (latestVersion.compareTo(installedVersion) <= 0)
    {
        return Results.fail(Util.WINDUP_BRAND_NAME_ACRONYM+" CLI is already in the most updated version.");
    }

    distUpdater.replaceWindupDirectoryWithDistribution(latestDist);

    return Results.success("Sucessfully updated "+Util.WINDUP_BRAND_NAME_ACRONYM+" CLI to version " + latestDist.getVersion() + ". Please restart RHAMT CLI.");
}
 
开发者ID:windup,项目名称:windup,代码行数:23,代码来源:WindupUpdateDistributionCommand.java

示例9: execute

import org.jboss.forge.addon.ui.result.Results; //导入方法依赖的package包/类
@Override
public Result execute(UIExecutionContext context) throws Exception {
    UIContext uiContext = context.getUIContext();
    storeAttributes(uiContext);
    if (github == null) {
        return Results.fail("No github account setup");
    }

    String org = getOrganisationName(gitOrganisation.getValue());
    String repo = getGitHubRepositoryName().getValue();
    if (Strings.isNullOrBlank(repo)) {
        repo = getNamed().getValue();
    }

    String orgOrNoUser = org;
    if (Strings.isNotBlank(org)) {
        orgOrNoUser = "user";
    }
    String orgAndRepo = orgOrNoUser + "/" + repo;
    LOG.info("Creating github repository " + orgAndRepo);

    File basedir = getSelectionFolder(uiContext);
    if (basedir == null || !basedir.exists() || !basedir.isDirectory()) {
        return Results.fail("No project directory exists! " + basedir);
    }

    GitHubImportParameters importParameters = new GitHubImportParameters(org, repo, orgAndRepo, github);
    uiContext.getAttributeMap().put(GitHubImportParameters.class, importParameters);

    return super.execute(context);
}
 
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:32,代码来源:Fabric8ProjectInfoStep.java

示例10: storeAttributes

import org.jboss.forge.addon.ui.result.Results; //导入方法依赖的package包/类
protected Result storeAttributes(UIContext uiContext) {
        if (github == null) {
            return Results.fail("No github account setup");
        }
        List<String> repositories = new ArrayList<>();

        Iterable<GitRepositoryDTO> values = gitRepositoryPattern.getValue();
        for (GitRepositoryDTO repo : values) {
            String id = repo.getId();

            if (Strings.isNotBlank(id)) {
                repositories.add(id);
            }
/*
            Pattern regex;
            try {
                regex = Pattern.compile(pattern);
            } catch (Exception e) {
                return Results.fail("Invalid regular expression `" + pattern + "` due to: " + e, e);
            }

            for (String repositoryName : repositoryNames) {
                if (regex.matcher(repositoryName).matches()) {
                    repositories.add(repositoryName);
                }
            }
*/
        }
        String pattern = createPatternFromRepositories(repositories);
        uiContext.getAttributeMap().put(GIT_REPOSITORY_PATTERN, pattern);
        uiContext.getAttributeMap().put(GIT_REPO_NAMES, repositories);
        return Results.success();
    }
 
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:34,代码来源:GitHubImportPickRepositoriesStep.java

示例11: storeAttributes

import org.jboss.forge.addon.ui.result.Results; //导入方法依赖的package包/类
protected Result storeAttributes(UIContext uiContext) {
    if (github == null) {
        return Results.fail("No github account setup");
    }
    GitOrganisationDTO organisation = gitOrganisation.getValue();
    String org = getOrganisationName(organisation);

    uiContext.getAttributeMap().put(GIT_OWNER_NAME, org);
    uiContext.getAttributeMap().put(GIT_ORGANISATION, org);
    uiContext.getAttributeMap().put(GIT_ACCOUNT, github.getDetails());

    return Results.success();
}
 
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:14,代码来源:GitHubImportPickOrganisationStep.java

示例12: execute

import org.jboss.forge.addon.ui.result.Results; //导入方法依赖的package包/类
@Override
public Result execute(UIExecutionContext context) throws Exception {
    String url = getJolokiaUrl();
    if (url == null) {
        return Results.fail("Not connected to remote jolokia agent. Use camel-connect command first");
    }

    org.apache.camel.commands.RouteListCommand command = new org.apache.camel.commands.RouteListCommand(name.getValue());

    command.execute(getController(), getOutput(context), getError(context));
    return Results.success();
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:13,代码来源:RouteListCommand.java

示例13: execute

import org.jboss.forge.addon.ui.result.Results; //导入方法依赖的package包/类
@Override
public Result execute(UIExecutionContext context) throws Exception {
    Project project = getSelectedProject(context);

    // does the project already have camel?
    Dependency core = findCamelCoreDependency(project);
    if (core == null) {
        return Results.fail("The project does not include camel-core");
    }

    ProjectDto camelProject = new ProjectDto();

    ResourcesFacet resourcesFacet = project.getFacet(ResourcesFacet.class);
    WebResourcesFacet webResourcesFacet = null;
    if (project.hasFacet(WebResourcesFacet.class)) {
        webResourcesFacet = project.getFacet(WebResourcesFacet.class);
    }

    // use value choices instead of completer as that works better in web console
    XmlEndpointsCompleter xmlEndpointCompleter = new XmlEndpointsCompleter(resourcesFacet, webResourcesFacet, null);
    JavaSourceFacet javaSourceFacet = project.getFacet(JavaSourceFacet.class);

    // use value choices instead of completer as that works better in web console
    RouteBuilderEndpointsCompleter javaEndpointsCompleter = new RouteBuilderEndpointsCompleter(javaSourceFacet, null);

    camelProject.addEndpoints(javaEndpointsCompleter.getEndpoints());
    camelProject.addEndpoints(xmlEndpointCompleter.getEndpoints());

    CamelCurrentComponentsFinder componentsFinder = new CamelCurrentComponentsFinder(getCamelCatalog(), project);
    List<ComponentDto> currentComponents = componentsFinder.findCurrentComponents();
    camelProject.setComponents(currentComponents);

    String result = formatResult(camelProject);
    return Results.success(result);
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:36,代码来源:CamelGetOverviewCommand.java

示例14: execute

import org.jboss.forge.addon.ui.result.Results; //导入方法依赖的package包/类
@Override
public Result execute(UIExecutionContext context) throws Exception {
    Project project = getSelectedProject(context);

    String xmlResourceName = xml.getValue();
    List<ContextDto> camelContexts = CamelXmlHelper.loadCamelContext(getCamelCatalog(), context.getUIContext(), project, xmlResourceName);
    if (camelContexts == null) {
        return Results.fail("No file found for: " + xmlResourceName);
    }
    String result = formatResult(camelContexts);
    return Results.success(result);
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:13,代码来源:CamelGetRoutesXmlCommand.java

示例15: execute

import org.jboss.forge.addon.ui.result.Results; //导入方法依赖的package包/类
@Override
public Result execute(UIExecutionContext context) throws Exception {
    String url = getJolokiaUrl();
    if (url == null) {
        return Results.fail("Not connected to remote jolokia agent. Use camel-connect command first");
    }

    org.apache.camel.commands.ContextStartCommand command = new org.apache.camel.commands.ContextStartCommand(name.getValue());
    command.execute(getController(), getOutput(context), getError(context));

    return Results.success("Started " + name.getValue());
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:13,代码来源:ContextStartCommand.java


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