public abstract class AbstractConnect extends Object implements ConnectIF
XXXConnect -host=サーバー -user=ユーザー -passwd=パスワード -remoteFile=接続先のファイル名 [-localFile=ローカルのファイル名] [-command=[GET/PUT/DEL/GETDIR/PUTDIR/DELDIR] ] [-display=[true/false] ] ・・・・ -host=サーバー :接続先のサーバーのアドレスまたは、サーバー名 -user=ユーザー :接続するユーザー名 -passwd=パスワード :接続するユーザーのパスワード -remoteFile=接続先のファイル名 :接続先のサーバー側のファイル名。PUT,GET 関係なくFTP側として指定します。 [-localFile=ローカルのファイル名] :ローカルのファイル名。PUT,GET 関係なくローカルファイルを指定します。 [-port=ポート ] :接続するサーバーのポートを指定します。 [-command=[GET/PUT/DEL] ] :サーバー側での処理の方法を指定します。 [GETDIR/PUTDIR/DELDIR]] GET:FTP⇒LOCAL、PUT:LOCAL⇒FTP への転送です(初期値:GET) DEL:FTPファイルを削除します。 GETDIR,PUTDIR,DELDIR 指定のフォルダ以下のファイルを処理します。 [-mkdirs=[true/false] ] :受け側ファイル(GET時:LOCAL、PUT時:サーバー)にディレクトリを作成するかどうか(初期値:true) (false:ディレクトリが無ければ、エラーにします。) [-encode=エンコード名 ] :日本語ファイル名などのエンコード名を指定します(初期値:Windows-31J) [-timeout=タイムアウト[秒] ] :Dataタイムアウト(初期値:600 [秒]) [-display=[false/true] ] :trueは、検索状況を表示します(初期値:false) [-debug=[false|true] ] :デバッグ情報を標準出力に表示する(true)かしない(false)か(初期値:false[表示しない])
5.1.6.0 (2010/05/01) 新規追加 |
修飾子とタイプ | フィールドと説明 |
---|---|
static String |
CR |
static boolean |
FLAG_NG
異常フラグ false
|
static boolean |
FLAG_OK
正常フラグ true
|
protected String |
host
サーバー
|
protected boolean |
isDebug
デバッグ情報を表示するかどうか
|
protected boolean |
isDisplay
検索状況を表示するかどうか
|
protected boolean |
isMkdirs
ディレクトリを作成するかどうか
|
protected String |
passwd
パスワード
|
protected String |
port
ポート
|
protected int |
timeout
Dataタイムアウト
|
static int |
TIMEOUT
Dataタイムアウト(初期値:600 [秒])
|
protected String |
user
ユーザー
|
コンストラクタと説明 |
---|
AbstractConnect() |
修飾子とタイプ | メソッドと説明 |
---|---|
void |
action(String command,
String localFile,
String remoteFile)
command , localFile , remoteFile を元に、FTP処理を行います。
|
protected abstract void |
actionDEL(String remoteFile)
command="DEL" が指定されたときの処理を行います。
|
protected abstract void |
actionDELdir(String remoteDir)
command="DELDIR" が指定されたときの処理を行います。
|
protected abstract void |
actionGET(String localFile,
String remoteFile)
command="GET" が指定されたときの処理を行います。
|
protected abstract void |
actionGETdir(String localDir,
String remoteDir)
command="GETDIR" が指定されたときの処理を行います。
|
protected abstract void |
actionPUT(String localFile,
String remoteFile)
command="PUT" が指定されたときの処理を行います。
|
protected void |
actionPUTdir(String localDir,
String remoteDir)
command="PUTDIR" が指定されたときの処理を行います。
|
protected String |
addFile(String dir,
String file)
ディレクトリとファイル名を合成します。
|
abstract void |
connect()
サーバーへの接続、ログインを行います。
|
abstract void |
disconnect()
サーバーとの接続をクローズします。
|
protected void |
errAppend(Object... msgs)
処理中に発生したエラーメッセージをセットします。
|
protected void |
errAppend(Object msg)
処理中に発生したエラーメッセージをセットします。
|
String |
getErrMsg()
処理中に発生したエラーメッセージを取り出します。
|
protected String |
getPort()
ポートを取得します。
|
protected int |
getPort(int defPort)
ポートを取得します。
|
protected void |
makeLocalDir(String localFile)
ローカルファイルのディレクトリを作成します。
|
void |
setDebug(boolean isDebug)
デバッグ情報の表示可否 を設定します(初期値:false:表示しない)。
|
void |
setDisplay(boolean isDisplay)
実行状況の表示可否 を設定します(初期値:false:表示しない)。
|
void |
setHostUserPass(String host,
String user,
String passwd)
サーバーの、ホスト、ユーザー、パスワードを設定します。
|
void |
setMkdirs(boolean isMkdirs)
それぞれの受け側ファイルにディレクトリを作成するかどうか(初期値:true:作成する)。
|
void |
setPort(String port)
接続に利用するポート番号を設定します。
|
void |
setTimeout(int timeout)
タイムアウトを秒で指定します(初期値:600 [秒])。
|
public static final String CR
public static final boolean FLAG_OK
public static final boolean FLAG_NG
public static final int TIMEOUT
protected String host
protected String user
protected String passwd
protected String port
protected boolean isMkdirs
protected int timeout
protected boolean isDisplay
protected boolean isDebug
public void action(String command, String localFile, String remoteFile)
action
インタフェース内 ConnectIF
command
- GET:HOST⇒LOCAL 、PUT:LOCAL⇒HOST 、DEL:HOSTファイルを削除localFile
- ローカルのファイル名remoteFile
- HOST接続先のファイル名RuntimeException
public abstract void disconnect()
disconnect
インタフェース内 ConnectIF
protected abstract void actionGET(String localFile, String remoteFile) throws Exception
localFile
- ローカルのファイル名remoteFile
- 接続先のファイル名Exception
protected abstract void actionGETdir(String localDir, String remoteDir) throws Exception
localDir
- ローカルのディレクトリ名remoteDir
- 接続先のディレクトリ名IOException
Exception
protected abstract void actionPUT(String localFile, String remoteFile) throws Exception
localFile
- ローカルのファイル名remoteFile
- 接続先のファイル名Exception
protected void actionPUTdir(String localDir, String remoteDir) throws Exception
localDir
- ローカルのディレクトリ名remoteDir
- 接続先のディレクトリ名Exception
5.3.7.0 (2011/07/01) フォルダにアクセスできない場合は、エラーを返します。 |
protected abstract void actionDEL(String remoteFile) throws Exception
remoteFile
- 接続先のファイル名Exception
protected abstract void actionDELdir(String remoteDir) throws Exception
remoteDir
- 接続先のディレクトリ名Exception
protected void makeLocalDir(String localFile) throws IOException
localFile
- ローカルのファイル名IOException
- , RuntimeExceptionprotected String addFile(String dir, String file)
dir
- ディレクトリ名file
- ファイル名public void setHostUserPass(String host, String user, String passwd)
setHostUserPass
インタフェース内 ConnectIF
host
- サーバーuser
- ユーザーpasswd
- パスワードpublic void setPort(String port)
protected String getPort()
protected int getPort(int defPort)
defPort
- port が null の場合の初期値public void setMkdirs(boolean isMkdirs)
public void setTimeout(int timeout)
setTimeout
インタフェース内 ConnectIF
timeout
- タイムアウト[秒]RuntimeException
- タイムアウトの指定が大きすぎた場合public void setDisplay(boolean isDisplay)
setDisplay
インタフェース内 ConnectIF
isDisplay
- 実行状況の表示可否public void setDebug(boolean isDebug)
protected void errAppend(Object msg)
msg
- メッセージ化したいオブジェクトprotected void errAppend(Object... msgs)
msgs
- Object...Webアプリケーションフレームワーク openGionCopyright (c) 2009 The openGion Project.