本文整理匯總了Java中org.apache.fluo.api.config.SimpleConfiguration.save方法的典型用法代碼示例。如果您正苦於以下問題:Java SimpleConfiguration.save方法的具體用法?Java SimpleConfiguration.save怎麽用?Java SimpleConfiguration.save使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.fluo.api.config.SimpleConfiguration
的用法示例。
在下文中一共展示了SimpleConfiguration.save方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: configure
import org.apache.fluo.api.config.SimpleConfiguration; //導入方法依賴的package包/類
/**
* Configure properties needed to connect to a Fluo application
*
* @param conf Job configuration
* @param config use {@link org.apache.fluo.api.config.FluoConfiguration} to configure
* programmatically
*/
@SuppressWarnings("deprecation")
public static void configure(Job conf, SimpleConfiguration config) {
try {
FluoConfiguration fconfig = new FluoConfiguration(config);
try (Environment env = new Environment(fconfig)) {
long ts =
env.getSharedResources().getTimestampTracker().allocateTimestamp().getTxTimestamp();
conf.getConfiguration().setLong(TIMESTAMP_CONF_KEY, ts);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
config.save(baos);
conf.getConfiguration().set(PROPS_CONF_KEY,
new String(baos.toByteArray(), StandardCharsets.UTF_8));
AccumuloInputFormat.setZooKeeperInstance(conf, fconfig.getAccumuloInstance(),
fconfig.getAccumuloZookeepers());
AccumuloInputFormat.setConnectorInfo(conf, fconfig.getAccumuloUser(),
new PasswordToken(fconfig.getAccumuloPassword()));
AccumuloInputFormat.setInputTableName(conf, env.getTable());
AccumuloInputFormat.setScanAuthorizations(conf, env.getAuthorizations());
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例2: configure
import org.apache.fluo.api.config.SimpleConfiguration; //導入方法依賴的package包/類
/**
* Configure properties needed to connect to a Fluo application
*
* @param conf Job configuration
* @param config use {@link FluoConfiguration} to configure programmatically
*/
@SuppressWarnings("deprecation")
public static void configure(Job conf, SimpleConfiguration config) {
try {
FluoConfiguration fconfig = new FluoConfiguration(config);
try (Environment env = new Environment(fconfig)) {
long ts =
env.getSharedResources().getTimestampTracker().allocateTimestamp().getTxTimestamp();
conf.getConfiguration().setLong(TIMESTAMP_CONF_KEY, ts);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
config.save(baos);
conf.getConfiguration().set(PROPS_CONF_KEY,
new String(baos.toByteArray(), StandardCharsets.UTF_8));
AccumuloInputFormat.setZooKeeperInstance(conf, fconfig.getAccumuloInstance(),
fconfig.getAccumuloZookeepers());
AccumuloInputFormat.setConnectorInfo(conf, fconfig.getAccumuloUser(),
new PasswordToken(fconfig.getAccumuloPassword()));
AccumuloInputFormat.setInputTableName(conf, env.getTable());
AccumuloInputFormat.setScanAuthorizations(conf, env.getAuthorizations());
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例3: configure
import org.apache.fluo.api.config.SimpleConfiguration; //導入方法依賴的package包/類
/**
* Call this method to initialize the Fluo connection props
*
* @param conf Job configuration
* @param props Use {@link org.apache.fluo.api.config.FluoConfiguration} to set props
* programmatically
*/
public static void configure(Job conf, SimpleConfiguration props) {
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
props.save(baos);
conf.getConfiguration().set(PROPS_CONF_KEY,
new String(baos.toByteArray(), StandardCharsets.UTF_8));
} catch (Exception e) {
throw new RuntimeException(e);
}
}