public final class UtilityMethods extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
anyNull(Object... args)
Any null.
|
static String |
confToString(org.apache.hadoop.conf.Configuration conf)
Conf to string.
|
static org.apache.commons.dbcp.BasicDataSource |
getDataSourceFromConf(org.apache.hadoop.conf.Configuration conf)
Gets the data source from 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 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.Copyright © 2014–2015 Apache Software Foundation. All rights reserved.