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.fukurou.xml; 017 018/** 019 * このクラスは、HybsXMLHandler に設定する Listener インターフェースです。 020 * これは、HybsXMLHandler#setTagElementListener( TagElementListener ) することで、 021 * ROW 毎に 内部情報を TagElement オブジェクト化し、action( TagElement ) 022 * が呼び出されます。この Listener を介して、1レコードずつ処理することが 023 * 可能です。 024 * 025 * この Listener を implements したクラスを個別に作成することで、 026 * XML処理を、プラグイン可能にします。 027 * 028 * @version 4.0 029 * @author Kazuhiko Hasegawa 030 * @since JDK5.0, 031 */ 032public interface TagElementListener { 033 034 /** 035 * <ROWSET> タグの一番最初に呼び出されます。 036 * ROWSET の属性である、table 属性と、dbid 属性 を、TagElement の 037 * get メソッドで取得できます。 038 * 取得時のキーは、それぞれ、"TABLE" と "DBID" です。 039 * 040 * @param tag タグエレメント 041 * @see org.opengion.fukurou.xml.TagElement 042 * @see HybsXMLHandler#setTagElementListener( TagElementListener ) 043 */ 044 void actionInit( TagElement tag ) ; 045 046 /** 047 * <ROW> タグの endElement 処理毎に呼び出されます。 048 * この Listener をセットすることにより、行データを取得都度、 049 * TagElement オブジェクトを作成し、このメソッドが呼び出されます。 050 * 051 * @param tag タグエレメント 052 * @see org.opengion.fukurou.xml.TagElement 053 * @see HybsXMLHandler#setTagElementListener( TagElementListener ) 054 */ 055 void actionRow( TagElement tag ) ; 056 057 /** 058 * <EXEC_SQL> タグの endElement 処理毎に呼び出されます。 059 * getBody メソッドを使用して、このタグのBODY部の文字列を取得します。 060 * この Listener をセットすることにより、EXEC_SQL データを取得都度、 061 * TagElement オブジェクトを作成し、このメソッドが呼び出されます。 062 * 063 * @param tag タグエレメント 064 * @see org.opengion.fukurou.xml.TagElement 065 * @see HybsXMLHandler#setTagElementListener( TagElementListener ) 066 */ 067 void actionExecSQL( TagElement tag ) ; 068 069 /** 070 * <MERGE_SQL> タグの endElement 処理時に呼び出されます。 071 * getBody メソッドを使用して、このタグのBODY部の文字列を取得します。 072 * MERGE_SQLタグは、マージ処理したいデータ部よりも上位に記述しておく 073 * 必要がありますが、中間部に記述しても構いません。ただし、1回のみです。 074 * このタグが現れるまでは、INSERT のみ実行されます。このタグ以降は、 075 * 一旦 UPDATE し、結果が 0件の場合は、INSERTする流れになります。 076 * 完全に INSERT のみであるデータを前半に、UPDATE/INSERTを行う 077 * データを後半に、その間に、MERGE_SQL タグを入れることで、無意味な 078 * UPDATE を避けることが可能です。 079 * この Listener をセットすることにより、MERGE_SQL データを取得都度、 080 * TagElement オブジェクトを作成し、このメソッドが呼び出されます。 081 * 082 * @param tag タグエレメント 083 * @see org.opengion.fukurou.xml.TagElement 084 * @see HybsXMLHandler#setTagElementListener( TagElementListener ) 085 */ 086 void actionMergeSQL( TagElement tag ) ; 087}