|
|
|||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
java.lang.Objectorg.opengion.fukurou.util.AbstractConnect
public abstract class AbstractConnect
AbstractConnect.java は、共通的に使用される ファイル伝送関連の基本機能を実装した、Abstractクラスです。 -host=サーバー -user=ユーザー -passwd=パスワード -remoteFile=接続先のファイル名 を必須設定します。 -localFile=ローカルのファイル名は、必須ではありませんが、-command=DEL の場合にのみ不要であり、 それ以外の command の場合は、必要です。 -command=[GET/PUT/DEL/GETDIR/PUTDIR/DELDIR] は、サーバーに対しての処理の方法を指定します。 GET:サーバーからローカルにファイル転送します(初期値) PUT:ローカルファイルをサーバーに PUT(STORE、SAVE、UPLOAD、などと同意語)します。 DEL:サーバーの指定のファイルを削除します。この場合のみ、-localFile 属性の指定は不要です。 GETDIR,PUTDIR,DELDIR:指定のフォルダ以下のファイルを処理します。 -mkdirs=[true/false] は、受け側のファイル(GET時:LOCAL、PUT時:サーバー)に取り込むファイルのディレクトリが 存在しない場合に、作成するかどうかを指定します(初期値:true) 通常、サーバーに、フォルダ階層を作成してPUTする場合、動的にフォルダ階層を作成したいケースで便利です。 逆に、フォルダは確定しており、指定フォルダ以外に PUT するのはバグっていると事が分かっている場合には false に設定して、存在しないフォルダにPUT しようとすると、エラーになるようにします。 引数文字列中に空白を含む場合は、ダブルコーテーション("") で括って下さい。 引数文字列の 『=』の前後には、空白は挟めません。必ず、-key=value の様に 繋げてください。
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 [秒])。 |
クラス java.lang.Object から継承されたメソッド |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
フィールドの詳細 |
---|
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 AbstractConnect()
メソッドの詳細 |
---|
public abstract void connect()
ConnectIF
内の connect
public void action(String command, String localFile, String remoteFile)
ConnectIF
内の action
command
- GET:HOST⇒LOCAL 、PUT:LOCAL⇒HOST 、DEL:HOSTファイルを削除localFile
- ローカルのファイル名remoteFile
- HOST接続先のファイル名public abstract void disconnect()
ConnectIF
内の disconnect
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
- 接続先のディレクトリ名
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
- File#getCanonicalFile() で発生する入出力エラーprotected String addFile(String dir, String file)
dir
- ディレクトリ名file
- ファイル名
public void setHostUserPass(String host, String user, String passwd)
ConnectIF
内の setHostUserPass
host
- サーバーuser
- ユーザーpasswd
- パスワードpublic void setPort(String port)
ConnectIF
内の setPort
port
- 接続に利用するポート番号protected String getPort()
protected int getPort(int defPort)
defPort
- port が null の場合の初期値
public void setMkdirs(boolean isMkdirs)
ConnectIF
内の setMkdirs
isMkdirs
- 受け側ファイルにディレクトリを作成するかどうか。true:作成するpublic void setTimeout(int timeout)
ConnectIF
内の setTimeout
timeout
- タイムアウト[秒]
RuntimeException
- タイムアウトの指定が大きすぎた場合public void setDisplay(boolean isDisplay)
ConnectIF
内の setDisplay
isDisplay
- 実行状況の表示可否public void setDebug(boolean isDebug)
ConnectIF
内の setDebug
isDebug
- デバッグ情報の表示可否protected void errAppend(Object msg)
msg
- メッセージ化したいオブジェクトprotected void errAppend(Object... msgs)
msgs
- Object...public String getErrMsg()
ConnectIF
内の getErrMsg
|
openGion 5.8.8.0 | ||||||||
前のクラス 次のクラス | フレームあり フレームなし | ||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |