当前位置: 首页>>代码示例>>Java>>正文


Java SimpleConfiguration.save方法代码示例

本文整理汇总了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);
  }
}
 
开发者ID:apache,项目名称:fluo,代码行数:33,代码来源:FluoRowInputFormat.java

示例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);
  }
}
 
开发者ID:apache,项目名称:fluo,代码行数:32,代码来源:FluoEntryInputFormat.java

示例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);
  }
}
 
开发者ID:apache,项目名称:fluo,代码行数:21,代码来源:FluoOutputFormat.java


注:本文中的org.apache.fluo.api.config.SimpleConfiguration.save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。