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 */
016 package org.opengion.fukurou.util;
017
018 import java.util.Map;
019 import java.util.WeakHashMap;
020
021 /**
022 * HybsLoaderを生成するため?ファクトリクラスです?
023 * HybsLoaderは、ソース?レクトリをキーとして、キャ?ュされます?
024 *
025 * @og.rev 5.1.1.0 (2009/12/01) 新規作?
026 * @og.group 業務ロジ?
027 *
028 * @version 5.0
029 * @author Hiroki Nakamura
030 * @since JDK1.6,
031 */
032 final public class HybsLoaderFactory {
033
034 private static final Map<String,HybsLoader> loaderMap = new WeakHashMap<String,HybsLoader>();
035
036 /**
037 * オブジェクト?生?を禁止します?
038 */
039 private HybsLoaderFactory() {}
040
041 /**
042 * HybsLoaderオブジェクトを取得します?
043 *
044 * @param option HybsLoaderを生成するため?設定情報
045 *
046 * @return HybsLoaderオブジェク?
047 */
048 public static HybsLoader getLoader( final HybsLoaderConfig option ) {
049 HybsLoader loader = null;
050 synchronized( HybsLoaderFactory.class ) {
051 loader = loaderMap.get( option.getSrcDir() );
052 if( loader == null ) {
053 loader = new HybsLoader( option );
054 }
055 loaderMap.put( option.getSrcDir(), loader );
056 }
057 return loader;
058 }
059 }