Ahhh yes, your right. I figured this out with some help from their tech
support but you are right on the money. Now, I have another problem. I got
this working, but now I need to listen for events to know if the ftp was
successfull etc, ect. The only way to do this, according to their
documentation I need to create a new object/class to do this and while I
could figure out how to do this in Java or AS, I'm not sure how its
possible within CFMX. Is it even possible to do something like this with
cfscript?
For an object to listen for events published by the Sftp class the
following steps are required:
1. Set object to implement SftpListener or extend SftpAdapter class.
2. Overload event handling methods.
3. Subscribe object to receive events published by Sftp instance.
The example below demonstrates using the SftpAdapter class.
import com.jscape.inet.sftp.*;
import com.jscape.inet.sftp.events.*;
import com.jscape.inet.ssh.util.SshParameters;
public class MySftpAdapter extends SftpAdapter {
public void connected(SftpConnectedEvent evt) {
System.out.println("Connected to host: " + evt.getHostname());
}
public void disconnected(SftpDisconnectedEvent evt) {
System.out.println("Disconnected from host: " + evt.getHostname());
}
public static void main(String[] args) {
try {
String hostname = "ftp.host.com";
String username = "jsmith";
String password = "secret";
// create connection parameters
SshParameters sshParams = new
SshParameters(hostname,username,password);
Sftp sftp = new Sftp(sshParams);
// subscribe listener to published SFTP events
sftp.addSftpListener(new MySftpAdapter());
// connect then disconnect
sftp.connect();
sftp.disconnect();
} catch(SftpException e) {
e.printStackTrace();
}
}
}
At 05:46 PM 1/20/2006, you wrote:
><cfobject action="create" type="java"
>class="com.jscape.inet.sftp.Sftp" name="sftp">
><cfobject action="create" type="java"
>class="com.jscape.inet.ssh.util.SshParameters" name="sshParams">
><cfset sshParams.init(hostname,username,password)>
><cfset sftp.init(sshParams)>
><cfset sftp.connect()>
>
>On 1/21/06, blists <[EMAIL PROTECTED]> wrote:
> > The jar file is from jscape, it provides SSH/FTP. I've copied it now, into
> > the WEB-INF\lib\ directory. The docs show an example use like this:
> >
> > import com.jscape.inet.ssh.util.*;
> > import com.jscape.inet.sftp.*;
> >
> > // create a new SshParameters instance with authentication info
> > SshParameters sshParams(hostanme,username,password);
> >
> > // create a new Sftp instance
> > Sftp sftp = new Sftp(sshParams);
> >
> > // establish a connection
> > sftp.connect();
>
>--
>CFAJAX docs and other useful articles:
>http://jr-holmes.coldfusionjournal.com/
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:230161
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54