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.hayabusa.db; 017 018 import org.opengion.hayabusa.common.HybsSystem; 019 020 /** 021 * Queryオブジェクトを取得する為に使用する?ファクトリクラスです? 022 * 023 * Queryオブジェク?の識別ID を?に、QueryFactory.newInstance( String id ) 024 * メソ?で?Queryオブジェクトを取得します? 025 * <del>QueryFactory.close( Query query ) メソ?で??部? QueryFactory に 026 * オブジェクトを戻す事によって,Queryオブジェクト?プ?リングを行なって?す?</del> 027 * 028 * 実?マッピングの関係か?識別ID は、シス?パラメータ で 定義しま? 029 * <del>大前提として、ユーザー共通で使用することを?えており,ユーザー個別にプ?ル 030 * する?があるなら?, HttpSession オブジェクトに登録すべきです?</del> 031 * 032 * @og.rev 3.6.0.8 (2004/11/19) キャ?ュ()ではなく?オブジェクトを直接生?します? 033 * @og.group ??タ表示 034 * @og.group ??タ編? 035 * 036 * @version 4.0 037 * @author Kazuhiko Hasegawa 038 * @since JDK5.0, 039 */ 040 public final class QueryFactory { 041 // 3.1.0.0 (2003/03/20) Hashtable を使用して??で?同期でも構わな??を?HashMap に置換え? 042 /** newInstance() 時??ォルトクラス {@value} */ 043 public static final String DEFAULT = "JDBC" ; 044 045 /** 046 * ?ォルトコンストラクターをprivateにして? 047 * オブジェクト?生?をさせな??する? 048 * 049 */ 050 private QueryFactory() { 051 } 052 053 /** 054 * 標準的な Queryオブジェク?JDBCQuery)を取得します? 055 * 過去に使用され?Queryオブジェク?はプ?ルから取得されます? 056 * ただし??変数はすべてクリアされます?で??取り出した 057 * オブジェクトを保持した??合??各アプリケーション側で保持して下さ?? 058 * 059 * @return Queryオブジェク? 060 */ 061 public static Query newInstance() { 062 return newInstance( DEFAULT ); 063 } 064 065 /** 066 * 識別id に応じ?Queryオブジェクトを取得します? 067 * 過去に使用され?Queryオブジェク?はプ?ルから取得されます? 068 * ただし??変数はすべてクリアされます?で??取り出した 069 * オブジェクトを保持した??合??各アプリケーション側で保持して下さ?? 070 * 071 * @og.rev 3.6.0.8 (2004/11/19) キャ?ュ?。直接生?します? 072 * @og.rev 4.0.0.0 (2005/01/31) キーの?を、Query. から、Query_ に変更します? 073 * @og.rev 5.3.7.0 (2011/07/01) ゼロ???efaultを適用 074 * 075 * @param id Queryインターフェースを実?たサブクラスの識別id 076 * 077 * @return Queryオブジェク? 078 */ 079 public static Query newInstance( final String id ) { 080 // String type = ( id == null ) ? DEFAULT : id ; 081 String type = ( id == null || id.length() == 0 ) ? DEFAULT : id ; 082 return (Query)HybsSystem.newInstance( HybsSystem.sys( "Query_" + type ) ); 083 } 084 085 /** 086 * Queryオブジェクトをプ?ルに戻します? 087 * newInstance でオブジェクトを取り出す方法によっては、close() する?をなくす 088 * ことができますが、現状はこ?メソ?でオブジェクトをプ?ルに戻してください? 089 * オブジェクトを?個貸し?して?場?close() で戻すとすでに同じキーの 090 * 別のオブジェクトが存在する?そ?場合?,先?オブジェクト?破?れます? 091 * 092 * @og.rev 3.5.6.2 (2004/07/05) メソ?名がまぎらわし?、変更します? 093 * @og.rev 3.6.0.8 (2004/11/19) キャ?ュ?? 094 * @og.rev 4.0.0.0 (2005/01/31) Queryの、close() 処?呼び出しておきます? 095 * 096 * @param query Queryオブジェク? 097 */ 098 public static void close( final Query query ) { 099 if( query != null ) { query.close(); } // 4.0.0 (2005/01/31) 100 } 101 102 /** 103 * Queryオブジェクトをプ?ルからすべて削除します? 104 * シス?全体を初期化するときや、動作が不安定になったときに行います? 105 * プ?ルの方法?体が,?のキャ?ュ?使?たしかして??, 106 * 実行中でも??でも?ールを?期化できます? 107 * 108 * @og.rev 3.6.0.8 (2004/11/19) キャ?ュ?。メソ?も?します? 109 */ 110 public static void clear() { 111 // ここでは処?行いません? 112 } 113 }