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.taglib;
017    
018    import org.opengion.hayabusa.common.HybsSystem;
019    import org.opengion.hayabusa.common.HybsSystemException;
020    import org.opengion.fukurou.util.FileString;
021    import org.opengion.fukurou.util.FileUtil;
022    
023    import org.opengion.fukurou.util.StringUtil ;
024    import static org.opengion.fukurou.util.StringUtil.nval ;
025    
026    import java.io.File;
027    import java.io.InputStream;
028    import java.io.IOException;
029    
030    /**
031     * å�?¨®アクションを指定して、ファイル関連の操作をおこなã�?‚¿グですã?
032     *
033     * å�?¨®アクション に応じた振るè?ã�?‚’行いますã?
034     * 結果につã�?�¦は、false の場合ã?、body 要ç´?‚’表示して、終äº?�—ますã?
035     * これは、BODYにエラーメãƒ?‚»ージを書ã�?�¦おくことを想定した作りになってã�?�¾すã?
036    
037     * 判定結果を反転したã�??合ã?、notEquals 属æ?を使用してください。またã?
038     * 結果に応じて、å?ç�?‚’止めたくなã�??合ã?、useStop 属æ?ã‚?false にæŒ?®šすることでã€?
039     * 後続å?ç�?‚’実行できますã?
040     *
041     * [å�?¨®アクション]
042     *       canRead          読み込めるかどã�?�‹を判定ã?
043     *       canWrite         変更できるかどã�?�‹判定ã?
044     *       createNewFile    空の新しいファイルを不可åˆ?(atomic) に生æ?ã€?そã?ファイルがまã�?­˜在しなã�??合だã�?
045     *       delete           ファイルまたã?ãƒ?‚£レクトリを削除ã€?
046     *       renameTo         ファイルまたã?ãƒ?‚£レクトリ名を変更ã€?
047     *       exists           ファイルが存在するかどã�?�‹判定ã?
048     *       isDirectory      ファイルがディレクトリであるかどã�?�‹判定ã?
049     *       isFile           ファイルが普通ã?ファイルかどã�?�‹判定ã?
050     *       isHidden         ファイルが隠しファイルかどã�?�‹判定ã?
051     *       mkdir            ãƒ?‚£レクトリを生成ã?
052     *       mkdirs           ãƒ?‚£レクトリをè¤?•°生æ?ã€?
053     *       read             ファイルを読み込んでjspWriterに出åŠ?
054     *       existsLength     ファイルサイズが0Byte以上ã?ファイルが存在するかどã�?�‹判定ã?
055     *       copy             ファイルまたã?ãƒ?‚£レクトリをコピã?(file1 â‡?file2 にコピã?)ã€?
056     *
057     * @og.formSample
058     * ●形式ï¼?lt;og:file action="…" fileURL="…" >?¥?¥?¥</og:file>
059     * ●body?šあã‚?EVAL_BODY_INCLUDE:BODYをインクルードし、{@XXXX} は解析しません)
060     *
061     * ●Tag定義??
062     *   <og:file
063     *       action           ○ã?TAG】アクション(canRead,canWrite,createNewFile,delete,exists,isDirectory,isFile,isHidden,mkdir,mkdirs)を指定しまã�?å¿??)ã€?
064     *       fileURL            【TAG】操作するファイルのãƒ?‚£レクトリを指定しまã�?(初期値:FILE_URL[=filetemp/])
065     *       file1              【TAG】基準となるファイル名をæŒ?®šしまã�?コマンドã?左辺のファイル名でã�?
066     *       file2              【TAG】å?ç�?µ�果となるファイル名をæŒ?®šしまã�?コマンドã?右辺のファイル名でã�?
067     *       notEquals          【TAG】判定結果を反転させるかどã�?�‹[true/false]を指定しまã�?初期値:false)
068     *       useStop            【TAG】エラーæ™?ODYをå?ç�?¾Œに停止するかどã�?�‹[true/false]を指定しまã�?初期値:true)
069     *       encode             【TAG】ファイルを読み込ã‚?action="READ")際ã?エンコードをæŒ?®šしまã�?初期値:OS依存文字コーãƒ?
070     *       debug              【TAG】デバッグæƒ??をå?力するかどã�?�‹[true/false]を指定しまã�?初期値:false)
071     *   >   ... Body ...
072     *   </og:file>
073     *
074     * ●使用ä¾?
075     *    ・ファイルの存在チェãƒ?‚¯→存在しなければエラーメãƒ?‚»ージを表示ã€?
076     *        <og:file action="exists" fileURL="N:/CIR/" file1="{@USER.LKISB}/{@USER.LDNO1KAI}.cir/001.sht">
077     *            <og:message lbl="RKE_0157" comment="回路図が存在しませんã€? />
078     *        </og:file>
079     *
080     *    ・N:/Filetemp/にユーザーãƒ?‚£レクトリが存在しなければ作æ?。â?失敗したå?合エラーメãƒ?‚»ージを表示ã€?
081     *        <og:file action="mkdir" fileURL="N:/Filetemp/{@USER.ID}" >
082     *            <og:message comment="エラーが発生しました。シスãƒ?ƒ 管ç�??に連絡してくださいã€? />
083     *        </og:file>
084     *
085     *    ・N:/Filetemp/test.txt ファイルの削除。ファイルが存在しなくてもå?ç�?‚’続けるã?
086     *        <og:file action="delete" fileURL="N:/Filetemp/" file1="test.txt" useStop="false" >
087     *            <og:message comment="ファイルは存在しませんでしたã€? />
088     *        </og:file>
089     *
090     * @og.group そã?他部å“?
091     *
092     * @version  4.0
093     * @author       Kazuhiko Hasegawa
094     * @since    JDK5.0,
095     */
096    public class FileTag extends CommonTagSupport {
097            //* こã?プログラãƒ??VERSIONæ–?­—å?を設定しますã?       {@value} */
098            private static final String VERSION = "5.7.1.1 (2013/12/13)" ;
099    
100            private static final long serialVersionUID = 571120131213L ;
101    
102            /** action 引数に渡す事ã?出来ã‚?アクションコマンãƒ? 読み込めるかどã�?�‹ {@value} */
103            public static final String ACT_CANREAD  = "canRead" ;
104            /** action 引数に渡す事ã?出来ã‚?アクションコマンãƒ? 変更できるかどã�?�‹ {@value} */
105            public static final String ACT_CANWRITE    = "canWrite" ;
106            /** action 引数に渡す事ã?出来ã‚?アクションコマンãƒ? 空の新しいファイルを不可åˆ?(atomic) に生æ?しまã�?(そã?ファイルがまã�?­˜在しなã�??合だã�?{@value} */
107            public static final String ACT_CREATENEWFILE    = "createNewFile" ;
108            /** action 引数に渡す事ã?出来ã‚?アクションコマンãƒ? ファイルまたã?ãƒ?‚£レクトリを削除{@value}      */
109            public static final String ACT_DELETE    = "delete" ;
110            /** action 引数に渡す事ã?出来ã‚?アクションコマンãƒ? ファイルが存在するかどã�?�‹ {@value} */
111            public static final String ACT_EXISTS    = "exists" ;
112            /** action 引数に渡す事ã?出来ã‚?アクションコマンãƒ? ファイルがディレクトリであるかどã�?�‹{@value}   */
113            public static final String ACT_ISDIRECTORY        = "isDirectory" ;
114            /** action 引数に渡す事ã?出来ã‚?アクションコマンãƒ? ファイルが普通ã?ファイルかどã�?�‹{@value}       */
115            public static final String ACT_ISFILE    = "isFile" ;
116            /** action 引数に渡す事ã?出来ã‚?アクションコマンãƒ? ファイルが隠しファイルかどã�?�‹ {@value} */
117            public static final String ACT_ISHIDDEN    = "isHidden" ;
118            /** action 引数に渡す事ã?出来ã‚?アクションコマンãƒ? ãƒ?‚£レクトリを生成しますã? {@value} */
119            public static final String ACT_MKDIR    = "mkdir" ;
120            /** action 引数に渡す事ã?出来ã‚?アクションコマンãƒ? ãƒ?‚£レクトリを生成しますã? {@value} */
121            public static final String ACT_MKDIRS   = "mkdirs" ;
122            /** action 引数に渡す事ã?出来ã‚?アクションコマンãƒ? ファイル名を変更しますã? {@value} */
123            public static final String ACT_RENAMETO = "renameTo" ;          // 3.5.6.5 (2004/08/09)
124            /** action 引数に渡す事ã?出来ã‚?アクションコマンãƒ? ファイルを読み込んで表示しますã? {@value} */
125            public static final String ACT_READ     = "read" ;              // 3.6.0.0 (2004/09/25)
126            /** action 引数に渡す事ã?出来ã‚?アクションコマンãƒ? ファイルサイズが0Byte以上ã?ファイルが存在するかどã�?�‹判定ã? {@value} */
127            public static final String ACT_EXISTSLENGTH      = "existsLength" ;             // 3.8.5.2 (2006/05/31)
128            /** action 引数に渡す事ã?出来ã‚?アクションコマンãƒ? ファイルまたã?ãƒ?‚£レクトリをコピã?しますã? {@value} */
129            public static final String ACT_COPY      = "copy" ;             // 5.3.6.0 (2011/06/01)
130    
131            /** action 引数に渡す事ã?出来ã‚?コマンãƒ?リスãƒ? */
132            private static final String[] ACTION_LIST = new String[] {
133                    ACT_CANREAD , ACT_CANWRITE , ACT_CREATENEWFILE , ACT_DELETE , ACT_EXISTS , ACT_ISDIRECTORY ,
134                    ACT_ISFILE , ACT_ISHIDDEN , ACT_MKDIR , ACT_MKDIRS , ACT_RENAMETO , ACT_READ , ACT_EXISTSLENGTH , ACT_COPY };
135    
136            private String  fileURL         = HybsSystem.sys( "FILE_URL" );
137            private String  file1           = "";
138            private String  file2           = null;
139            private String  action          = null;
140            private boolean rtnCode         = false;
141    
142            private boolean notEquals       = false;        // 3.8.5.2 (2006/05/31) 判定結果を反転させて処ç�?�—ますã?
143            private boolean useStop         = true;         // 3.8.5.2 (2006/05/31) エラーæ™?ODYをå?ç�?¾Œに停止(true)するかどã�?�‹
144    
145            private String encode           = null;         // 5.1.9.0 (2010/08/01) READ時ã?エンコード指å®?
146    
147            /**
148             * Taglibの開始タグが見つかったときに処ç�?�™ã‚?doStartTag() ã‚?オーバã?ライドしますã?
149             *
150             * @og.rev 3.6.0.0 (2004/09/25) file オブジェクトã?作æ?ã‚?actionExec 移å‹?
151             * @og.rev 3.8.5.2 (2006/05/31) notEquals追åŠ?? 判定結果を反転させて処ç�?�—ますã?
152             *
153             * @return      後続å?ç�??æŒ?¤º
154             */
155            @Override
156            public int doStartTag() {
157                    try {
158                            rtnCode = notEquals ^ actionExec( action );             // 3.8.5.2 (2006/05/31) 排他的論理å’?XOR)
159                    }
160                    catch( IOException ex ) {
161                            String errMsg = "æŒ?®šã?アクションは実行できません。アクションエラー"
162                                                            + HybsSystem.CR
163                                                            + "action=[" + action + "] , "
164                                                            + "  fileURL=[" + fileURL + "]"
165                                                            + "  file1=[" + file1 + "]"
166                                                            + "  file2=[" + file2 + "]" ;
167                            throw new HybsSystemException( errMsg,ex );             // 3.5.5.4 (2004/04/15) 引数の並びé ?¤‰更
168                    }
169    
170                    if( rtnCode ) { return(SKIP_BODY); }                    // Body を評価しなã�?
171                    else {                  return( EVAL_BODY_INCLUDE ); }  // Body インクルーãƒ? extends TagSupport æ™?
172            }
173    
174            /**
175             * Taglibの終äº?‚¿グが見つかったときに処ç�?�™ã‚?doEndTag() ã‚?オーバã?ライドしますã?
176             *
177             * @og.rev 3.1.1.2 (2003/04/04) Tomcat4.1 対応ã?release2() ã‚?doEndTag()で呼ぶã€?
178             * @og.rev 3.8.5.2 (2006/05/31) useStop 追åŠ?? エラーæ™?ODYをå?ç�?¾Œに停止(true)するかどã�?�‹
179             *
180             * @return      後続å?ç�??æŒ?¤º
181             */
182            @Override
183            public int doEndTag() {
184                    debugPrint();           // 4.0.0 (2005/02/28)
185                    int rtn = ( useStop && !rtnCode ) ? SKIP_PAGE : EVAL_PAGE ;
186    
187                    return( rtn );
188            }
189    
190            /**
191             * タグリブオブジェクトをリリースしますã?
192             * キャãƒ?‚·ュされて再利用されるã?で、フィールドã?初期設定を行いますã?
193             *
194             * @og.rev 2.0.0.4 (2002/09/27) カスタãƒ?‚¿グの release() メソãƒ?ƒ‰をã?追åŠ?
195             * @og.rev 3.1.1.2 (2003/04/04) Tomcat4.1 対応ã?release2() ã‚?doEndTag()で呼ぶã€?
196             * @og.rev 3.6.0.0 (2004/09/24) columns 、tableId 、file 削除
197             * @og.rev 3.8.5.2 (2006/05/31) notEquals 、useStop 追åŠ?
198             * @og.rev 5.1.9.0 (2010/08/01) READ時ã?エンコード指å®?
199             *
200             */
201            @Override
202            protected void release2() {
203                    super.release2();
204                    fileURL         = HybsSystem.sys( "FILE_URL" );
205                    file1           = "";
206                    file2           = null;
207                    action          = null;
208                    rtnCode         = false;
209                    notEquals       = false;        // 3.8.5.2 (2006/05/31) 判定結果を反転させて処ç�?�—ますã?
210                    useStop         = true;         // 3.8.5.2 (2006/05/31) エラーæ™?ODYをå?ç�?¾Œに停止(true)するかどã�?�‹
211                    encode          = null;         // 5.1.9.0 (2010/08/01) READ時ã?エンコード指å®?
212            }
213    
214            /**
215             * アクションを実行しますã?
216             * アクションは,æŒ?®šã?アクションコマンドに対応するå?ç�?‚’入力データに
217             * 対して行いますã?
218             *
219             * @og.rev 3.0.0.0 (2002/12/25) ACTION_LIST のチェãƒ?‚¯を削除
220             * @og.rev 3.6.0.0 (2004/09/25) ACT_read を追åŠ?, file オブジェクトを移å‹?
221             * @og.rev 3.8.5.2 (2006/05/31) existsLength 追åŠ?
222             * @og.rev 4.0.0.0 (2007/11/28) メソãƒ?ƒ‰の戻りå?をチェãƒ?‚¯しますã?
223             * @og.rev 5.1.9.0 (2010/08/01) READ時ã?エンコード指å®?
224             * @og.rev 5.3.6.0 (2011/06/01) ACT_copy 対å¿?
225             * @og.rev 5.7.1.1 (2013/12/13) copyå…?file1)のファイルが存在しなければ、エラーにしますã?
226             *
227             * @param       action アクションコマンãƒ?public static final 宣è¨?�•れてã�?‚‹æ–?­—å?)
228             *
229             * @return      実行後ã?ãƒ??タ
230             */
231            private boolean actionExec( final String action ) throws IOException {
232                    String directory = HybsSystem.url2dir( fileURL );
233                    File file = new File( StringUtil.urlAppend( directory,file1 ) );
234    
235                    boolean rtnVal = false;
236                    if( action != null ) {
237                            if(      ACT_CANREAD.equalsIgnoreCase(           action ) ) { rtnVal = file.canRead(); }
238                            else if( ACT_CANWRITE.equalsIgnoreCase(          action ) ) { rtnVal = file.canWrite(); }
239                            else if( ACT_CREATENEWFILE.equalsIgnoreCase( action ) ) { rtnVal = file.createNewFile(); }
240                            else if( ACT_DELETE.equalsIgnoreCase(            action ) ) { rtnVal = file.delete(); }
241                            else if( ACT_EXISTS.equalsIgnoreCase(            action ) ) { rtnVal = file.exists(); }
242                            else if( ACT_ISDIRECTORY.equalsIgnoreCase(       action ) ) { rtnVal = file.isDirectory(); }
243                            else if( ACT_ISFILE.equalsIgnoreCase(            action ) ) { rtnVal = file.isFile(); }
244                            else if( ACT_ISHIDDEN.equalsIgnoreCase(          action ) ) { rtnVal = file.isHidden(); }
245                            else if( ACT_MKDIR.equalsIgnoreCase(             action ) ) {
246                                    if( file.isDirectory() ) { rtnVal = true; }
247                                    else { rtnVal = file.mkdir(); }
248                            }
249                            else if( ACT_MKDIRS.equalsIgnoreCase(            action ) ) { rtnVal = file.mkdirs(); }
250                            else if( ACT_RENAMETO.equalsIgnoreCase(          action ) ) {
251                                    if( file2 != null ) {
252                                            File newFile = new File( StringUtil.urlAppend( directory,file2 ) );
253    //                                      if( newFile.exists() ) { newFile.delete(); }
254                                            if( newFile.exists() && !newFile.delete() ) {
255                                                    String errMsg = "æ‰?®šã?ファイルを削除できませんでしたã€?" + newFile + "]" ;
256                                                    throw new RuntimeException( errMsg );
257                                            }
258                                            rtnVal = file.renameTo( newFile );
259                                    }
260                            }
261                            // 3.6.0.0 (2004/09/25) ACT_read を追åŠ?
262                            else if( ACT_READ.equalsIgnoreCase(                      action ) ) {
263                                    if( file.isFile() ) {
264                                            FileString fs = new FileString();
265                                            fs.setFilename( StringUtil.urlAppend( directory,file1 ) );
266                                            if( encode != null ) { fs.setEncode( encode ); } // 5.1.9.0 (2010/08/01) READ時ã?エンコード指å®?
267                                            String val = fs.getValue();
268    
269                                            jspPrint( nval( getRequestParameter( val ),"" ) );
270                                            rtnVal = true;
271                                    }
272                                    else {
273                                            String errMsg = "ファイルが存在しなã�?�‹、ファイルではありませんã€?
274                                                            + HybsSystem.CR
275                                                            + "action=[" + action + "] , "
276                                                            + "  fileURL=[" + fileURL + "]"
277                                                            + "  directory=[" + directory + "]"
278                                                            + "  file1=[" + file1 + "]" ;
279                                            throw new HybsSystemException( errMsg );
280                                    }
281                            }
282                            // 3.8.5.2 (2006/05/31) ファイルサイズが0Byte以上ã?ファイルが存在するかどã�?�‹判定ã?
283                            else if( ACT_EXISTSLENGTH.equalsIgnoreCase( action ) ) {
284                                    rtnVal = ( file.exists() && file.length() > 0L );
285                            }
286                            // 5.3.6.0 (2011/06/01) ファイルコピã?対å¿?
287                            else if( ACT_COPY.equalsIgnoreCase( action ) ) {
288                                    if( file2 != null ) {
289                                            File newFile = new File( StringUtil.urlAppend( directory,file2 ) );
290                                            if( file.isFile() ) {
291                                                    // FileUtil.copy 側で、toFile のフォルãƒ?‚’作æ?しますã?
292                                                    rtnVal = FileUtil.copy( file, newFile );
293                                            }
294                                            else if( file.isDirectory() ) {
295                                                    rtnVal = FileUtil.copyDirectry( file, newFile );
296                                            }
297                                            // 5.7.1.1 (2013/12/13) copyå…?file1)のファイルが存在しなければ、エラーにしますã?
298                                            else if( !file.exists() ) {
299                                                    String errMsg = "copyå…?file1)のファイルが存在しませんã€?
300                                                                    + HybsSystem.CR
301                                                                    + "action=[" + action + "] , "
302                                                                    + "  fileURL=[" + fileURL + "]"
303                                                                    + "  directory=[" + directory + "]"
304                                                                    + "  file1=[" + file1 + "]" 
305                                                                    + "  file2=[" + file2 + "]" ;
306                                                    throw new HybsSystemException( errMsg );
307                                            }
308                                    }
309                            }
310                    }
311                    else {
312                            String errMsg = "アクションが指定されてã�?�¾せん。アクション NULL エラー"
313                                                            + HybsSystem.CR
314                                                            + "  file=[" + file1 + "]" ;
315                            throw new HybsSystemException( errMsg );
316                    }
317    
318                    return rtnVal;
319            }
320    
321            /**
322             * 【TAG】アクション(canRead,canWrite,createNewFile,delete,exists,isDirectory,isFile,isHidden,mkdir,mkdirs)を指定しますã?
323             *
324             * @og.tag
325             * アクションは,HTMLから(get/post)æŒ?®šされますã?で,ACT_xxx で設定される
326             * フィールド定数値のã�?�¥れかをã?æŒ?®šできますã?
327             * 処ç�??結果がã?false の場合ã?、body 要ç´?‚’表示して終äº?�—ますã?
328             * useStop 属æ?と、notEquals 属æ?によって、上記ã?振るè?ã�?‚’けることが可能ですã?
329             *
330             * canRead          読み込めるかどã�?�‹を判定ã?
331             * canWrite         変更できるかどã�?�‹判定ã?
332             * createNewFile    空の新しいファイルを不可åˆ?(atomic) に生æ?ã€?そã?ファイルがまã�?­˜在しなã�??合だã�?
333             * delete           ファイルまたã?ãƒ?‚£レクトリを削除ã€?
334             * renameTo         ファイルまたã?ãƒ?‚£レクトリ名を変更ã€?
335             * exists           ファイルが存在するかどã�?�‹判定ã?
336             * isDirectory      ファイルがディレクトリであるかどã�?�‹判定ã?
337             * isFile           ファイルが普通ã?ファイルかどã�?�‹判定ã?
338             * isHidden         ファイルが隠しファイルかどã�?�‹判定ã?
339             * mkdir            ãƒ?‚£レクトリを生成ã?
340             * mkdirs           ãƒ?‚£レクトリをè¤?•°生æ?ã€?
341             * read             ファイルを読み込んでjspWriterに出åŠ?
342             * existsLength     ファイルサイズが0Byte以上ã?ファイルが存在するかどã�?�‹判定ã?
343             * copy             ファイルまたã?ãƒ?‚£レクトリをコピã?(file1 â‡?file2 にコピã?)ã€?
344             *
345             * @og.rev 3.0.0.0 (2002/12/25) ACTION_LIST のチェãƒ?‚¯を導å?
346             * @og.rev 3.5.6.2 (2004/07/05) æ–?­—å?の連結にStringBuilderを使用しますã?
347             *
348             * @param       cmd アクションæ–?­—å?
349             * @see         <a href="../../../../constant-values.html#org.opengion.hayabusa.taglib.FileTag.ACT_canRead">アクション定数</a>
350             */
351            public void setAction( final String cmd ) {
352                    action = getRequestParameter( cmd );
353    
354                    if( ! check( action, ACTION_LIST ) ) {
355    
356                            StringBuilder errMsg = new StringBuilder( HybsSystem.BUFFER_MIDDLE );
357                            errMsg.append( "æŒ?®šã?アクションは実行できません。アクションエラー" );
358                            errMsg.append( HybsSystem.CR );
359                            errMsg.append( "action=[" ).append( action ).append( "] " );
360                            errMsg.append( HybsSystem.CR );
361    
362                            for( int i=0; i<ACTION_LIST.length; i++ ) {
363                                    errMsg.append( " | " );
364                                    errMsg.append( ACTION_LIST[i] );
365                            }
366                            errMsg.append( " | " );
367                            throw new HybsSystemException( errMsg.toString() );
368                    }
369            }
370    
371            /**
372             * 【TAG】操作するファイルのãƒ?‚£レクトリを指定しまã�?
373             *              (初期値:FILE_URL[={@og.value org.opengion.hayabusa.common.SystemData#FILE_URL}])ã€?
374             *
375             * @og.tag
376             * こã?属æ?でæŒ?®šされるãƒ?‚£レクトリのファイルを操作しますã?
377             * æŒ?®š方法ã?ã€??常の fileURL 属æ?と同様に、å?頭がã?'/' (UNIX) またã?ã€?¼’文字目がã?
378             * ":" (Windows)の場合ã?、指定ã?URLそã?ままのãƒ?‚£レクトリに、そã�?�§なã�??合ã?ã€?
379             * (初期値:シスãƒ?ƒ 定数のFILE_URL[={@og.value org.opengion.hayabusa.common.SystemData#FILE_URL}])ã€?
380             *
381             * @og.rev 4.0.0.0 (2005/01/31) urlAppend メソãƒ?ƒ‰の利用
382             * @og.rev 4.0.0.0 (2007/11/20) æŒ?®šされたãƒ?‚£レクトリ名ã?æœ?¾Œが"\"or"/"で終わってã�?�ªã�??合にã€?/"を付加するã€?
383             *
384             * @param       url ファイルURL
385             * @see         org.opengion.hayabusa.common.SystemData#FILE_URL
386             */
387            public void setFileURL( final String url ) {
388                    String furl = nval( getRequestParameter( url ),null );
389                    if( furl != null ) {
390                            char ch = furl.charAt( furl.length()-1 );
391                            if( ch != '/' && ch != '\\' ) { furl = furl + "/"; }
392                            fileURL = StringUtil.urlAppend( fileURL,furl );
393                    }
394            }
395    
396            /**
397             * 【TAG】基準となるファイル名をæŒ?®šしまã�?コマンドã?左辺のファイル名でã�?ã€?
398             *
399             * @og.tag
400             * コマンドã?左辺のファイル名ですã?
401             *
402             * @param       fname ファイル名ï¼?
403             */
404            public void setFile1( final String fname ) {
405                    file1 = nval( getRequestParameter( fname ),file1 );
406            }
407    
408            /**
409             * 【TAG】å?ç�?µ�果となるファイル名をæŒ?®šしまã�?コマンドã?右辺のファイル名でã�?ã€?
410             *
411             * @og.tag
412             * コマンドã?右辺のファイル名ですã?
413             *
414             * @param       fname ファイル名ï¼?
415             */
416            public void setFile2( final String fname ) {
417                    file2 = nval( getRequestParameter( fname ),file2 );
418            }
419    
420            /**
421             * 【TAG】判定結果を反転させるかどã�?�‹[true/false]を指定しまã�?初期値:false)ã€?
422             *
423             * @og.tag
424             * 通常の判定結果において、不æ?ç«?false)の場合に、BODY を実行しますã?
425             * 通常の処ç�?µ�果の正反対の処ç�?‚’行いますã?
426             * 初期値はã€??常 (true 以å¤?ですã?
427             *
428             * @og.rev 3.8.5.2 (2006/05/31) 新規追åŠ?
429             *
430             * @param   flag  [true:反転する/それ以å¤?通常]
431             */
432            public void setNotEquals( final String flag ) {
433                    notEquals = nval( getRequestParameter( flag ),notEquals );
434            }
435    
436            /**
437             * 【TAG】エラーæ™?ODYをå?ç�?¾Œに停止するかどã�?�‹[true/false]を指定しまã�?初期値:true)ã€?
438             *
439             * @og.tag
440             * 処ç�?µ�果などに応じて、以下ã?処ç�?‚’停止したã�??合に、使用しますã?
441             * 通常は、条件を判定後ã?false の場合に、BODY部をå?åŠ?処ç�?した後にã€?
442             * 処ç�?‚’停止しますã?(useStop="true")
443             * false を指定すると、判定結果に無関係に、以下ã?処ç�?‚’実行しますã?
444             * 処ç�??継続したいがã?警告表示する場合に、useStop="false" を指定しますã?
445             * 初期値は、停止する ("true")ですã?
446             *
447             * @og.rev 3.8.5.2 (2006/05/31) 新規追åŠ?
448             *
449             * @param   flag  [true:判定すã‚?それ以å¤?しない]
450             */
451            public void setUseStop( final String flag ) {
452                    useStop = nval( getRequestParameter( flag ),useStop );
453            }
454    
455            /**
456             * 【TAG】ファイルを読み込ã‚?action="READ")際ã?エンコードをæŒ?®šしまã�?初期値:OS依存文字コーãƒ?ã€?
457             *
458             * @og.tag
459             * ファイルを読み込ã‚?action="READ")際ã?エンコードをæŒ?®šしますã?
460             * action="READ"以外å?合には、この属æ?値は利用されませんã€?
461             * æŒ?®šしなã�??合ã?、OS依存文字コードで読み込まれますã?
462             *
463             * @og.rev 5.1.9.0 (2010/08/01) 新規作æ?
464             *
465             * @param   enc ファイル読み込みのエンコーãƒ?
466             */
467            public void setEncode( final String enc ) {
468                    encode = nval( getRequestParameter( enc ),encode );
469            }
470    
471            /**
472             * こã?オブジェクトã?æ–?­—å?表現を返しますã?
473             * 基本çš?�«ãƒ?ƒ�ãƒ?‚°目çš?�«使用しますã?
474             *
475             * @return こã?クラスのæ–?­—å?表現
476             */
477            @Override
478            public String toString() {
479                    return org.opengion.fukurou.util.ToString.title( this.getClass().getName() )
480                                    .println( "VERSION"             ,VERSION        )
481                                    .println( "fileURL"             ,fileURL        )
482                                    .println( "file1"               ,file1          )
483                                    .println( "file2"               ,file2          )
484                                    .println( "action"              ,action         )
485                                    .println( "rtnCode"             ,rtnCode        )
486                                    .println( "notEquals"   ,notEquals      )
487                                    .println( "useStop"             ,useStop        )
488                                    .println( "Other..."    ,getAttributes().getAttribute() )
489                                    .fixForm().toString() ;
490            }
491    }