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