public class MetastoreConf extends Object
Configuration.get(String) and Configuration.set(String, String). All
the methods of this class will handle checking both the MetastoreConf key and the Hive key. The
algorithm is, on reads, to check first the MetastoreConf key, then the Hive key, then return the
default if neither are set. On write the Metastore key only is set.
This class does not extend Configuration. Rather it provides static methods for operating on a Configuration object. This allows it to work on HiveConf objects, which otherwise would not be the case.
| Modifier and Type | Class and Description |
|---|---|
static class |
MetastoreConf.ConfVars |
| Modifier and Type | Field and Description |
|---|---|
static MetastoreConf.ConfVars[] |
metaVars
Metastore related options that the db is initialized against.
|
| Modifier and Type | Method and Description |
|---|---|
static long |
convertTimeStr(String val,
TimeUnit defaultUnit,
TimeUnit outUnit) |
static String |
get(org.apache.hadoop.conf.Configuration conf,
String key)
Get the configuration value based on a string rather than a ConfVar.
|
static String |
getAsString(org.apache.hadoop.conf.Configuration conf,
MetastoreConf.ConfVars var)
Return the configuration value as a String.
|
static boolean |
getBoolVar(org.apache.hadoop.conf.Configuration conf,
MetastoreConf.ConfVars var)
Get the variable as a boolean
|
static <I> Class<? extends I> |
getClass(org.apache.hadoop.conf.Configuration conf,
MetastoreConf.ConfVars var,
Class<? extends I> defaultValue,
Class<I> xface)
Get a class instance based on a configuration value
|
static double |
getDoubleVar(org.apache.hadoop.conf.Configuration conf,
MetastoreConf.ConfVars var)
Get the variable as a double
|
static URL |
getHiveDefaultLocation() |
static URL |
getHiveMetastoreSiteURL() |
static URL |
getHiveSiteLocation() |
static int |
getIntVar(org.apache.hadoop.conf.Configuration conf,
MetastoreConf.ConfVars var)
Get the variable as a int.
|
static long |
getLongVar(org.apache.hadoop.conf.Configuration conf,
MetastoreConf.ConfVars var)
Get the variable as a long
|
static MetastoreConf.ConfVars |
getMetaConf(String name) |
static URL |
getMetastoreSiteURL() |
static String |
getPassword(org.apache.hadoop.conf.Configuration conf,
MetastoreConf.ConfVars var)
Get a password from the configuration file.
|
List<URL> |
getResourceFileLocations() |
static long |
getSizeVar(org.apache.hadoop.conf.Configuration conf,
MetastoreConf.ConfVars var) |
static Collection<String> |
getStringCollection(org.apache.hadoop.conf.Configuration conf,
MetastoreConf.ConfVars var)
Treat a configuration value as a comma separated list.
|
static long |
getTimeVar(org.apache.hadoop.conf.Configuration conf,
MetastoreConf.ConfVars var,
TimeUnit outUnit)
Get the variable as a long indicating a period of time
|
static String[] |
getTrimmedStringsVar(org.apache.hadoop.conf.Configuration conf,
MetastoreConf.ConfVars var)
Get values from comma-separated config, to an array after extracting individual values.
|
static char[] |
getValueFromKeystore(String keystorePath,
String key) |
static String |
getVar(org.apache.hadoop.conf.Configuration conf,
MetastoreConf.ConfVars var)
Get the variable as a string
|
static String |
getVar(org.apache.hadoop.conf.Configuration conf,
MetastoreConf.ConfVars var,
String defaultVal)
Get the variable as a string
|
static ZooKeeperHiveHelper |
getZKConfig(org.apache.hadoop.conf.Configuration conf) |
static boolean |
isEmbeddedMetaStore(String msUri)
Check if metastore is being used in embedded mode.
|
static boolean |
isPrintable(String key) |
static org.apache.hadoop.conf.Configuration |
newMetastoreConf() |
static org.apache.hadoop.conf.Configuration |
newMetastoreConf(org.apache.hadoop.conf.Configuration conf) |
static void |
setBoolVar(org.apache.hadoop.conf.Configuration conf,
MetastoreConf.ConfVars var,
boolean val)
Set the variable as a boolean
|
static <I> void |
setClass(org.apache.hadoop.conf.Configuration conf,
MetastoreConf.ConfVars var,
Class<? extends I> theClass,
Class<I> xface)
Set the class name in the configuration file
|
static void |
setDoubleVar(org.apache.hadoop.conf.Configuration conf,
MetastoreConf.ConfVars var,
double val)
Set the variable as a double
|
static void |
setLongVar(org.apache.hadoop.conf.Configuration conf,
MetastoreConf.ConfVars var,
long val)
Set the variable as a long
|
static void |
setTimeVar(org.apache.hadoop.conf.Configuration conf,
MetastoreConf.ConfVars var,
long duration,
TimeUnit unit)
Set the variable as a string
|
static void |
setVar(org.apache.hadoop.conf.Configuration conf,
MetastoreConf.ConfVars var,
String val)
Set the variable as a string
|
public static final MetastoreConf.ConfVars[] metaVars
public static MetastoreConf.ConfVars getMetaConf(String name)
public static org.apache.hadoop.conf.Configuration newMetastoreConf()
public static org.apache.hadoop.conf.Configuration newMetastoreConf(org.apache.hadoop.conf.Configuration conf)
public static String getVar(org.apache.hadoop.conf.Configuration conf, MetastoreConf.ConfVars var)
conf - configuration to retrieve it fromvar - variable to retrievepublic static String getVar(org.apache.hadoop.conf.Configuration conf, MetastoreConf.ConfVars var, String defaultVal)
conf - configuration to retrieve it fromvar - variable to retrievedefaultVal - default to return if the variable is unsetpublic static Collection<String> getStringCollection(org.apache.hadoop.conf.Configuration conf, MetastoreConf.ConfVars var)
conf - configuration to retrieve it fromvar - variable to retrievepublic static void setVar(org.apache.hadoop.conf.Configuration conf,
MetastoreConf.ConfVars var,
String val)
conf - configuration file to set it invar - variable to setval - value to set it topublic static int getIntVar(org.apache.hadoop.conf.Configuration conf,
MetastoreConf.ConfVars var)
conf - configuration to retrieve it fromvar - variable to retrievepublic static long getLongVar(org.apache.hadoop.conf.Configuration conf,
MetastoreConf.ConfVars var)
conf - configuration to retrieve it fromvar - variable to retrievepublic static void setLongVar(org.apache.hadoop.conf.Configuration conf,
MetastoreConf.ConfVars var,
long val)
conf - configuration file to set it invar - variable to setval - value to set it topublic static boolean getBoolVar(org.apache.hadoop.conf.Configuration conf,
MetastoreConf.ConfVars var)
conf - configuration to retrieve it fromvar - variable to retrievepublic static String[] getTrimmedStringsVar(org.apache.hadoop.conf.Configuration conf, MetastoreConf.ConfVars var)
conf - Configuration to retrieve it fromvar - variable to retrievepublic static void setBoolVar(org.apache.hadoop.conf.Configuration conf,
MetastoreConf.ConfVars var,
boolean val)
conf - configuration file to set it invar - variable to setval - value to set it topublic static double getDoubleVar(org.apache.hadoop.conf.Configuration conf,
MetastoreConf.ConfVars var)
conf - configuration to retrieve it fromvar - variable to retrievepublic static void setDoubleVar(org.apache.hadoop.conf.Configuration conf,
MetastoreConf.ConfVars var,
double val)
conf - configuration file to set it invar - variable to setval - value to set it topublic static long getSizeVar(org.apache.hadoop.conf.Configuration conf,
MetastoreConf.ConfVars var)
public static <I> Class<? extends I> getClass(org.apache.hadoop.conf.Configuration conf, MetastoreConf.ConfVars var, Class<? extends I> defaultValue, Class<I> xface)
I - interface that class implementsconf - configuration file to retrieve it fromvar - variable to retrievedefaultValue - default class to return if the value isn't setxface - interface that class must implementpublic static <I> void setClass(org.apache.hadoop.conf.Configuration conf,
MetastoreConf.ConfVars var,
Class<? extends I> theClass,
Class<I> xface)
I - interface the class implements.conf - configuration file to set it invar - variable to settheClass - the class to set it toxface - interface that the class implements. I don't know why this is required, but the
underlying Configuration.setClass(String, Class, Class) requires it.public static long getTimeVar(org.apache.hadoop.conf.Configuration conf,
MetastoreConf.ConfVars var,
TimeUnit outUnit)
conf - configuration to retrieve it fromvar - variable to retrieveoutUnit - Timeout to return value inpublic static void setTimeVar(org.apache.hadoop.conf.Configuration conf,
MetastoreConf.ConfVars var,
long duration,
TimeUnit unit)
conf - configuration file to set it invar - variable to setduration - value to set it tounit - time unit that duration is expressed inpublic static long convertTimeStr(String val, TimeUnit defaultUnit, TimeUnit outUnit)
public static String getPassword(org.apache.hadoop.conf.Configuration conf, MetastoreConf.ConfVars var) throws IOException
Configuration.getPassword(String) to handle getting secure passwords.conf - configuration file to read fromvar - configuration value to readIOException - if thrown by Configuration.getPasswordpublic static String get(org.apache.hadoop.conf.Configuration conf, String key)
conf - configuration to read.key - metastore or hive key to read.public static boolean isPrintable(String key)
public static String getAsString(org.apache.hadoop.conf.Configuration conf, MetastoreConf.ConfVars var)
conf - configuration to readvar - variable to readpublic static URL getHiveDefaultLocation()
public static URL getHiveSiteLocation()
public static URL getHiveMetastoreSiteURL()
public static URL getMetastoreSiteURL()
public static boolean isEmbeddedMetaStore(String msUri)
msUri - - metastore server uripublic static ZooKeeperHiveHelper getZKConfig(org.apache.hadoop.conf.Configuration conf)
public static char[] getValueFromKeystore(String keystorePath, String key) throws IOException
IOExceptionCopyright © 2022 The Apache Software Foundation. All rights reserved.