com.akaxin.proto.plugin.HaiSiteGetConfigProto Java Examples

The following examples show how to use com.akaxin.proto.plugin.HaiSiteGetConfigProto. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HttpSiteService.java    From wind-im with Apache License 2.0 6 votes vote down vote up
/**
 * 获取站点配置信息
 * 
 * @param command
 * @return
 */
public CommandResponse getConfig(Command command) {
	CommandResponse commandResponse = new CommandResponse();
	ErrorCode2 errorCode = ErrorCode2.ERROR;
	try {
		Map<Integer, String> configMap = SiteConfig.getConfigMap();
		LogUtils.requestDebugLog(logger, command, "");
		logger.info("get config map = {}", configMap);

		ConfigProto.SiteBackConfig config = ConfigProto.SiteBackConfig.newBuilder().putAllSiteConfig(configMap)
				.build();
		HaiSiteGetConfigProto.HaiSiteGetConfigResponse response = HaiSiteGetConfigProto.HaiSiteGetConfigResponse
				.newBuilder().setSiteConfig(config).build();
		logger.info("get config service  response={}", response.toString());
		commandResponse.setParams(response.toByteArray());
		errorCode = ErrorCode2.SUCCESS;
	} catch (Exception e) {
		errorCode = ErrorCode2.ERROR_SYSTEMERROR;
		LogUtils.requestErrorLog(logger, command, e);
	}
	return commandResponse.setErrCode2(errorCode);
}
 
Example #2
Source File: HttpSiteService.java    From openzaly with Apache License 2.0 6 votes vote down vote up
/**
 * 获取站点配置信息
 * 
 * @param command
 * @return
 */
public CommandResponse getConfig(Command command) {
	CommandResponse commandResponse = new CommandResponse();
	ErrorCode2 errorCode = ErrorCode2.ERROR;
	try {
		Map<Integer, String> configMap = SiteConfig.getConfigMap();
		LogUtils.requestDebugLog(logger, command, "");
		logger.info("get config map = {}", configMap);

		ConfigProto.SiteBackConfig config = ConfigProto.SiteBackConfig.newBuilder().putAllSiteConfig(configMap)
				.build();
		HaiSiteGetConfigProto.HaiSiteGetConfigResponse response = HaiSiteGetConfigProto.HaiSiteGetConfigResponse
				.newBuilder().setSiteConfig(config).build();
		logger.info("get config service  response={}", response.toString());
		commandResponse.setParams(response.toByteArray());
		errorCode = ErrorCode2.SUCCESS;
	} catch (Exception e) {
		errorCode = ErrorCode2.ERROR_SYSTEMERROR;
		LogUtils.requestErrorLog(logger, command, e);
	}
	return commandResponse.setErrCode2(errorCode);
}
 
Example #3
Source File: HttpSiteService.java    From openzaly with Apache License 2.0 6 votes vote down vote up
/**
 * 获取站点配置信息
 * 
 * @param command
 * @return
 */
public CommandResponse getConfig(Command command) {
	CommandResponse commandResponse = new CommandResponse();
	ErrorCode2 errorCode = ErrorCode2.ERROR;
	try {
		Map<Integer, String> configMap = SiteConfig.getConfigMap();
		LogUtils.requestDebugLog(logger, command, "");
		logger.info("get config map = {}", configMap);

		ConfigProto.SiteBackConfig config = ConfigProto.SiteBackConfig.newBuilder().putAllSiteConfig(configMap)
				.build();
		HaiSiteGetConfigProto.HaiSiteGetConfigResponse response = HaiSiteGetConfigProto.HaiSiteGetConfigResponse
				.newBuilder().setSiteConfig(config).build();
		logger.info("get config service  response={}", response.toString());
		commandResponse.setParams(response.toByteArray());
		errorCode = ErrorCode2.SUCCESS;
	} catch (Exception e) {
		errorCode = ErrorCode2.ERROR_SYSTEMERROR;
		LogUtils.requestErrorLog(logger, command, e);
	}
	return commandResponse.setErrCode2(errorCode);
}