#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: dailidong <dailidong66@gmail.com>
This commit is contained in:
parent
1eb8fb6db3
commit
1e7582e910
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue