Unverified Commit 1e7582e9 authored by felix-thinkingdata's avatar felix-thinkingdata Committed by GitHub
Browse files

#3176 optimize Gets the value of this property “resource.storage.type”,...


#3176 optimize Gets the value of this property “resource.storage.type”, Comparison with enumerated types (#3178)

* fix bug #3165   get resource.storage.type value   toUpperCase

* fix bug #3176  optimize Gets the value of this property “resource.storage.type”

Co-authored-by: default avatardailidong <dailidong66@gmail.com>
parent 1eb8fb6d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -70,7 +70,7 @@ public class CommonUtils {
   * @return true if upload resource is HDFS and kerberos startup
   */
  public static boolean getKerberosStartupState(){
    String resUploadStartupType = PropertyUtils.getString(Constants.RESOURCE_STORAGE_TYPE);
    String resUploadStartupType = PropertyUtils.getUpperCaseString(Constants.RESOURCE_STORAGE_TYPE);
    ResUploadType resUploadType = ResUploadType.valueOf(resUploadStartupType);
    Boolean kerberosStartupState = PropertyUtils.getBoolean(Constants.HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE,false);
    return resUploadType == ResUploadType.HDFS && kerberosStartupState;
+1 −1
Original line number Diff line number Diff line
@@ -110,7 +110,7 @@ public class HadoopUtils implements Closeable {
        try {
            configuration = new Configuration();

            String resourceStorageType = PropertyUtils.getString(Constants.RESOURCE_STORAGE_TYPE);
            String resourceStorageType = PropertyUtils.getUpperCaseString(Constants.RESOURCE_STORAGE_TYPE);
            ResUploadType resUploadType = ResUploadType.valueOf(resourceStorageType);

            if (resUploadType == ResUploadType.HDFS) {
+11 −1
Original line number Diff line number Diff line
@@ -72,7 +72,7 @@ public class PropertyUtils {
     * @return  judge whether resource upload startup
     */
    public static Boolean getResUploadStartupState(){
        String resUploadStartupType = PropertyUtils.getString(Constants.RESOURCE_STORAGE_TYPE).toUpperCase();
        String resUploadStartupType = PropertyUtils.getUpperCaseString(Constants.RESOURCE_STORAGE_TYPE);
        ResUploadType resUploadType = ResUploadType.valueOf(resUploadStartupType);
        return resUploadType == ResUploadType.HDFS || resUploadType == ResUploadType.S3;
    }
@@ -87,6 +87,16 @@ public class PropertyUtils {
        return properties.getProperty(key.trim());
    }

    /**
     * get property value with upper case
     *
     * @param key property name
     * @return property value  with upper case
     */
    public static String getUpperCaseString(String key) {
        return properties.getProperty(key.trim()).toUpperCase();
    }

    /**
     * get property value
     *