use of java.lang.reflect.Method in project titan by thinkaurelius.
the class HBaseAuthHelper method setHBaseAuthToken.
public static void setHBaseAuthToken(Configuration configuration, Job job) throws IOException {
// Get HBase authentication token (when configured)
String hbaseAuthentication = configuration.get("hbase.security.authentication");
if (null != hbaseAuthentication && hbaseAuthentication.equals("kerberos")) {
String quorumCfgKey = "hbase.zookeeper.quorum";
log.info("Obtaining HBase Auth Token from ZooKeeper quorum " + configuration.get(quorumCfgKey));
final String className = "org.apache.hadoop.hbase.security.User";
try {
Class<?> clazz = HBaseAuthHelper.class.getClassLoader().loadClass(className);
Method getCurrent = clazz.getMethod("getCurrent");
Object user = getCurrent.invoke(null);
Method obtainAuthTokenForJob = clazz.getMethod("obtainAuthTokenForJob", Configuration.class, Job.class);
obtainAuthTokenForJob.invoke(user, configuration, job);
log.info("Obtained HBase Auth Token from ZooKeeper quorum {} for job {}", configuration.get(quorumCfgKey), job.getJobName());
} catch (ClassNotFoundException e) {
log.error("Failed to generate or store HBase auth token", e);
} catch (InvocationTargetException e) {
log.error("Failed to generate or store HBase auth token", e);
} catch (NoSuchMethodException e) {
log.error("Failed to generate or store HBase auth token", e);
} catch (IllegalAccessException e) {
log.error("Failed to generate or store HBase auth token", e);
} catch (Throwable t) {
log.error("Failed to generate or store HBase auth token", t);
}
} else {
log.info("Not obtaining HBase Auth Token for MapReduce job " + job.getJobName());
}
}
use of java.lang.reflect.Method in project titan by thinkaurelius.
the class HBaseBinaryInputFormat method setConf.
@Override
public void setConf(final Configuration config) {
super.setConf(config);
//config.set(TableInputFormat.SCAN_COLUMN_FAMILY, Backend.EDGESTORE_NAME);
config.set(TableInputFormat.INPUT_TABLE, titanConf.get(HBaseStoreManager.HBASE_TABLE));
//config.set(HConstants.ZOOKEEPER_QUORUM, config.get(TITAN_HADOOP_GRAPH_INPUT_TITAN_STORAGE_HOSTNAME));
config.set(HConstants.ZOOKEEPER_QUORUM, titanConf.get(GraphDatabaseConfiguration.STORAGE_HOSTS)[0]);
// if (basicConf.get(TITAN_HADOOP_GRAPH_INPUT_TITAN_STORAGE_PORT, null) != null)
if (titanConf.has(GraphDatabaseConfiguration.STORAGE_PORT))
config.set(HConstants.ZOOKEEPER_CLIENT_PORT, String.valueOf(titanConf.get(GraphDatabaseConfiguration.STORAGE_PORT)));
config.set("autotype", "none");
log.debug("hbase.security.authentication={}", config.get("hbase.security.authentication"));
Scan scanner = new Scan();
String cfName = mrConf.get(TitanHadoopConfiguration.COLUMN_FAMILY_NAME);
// TODO the space-saving short name mapping leaks from HBaseStoreManager here
if (titanConf.get(HBaseStoreManager.SHORT_CF_NAMES)) {
try {
cfName = HBaseStoreManager.shortenCfName(cfName);
} catch (PermanentBackendException e) {
throw new RuntimeException(e);
}
}
scanner.addFamily(cfName.getBytes());
inputCFBytes = Bytes.toBytes(cfName);
//scanner.setFilter(getColumnFilter(titanSetup.inputSlice(this.vertexQuery))); // TODO
//TODO (minor): should we set other options in http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/Scan.html for optimization?
Method converter;
try {
converter = TableMapReduceUtil.class.getDeclaredMethod("convertScanToString", Scan.class);
converter.setAccessible(true);
config.set(TableInputFormat.SCAN, (String) converter.invoke(null, scanner));
} catch (Exception e) {
throw new RuntimeException(e);
}
this.tableInputFormat.setConf(config);
}
use of java.lang.reflect.Method in project blueprints by tinkerpop.
the class WritethroughGraphTest method doTestSuite.
public void doTestSuite(final TestSuite testSuite) throws Exception {
for (Method method : testSuite.getClass().getDeclaredMethods()) {
if (method.getName().startsWith("test")) {
System.out.println("Testing " + method.getName() + "...");
method.invoke(testSuite);
}
}
}
use of java.lang.reflect.Method in project blueprints by tinkerpop.
the class IdGraphTest method doTestSuite.
public void doTestSuite(final TestSuite testSuite) throws Exception {
for (Method method : testSuite.getClass().getDeclaredMethods()) {
if (method.getName().startsWith("test")) {
System.out.println("Testing " + method.getName() + "...");
method.invoke(testSuite);
}
}
}
use of java.lang.reflect.Method in project blueprints by tinkerpop.
the class EventGraphTest method doTestSuite.
public void doTestSuite(final TestSuite testSuite) throws Exception {
for (Method method : testSuite.getClass().getDeclaredMethods()) {
if (method.getName().startsWith("test")) {
System.out.println("Testing " + method.getName() + "...");
method.invoke(testSuite);
}
}
}
Aggregations