/*********************************************************************
* All Rights reserved,Copyright (c) K-Opticom
**********************************************************************
*＜プログラム内容＞
*   システム名      ：eo顧客基幹システム
*   モジュール名    ：JCCWfsAccessLogTargetCache
*   ソースファイル名：JCCWfsAccessLogTargetCache.java
*   作成者          ：富士通
*   日付            ：2012年07月20日
*＜機能概要＞
*   WebFOCUSアクセスログ対象定義ファイルキャッシュ部品です。
*＜修正履歴＞
*   バージョン  修正日       修正者      修正内容
*   v1.00.00    2012/07/20    FST        新規作成
*
**********************************************************************/

package eo.common.util;

import com.fujitsu.futurity.common.JCMPropertyCache;

public class JCCWfsAccessLogTargetCache extends JCMPropertyCache {

	
	/**
	 * アプリケーションプロパティファイルから、WebFOCUSアクセスログ対象定義ファイルのパス
	 * 及び文字エンコード種別を取得し、シングルトンでインスタンス化します。
	 * 
	 * @param path プロパティファイルのパス
	 * @param encoding プロパティファイルの文字エンコード種別
	 * @return なし
	 */	
	public synchronized static void setPath(String path, String encoding)
	{
		JCCWfsAccessLogTargetCache rc = JCCWfsAccessLogTargetCache.getInstance();

		rc.PATH = path;
		rc.ENCODING = encoding;
	}

	/** インスタンス領域 */
	private static JCCWfsAccessLogTargetCache prop = null;

	/**
	 * 本クラスのシングルトンインスタンスを取得します。
	 * 
	 * @return JCCWfsAccessLogTargetCache シングルトンインスタンス
	 */
	private static JCCWfsAccessLogTargetCache getInstance()
	{
		if (prop == null)
		{
			prop = new JCCWfsAccessLogTargetCache();
		}

		return prop;
	}
	
	/**
	 * 指定されたキーに対応する値を返却します。
	 * 
	 * @param  key        WebFOCUSアクセスログ対象定義ファイルのキー
	 * @return String     取得結果
	 * @throws JCCFrameworkException
	 */
	public synchronized static String getValue(String key)
	{
		try
		{
			// 親クラスのgetValuePropメソッドを値を取得
			String value = JCCWfsAccessLogTargetCache.getInstance().getValueProp(key);
			
			// 値が設定されていない場合は空のHashMapを返却
			if (null == value || 0 == value.trim().length())
			{
				return null;
			}
			// 取得値を返却
			return value;
		}
		catch(Exception e)
		{
			throw new JCCFrameworkException(e.getMessage());
		}
	}
}
