本文整理汇总了Java中com.thoughtworks.go.plugin.api.request.GoPluginApiRequest.requestName方法的典型用法代码示例。如果您正苦于以下问题:Java GoPluginApiRequest.requestName方法的具体用法?Java GoPluginApiRequest.requestName怎么用?Java GoPluginApiRequest.requestName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.thoughtworks.go.plugin.api.request.GoPluginApiRequest
的用法示例。
在下文中一共展示了GoPluginApiRequest.requestName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handle
import com.thoughtworks.go.plugin.api.request.GoPluginApiRequest; //导入方法依赖的package包/类
@Override
public GoPluginApiResponse handle(GoPluginApiRequest request) throws UnhandledRequestTypeException {
String requestName = request.requestName();
if (requestName.equals(PLUGIN_SETTINGS_GET_CONFIGURATION)) {
return handleGetPluginSettingsConfiguration();
} else if (requestName.equals(PLUGIN_SETTINGS_GET_VIEW)) {
try {
return handleGetPluginSettingsView();
} catch (IOException e) {
return renderJSON(500, String.format("Failed to find template: %s", e.getMessage()));
}
} else if (requestName.equals(PLUGIN_SETTINGS_VALIDATE_CONFIGURATION)) {
return handleValidatePluginSettingsConfiguration(request);
}
if ("parse-directory".equals(request.requestName())) {
return handleParseDirectoryRequest(request);
}
throw new UnhandledRequestTypeException(request.requestName());
}
示例2: handle
import com.thoughtworks.go.plugin.api.request.GoPluginApiRequest; //导入方法依赖的package包/类
@Override
public GoPluginApiResponse handle(GoPluginApiRequest request) throws UnhandledRequestTypeException {
try {
switch (Request.fromString(request.requestName())) {
case PLUGIN_SETTINGS_GET_VIEW:
return new GetViewRequestExecutor().execute();
case REQUEST_NOTIFICATIONS_INTERESTED_IN:
return new NotificationInterestedInExecutor().execute();
case REQUEST_STAGE_STATUS:
return StageStatusRequest.fromJSON(request.requestBody()).executor(pluginRequest).execute();
case PLUGIN_SETTINGS_GET_CONFIGURATION:
return new GetPluginConfigurationExecutor().execute();
case PLUGIN_SETTINGS_VALIDATE_CONFIGURATION:
return ValidatePluginSettings.fromJSON(request.requestBody()).executor().execute();
default:
throw new UnhandledRequestTypeException(request.requestName());
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例3: handle
import com.thoughtworks.go.plugin.api.request.GoPluginApiRequest; //导入方法依赖的package包/类
@Override
public GoPluginApiResponse handle(GoPluginApiRequest goPluginApiRequest) {
String requestName = goPluginApiRequest.requestName();
if (requestName.equals(PLUGIN_SETTINGS_GET_CONFIGURATION)) {
return handleGetPluginSettingsConfiguration();
} else if (requestName.equals(PLUGIN_SETTINGS_GET_VIEW)) {
try {
return handleGetPluginSettingsView();
} catch (IOException e) {
return renderJSON(500, String.format("Failed to find template: %s", e.getMessage()));
}
} else if (requestName.equals(PLUGIN_SETTINGS_VALIDATE_CONFIGURATION)) {
return handleValidatePluginSettingsConfiguration(goPluginApiRequest);
} else if (requestName.equals(PLUGIN_CONFIGURATION)) {
Map<String, Object> configuration = getPluginConfiguration();
return renderJSON(SUCCESS_RESPONSE_CODE, configuration);
} else if (requestName.equals(SEARCH_USER)) {
return handleSearchUserRequest(goPluginApiRequest);
} else if (requestName.equals(WEB_REQUEST_INDEX)) {
return handleSetupLoginWebRequest(goPluginApiRequest);
} else if (requestName.equals(WEB_REQUEST_AUTHENTICATE)) {
return handleAuthenticateWebRequest(goPluginApiRequest);
}
return renderJSON(NOT_FOUND_ERROR_RESPONSE_CODE, null);
}
示例4: handle
import com.thoughtworks.go.plugin.api.request.GoPluginApiRequest; //导入方法依赖的package包/类
@Override
public GoPluginApiResponse handle(GoPluginApiRequest request) throws UnhandledRequestTypeException {
try {
switch (request.requestName()) {
case "configuration":
case "go.plugin-settings.get-configuration":
return handleGetConfigRequest(request);
case "validate":
case "go.plugin-settings.validate-configuration":
return handleValidation(request);
case "execute":
return handleTaskExecution(request);
case "view":
case "go.plugin-settings.get-view":
return handleTaskView(request);
default:
return DefaultGoPluginApiResponse.badRequest(String.format("Invalid request name %s", request.requestName()));
}
} catch (Throwable e) {
return DefaultGoPluginApiResponse.error(e.getMessage());
}
}
示例5: handle
import com.thoughtworks.go.plugin.api.request.GoPluginApiRequest; //导入方法依赖的package包/类
@Override
public GoPluginApiResponse handle(GoPluginApiRequest request) throws UnhandledRequestTypeException {
switch (request.requestName()) {
case "configuration":
case "go.plugin-settings.get-configuration":
return handleGetConfigRequest();
case "validate":
case "go.plugin-settings.validate-configuration":
return handleValidation();
case "execute":
return handleTaskExecution(request);
case "view":
case "go.plugin-settings.get-view":
return handleTaskView();
default:
throw new UnhandledRequestTypeException(request.requestName());
}
}
示例6: handle
import com.thoughtworks.go.plugin.api.request.GoPluginApiRequest; //导入方法依赖的package包/类
@Override
public GoPluginApiResponse handle(GoPluginApiRequest goPluginApiRequest) {
String requestName = goPluginApiRequest.requestName();
if (requestName.equals(PLUGIN_SETTINGS_GET_CONFIGURATION)) {
return handleGetPluginSettingsConfiguration();
} else if (requestName.equals(PLUGIN_SETTINGS_GET_VIEW)) {
try {
return handleGetPluginSettingsView();
} catch (IOException e) {
return renderJSON(500, String.format("Failed to find template: %s", e.getMessage()));
}
} else if (requestName.equals(PLUGIN_SETTINGS_VALIDATE_CONFIGURATION)) {
return handleValidatePluginSettingsConfiguration(goPluginApiRequest);
} else if (requestName.equals(REQUEST_NOTIFICATIONS_INTERESTED_IN)) {
return handleNotificationsInterestedIn();
} else if (requestName.equals(REQUEST_STAGE_STATUS)) {
return handleStageNotification(goPluginApiRequest);
}
return renderJSON(NOT_FOUND_RESPONSE_CODE, null);
}
示例7: handle
import com.thoughtworks.go.plugin.api.request.GoPluginApiRequest; //导入方法依赖的package包/类
@Override
public GoPluginApiResponse handle(GoPluginApiRequest request) throws UnhandledRequestTypeException {
try {
switch (Request.fromString(request.requestName())) {
case PLUGIN_SETTINGS_GET_VIEW:
return new GetViewRequestExecutor().execute();
case REQUEST_NOTIFICATIONS_INTERESTED_IN:
return new NotificationInterestedInExecutor().execute();
case REQUEST_STAGE_STATUS:
return StageStatusRequest.fromJSON(request.requestBody()).executor(pluginRequest).execute();
case PLUGIN_SETTINGS_GET_CONFIGURATION:
return new GetPluginConfigurationExecutor().execute();
case PLUGIN_SETTINGS_VALIDATE_CONFIGURATION:
return ValidatePluginSettingsRequest.fromJSON(request.requestBody()).executor().execute();
default:
throw new UnhandledRequestTypeException(request.requestName());
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例8: handle
import com.thoughtworks.go.plugin.api.request.GoPluginApiRequest; //导入方法依赖的package包/类
@Override
public GoPluginApiResponse handle(GoPluginApiRequest request) throws UnhandledRequestTypeException {
if ("configuration".equals(request.requestName())) {
return handleGetConfigRequest();
} else if ("validate".equals(request.requestName())) {
return handleValidation(request);
} else if ("execute".equals(request.requestName())) {
return handleTaskExecution(request);
} else if ("view".equals(request.requestName())) {
try {
return handleView();
} catch (IOException e) {
String message = "Failed to find template: " + e.getMessage();
return renderJSON(500, message);
}
}
throw new UnhandledRequestTypeException(request.requestName());
}
示例9: handle
import com.thoughtworks.go.plugin.api.request.GoPluginApiRequest; //导入方法依赖的package包/类
@Override
public GoPluginApiResponse handle(GoPluginApiRequest request) throws UnhandledRequestTypeException {
try {
if ("configuration".equals(request.requestName())) {
return handleGetConfigRequest();
} else if ("validate".equals(request.requestName())) {
return handleValidation(request);
} else if ("execute".equals(request.requestName())) {
return handleTaskExecution(request);
} else if ("view".equals(request.requestName())) {
return handleTaskView();
}
} catch (IOException e) {
logError(e, "error when serializing");
throw new UnhandledRequestTypeException(request.requestName());
}
throw new UnhandledRequestTypeException(request.requestName());
}
示例10: handle
import com.thoughtworks.go.plugin.api.request.GoPluginApiRequest; //导入方法依赖的package包/类
@Override
public GoPluginApiResponse handle(GoPluginApiRequest goPluginApiRequest) {
String requestName = goPluginApiRequest.requestName();
if (requestName.equals(PLUGIN_CONFIGURATION)) {
return handlePluginConfigurationRequest();
} else if (requestName.equals(SEARCH_USER)) {
return handleSearchUserRequest(goPluginApiRequest);
} else if (requestName.equals(AUTHENTICATE_USER)) {
return handleAuthenticateUserRequest(goPluginApiRequest);
} else if (requestName.equals(WEB_REQUEST_INDEX)) {
return handleSetupLoginWebRequest(goPluginApiRequest);
} else if (requestName.equals(WEB_REQUEST_AUTHENTICATE)) {
return handleAuthenticateWebRequest(goPluginApiRequest);
}
return renderResponse(404, null, null);
}
示例11: handle
import com.thoughtworks.go.plugin.api.request.GoPluginApiRequest; //导入方法依赖的package包/类
@Override
public GoPluginApiResponse handle(GoPluginApiRequest request) throws UnhandledRequestTypeException {
try {
switch (Request.fromString(request.requestName())) {
case REQUEST_GET_CAPABILITIES:
return new GetCapabilitiesExecutor().execute();
case PLUGIN_SETTINGS_GET_ICON:
return new GetPluginSettingsIconExecutor().execute();
case PLUGIN_SETTINGS_GET_CONFIGURATION:
return new GetPluginConfigurationExecutor().execute();
case PLUGIN_SETTINGS_GET_VIEW:
return new GetViewRequestExecutor().execute();
case PLUGIN_SETTINGS_VALIDATE_CONFIGURATION:
return ValidatePluginSettings.fromJSON(request.requestBody()).executor(pluginRequest).execute();
case REQUEST_GET_PROFILE_METADATA:
return new GetProfileMetadataExecutor().execute();
case REQUEST_GET_PROFILE_VIEW:
return new GetProfileViewExecutor().execute();
case REQUEST_VALIDATE_PROFILE:
return ProfileValidateRequest.fromJSON(request.requestBody()).executor().execute();
case REQUEST_CREATE_AGENT:
refreshInstances();
return CreateAgentRequest.fromJSON(request.requestBody()).executor(agentInstances, pluginRequest).execute();
case REQUEST_SHOULD_ASSIGN_WORK:
return ShouldAssignWorkRequest.fromJSON(request.requestBody()).executor(agentInstances).execute();
case REQUEST_SERVER_PING:
refreshInstances();
return new ServerPingRequestExecutor(agentInstances, pluginRequest).execute();
case REQUEST_STATUS_REPORT:
return new StatusReportExecutor(pluginRequest).execute();
default:
throw new UnhandledRequestTypeException(request.requestName());
}
} catch (Exception e) {
LOG.error("Failed to handle request " + request.requestName(), e);
return DefaultGoPluginApiResponse.error("Failed to handle request " + request.requestName());
}
}
示例12: handle
import com.thoughtworks.go.plugin.api.request.GoPluginApiRequest; //导入方法依赖的package包/类
@Override
public GoPluginApiResponse handle(GoPluginApiRequest request) throws UnhandledRequestTypeException {
try {
switch (Request.fromString(request.requestName())) {
case REQUEST_SHOULD_ASSIGN_WORK:
refreshInstances();
return ShouldAssignWorkRequest.fromJSON(request.requestBody()).executor(agentInstances, pluginRequest).execute();
case REQUEST_CREATE_AGENT:
refreshInstances();
return CreateAgentRequest.fromJSON(request.requestBody()).executor(agentInstances, pluginRequest).execute();
case REQUEST_SERVER_PING:
refreshInstances();
return new ServerPingRequestExecutor(agentInstances, pluginRequest).execute();
case PLUGIN_SETTINGS_GET_VIEW:
return new GetViewRequestExecutor().execute();
case REQUEST_GET_PROFILE_METADATA:
return new GetProfileMetadataExecutor().execute();
case REQUEST_GET_PROFILE_VIEW:
return new GetProfileViewExecutor().execute();
case REQUEST_VALIDATE_PROFILE:
return ProfileValidateRequest.fromJSON(request.requestBody()).executor().execute();
case PLUGIN_SETTINGS_GET_ICON:
return new GetPluginSettingsIconExecutor().execute();
case PLUGIN_SETTINGS_GET_CONFIGURATION:
return new GetPluginConfigurationExecutor().execute();
case PLUGIN_SETTINGS_VALIDATE_CONFIGURATION:
return ValidatePluginSettings.fromJSON(request.requestBody()).executor().execute();
default:
throw new UnhandledRequestTypeException(request.requestName());
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例13: handle
import com.thoughtworks.go.plugin.api.request.GoPluginApiRequest; //导入方法依赖的package包/类
@Override
public GoPluginApiResponse handle(GoPluginApiRequest requestMessage) throws UnhandledRequestTypeException {
long startTime = System.currentTimeMillis();
String name = requestMessage.requestName();
String body = requestMessage.requestBody();
logger.debug("got requestName: '" + name + "', with body: " + body);
try {
if (REQUEST_SETTINGS_GET_CONFIG.equals(name)) {
return toJson(handlePluginConfig());
} else if (REQUEST_SETTINGS_GET_VIEW.equals(name)) {
return toJson(handlePluginConfigView());
} else if (REQUEST_SETTINGS_VALIDATE.equals(name)) {
return toJson(handlePluginConfigValidation(body));
} else {
GoPluginApiResponse response = handleApiRequest(name, body);
if (response == null) {
logger.warn("unknown request: " + name);
}
return response;
}
} catch (Exception e) {
return error(name, body, e);
} finally {
long endTime = System.currentTimeMillis();
logger.debug("operation took: " + (endTime - startTime) + " ms");
}
}
示例14: handle
import com.thoughtworks.go.plugin.api.request.GoPluginApiRequest; //导入方法依赖的package包/类
@Override
public GoPluginApiResponse handle(GoPluginApiRequest request) throws UnhandledRequestTypeException {
try {
switch (Request.fromString(request.requestName())) {
case REQUEST_SHOULD_ASSIGN_WORK:
refreshInstances();
return ShouldAssignWorkRequest.fromJSON(request.requestBody()).executor(agentInstances, pluginRequest).execute();
case REQUEST_CREATE_AGENT:
refreshInstances();
return CreateAgentRequest.fromJSON(request.requestBody()).executor(agentInstances, pluginRequest).execute();
case REQUEST_SERVER_PING:
refreshInstances();
return new ServerPingRequestExecutor(agentInstances, pluginRequest).execute();
case REQUEST_GET_PROFILE_VIEW:
return new GetProfileViewExecutor().execute();
case REQUEST_GET_PROFILE_METADATA:
return new GetProfileMetadataExecutor().execute();
case REQUEST_VALIDATE_PROFILE:
return ProfileValidateRequest.fromJSON(request.requestBody()).executor().execute();
case PLUGIN_SETTINGS_GET_VIEW:
return new GetViewRequestExecutor().execute();
case PLUGIN_SETTINGS_GET_CONFIGURATION:
return new GetPluginConfigurationExecutor().execute();
case PLUGIN_SETTINGS_GET_ICON:
return new GetPluginSettingsIconExecutor().execute();
case PLUGIN_SETTINGS_VALIDATE_CONFIGURATION:
return ValidatePluginSettings.fromJSON(request.requestBody()).executor().execute();
default:
throw new UnhandledRequestTypeException(request.requestName());
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例15: dispatch
import com.thoughtworks.go.plugin.api.request.GoPluginApiRequest; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public GoPluginApiResponse dispatch(GoPluginApiRequest request) throws UnhandledRequestTypeException {
// TODO validate the input
final ApiCommand command = commands.get(request.requestName());
if(command == null) {
logger.info("No command found for request: " + request.requestName());
throw new UnhandledRequestTypeException(request.requestName());
}
logger.info("Executing command for request: " + request.requestName());
return command.execute(request);
}