• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java UIExecutionContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: execute

import org.jboss.forge.addon.ui.context.UIExecutionContext; //导入依赖的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


示例2: execute

import org.jboss.forge.addon.ui.context.UIExecutionContext; //导入依赖的package包/类
@Override
public Result execute(UIExecutionContext context) throws Exception {
   final UIContext uiContext = context.getUIContext();
   final Project project = helper.getProject(uiContext);

   final Map<Object, Object> attributeMap = uiContext.getAttributeMap();
   final JPADataSource dataSource = (JPADataSource) attributeMap.get(JPADataSource.class);

   persistenceOperations.setup(SpringBootJPAFacet.PERSISTENCE_UNIT_NAME, project, dataSource, false);

   // if we're using H2, Derby or HSQL embedded databases, we need to remove any previously set data
   // source properties
   if (!SpringBootPersistenceContainer.isNotEmbeddedDB(dataSource.getDatabase())) {
      SpringBootHelper.removeSpringDataPropertiesFromApplication(project);
   }
   
   return null;
}
 
开发者ID:forge,项目名称:springboot-addon,代码行数:19,代码来源:FinishJPASetupCommand.java


示例3: execute

import org.jboss.forge.addon.ui.context.UIExecutionContext; //导入依赖的package包/类
@Override
public Result execute(UIExecutionContext context) throws Exception {
    String buildConfigName = buildName.getValue();
    Objects.assertNotNull(buildConfigName, "buildName");
    Map<String, String> labels = BuildConfigs.createBuildLabels(buildConfigName);
    String gitUrlText = getOrFindGitUrl(context, gitUri.getValue());
    String imageText = image.getValue();
    List<EnvVar> envVars = createEnvVars(buildConfigName, gitUrlText, mavenCommand.getValue());
    BuildConfig buildConfig = BuildConfigs.createIntegrationTestBuildConfig(buildConfigName, labels, gitUrlText, imageText, envVars);

    LOG.info("Generated BuildConfig: " + toJson(buildConfig));

    ImageStream imageRepository = BuildConfigs.imageRepository(buildConfigName, labels);

    Controller controller = createController();
    controller.applyImageStream(imageRepository, "generated ImageStream: " + toJson(imageRepository));
    controller.applyBuildConfig(buildConfig, "generated BuildConfig: " + toJson(buildConfig));
    return Results.success("Added BuildConfig: " + Builds.getName(buildConfig) + " to OpenShift at master: " + getKubernetes().getMasterUrl());
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:20,代码来源:NewIntegrationTestBuildCommand.java


示例4: execute

import org.jboss.forge.addon.ui.context.UIExecutionContext; //导入依赖的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


示例5: execute

import org.jboss.forge.addon.ui.context.UIExecutionContext; //导入依赖的package包/类
@Override
public Result execute(UIExecutionContext context) throws Exception {
    // only execute if we are last
    if (last) {
        Map<Object, Object> attributeMap = context.getUIContext().getAttributeMap();
        String kind = mandatoryAttributeValue(attributeMap, "kind");

        if ("springboot".equals(kind)) {
            return doExecuteSpringBoot(context);
        } else {
            return doExecuteJava(context);
        }
    } else {
        return null;
    }
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:17,代码来源:ConfigureComponentPropertiesStep.java


示例6: execute

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

    // only execute if we are last
    if (last) {
        String kind = mandatoryAttributeValue(attributeMap, "kind");
        if ("xml".equals(kind)) {
            return executeXml(context, attributeMap);
        } else if ("java".equals(kind)) {
            return executeJava(context, attributeMap);
        } else {
            return executeOther(context, attributeMap);
        }
    } else {
        return null;
    }
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:19,代码来源:ConfigureEndpointPropertiesStep.java


示例7: execute

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

    // only execute if we are last
    if (last) {
        String kind = mandatoryAttributeValue(attributeMap, "kind");
        if ("xml".equals(kind)) {
            return executeXml(context, attributeMap);
        } else {
            throw new UnsupportedOperationException("Java not yet supported");
        }
    } else {
        return null;
    }
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:17,代码来源:ConfigureEipPropertiesStep.java


示例8: execute

import org.jboss.forge.addon.ui.context.UIExecutionContext; //导入依赖的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");
    }

    boolean val = "true".equals(decode.getValue());
    String[] val2 = null;
    if (filter.getValue() != null) {
        String s = filter.getValue().toString();
        val2 = s.split(",");
    }

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

    return Results.success();
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:20,代码来源:EndpointStatsCommand.java


示例9: execute

import org.jboss.forge.addon.ui.context.UIExecutionContext; //导入依赖的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


示例10: execute

import org.jboss.forge.addon.ui.context.UIExecutionContext; //导入依赖的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");
    }

    boolean val = "true".equals(decode.getValue());
    boolean val2 = "true".equals(verbose.getValue());
    boolean val3 = "true".equals(explain.getValue());

    org.apache.camel.commands.EndpointListCommand command = new org.apache.camel.commands.EndpointListCommand(name.getValue(), val, val2, val3);
    command.execute(getController(), getOutput(context), getError(context));

    return Results.success();
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:17,代码来源:EndpointListCommand.java


示例11: execute

import org.jboss.forge.addon.ui.context.UIExecutionContext; //导入依赖的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


示例12: execute

import org.jboss.forge.addon.ui.context.UIExecutionContext; //导入依赖的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


示例13: execute

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

    if (text != null && !text.isEmpty()) {
        dto.setLabels(text.split(","));
    } else {
        dto.setLabels(null);
    }

    // marshal DTO
    String json = toJson(dto);

    // write the connector json file
    FileResource<?> fileResource = getCamelConnectorFile(context);
    fileResource.setContents(json);

    return Results.success("Updated labels on Connector: " + dto.getName());
}
 
开发者ID:fabric8io,项目名称:django,代码行数:20,代码来源:EditConnectorLabelsCommand.java


示例14: execute

import org.jboss.forge.addon.ui.context.UIExecutionContext; //导入依赖的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


示例15: execute

import org.jboss.forge.addon.ui.context.UIExecutionContext; //导入依赖的package包/类
@Override
public Result execute(UIExecutionContext uiExecutionContext) throws Exception {
    List<GitProvider> gitServices = GitProvider.loadGitProviders();
    List<String> validServices = new ArrayList<>();
    for (GitProvider gitService : gitServices) {
        if (gitService.isConfiguredCorrectly()) {
            validServices.add(gitService.getName());
        }
    }
    String message = "git providers: " + String.join(", ", validServices);
    return Results.success(message, validServices);
}
 
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:13,代码来源:CheckGitAccounts.java


示例16: execute

import org.jboss.forge.addon.ui.context.UIExecutionContext; //导入依赖的package包/类
@Override
public Result execute(UIExecutionContext context) throws Exception {
   final UIContext uiContext = context.getUIContext();
   JPADataSource dataSource = (JPADataSource) uiContext.getAttributeMap().get(JPADataSource.class);
   updateDataSource(dataSource);

   final Properties properties = new Properties();
   setProperties(properties, dataSource);

   final Project project = helper.getProject(uiContext);
   SpringBootHelper.writeToApplicationProperties(project, properties);

   return null;
}
 
开发者ID:forge,项目名称:springboot-addon,代码行数:15,代码来源:AbstractDataSourceCommand.java


示例17: decorateSource

import org.jboss.forge.addon.ui.context.UIExecutionContext; //导入依赖的package包/类
@Override
public JavaClassSource decorateSource(UIExecutionContext context, Project project, JavaClassSource source) throws Exception {
   // call the original command
   final JavaClassSource newSource = (JavaClassSource) original.decorateSource(context, project, source);

   createCRUDRepository(newSource, project);

   // return the output of the wrapped command
   return newSource;
}
 
开发者ID:forge,项目名称:springboot-addon,代码行数:11,代码来源:CreateSpringBootJPASupportDecorator.java


示例18: execute

import org.jboss.forge.addon.ui.context.UIExecutionContext; //导入依赖的package包/类
/**
 * Executes the wrapped command logic, temporarily using the provided {@link JavaSourceDecorator} instance before
 * resetting it to what it previously was before the invocation.
 */
@Override
public Result execute(UIExecutionContext context) throws Exception {
   final JavaSourceDecorator<JavaClassSource> initial = wrapped.getJavaSourceDecorator();
   try {
      wrapped.setJavaSourceDecorator(decorator);
      return wrapped.execute(context);
   } finally {
      wrapped.setJavaSourceDecorator(initial);
   }
}
 
开发者ID:forge,项目名称:springboot-addon,代码行数:15,代码来源:JavaSourceCommandWrapper.java


示例19: execute

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

   final Project project = helper.getProject(context.getUIContext());
   final DependencyFacet facet = project.getFacet(DependencyFacet.class);

   // add dependencies
   facet.addDirectDependency(SpringBootFacet.SPRING_BOOT_STARTER_WEB);
   facet.addDirectDependency(SpringBootFacet.CXF_SPRING_BOOT);
   facet.addDirectDependency(SpringBootFacet.JACKSON_JAXRS_PROVIDER);

   // remove EE dependencies
   facet.removeDependency(SpringBootFacet.JBOSS_EJB_SPEC);
   facet.removeDependency(SpringBootFacet.JBOSS_JAXRS_SPEC);
   facet.removeDependency(SpringBootFacet.JBOSS_SERVLET_SPEC);
   facet.removeManagedDependency(SpringBootFacet.JBOSS_EE_SPEC);

   // add CXF properties to application.properties
   final Properties cxfProps = new Properties();
   cxfProps.put("cxf.jaxrs.component-scan", "true");
   cxfProps.put("cxf.path", "/rest");
   SpringBootHelper.writeToApplicationProperties(project, cxfProps);

   SpringBootHelper.modifySpringBootApplication(project, sbApp -> {
      sbApp.addImport("com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider");

      final MethodSource<JavaClassSource> method = sbApp.addMethod("public JacksonJsonProvider config() {\n" +
               "\t\treturn new JacksonJsonProvider();\n" +
               "\t}");
      method.addAnnotation("org.springframework.context.annotation.Bean");

      return sbApp;
   });

   return result;
}
 
开发者ID:forge,项目名称:springboot-addon,代码行数:39,代码来源:RestGenerateFromEntitiesCommand.java


示例20: decorateSource

import org.jboss.forge.addon.ui.context.UIExecutionContext; //导入依赖的package包/类
@Override
public JavaClassSource decorateSource(UIExecutionContext context, Project project, JavaClassSource source)
         throws Exception
{
   final JavaClassSource result = wrapped.decorateSource(context, project, source);
   result.addAnnotation("org.springframework.stereotype.Component");
   return result;
}
 
开发者ID:forge,项目名称:springboot-addon,代码行数:9,代码来源:RestCORSFilterCommand.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java OWLException类代码示例发布时间:2022-05-21
下一篇:
Java WhileLoopTree类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap