/*******************************************************************************
*	All Rights reserved,Copyright (c) K-Opticom
********************************************************************************
*＜プログラム内容＞
*	システム名		：eo顧客基幹システム
*	モジュール名	：JACPrcMessageCache
*	ソースファイル名：JACPrcMessageCache.java
*	作成者			：富士通
*	日付			：2011年06月06日
*＜機能概要＞
*	料金メッセージプロパティのキャッシュクラス
*＜修正履歴＞
*	バージョン	修正日		修正者		修正内容
*	v1.00.00	2011/06/06	富士通		新規作成
*
**********************************************************************/

package eo.web.webview.common;

import com.fujitsu.futurity.common.JCMPropertyCache;
import com.fujitsu.futurity.model.common.JCMAPLConstMgr;


/**
 * 料金メッセージプロパティファイルの読み込みを行うクラス。
 * <p>
 * 
 * @author 富士通
 * @since 9.00.00
 */
public class JACPrcMessageCache extends JCMPropertyCache
{
	/**
	 * 本クラスのシングルトンインスタンス
	 */
	private static JACPrcMessageCache prop = null;

	/**
	 * 料金メッセージプロパティのパスを設定します。
	 * @param prop_path     料金メッセージプロパティファイルのパス
	 * @param prop_encoding 料金メッセージプロパティファイルの文字コード
	 */
	private static void setPath(String prop_path, String prop_encoding)
	{
		JACPrcMessageCache rc = JACPrcMessageCache.getInstance();

		rc.PATH = prop_path;
		rc.ENCODING = prop_encoding;

	}

	/**
	 * 本クラスのシングルトンインスタンスを取得します。
	 * 
	 * @return JCMLogMaskItemCache シングルトンインスタンス
	 */
	private static JACPrcMessageCache getInstance()
	{
		if (null == prop)
		{
			prop = new JACPrcMessageCache();
		}

		return prop;
	}

	/**
	 * 指定されたキーに対応する値を返却します。
	 * 
	 * @param key サービスＩ／Ｆ−ＩＤ
	 * @return String 出力有無文字列
	 * @throws Exception
	 */
	public synchronized static String getValue(String key) throws Exception
	{
		//プロパティファイルからファイルパスと文字コードを取得
		String filePath = JCMAPLConstMgr.getString("AC_ONMSG");
		String fileEncoding = JCMAPLConstMgr.getString("AC_ONMSG_FILE_ENCODING");

		// パスを設定
		setPath(filePath, fileEncoding);

		// 親クラスのgetValuePropメソッドを値を取得
		String val = JACPrcMessageCache.getInstance().getValueProp(key);

		return val;
	}
}
