本文整理汇总了Java中org.jboss.forge.addon.ui.context.UIExecutionContext类的典型用法代码示例。如果您正苦于以下问题:Java UIExecutionContext类的具体用法?Java UIExecutionContext怎么用?Java UIExecutionContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UIExecutionContext类属于org.jboss.forge.addon.ui.context包,在下文中一共展示了UIExecutionContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例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;
}
示例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());
}
示例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();
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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();
}
示例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());
}
}
示例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();
}
示例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);
}
}
示例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");
}
}
示例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());
}
示例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);
}
示例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);
}