Package com.asakusafw.bulkloader.common

Examples of com.asakusafw.bulkloader.common.FileCompType


     */
    public boolean sendExportFile(ExporterBean bean, String user) {

        // 圧縮に関する情報を取得
        String strCompType = ConfigurationLoader.getProperty(Constants.PROP_KEY_EXP_FILE_COMP_TYPE);
        FileCompType compType = FileCompType.find(strCompType);

        OutputStream output = getOutputStream();
        try {
            FileList.Writer writer;
            try {
                writer = FileList.createWriter(output, compType == FileCompType.DEFLATED);
            } catch (IOException e) {
                throw new BulkLoaderSystemException(e, getClass(), "TG-COLLECTOR-02001",
                        "Exporterと接続するチャネルを開けませんでした");
            }
            Configuration conf = new Configuration();
            List<String> l = bean.getExportTargetTableList();
            for (String tableName : l) {
                ExportTargetTableBean targetTable = bean.getExportTargetTable(tableName);
                Class<? extends Writable> targetTableModel =
                    targetTable.getExportTargetType().asSubclass(Writable.class);

                List<Path> filePath = FileNameUtil.createPaths(
                        conf,
                        targetTable.getDfsFilePaths(),
                        bean.getExecutionId(),
                        user);

                // Export対象テーブルに対するディレクトリ数分繰り返す
                int fileCount = filePath.size();
                long recordCount = 0;
                for (int i = 0; i < fileCount; i++) {
                    // Exportファイルを送信
                    LOG.info("TG-COLLECTOR-02002",
                            tableName, filePath.get(i), compType.getSymbol(), targetTableModel.toString());
                    long countInFile = send(targetTableModel, filePath.get(i).toString(), writer, tableName);
                    if (countInFile >= 0) {
                        recordCount += countInFile;
                    }
                    LOG.info("TG-COLLECTOR-02003",
                            tableName, filePath.get(i), compType.getSymbol(), targetTableModel.toString());
                }

                LOG.info("TG-PROFILE-01004",
                        bean.getTargetName(),
                        bean.getBatchId(),
View Full Code Here


     * @return Import対象ファイル送信結果(true:成功、false:失敗)
     */
    public boolean sendImportFile(ImportBean bean) {
        // ZIP圧縮に関する情報を取得
        String strCompType = ConfigurationLoader.getProperty(Constants.PROP_KEY_IMP_FILE_COMP_TYPE);
        FileCompType compType = FileCompType.find(strCompType);

        FileListProvider provider = null;
        FileList.Writer writer = null;

        long totalStartTime = System.currentTimeMillis();
        try {
            provider = openFileList(
                    bean.getTargetName(),
                    bean.getBatchId(),
                    bean.getJobflowId(),
                    bean.getExecutionId());
            provider.discardReader();
            writer = provider.openWriter(compType == FileCompType.DEFLATED);

            // Import対象テーブル毎にファイルの読み込み・書き出しの処理を行う
            List<String> list = arrangeSendOrder(bean);
            for (String tableName : list) {
                long tableStartTime = System.currentTimeMillis();
                ImportTargetTableBean targetTable = bean.getTargetTable(tableName);
                LOG.info("TG-IMPORTER-04004",
                        tableName,
                        targetTable.getImportFile().getAbsolutePath(),
                        compType.getSymbol());
                long dumpFileSize = sendTableFile(writer, tableName, targetTable);
                LOG.info("TG-PROFILE-02003",
                        bean.getTargetName(),
                        bean.getBatchId(),
                        bean.getJobflowId(),
                        bean.getExecutionId(),
                        tableName,
                        dumpFileSize,
                        System.currentTimeMillis() - tableStartTime);
                LOG.info("TG-IMPORTER-04005",
                        tableName,
                        targetTable.getImportFile().getAbsolutePath(),
                        compType.getSymbol());
            }
            writer.close();
            provider.waitForComplete();
            LOG.info("TG-PROFILE-02001",
                    bean.getTargetName(),
View Full Code Here

TOP

Related Classes of com.asakusafw.bulkloader.common.FileCompType

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.