Package com.asakusafw.bulkloader.exception

Examples of com.asakusafw.bulkloader.exception.BulkLoaderSystemException


                if (RuntimeContext.get().isSimulation() == false) {
                    output.openNext(result).close();
                }
            }
        } catch (IOException e) {
            throw new BulkLoaderSystemException(e, getClass(), "TG-GETCACHE-01005",
                    targetName, batchId, flowId, executionId, userName);
        }
    }
View Full Code Here


        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));
        }
View Full Code Here

        assert info != null;

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

        URI dfsFilePath = resolveLocation(bean, user, protocol.getLocation());
        try {
            CacheStorage storage = new CacheStorage(new Configuration(), dfsFilePath);
            try {
                LOG.info("TG-EXTRACTOR-11001", info.getId(), info.getTableName(), storage.getPatchProperties());
                storage.putPatchCacheInfo(info);
                LOG.info("TG-EXTRACTOR-11002", info.getId(), info.getTableName(), storage.getPatchProperties());

                Class<?> targetTableModel = targetTableBean.getImportTargetType();
                Path targetUri = storage.getPatchContents("0");
                LOG.info("TG-EXTRACTOR-11003", info.getId(), info.getTableName(), targetUri);
                long recordCount = write(targetTableModel, targetUri.toUri(), content);
                LOG.info("TG-EXTRACTOR-11004", info.getId(), info.getTableName(), targetUri, recordCount);
                LOG.info("TG-PROFILE-01002",
                        bean.getTargetName(),
                        bean.getBatchId(),
                        bean.getJobflowId(),
                        bean.getExecutionId(),
                        info.getTableName(),
                        recordCount);
                return recordCount;
            } finally {
                storage.close();
            }
        } catch (IOException e) {
            throw new BulkLoaderSystemException(e, getClass(), "TG-EXTRACTOR-11005",
                    info.getId(), info.getTableName(), dfsFilePath);
        }
    }
View Full Code Here

                }
            default:
                throw new AssertionError(protocol);
            }
        } catch (IOException e) {
            throw new BulkLoaderSystemException(e, getClass(), "TG-EXTRACTOR-12002",
                    protocol.getKind(),
                    info.getId(),
                    info.getTableName(),
                    bean.getTargetName(),
                    bean.getBatchId(),
View Full Code Here

                                "Cache builder returns unexpected exit code: {0}",
                                exitCode));
                    }
                    LOG.info("TG-EXTRACTOR-12004", subcommand, info.getId(), info.getTableName());
                } catch (Exception e) {
                    throw new BulkLoaderSystemException(e, DfsFileImport.class, "TG-EXTRACTOR-12005",
                            subcommand,
                            info.getId(),
                            info.getTableName());
                } finally {
                    process.destroy();
View Full Code Here

            } catch (TimeoutException e) {
                // continue...
                rest.addLast(future);
            } catch (InterruptedException e) {
                cancel(rest);
                throw new BulkLoaderSystemException(e, getClass(), "TG-EXTRACTOR-12007",
                        bean.getTargetName(),
                        bean.getBatchId(),
                        bean.getJobflowId(),
                        bean.getExecutionId());
            } catch (ExecutionException e) {
                cancel(rest);
                Throwable cause = e.getCause();
                if (cause instanceof RuntimeException) {
                    throw (RuntimeException) cause;
                } else if (cause instanceof Error) {
                    throw (Error) cause;
                } else if (cause instanceof BulkLoaderSystemException) {
                    LOG.log((BulkLoaderSystemException) cause);
                    sawError = true;
                } else {
                    LOG.error(e, "TG-EXTRACTOR-12008",
                            bean.getTargetName(),
                            bean.getBatchId(),
                            bean.getJobflowId(),
                            bean.getExecutionId());
                    sawError = true;
                }
            }
        }
        if (sawError) {
            throw new BulkLoaderSystemException(getClass(), "TG-EXTRACTOR-12008",
                    bean.getTargetName(),
                    bean.getBatchId(),
                    bean.getJobflowId(),
                    bean.getExecutionId());
        } else {
View Full Code Here

            } else {
                output = TemporaryStorage.openOutput(conf, targetTableModel, new Path(dfsFilePath));
            }
            return MultiThreadedCopier.copy(input, output, working);
        } catch (IOException e) {
            throw new BulkLoaderSystemException(e, getClass(), "TG-EXTRACTOR-02001",
                    "DFSにファイルを書き出す処理に失敗。URI:" + dfsFilePath);
        } catch (InterruptedException e) {
            throw new BulkLoaderSystemException(e, getClass(), "TG-EXTRACTOR-02001",
                    "DFSにファイルを書き出す処理に失敗。URI:" + dfsFilePath);
        } finally {
            if (output != null) {
                try {
                    output.close();
View Full Code Here

        Calendar last = null;
        try {
            LOG.debugMessage("putting cache info: {0}", current);
            last = getLastUpdated(current.getTableName());
            if (last == null) {
                throw new BulkLoaderSystemException(getClass(), "TG-COMMON-11001", current);
            }
            statement = connection.prepareStatement(sql);
            statement.setString(1, current.getId());
            statement.setTimestamp(2, toTimestamp(last));
            statement.setTimestamp(3, toTimestamp(current.getRemoteTimestamp()));
            statement.setString(4, current.getTableName());
            statement.setString(5, current.getPath());
            int rows = statement.executeUpdate();
            if (rows == 0) {
                throw new BulkLoaderSystemException(getClass(), "TG-COMMON-11002", current);
            }
            DBConnection.commit(connection);
            succeed = true;
            LOG.debugMessage("put cache info: {0}", toTimestamp(last));
            return last;
View Full Code Here

                    while (true) {
                        int read;
                        try {
                            read = content.read(b);
                        } catch (IOException e) {
                            throw new BulkLoaderSystemException(e, getClass(), "TG-EXPORTER-02002",
                                    "Exportファイルの読み込みに失敗。エントリ名:" + protocol.getLocation());
                        }
                        // 入力ファイルの終端を察知する
                        if (read < 0) {
                            break;
                        }
                        dumpFileSize += read;
                        // ファイルを書き出す
                        try {
                            fos.write(b, 0, read);
                        } catch (IOException e) {
                            throw new BulkLoaderSystemException(e, getClass(), "TG-EXPORTER-02002",
                                    "Exportファイルの書き出しに失敗。ファイル名:" +  file.getName());
                        }
                    }
                    // ファイル名を設定する
                    bean.getExportTargetTable(tableName).addExportFile(file);
View Full Code Here

     */
    private OutputStream createFos(File file) throws BulkLoaderSystemException {
        if (file.exists()) {
            if (!file.delete()) {
                // ファイルの削除に失敗した場合は異常終了する
                throw new BulkLoaderSystemException(getClass(), "TG-EXPORTER-02004",
                        file.getName());
            }
        }
        FileOutputStream fos = null;
        try {
            fos = new FileOutputStream(file);
        } catch (FileNotFoundException e) {
            throw new BulkLoaderSystemException(e, getClass(), "TG-EXPORTER-02002",
                    "Exportファイルの指定が不正。ファイル名:" +  file.getName());
        }
        return fos;
    }
View Full Code Here

TOP

Related Classes of com.asakusafw.bulkloader.exception.BulkLoaderSystemException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.