com.akaxin.proto.core.ConfigProto Java Examples

The following examples show how to use com.akaxin.proto.core.ConfigProto. 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 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 #2
Source File: ConfigHelper.java    From openzaly with Apache License 2.0 6 votes vote down vote up
public static Map<Integer, String> getConfigMap() {
	Map<Integer, String> configMap = new HashMap<Integer, String>();
	configMap.put(ConfigProto.ConfigKey.SITE_VERSION_VALUE, getStringConfig(SITE_VERSION));
	configMap.put(ConfigProto.ConfigKey.SITE_ADDRESS_VALUE, getStringConfig(SITE_ADDRESS));
	configMap.put(ConfigProto.ConfigKey.SITE_PORT_VALUE, getStringConfig(SITE_PORT));
	// 扩展的http功能接口
	configMap.put(ConfigProto.ConfigKey.SITE_HTTP_ADDRESS_VALUE, getStringConfig(PLUGIN_API_ADDRESS));
	configMap.put(ConfigProto.ConfigKey.SITE_HTTP_PORT_VALUE, getStringConfig(PLUGIN_API_PORT));
	String basePath = System.getProperty("user.dir");
	configMap.put(ConfigProto.ConfigKey.PIC_PATH_VALUE, basePath);// 存放资源的位置
	configMap.put(ConfigProto.ConfigKey.DB_PATH_VALUE, basePath);
	// 默认100人
	configMap.put(ConfigProto.ConfigKey.GROUP_MEMBERS_COUNT_VALUE, "100");
	// 默认二人绝密聊天状态:开启二人绝密聊天功能
	configMap.put(ConfigProto.ConfigKey.U2_ENCRYPTION_STATUS_VALUE,
			ConfigProto.U2EncryptionConfig.U2_OPEN_VALUE + "");
	// 默认匿名
	configMap.put(ConfigProto.ConfigKey.REALNAME_STATUS_VALUE, ConfigProto.RealNameConfig.REALNAME_NO_VALUE + "");
	// 默认开启邀请码
	configMap.put(ConfigProto.ConfigKey.INVITE_CODE_STATUS_VALUE, ConfigProto.InviteCodeConfig.UIC_YES_VALUE + "");
	// 默认Push状态:不显示push内容
	configMap.put(ConfigProto.ConfigKey.PUSH_CLIENT_STATUS_VALUE,
			String.valueOf(ConfigProto.PushClientStatus.PUSH_HIDDEN_TEXT_VALUE));
	return configMap;
}
 
Example #3
Source File: ConfigHelper.java    From openzaly with Apache License 2.0 6 votes vote down vote up
public static Map<Integer, String> getConfigMap() {
	Map<Integer, String> configMap = new HashMap<Integer, String>();
	configMap.put(ConfigProto.ConfigKey.SITE_VERSION_VALUE, getStringConfig(SITE_VERSION));
	configMap.put(ConfigProto.ConfigKey.SITE_ADDRESS_VALUE, getStringConfig(SITE_ADDRESS));
	configMap.put(ConfigProto.ConfigKey.SITE_PORT_VALUE, getStringConfig(SITE_PORT));
	// 扩展的http功能接口
	configMap.put(ConfigProto.ConfigKey.SITE_HTTP_ADDRESS_VALUE, getStringConfig(PLUGIN_API_ADDRESS));
	configMap.put(ConfigProto.ConfigKey.SITE_HTTP_PORT_VALUE, getStringConfig(PLUGIN_API_PORT));
	String basePath = System.getProperty("user.dir");
	configMap.put(ConfigProto.ConfigKey.PIC_PATH_VALUE, basePath);// 存放资源的位置
	configMap.put(ConfigProto.ConfigKey.DB_PATH_VALUE, basePath);
	// 默认100人
	configMap.put(ConfigProto.ConfigKey.GROUP_MEMBERS_COUNT_VALUE, "100");
	// 默认二人绝密聊天状态:开启二人绝密聊天功能
	configMap.put(ConfigProto.ConfigKey.U2_ENCRYPTION_STATUS_VALUE,
			ConfigProto.U2EncryptionConfig.U2_OPEN_VALUE + "");
	// 默认匿名
	configMap.put(ConfigProto.ConfigKey.REALNAME_STATUS_VALUE, ConfigProto.RealNameConfig.REALNAME_NO_VALUE + "");
	// 默认开启邀请码
	configMap.put(ConfigProto.ConfigKey.INVITE_CODE_STATUS_VALUE, ConfigProto.InviteCodeConfig.UIC_YES_VALUE + "");
	// 默认Push状态:不显示push内容
	configMap.put(ConfigProto.ConfigKey.PUSH_CLIENT_STATUS_VALUE,
			String.valueOf(ConfigProto.PushClientStatus.PUSH_HIDDEN_TEXT_VALUE));
	return configMap;
}
 
Example #4
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 #5
Source File: ConfigHelper.java    From wind-im with Apache License 2.0 6 votes vote down vote up
public static Map<Integer, String> getConfigMap() {
	Map<Integer, String> configMap = new HashMap<Integer, String>();
	configMap.put(ConfigProto.ConfigKey.SITE_VERSION_VALUE, getStringConfig(SITE_VERSION));
	configMap.put(ConfigProto.ConfigKey.SITE_ADDRESS_VALUE, getStringConfig(SITE_ADDRESS));
	configMap.put(ConfigProto.ConfigKey.SITE_PORT_VALUE, getStringConfig(SITE_PORT));
	// 扩展的http功能接口
	configMap.put(ConfigProto.ConfigKey.SITE_HTTP_ADDRESS_VALUE, getStringConfig(PLUGIN_API_ADDRESS));
	configMap.put(ConfigProto.ConfigKey.SITE_HTTP_PORT_VALUE, getStringConfig(PLUGIN_API_PORT));
	String basePath = System.getProperty("user.dir");
	configMap.put(ConfigProto.ConfigKey.PIC_PATH_VALUE, basePath);// 存放资源的位置
	configMap.put(ConfigProto.ConfigKey.DB_PATH_VALUE, basePath);
	// 默认100人
	configMap.put(ConfigProto.ConfigKey.GROUP_MEMBERS_COUNT_VALUE, "100");
	// 默认二人绝密聊天状态:开启二人绝密聊天功能
	configMap.put(ConfigProto.ConfigKey.U2_ENCRYPTION_STATUS_VALUE,
			ConfigProto.U2EncryptionConfig.U2_OPEN_VALUE + "");
	// 默认匿名
	configMap.put(ConfigProto.ConfigKey.REALNAME_STATUS_VALUE, ConfigProto.RealNameConfig.REALNAME_NO_VALUE + "");
	// 默认开启邀请码
	configMap.put(ConfigProto.ConfigKey.INVITE_CODE_STATUS_VALUE, ConfigProto.InviteCodeConfig.UIC_YES_VALUE + "");
	// 默认Push状态:不显示push内容
	configMap.put(ConfigProto.ConfigKey.PUSH_CLIENT_STATUS_VALUE,
			String.valueOf(ConfigProto.PushClientStatus.PUSH_HIDDEN_TEXT_VALUE));
	return configMap;
}
 
Example #6
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 #7
Source File: SiteConfig.java    From openzaly with Apache License 2.0 5 votes vote down vote up
/**
 * 获取超级管理员
 * 
 * @return
 */
public static String getSiteSuperAdmin() {
	if (getConfigMap() != null) {
		String siteAdmin = getConfigMap().get(ConfigProto.ConfigKey.SITE_ADMIN_VALUE);
		return siteAdmin;
	}
	return null;
}
 
Example #8
Source File: SiteConfig.java    From openzaly with Apache License 2.0 5 votes vote down vote up
/**
 * <pre>
 * 站点是否关闭,关闭的站点,用户不能注册以及登陆功能
 * 		1.siteStatus=0,站点关闭
 * 		2.siteStatus=1,站点开启
 * </pre>
 * 
 * @return true/false
 */
public static boolean isOpen() {
	if (getConfigMap() != null) {
		String value = getConfigMap().get(ConfigProto.ConfigKey.SITE_STATUS_VALUE);

		if (StringUtils.isNumeric(value)) {
			return ConfigProto.SiteStatusConfig.OPEN_VALUE == Integer.valueOf(value);
		}
	}
	return false;
}
 
Example #9
Source File: ApiSiteService.java    From openzaly with Apache License 2.0 5 votes vote down vote up
private void justForAdminUser(String siteUserId, Map<Integer, String> header) {
	try {
		// 如果站点没有管理员
		if (SiteConfig.hasNoAdminUser()) {
			logger.debug("user first time to register site server ,set it as admin:{} map:{}", siteUserId, header);
			SiteConfigDao.getInstance().updateSiteConfig(ConfigProto.ConfigKey.SITE_ADMIN_VALUE, siteUserId);
			if (header != null) {
				String host = header.get(CoreProto.HeaderKey.CLIENT_REQUEST_SERVER_HOST_VALUE);
				if (StringUtils.isNotEmpty(host)) {
					SiteConfigDao.getInstance().updateSiteConfig(ConfigProto.ConfigKey.SITE_ADDRESS_VALUE, host);
					SiteConfigDao.getInstance().updateSiteConfig(ConfigProto.ConfigKey.SITE_NAME_VALUE, host);
				}
				String port = header.get(CoreProto.HeaderKey.CLIENT_REQUEST_SERVER_HOST_VALUE);
				if (StringUtils.isNotBlank(port)) {
					port = "" + DEFAULT_PORT;
					SiteConfigDao.getInstance().updateSiteConfig(ConfigProto.ConfigKey.SITE_PORT_VALUE, port);
				}
				// 修改邀请码注册方式
				SiteConfigDao.getInstance().updateSiteConfig(ConfigProto.ConfigKey.INVITE_CODE_STATUS_VALUE,
						ConfigProto.InviteCodeConfig.UIC_NO_VALUE + "");
			}
			SiteConfig.updateConfig();
		}
	} catch (Exception e) {
		logger.error("set site admin error", e);
	}
}
 
Example #10
Source File: SiteConfig.java    From openzaly with Apache License 2.0 5 votes vote down vote up
public static String getSiteLogo() {
	try {
		Map<Integer, String> map = getConfigMap();
		if (map != null) {
			return map.get(ConfigProto.ConfigKey.SITE_LOGO_VALUE);
		}
	} catch (Exception e) {
		logger.error("get site logo error", e);
	}
	return null;
}
 
Example #11
Source File: SiteConfig.java    From openzaly with Apache License 2.0 5 votes vote down vote up
public static ConfigProto.U2EncryptionConfig getU2EncryStatusConfig() {
	try {
		Map<Integer, String> map = getConfigMap();
		if (map != null) {
			String statusNum = map.get(ConfigProto.ConfigKey.U2_ENCRYPTION_STATUS_VALUE);
			if (StringUtils.isNumeric(statusNum)) {
				return ConfigProto.U2EncryptionConfig.forNumber(Integer.valueOf(statusNum));
			}
		}
	} catch (Exception e) {
		logger.error("get u2 encry status error", e);
	}
	return ConfigProto.U2EncryptionConfig.U2_CLOSE;
}
 
Example #12
Source File: SiteConfig.java    From openzaly with Apache License 2.0 5 votes vote down vote up
public static int getMaxGroupMemberSize() {
	try {
		Map<Integer, String> map = getConfigMap();
		if (map != null) {
			String memberCount = map.get(ConfigProto.ConfigKey.GROUP_MEMBERS_COUNT_VALUE);
			if (StringUtils.isNumeric(memberCount)) {
				return Integer.valueOf(memberCount);
			}
		}
	} catch (Exception e) {
		logger.error("get max group member size error.", e);
	}
	return GroupConfig.GROUP_MAX_MEMBER_COUNT;
}
 
Example #13
Source File: SiteConfig.java    From openzaly with Apache License 2.0 5 votes vote down vote up
/**
 * <pre>
 * 1天
 * 7天
 * 14天
 * </pre>
 * 
 * @return
 */
public static int getGroupQRExpireDay() {
	int expireDay = 14;
	Map<Integer, String> map = getConfigMap();
	if (map != null) {
		String value = map.get(ConfigProto.ConfigKey.GROUP_QR_EXPIRE_TIME_VALUE);
		if (NumberUtils.isDigits(value)) {
			int day = Integer.valueOf(value);
			if (day == 1 || day == 7 || day == 14) {
				return day;
			}
		}
	}
	return expireDay;
}
 
Example #14
Source File: SiteConfig.java    From openzaly with Apache License 2.0 5 votes vote down vote up
public static String getSiteAddress() {
	if (getConfigMap() != null) {
		String siteHost = getConfigMap().get(ConfigProto.ConfigKey.SITE_ADDRESS_VALUE);
		String sitePort = getConfigMap().get(ConfigProto.ConfigKey.SITE_PORT_VALUE);
		return siteHost + ":" + sitePort;
	}
	return null;
}
 
Example #15
Source File: SiteConfig.java    From openzaly with Apache License 2.0 5 votes vote down vote up
public static ConfigProto.InviteCodeConfig getUICConfig() {
	ConfigProto.InviteCodeConfig uicConfig = null;
	if (getConfigMap() != null) {
		String value = getConfigMap().get(ConfigProto.ConfigKey.INVITE_CODE_STATUS_VALUE);
		if (StringUtils.isNumeric(value)) {
			uicConfig = ConfigProto.InviteCodeConfig.forNumber(Integer.valueOf(value));
		}
	}
	return uicConfig == null ? ConfigProto.InviteCodeConfig.UIC_NO : uicConfig;
}
 
Example #16
Source File: SiteConfig.java    From openzaly with Apache License 2.0 5 votes vote down vote up
public static ConfigProto.RealNameConfig getRealNameConfig() {
	ConfigProto.RealNameConfig realNameConfig = null;
	if (getConfigMap() != null) {
		String value = getConfigMap().get(ConfigProto.ConfigKey.REALNAME_STATUS_VALUE);
		if (StringUtils.isNumeric(value)) {
			realNameConfig = ConfigProto.RealNameConfig.forNumber(Integer.valueOf(value));
		}
	}
	return realNameConfig == null ? ConfigProto.RealNameConfig.REALNAME_NO : realNameConfig;
}
 
Example #17
Source File: ConfigListener.java    From openzaly with Apache License 2.0 5 votes vote down vote up
private static Logger getLogger() {
	String currentPath = SiteConfigHelper.getConfig(ConfigProto.ConfigKey.DB_PATH);
	if (logger == null || !currentPath.equals(logPath)) {
		logPath = currentPath;
		logger = LogCreater.createTimeLogger("config", currentPath + "/site-logs");
	}

	return logger;
}
 
Example #18
Source File: PrepareSiteConfigData.java    From openzaly with Apache License 2.0 5 votes vote down vote up
private static void initSiteConfig(Map<Integer, String> configMap) throws SQLException {
	Map<Integer, String> oldMap = SiteConfigDao.getInstance().queryConfig();
	if (oldMap != null) {
		if (oldMap.get(ConfigProto.ConfigKey.SITE_ADMIN_VALUE) != null) {
			configMap.remove(ConfigProto.ConfigKey.SITE_ADMIN_VALUE);
		}
		if (oldMap.get(ConfigProto.ConfigKey.SITE_ADDRESS_VALUE) != null) {
			configMap.remove(ConfigProto.ConfigKey.SITE_ADDRESS_VALUE);
		}
		if (oldMap.get(ConfigProto.ConfigKey.PIC_PATH_VALUE) != null) {
			configMap.remove(ConfigProto.ConfigKey.PIC_PATH_VALUE);
		}
		if (oldMap.get(ConfigProto.ConfigKey.GROUP_MEMBERS_COUNT_VALUE) != null) {
			configMap.remove(ConfigProto.ConfigKey.GROUP_MEMBERS_COUNT_VALUE);
		}
		if (oldMap.get(ConfigProto.ConfigKey.REALNAME_STATUS_VALUE) != null) {
			configMap.remove(ConfigProto.ConfigKey.REALNAME_STATUS_VALUE);
		}
		if (oldMap.get(ConfigProto.ConfigKey.INVITE_CODE_STATUS_VALUE) != null) {
			configMap.remove(ConfigProto.ConfigKey.INVITE_CODE_STATUS_VALUE);
		}
		if (oldMap.get(ConfigProto.ConfigKey.PUSH_CLIENT_STATUS_VALUE) != null) {
			configMap.remove(ConfigProto.ConfigKey.PUSH_CLIENT_STATUS_VALUE);
		}
	}
	SiteConfigDao.getInstance().updateConfig(configMap, true);
}
 
Example #19
Source File: ApiSiteService.java    From openzaly with Apache License 2.0 5 votes vote down vote up
private void justForAdminUser(String siteUserId, Map<Integer, String> header) {
	try {
		// 如果站点没有管理员
		if (SiteConfig.hasNoAdminUser()) {
			logger.debug("user first time to register site server ,set it as admin:{} map:{}", siteUserId, header);
			SiteConfigDao.getInstance().updateSiteConfig(ConfigProto.ConfigKey.SITE_ADMIN_VALUE, siteUserId);
			if (header != null) {
				String host = header.get(CoreProto.HeaderKey.CLIENT_REQUEST_SERVER_HOST_VALUE);
				if (StringUtils.isNotEmpty(host)) {
					SiteConfigDao.getInstance().updateSiteConfig(ConfigProto.ConfigKey.SITE_ADDRESS_VALUE, host);
					SiteConfigDao.getInstance().updateSiteConfig(ConfigProto.ConfigKey.SITE_NAME_VALUE, host);
				}
				String port = header.get(CoreProto.HeaderKey.CLIENT_REQUEST_SERVER_HOST_VALUE);
				if (StringUtils.isNotBlank(port)) {
					port = "" + DEFAULT_PORT;
					SiteConfigDao.getInstance().updateSiteConfig(ConfigProto.ConfigKey.SITE_PORT_VALUE, port);
				}
				// 修改邀请码注册方式
				SiteConfigDao.getInstance().updateSiteConfig(ConfigProto.ConfigKey.INVITE_CODE_STATUS_VALUE,
						ConfigProto.InviteCodeConfig.UIC_NO_VALUE + "");
			}
			SiteConfig.updateConfig();
		}
	} catch (Exception e) {
		logger.error("set site admin error", e);
	}
}
 
Example #20
Source File: SiteConfigHelper.java    From openzaly with Apache License 2.0 5 votes vote down vote up
/**
 * <pre>
 * 站点发送PUSH的状态值
 * 		PUSH_NO
 * 		PUSH_HIDDEN_TEXT
 * 		PUSH_HIDDEN_TEXT
 * 
 * </pre>
 * 
 * @return
 */
public static ConfigProto.PushClientStatus getPushClientStatus() {
	try {
		String status = getConfig(ConfigProto.ConfigKey.PUSH_CLIENT_STATUS);
		if (status != null) {
			return ConfigProto.PushClientStatus.forNumber(Integer.valueOf(status));
		}
	} catch (Exception e) {
		logger.error("get push client status error.", e);
	}
	return ConfigProto.PushClientStatus.PUSH_HIDDEN_TEXT;
}
 
Example #21
Source File: SiteConfig.java    From openzaly with Apache License 2.0 5 votes vote down vote up
public static boolean allowCreateGroups(String siteUserId) {
	if (isSiteManager(siteUserId)) {
		return true;
	}

	Map<Integer, String> map = getConfigMap();
	if (map != null) {
		String value = map.get(ConfigProto.ConfigKey.CONFIG_CREATE_GROUP_VALUE);
		return !String.valueOf(ConfigProto.ConfigCreateGroup.ConfigCreateGroup_NO_VALUE).equals(value);
	}
	return true;
}
 
Example #22
Source File: SiteConfig.java    From openzaly with Apache License 2.0 5 votes vote down vote up
public static boolean allowAddFriends(String siteUserId) {
	if (isSiteManager(siteUserId)) {
		return true;
	}
	Map<Integer, String> map = getConfigMap();
	if (map != null) {
		String value = map.get(ConfigProto.ConfigKey.CONFIG_FRIEND_REQUEST_VALUE);
		return !String.valueOf(ConfigProto.ConfigFriendRequest.ConfigFriendRequest_NO_VALUE).equals(value);
	}
	return true;
}
 
Example #23
Source File: SiteConfig.java    From openzaly with Apache License 2.0 5 votes vote down vote up
public static ConfigProto.U2EncryptionConfig getU2EncryStatusConfig() {
	try {
		Map<Integer, String> map = getConfigMap();
		if (map != null) {
			String statusNum = map.get(ConfigProto.ConfigKey.U2_ENCRYPTION_STATUS_VALUE);
			if (StringUtils.isNumeric(statusNum)) {
				return ConfigProto.U2EncryptionConfig.forNumber(Integer.valueOf(statusNum));
			}
		}
	} catch (Exception e) {
		logger.error("get u2 encry status error", e);
	}
	return ConfigProto.U2EncryptionConfig.U2_CLOSE;
}
 
Example #24
Source File: SiteConfig.java    From openzaly with Apache License 2.0 5 votes vote down vote up
public static int getMaxGroupMemberSize() {
	try {
		Map<Integer, String> map = getConfigMap();
		if (map != null) {
			String memberCount = map.get(ConfigProto.ConfigKey.GROUP_MEMBERS_COUNT_VALUE);
			if (StringUtils.isNumeric(memberCount)) {
				return Integer.valueOf(memberCount);
			}
		}
	} catch (Exception e) {
		logger.error("get max group member size error.", e);
	}
	return GroupConfig.GROUP_MAX_MEMBER_COUNT;
}
 
Example #25
Source File: SiteConfig.java    From openzaly with Apache License 2.0 5 votes vote down vote up
/**
 * 获取超级管理员
 * 
 * @return
 */
public static String getSiteSuperAdmin() {
	if (getConfigMap() != null) {
		String siteAdmin = getConfigMap().get(ConfigProto.ConfigKey.SITE_ADMIN_VALUE);
		return siteAdmin;
	}
	return null;
}
 
Example #26
Source File: SiteConfig.java    From openzaly with Apache License 2.0 5 votes vote down vote up
public static String getSiteAddress() {
	if (getConfigMap() != null) {
		String siteHost = getConfigMap().get(ConfigProto.ConfigKey.SITE_ADDRESS_VALUE);
		String sitePort = getConfigMap().get(ConfigProto.ConfigKey.SITE_PORT_VALUE);
		return siteHost + ":" + sitePort;
	}
	return null;
}
 
Example #27
Source File: SiteConfig.java    From openzaly with Apache License 2.0 5 votes vote down vote up
public static ConfigProto.InviteCodeConfig getUICConfig() {
	ConfigProto.InviteCodeConfig uicConfig = null;
	if (getConfigMap() != null) {
		String value = getConfigMap().get(ConfigProto.ConfigKey.INVITE_CODE_STATUS_VALUE);
		if (StringUtils.isNumeric(value)) {
			uicConfig = ConfigProto.InviteCodeConfig.forNumber(Integer.valueOf(value));
		}
	}
	return uicConfig == null ? ConfigProto.InviteCodeConfig.UIC_NO : uicConfig;
}
 
Example #28
Source File: SiteConfig.java    From openzaly with Apache License 2.0 5 votes vote down vote up
/**
 * <pre>
 * 站点是否关闭,关闭的站点,用户不能注册以及登陆功能
 * 		1.siteStatus=0,站点关闭
 * 		2.siteStatus=1,站点开启
 * </pre>
 * 
 * @return true/false
 */
public static boolean isOpen() {
	if (getConfigMap() != null) {
		String value = getConfigMap().get(ConfigProto.ConfigKey.SITE_STATUS_VALUE);

		if (StringUtils.isNumeric(value)) {
			return ConfigProto.SiteStatusConfig.OPEN_VALUE == Integer.valueOf(value);
		}
	}
	return false;
}
 
Example #29
Source File: SiteConfig.java    From openzaly with Apache License 2.0 5 votes vote down vote up
private static void updateCacheUserDefaultGroupSet() {
	String userGroups = getConfigMap().get(ConfigProto.ConfigKey.DEFAULT_USER_GROUPS_VALUE);
	if (StringUtils.isNotEmpty(userGroups)) {
		String[] groups = userGroups.split(",");
		List<String> groupList = Arrays.asList(groups);
		userDefaultGroupSet = new HashSet<String>(groupList);
		logger.info("update user default groups={}", userDefaultGroupSet);
	}
}
 
Example #30
Source File: SiteConfig.java    From openzaly with Apache License 2.0 5 votes vote down vote up
private static void updateCacheSiteManagerSet() {
	String siteManageUsers = getConfigMap().get(ConfigProto.ConfigKey.SITE_MANAGER_VALUE);
	if (StringUtils.isNotEmpty(siteManageUsers)) {
		String[] adminUsers = siteManageUsers.split(",");
		List<String> managerList = Arrays.asList(adminUsers);
		siteManagerSet = new HashSet<String>(managerList);
		logger.info("update new site managers={}", siteManagerSet);
	}
}