Java 类com.liferay.portal.kernel.util.ReleaseInfo 实例源码

项目:staging-checker    文件:RemoteConfigurationUtil.java   
@SuppressWarnings("unchecked")
private static Map<String, Object> readConfiguration(
        String configurationURL) {

    Map<String, Object> tempConfiguration;

    try {
        String configurationContent = HttpUtil.URLtoString(
            configurationURL);

        Yaml yaml = new Yaml();

        tempConfiguration = (Map<String, Object>)yaml.load(
            configurationContent);
    }
    catch (Exception e) {
        _log.error(e, e);

        tempConfiguration =
            (Map<String, Object>)ConfigurationUtil.getConfigurationEntry(
                "remoteConfigurationBackup");
    }

    if (Validator.isNull(tempConfiguration)) {
        return Collections.emptyMap();
    }

    int liferayBuildNumber = ReleaseInfo.getBuildNumber();

    if (tempConfiguration.containsKey(liferayBuildNumber)) {
        return (Map<String, Object>)tempConfiguration.get(
            liferayBuildNumber);
    }

    int liferayVersion = liferayBuildNumber / 100;

    if (tempConfiguration.containsKey(liferayVersion)) {
        return (Map<String, Object>)tempConfiguration.get(liferayVersion);
    }

    return Collections.emptyMap();
}
项目:index-checker    文件:RemoteConfigurationUtil.java   
@SuppressWarnings("unchecked")
private static Map<String, Object> readConfiguration(
        String configurationURL) {

    Map<String, Object> tempConfiguration;

    try {
        String configurationContent = HttpUtil.URLtoString(
            configurationURL);

        Yaml yaml = new Yaml();

        tempConfiguration = (Map<String, Object>)yaml.load(
            configurationContent);
    }
    catch (Exception e) {
        _log.error(e, e);

        tempConfiguration =
            (Map<String, Object>)ConfigurationUtil.getConfigurationEntry(
                "remoteConfigurationBackup");
    }

    if (Validator.isNull(tempConfiguration)) {
        return Collections.emptyMap();
    }

    int liferayBuildNumber = ReleaseInfo.getBuildNumber();

    if (tempConfiguration.containsKey(liferayBuildNumber)) {
        return (Map<String, Object>)tempConfiguration.get(
            liferayBuildNumber);
    }

    int liferayVersion = liferayBuildNumber / 100;

    if (tempConfiguration.containsKey(liferayVersion)) {
        return (Map<String, Object>)tempConfiguration.get(liferayVersion);
    }

    return Collections.emptyMap();
}