Exemplo n.º 1
0
 private URI getTargetUri() {
   try {
     return FileNameUtil.createPath(
             getConfiguration(), "target/testing/" + getClass().getSimpleName(), "dummy", "dummy")
         .toUri();
   } catch (BulkLoaderSystemException e) {
     throw new AssertionError(e);
   }
 }
Exemplo n.º 2
0
  private void importContent(
      FileProtocol protocol, InputStream content, ImportBean bean, String user)
      throws BulkLoaderSystemException {
    assert protocol != null;
    assert content != null;
    assert bean != null;
    assert user != null;
    String tableName = FileNameUtil.getImportTableName(protocol.getLocation());

    ImportTargetTableBean targetTableBean = bean.getTargetTable(tableName);
    if (targetTableBean == null) {
      // 対応するテーブルの定義がDSL存在しない場合異常終了する。
      throw new BulkLoaderSystemException(
          getClass(),
          "TG-EXTRACTOR-02001",
          MessageFormat.format("エントリに対応するテーブルの定義がDSL存在しない。テーブル名:{0}", tableName));
    }

    URI dfsFilePath = resolveLocation(bean, user, targetTableBean.getDfsFilePath());
    Class<?> targetTableModel = targetTableBean.getImportTargetType();

    LOG.info("TG-EXTRACTOR-02002", tableName, dfsFilePath.toString(), targetTableModel.toString());

    // ファイルをジョブ入力データ領域に書き出す
    long recordCount = write(targetTableModel, dfsFilePath, content);

    LOG.info("TG-EXTRACTOR-02003", tableName, dfsFilePath.toString(), targetTableModel.toString());
    LOG.info(
        "TG-PROFILE-01002",
        bean.getTargetName(),
        bean.getBatchId(),
        bean.getJobflowId(),
        bean.getExecutionId(),
        tableName,
        recordCount);
  }
Exemplo n.º 3
0
 /**
  * Resolves target location.
  *
  * @param bean importer bean
  * @param user current user name
  * @param location target location
  * @return the resolved location
  * @throws BulkLoaderSystemException if failed to resolve
  */
 protected URI resolveLocation(ImportBean bean, String user, String location)
     throws BulkLoaderSystemException {
   Configuration conf = new Configuration();
   URI dfsFilePath = FileNameUtil.createPath(conf, location, bean.getExecutionId(), user).toUri();
   return dfsFilePath;
 }