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


Java GoPluginApiRequest.requestName方法代码示例

本文整理汇总了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());
}
 
开发者ID:tomzo,项目名称:gocd-yaml-config-plugin,代码行数:20,代码来源:YamlConfigPlugin.java

示例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);
    }
}
 
开发者ID:gocd-contrib,项目名称:notification-skeleton-plugin,代码行数:22,代码来源:ExamplePlugin.java

示例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);
}
 
开发者ID:gocd-contrib,项目名称:gocd-oauth-login,代码行数:26,代码来源:OAuthLoginPlugin.java

示例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());
    }
}
 
开发者ID:Haufe-Lexware,项目名称:gocd-plugins,代码行数:23,代码来源:BaseGoPlugin.java

示例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());
    }
}
 
开发者ID:Haufe-Lexware,项目名称:gocd-plugins,代码行数:19,代码来源:NessusScanTask.java

示例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);
}
 
开发者ID:gocd-contrib,项目名称:email-notifier,代码行数:21,代码来源:EmailNotificationPluginImpl.java

示例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);
    }
}
 
开发者ID:gocd-contrib,项目名称:gitter-notifier,代码行数:22,代码来源:GitterNotifierPlugin.java

示例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());
}
 
开发者ID:tispr,项目名称:gocd-opsworks-plugin,代码行数:19,代码来源:GoPluginBase.java

示例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());
}
 
开发者ID:tsathishkumar,项目名称:gocd-git-release-tagger,代码行数:19,代码来源:ReleaseTaggerTask.java

示例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);
}
 
开发者ID:gocd,项目名称:go-plugins,代码行数:17,代码来源:SampleAuthenticationPluginImpl.java

示例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());
    }
}
 
开发者ID:gocd,项目名称:kubernetes-elastic-agents,代码行数:39,代码来源:KubernetesPlugin.java

示例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);
    }
}
 
开发者ID:pikselpalette,项目名称:gocd-elastic-agent-marathon,代码行数:35,代码来源:MarathonPlugin.java

示例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");
	}
}
 
开发者ID:cnenning,项目名称:go-artifactory-scm-plugin,代码行数:28,代码来源:AbstractArtifactoryPlugin.java

示例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);
    }
}
 
开发者ID:gocd-contrib,项目名称:openstack-elastic-agent,代码行数:35,代码来源:OpenStackPlugin.java

示例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);
}
 
开发者ID:jmnarloch,项目名称:gocd-task-plugin-api,代码行数:17,代码来源:ApiRequestDispatcherBuilder.java


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