1 package net.sf.jftp.net; 2 3 import java.util.Vector ; 4 5 6 public class SmbTransfer implements Runnable 7 { 8 private String url; 9 private String domain; 10 private String localPath; 11 private String file; 12 private String user; 13 private String pass; 14 private SmbConnection con = null; 15 private String type; 16 public Thread runner; 17 private Vector listeners; 18 19 public SmbTransfer(String url, String localPath, String file, String user, 20 String pass, String domain, Vector listeners, String type) 21 { 22 this.url = url; 23 this.localPath = localPath; 24 this.file = file; 25 this.user = user; 26 this.pass = pass; 27 this.type = type; 28 this.domain = domain; 29 this.listeners = listeners; 30 31 prepare(); 32 } 33 34 public void prepare() 35 { 36 runner = new Thread (this); 37 runner.setPriority(Thread.MIN_PRIORITY); 38 runner.start(); 39 } 40 41 public void run() 42 { 43 con = new SmbConnection(url, domain, user, pass, null); 44 con.setLocalPath(localPath); 45 con.setConnectionListeners(listeners); 46 47 if(type.equals(Transfer.DOWNLOAD)) 48 { 49 con.download(file); 50 } 51 else if(type.equals(Transfer.UPLOAD)) 52 { 53 con.upload(file); 54 } 55 } 56 57 public SmbConnection getSmbConnection() 58 { 59 return con; 60 } 61 } 62 | Popular Tags |