public final class UtilityMethods extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
anyNull(Object... args)
Any null.
|
static <T extends Enum<T>> |
checkAndGetOperation(String operation,
Class<T> enumType,
T... supportedOperations) |
static String |
confToString(org.apache.hadoop.conf.Configuration conf)
Conf to string.
|
static byte[] |
generateHashOfWritable(org.apache.hadoop.io.Writable writable)
Generates a md5 hash of a writable object.
|
static SchedulerJobHandle |
generateSchedulerJobHandle() |
static SchedulerJobInstanceHandle |
generateSchedulerJobInstanceHandle() |
static org.apache.commons.dbcp.BasicDataSource |
getDataSourceFromConf(org.apache.hadoop.conf.Configuration conf)
Gets the data source from conf.
|
static org.apache.commons.dbcp.BasicDataSource |
getDataSourceFromConfForScheduler(org.apache.hadoop.conf.Configuration conf) |
static DataSource |
getPoolingDataSourceFromConf(org.apache.hadoop.conf.Configuration conf) |
static <K,V> void |
mergeMaps(Map<K,V> into,
Map<K,V> from,
boolean override)
Merge maps.
|
static void |
pipe(InputStream is,
OutputStream os)
Pipe input stream to output stream
|
static String[] |
queryDatabase(DataSource ds,
String querySql,
boolean allowNull,
Object... args)
Query database.
|
static String |
removeDomain(String username)
Removes the domain.
|
public static <K,V> void mergeMaps(Map<K,V> into, Map<K,V> from, boolean override)
K
- the key typeV
- the value typeinto
- the intofrom
- the fromoverride
- the overridepublic static String removeDomain(String username)
username
- the usernamepublic static boolean anyNull(Object... args)
args
- the argspublic static String[] queryDatabase(DataSource ds, String querySql, boolean allowNull, Object... args) throws SQLException
ds
- the dsquerySql
- the query sqlallowNull
- the allow nullargs
- the argsSQLException
- the SQL exceptionpublic static org.apache.commons.dbcp.BasicDataSource getDataSourceFromConf(org.apache.hadoop.conf.Configuration conf)
conf
- the confpublic static DataSource getPoolingDataSourceFromConf(org.apache.hadoop.conf.Configuration conf)
public static String confToString(org.apache.hadoop.conf.Configuration conf)
conf
- the confpublic static void pipe(InputStream is, OutputStream os) throws IOException
is
- the isos
- the osIOException
- Signals that an I/O exception has occurred.public static byte[] generateHashOfWritable(org.apache.hadoop.io.Writable writable)
writable
- public static org.apache.commons.dbcp.BasicDataSource getDataSourceFromConfForScheduler(org.apache.hadoop.conf.Configuration conf)
conf
- public static SchedulerJobHandle generateSchedulerJobHandle()
public static SchedulerJobInstanceHandle generateSchedulerJobInstanceHandle()
public static <T extends Enum<T>> T checkAndGetOperation(String operation, Class<T> enumType, T... supportedOperations) throws UnSupportedOpException
UnSupportedOpException
Copyright © 2014–2018 Apache Software Foundation. All rights reserved.