本文整理汇总了Java中org.jboss.forge.addon.ui.result.Results类的典型用法代码示例。如果您正苦于以下问题:Java Results类的具体用法?Java Results怎么用?Java Results使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Results类属于org.jboss.forge.addon.ui.result包,在下文中一共展示了Results类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
示例2: execute
import org.jboss.forge.addon.ui.result.Results; //导入依赖的package包/类
@Override
public Result execute(final UIExecutionContext context) throws Exception
{
final UIContext uiContext = context.getUIContext();
applyUIValues(uiContext);
// add driver dependency
final Project project = helper.getProject(uiContext);
final DatabaseType database = dbType.getValue();
final Coordinate driverCoordinate = database.getDriverCoordinate();
SpringBootHelper.addDependency(project, driverCoordinate.getGroupId(), driverCoordinate.getArtifactId())
.setScopeType("runtime");
SpringBootHelper.addSpringBootDependency(project, SpringBootFacet.SPRING_BOOT_STARTER_DATA_JPA_ARTIFACT)
.setScopeType("runtime");
return Results.success("Spring Boot JPA successfully set up!");
}
示例3: next
import org.jboss.forge.addon.ui.result.Results; //导入依赖的package包/类
@Override
public NavigationResult next(UINavigationContext context) throws Exception
{
applyUIValues(context.getUIContext());
final DatabaseType database = dbType.getValue();
if (!isNotEmbeddedDB(database))
{
return Results.navigateTo(FinishJPASetupCommand.class);
}
else
{
if (dataSourceName.hasValue())
{
// if we specified a datasource, use it
return Results.navigateTo(AddJNDIDatasourceCommand.class);
}
else
{
// otherwise, we're using the DB URL, so deal with it
return Results.navigateTo(AddDBURLCommand.class);
}
}
}
示例4: execute
import org.jboss.forge.addon.ui.result.Results; //导入依赖的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());
}
示例5: 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();
}
示例6: ensureCamelArtifactIdAdded
import org.jboss.forge.addon.ui.result.Results; //导入依赖的package包/类
public static Result ensureCamelArtifactIdAdded(Project project, CamelComponentDetails details, DependencyInstaller dependencyInstaller) {
String groupId = details.getGroupId();
String artifactId = details.getArtifactId();
Dependency core = CamelProjectHelper.findCamelCoreDependency(project);
if (core == null) {
return Results.fail("The project does not include camel-core");
}
// we want to use same version as camel-core if its a camel component
// otherwise use the version from the dto
String version;
if ("org.apache.camel".equals(groupId)) {
version = core.getCoordinate().getVersion();
} else {
version = details.getVersion();
}
DependencyBuilder component = DependencyBuilder.create().setGroupId(groupId)
.setArtifactId(artifactId).setVersion(version);
// install the component
dependencyInstaller.install(project, component);
return null;
}
示例7: editEndpointXml
import org.jboss.forge.addon.ui.result.Results; //导入依赖的package包/类
private Result editEndpointXml(List<String> lines, String lineNumber, String endpointUrl, String uri, FileResource file, String xml) {
// the list is 0-based, and line number is 1-based
int idx = Integer.valueOf(lineNumber) - 1;
String line = lines.get(idx);
// replace uri with new value
line = StringHelper.replaceAll(line, endpointUrl, uri);
lines.set(idx, line);
LOG.info("Updating " + endpointUrl + " to " + uri + " at line " + lineNumber + " in file " + xml);
// and save the file back
String content = LineNumberHelper.linesToString(lines);
file.setContents(content);
return Results.success("Update endpoint uri: " + uri + " in file " + xml);
}
示例8: editEndpointOther
import org.jboss.forge.addon.ui.result.Results; //导入依赖的package包/类
protected Result editEndpointOther(Project project, ResourcesFacet facet, FileResource file, String uri, String endpointUrl,
String currentFile, String lineNumber) throws Exception {
List<String> lines = LineNumberHelper.readLines(file.getResourceInputStream());
// the list is 0-based, and line number is 1-based
int idx = Integer.valueOf(lineNumber) - 1;
String line = lines.get(idx);
// replace uri with new value
line = StringHelper.replaceAll(line, endpointUrl, uri);
lines.set(idx, line);
LOG.info("Updating " + endpointUrl + " to " + uri + " at line " + lineNumber + " in file " + currentFile);
// and save the file back
String content = LineNumberHelper.linesToString(lines);
file.setContents(content);
return Results.success("Update endpoint uri: " + uri + " in file " + currentFile);
}
示例9: 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");
}
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();
}
示例10: 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());
}
}
示例11: 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");
}
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();
}
示例12: 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);
}
}
示例13: 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");
}
}
示例14: execute
import org.jboss.forge.addon.ui.result.Results; //导入依赖的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());
}
示例15: execute
import org.jboss.forge.addon.ui.result.Results; //导入依赖的package包/类
@Override
public Result execute(UIExecutionContext context) throws Exception
{
ConnectionProfileManager manager = managerProvider.getConnectionProfileManager();
if (connectionProfile != null)
{
ConnectionProfile connection = manager.loadConnectionProfiles().get(connectionProfile.getValue());
if (!connection.isSavePassword())
{
String password = connectionProfilePassword.getValue();
if (password == null)
password = "";
connection.setPassword(password);
}
Project selectedProj = getSelectedProject(context);
if (selectedProj.getFacet(DatabaseMigrationFacet.class).isInstalled())
selectedProj.getFacet(DatabaseMigrationFacet.class).setPropertiesFile(connection);
}
return Results
.success("Properties stored!");
}