當前位置: 首頁>>代碼示例>>Java>>正文


Java JobStorage類代碼示例

本文整理匯總了Java中com.cloudera.sqoop.metastore.JobStorage的典型用法代碼示例。如果您正苦於以下問題:Java JobStorage類的具體用法?Java JobStorage怎麽用?Java JobStorage使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


JobStorage類屬於com.cloudera.sqoop.metastore包,在下文中一共展示了JobStorage類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getJobStorage

import com.cloudera.sqoop.metastore.JobStorage; //導入依賴的package包/類
/**
 * Given a storage descriptor, determine the correct JobStorage
 * implementation to use to connect to the storage resource and return an
 * instance of it -- or null if no JobStorage instance is appropriate.
 */
public JobStorage getJobStorage(Map<String, String> descriptor) {
  List<JobStorage> storages = ConfigurationHelper.getInstances(
      conf, AVAILABLE_STORAGES_KEY, JobStorage.class);
  for (JobStorage stor : storages) {
    if (stor.canAccept(descriptor)) {
      return stor;
    }
  }

  return null;
}
 
開發者ID:aliyun,項目名稱:aliyun-maxcompute-data-collectors,代碼行數:17,代碼來源:JobStorageFactory.java

示例2: saveIncrementalState

import com.cloudera.sqoop.metastore.JobStorage; //導入依賴的package包/類
/**
 * If this is an incremental import, then we should save the
 * user's state back to the metastore (if this job was run
 * from the metastore). Otherwise, log to the user what data
 * they need to supply next time.
 */
private void saveIncrementalState(SqoopOptions options)
    throws IOException {
  if (!isIncremental(options)) {
    return;
  }

  Map<String, String> descriptor = options.getStorageDescriptor();
  String jobName = options.getJobName();

  if (null != jobName && null != descriptor) {
    // Actually save it back to the metastore.
    LOG.info("Saving incremental import state to the metastore");
    JobStorageFactory ssf = new JobStorageFactory(options.getConf());
    JobStorage storage = ssf.getJobStorage(descriptor);
    storage.open(descriptor);
    try {
      // Save the 'parent' SqoopOptions; this does not contain the mutations
      // to the SqoopOptions state that occurred over the course of this
      // execution, except for the one we specifically want to memorize:
      // the latest value of the check column.
      JobData data = new JobData(options.getParent(), this);
      storage.update(jobName, data);
      LOG.info("Updated data for job: " + jobName);
    } finally {
      storage.close();
    }
  } else {
    // If there wasn't a parent SqoopOptions, then the incremental
    // state data was stored in the current SqoopOptions.
    LOG.info("Incremental import complete! To run another incremental "
        + "import of all data following this import, supply the "
        + "following arguments:");
    SqoopOptions.IncrementalMode incrementalMode =
        options.getIncrementalMode();
    switch (incrementalMode) {
    case AppendRows:
      LOG.info(" --incremental append");
      break;
    case DateLastModified:
      LOG.info(" --incremental lastmodified");
      break;
    default:
      LOG.warn("Undefined incremental mode: " + incrementalMode);
      break;
    }
    LOG.info("  --check-column " + options.getIncrementalTestColumn());
    LOG.info("  --last-value " + options.getIncrementalLastValue());
    LOG.info("(Consider saving this with 'sqoop job --create')");
  }
}
 
開發者ID:aliyun,項目名稱:aliyun-maxcompute-data-collectors,代碼行數:57,代碼來源:ImportTool.java

示例3: saveIncrementalState

import com.cloudera.sqoop.metastore.JobStorage; //導入依賴的package包/類
/**
 * If this is an incremental import, then we should save the user's state
 * back to the metastore (if this job was run from the metastore).
 * Otherwise, log to the user what data they need to supply next time.
 */
private void saveIncrementalState(SqoopOptions options) throws IOException {
	if (!isIncremental(options)) {
		return;
	}

	Map<String, String> descriptor = options.getStorageDescriptor();
	String jobName = options.getJobName();

	if (null != jobName && null != descriptor) {
		// Actually save it back to the metastore.
		LOG.info("Saving incremental import state to the metastore");
		JobStorageFactory ssf = new JobStorageFactory(options.getConf());
		JobStorage storage = ssf.getJobStorage(descriptor);
		storage.open(descriptor);
		try {
			// Save the 'parent' SqoopOptions; this does not contain the
			// mutations
			// to the SqoopOptions state that occurred over the course of
			// this
			// execution, except for the one we specifically want to
			// memorize:
			// the latest value of the check column.
			JobData data = new JobData(options.getParent(), this);
			storage.update(jobName, data);
			LOG.info("Updated data for job: " + jobName);
		} finally {
			storage.close();
		}
	} else {
		// If there wasn't a parent SqoopOptions, then the incremental
		// state data was stored in the current SqoopOptions.
		LOG.info("Incremental import complete! To run another incremental "
				+ "import of all data following this import, supply the "
				+ "following arguments:");
		SqoopOptions.IncrementalMode incrementalMode = options
				.getIncrementalMode();
		switch (incrementalMode) {
		case AppendRows:
			LOG.info(" --incremental append");
			break;
		case DateLastModified:
			LOG.info(" --incremental lastmodified");
			break;
		default:
			LOG.warn("Undefined incremental mode: " + incrementalMode);
			break;
		}
		LOG.info("  --check-column " + options.getIncrementalTestColumn());
		LOG.info("  --last-value " + options.getIncrementalLastValue());
		LOG.info("(Consider saving this with 'sqoop job --create')");
	}
}
 
開發者ID:unicredit,項目名稱:zSqoop,代碼行數:58,代碼來源:ImportTool.java


注:本文中的com.cloudera.sqoop.metastore.JobStorage類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。