001/*
002 * Copyright (c) 2009 The openGion Project.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
013 * either express or implied. See the License for the specific language
014 * governing permissions and limitations under the License.
015 */
016package org.opengion.hayabusa.develop;
017
018import java.util.Map;
019import java.util.List;
020
021import org.opengion.fukurou.util.StringUtil;
022import org.opengion.fukurou.xml.JspParserFilter;
023
024/**
025 * コンストラクタに引数で与えられたマスタデータ情報を元に、特定のJSPタグ情報を生成する基底クラス。
026 * マスタデータ情報はGF92のNMSYORIカラムの種別毎にJspConvertEntityオブジェクトに事前に準備する必要がある。
027 *
028 * 例)
029 * JspConvertEntity e = new JspConvertEntity("RESULT");
030 * e.setTableName("GF92");
031 * e.setColumnName("NMSYORI");
032 *
033 *
034 * 継承先のクラスのexecuteメソッドでは、引数のマスタデータ情報からJSPタグの文字列を生成する処理を実装します。
035 *
036 * @author Takeshi.Takada
037 *
038 */
039public final class JspCreateFactory {
040
041        /** 作成するクラスのベースとなる文字列  {@value} */
042        private static final String CLS_BASE = "org.opengion.plugin.develop.JspCreate_" ;
043
044        /**
045         * プライベート デフォルトコンストラクタ
046         *
047         * このクラスはファクトリクラスであり、インスタンスの作成を禁止します。
048         */
049        private JspCreateFactory() {}
050
051        /**
052         * コンストラクタ(メイン)
053         *
054         * 引数のキー文字列を使用して、新しい JspParserFilter オブジェクトを作成します。
055         * 基準文字列は、"org.opengion.plugin.develop.JspCreate_" です。
056         *
057         * @param       key             JspCreate_****の****部分
058         * @param       master  マスタデータ情報のMap
059         *
060         * @return      新しく作成されたJspParserFilter
061         */
062        public static JspParserFilter newInstance( final String key , final Map<String,List<JspConvertEntity>> master ) {
063
064                final AbstractJspCreate jspGen = (AbstractJspCreate)StringUtil.newInstance( CLS_BASE + key );
065
066                jspGen.init( master );
067
068                return jspGen ;
069        }
070}