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.fukurou.transfer;
017
018 import org.opengion.fukurou.util.StringUtil;
019
020 /**
021 * 伝é?要求に対してのHTTP経由でファイルの絶対パスのリストを行いますã?
022 *
023 * 読取対象はã€?スキャン対象のファイルまたã?ãƒ?‚£レクトリ) ([プロトコル]://[ホスト名]:[ポã?ト番号]/[コンãƒ?‚スト名]/)
024 * の形式でæŒ?®šしますã?
025 *
026 * ä¾?読取対象 : C:\FOLDER\ http://localhost:8824/gf/
027 *
028 * そã?他ã?処ç�??容につã�?�¦は、{@link org.opengion.fukurou.transfer.TransferRead_HTTP}及ã?
029 * {@link org.opengion.fukurou.transfer.TransferRead_FILELIST}のJavaDocを参照して下さã�??
030 *
031 * @og.group 伝é?シスãƒ?ƒ
032 *
033 * @version 5.0
034 * @author Hiroki.Nakamura
035 * @since JDK1.6
036 */
037 public class TransferRead_HTTP_FILELIST extends TransferRead_HTTP {
038
039 private String remoteHost = null; // リモート接続å?URL
040 private String remoteReadObj = null; // リモート接続å?の読取対象
041
042 /**
043 * ローカルの読取対象をã?リモート接続å?の読取対象とリモート接続å?URLにåˆ?§£しますã?
044 *
045 * @param localReadObj ローカルの読取対象
046 */
047 @Override
048 protected void splitReadObj( final String localReadObj ) {
049 String[] obj = StringUtil.csv2Array( localReadObj, ' ' );
050 if( obj.length < 2 ) {
051 String errMsg = "読取対象はã€?ファイルまたã?ãƒ?‚£レクトリ) ([プロトコル]://[ホスト名]:[ポã?ト番号]/[コンãƒ?‚スト名]/) の形式でæŒ?®šして下さã�??[READOBJ=" + localReadObj + "]";
052 throw new RuntimeException( errMsg );
053 }
054 String file = obj[0];
055 remoteHost = obj[1];
056 if( file == null || file.length() == 0
057 || remoteHost == null || remoteHost.length() == 0 ) {
058 String errMsg = "読取対象はã€?ファイルまたã?ãƒ?‚£レクトリ) ([プロトコル]://[ホスト名]:[ポã?ト番号]/[コンãƒ?‚スト名]/) はå¿??ですã?[READOBJ=" + localReadObj + "]";
059 throw new RuntimeException( errMsg );
060 }
061
062 remoteReadObj = file;
063 }
064
065 /**
066 * リモート接続å?URLを返しますã?
067 * こã?メソãƒ?ƒ‰は、{@link #splitReadObj(String)}の後に呼び出しするå¿?¦�がありますã?
068 *
069 * @return リモート接続å?URL
070 */
071 @Override
072 public String getRemoteHost() {
073 if( remoteHost == null || remoteHost.length() == 0 ) {
074 String errMsg = "先に#splitReadObj(String)を実行して下さã�?;
075 throw new RuntimeException( errMsg );
076 }
077 return remoteHost;
078 }
079
080 /**
081 * リモート接続å?の読取対象を返しますã?
082 * こã?メソãƒ?ƒ‰は、{@link #splitReadObj(String)}の後に呼び出しするå¿?¦�がありますã?
083 *
084 * @return 接続URL
085 */
086 @Override
087 public String getRemoteReadObj() {
088 if( remoteHost == null || remoteHost.length() == 0 ) {
089 String errMsg = "先に#splitReadObj(String)を実行して下さã�?;
090 throw new RuntimeException( errMsg );
091 }
092 return remoteReadObj;
093 }
094 }