當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。