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