-
Hier der Code
Methode connectFTP_Server
Public boolean connectFTP_Server() {
boolean boolConnectFTP_Server = false;
String strCurrentMethod = "connectFTP_Server()";
sbErrorDescription = new StringBuffer();
if (as400 == null) {
return false;
}
this.ftpClient = new AS400FTP(getAs400());
this.ftpClient.addFTPListener(new MyFTPListener());
try {
this.ftpClient.setPort(System_i5_config_Static
.getSystem_i5_FTP_Port());
appendSessionLogEntry_fromFTPServer(this.ftpClient .getLastMessage());
sbErrorDescription.append(this.ftpClient.getLastMe ssage());
} catch (PropertyVetoException e1) {
Exc.excInfo_Sun.getInfo(e1, CLASSNAME, strCurrentMethod,
sbErrorDescription);
return false;
}
try {
boolConnectFTP_Server = this.ftpClient.connect();
appendSessionLogEntry_fromFTPServer(this.ftpClient .getLastMessage());
} catch (UnknownHostException e) {
sbErrorDescription.append("Der Hostname: "
+ getAs400().getSystemName());
sbErrorDescription.append(SEP + "ist ungültig");
Exc.excInfo_Sun.getInfo(e, CLASSNAME, strCurrentMethod,
sbErrorDescription);
return false;
Klasse MyFTPListener
class MyFTPListener extends java.lang.Object implements FTPListener {
String strCurrentMethod = "connected(FTPEvent fe)";
public void connected(FTPEvent fe) {
try {
appendSessionLogEntry_fromFTPServer("Testanfrage an FTP-Server: "
+ ftpClient.issueCommand("NOOP"));
appendSessionLogEntry_fromFTPServer(ftpClient
.issueCommand("SYSTEM"));
ftpClient.setDataTransferType(AS400FTP.BINARY);
appendSessionLogEntry_fromFTPServer(ftpClient.getL astMessage());
ftpClient.issueCommand("SITE NAMEFMT 1");
appendSessionLogEntry_fromInstall_i5("---------------------------------------");
} catch (IOException ioe) {
Exc.excInfo_Sun.getInfo(ioe, CLASSNAME, strCurrentMethod, null);
return;
}
}
public void disconnected(FTPEvent fe) {
appendSessionLogEntry_fromFTPServer(ftpClient.getL astMessage());
}
public void listed(FTPEvent fe) {
}
public void put(FTPEvent fe) {
appendSessionLogEntry_fromFTPServer(ftpClient.getL astMessage());
}
public void retrieved(FTPEvent fe) {
}
Methode puInstallFile:
public boolean putInstallFile(String strSourceFileName) {
boolean boolPut = false;
String strCurrentMethod = "putInstallFile()";
sbErrorDescription = new StringBuffer();
if (this.ftpClient == null || strSourceFileName == null) {
return false;
}
if (quitFTP_Server() == false){
return false;
}
if (connectFTP_Server() == false) {
return false;
}
strSourceFileName = Transform_StringValue
.setStringVariable(strSourceFileName);
QSYSObjectPathName targetPath = null;
try {
targetPath = build_INSTALL_SAVF_TargetPath(strSourceFileName);
if (targetPath == null) {
return false;
}
} catch (ExtendedIllegalArgumentException exc) {
Exc.excInfo_IBM
.getInfo(exc, getClassInfo(), strCurrentMethod, null);
return false;
}
//
String strTargetFileName = targetPath.getPath();
try {
appendSessionLogEntry_fromInstall_i5(SEP);
String strNewInst = "=================================";
appendSessionLogEntry_fromInstall_i5(strNewInst);
String strLogEnty = "Start Datenübertragung für Datei:";
appendSessionLogEntry_fromInstall_i5(strLogEnty);
appendSessionLogEntry_fromInstall_i5(strSourceFile Name);
Hier fällt die Anwendung auf die Nase
boolPut = this.ftpClient.put(strSourceFileName, strTargetFileName);
appendSessionLogEntry_fromFTPServer(ftpClient.getL astMessage());
sbErrorDescription.append(strLogEnty + " fehlgeschlagen:");
sbErrorDescription.append(this.ftpClient.getLastMe ssage());
} catch (IOException e)
Similar Threads
-
By malzusrex in forum IBM i Hauptforum
Antworten: 3
Letzter Beitrag: 05-12-06, 14:38
-
By TARASIK in forum IBM i Hauptforum
Antworten: 3
Letzter Beitrag: 21-11-06, 17:18
-
By KM in forum IBM i Hauptforum
Antworten: 4
Letzter Beitrag: 28-08-06, 14:50
-
By wuwu in forum IBM i Hauptforum
Antworten: 5
Letzter Beitrag: 18-08-06, 09:09
-
By Frank.Sobanek in forum IBM i Hauptforum
Antworten: 5
Letzter Beitrag: 22-06-06, 21:22
Berechtigungen
- Neue Themen erstellen: Nein
- Themen beantworten: Nein
- You may not post attachments
- You may not edit your posts
-
Foren-Regeln
|
Erweiterte Foren Suche
Google Foren Suche
Forum & Artikel Update eMail
AS/400 / IBM i
Server Expert Gruppen
Unternehmens IT
|
Kategorien online Artikel
- Big Data, Analytics, BI, MIS
- Cloud, Social Media, Devices
- DMS, Archivierung, Druck
- ERP + Add-ons, Business Software
- Hochverfügbarkeit
- Human Resources, Personal
- IBM Announcements
- IT-Karikaturen
- Leitartikel
- Load`n`go
- Messen, Veranstaltungen
- NEWSolutions Dossiers
- Programmierung
- Security
- Software Development + Change Mgmt.
- Solutions & Provider
- Speicher – Storage
- Strategische Berichte
- Systemmanagement
- Tools, Hot-Tips
Auf dem Laufenden bleiben
|
Bookmarks