/*******************************************************************************
 * Copyright (c) 2008 IGA Tosiki, NTT DATA BUSINESS BRAINS Corp.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    IGA Tosiki (NTT DATA BUSINESS BRAINS Corp.) - initial API and implementation
 *******************************************************************************/
/*
 * blanco Framework
 * Copyright (C) 2008 NTT DATA BUSINESS BRAINS CORPORATION
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 */
package blanco.nlpack.generator.task;

import java.io.IOException;

import blanco.nlpack.generator.csv.io.BlancoCsvIOException;
import blanco.nlpack.generator.task.valueobject.BlancoNLpackGeneratorTranslationFragmentToPleiadesProcessInput;
import blanco.nlpack.generator.util.BlancoNLpackGeneratorTranslationFragmentToPleiades;

/**
 * 翻訳フラグメント形式のファイルを Pleiades形式ファイルに変換します。
 * 
 * @author IGA Tosiki
 */
public class BlancoNLpackGeneratorTranslationFragmentToPleiadesProcessImpl
        implements BlancoNLpackGeneratorTranslationFragmentToPleiadesProcess {

    /**
     * クラスをインスタンス化して処理を実行する際のエントリポイントです。
     * 
     * @param input
     *            処理の入力パラメータ。
     * @return 処理の実行結果。
     * @throws IOException
     *             入出力例外が発生した場合。
     * @throws IllegalArgumentException
     *             入力値に不正が見つかった場合。
     */
    public int execute(
            final BlancoNLpackGeneratorTranslationFragmentToPleiadesProcessInput input)
            throws IOException, IllegalArgumentException {
        System.out.println("nlpack: TranslationFragment -> Pleiades: begin");

        try {
            new BlancoNLpackGeneratorTranslationFragmentToPleiades()
                    .process(input);
        } catch (BlancoCsvIOException ex) {
            throw new IOException("CSVファイル入力で例外が発生:" + ex.toString());
        }

        System.out.println("nlpack: TranslationFragment -> Pleiades: end");

        return BlancoNLpackGeneratorTranslationFragmentToPleiadesBatchProcess.END_SUCCESS;
    }
}
