001/** 002 * 003 * Copyright (c) 2014, the Railo Company Ltd. All rights reserved. 004 * 005 * This library is free software; you can redistribute it and/or 006 * modify it under the terms of the GNU Lesser General Public 007 * License as published by the Free Software Foundation; either 008 * version 2.1 of the License, or (at your option) any later version. 009 * 010 * This library is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 013 * Lesser General Public License for more details. 014 * 015 * You should have received a copy of the GNU Lesser General Public 016 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 017 * 018 **/ 019package lucee.runtime.tag; 020 021import lucee.commons.io.IOUtil; 022import lucee.commons.io.res.Resource; 023import lucee.commons.io.res.util.ResourceUtil; 024import lucee.runtime.PageContextImpl; 025import lucee.runtime.exp.ApplicationException; 026import lucee.runtime.exp.PageException; 027import lucee.runtime.ext.tag.TagImpl; 028import lucee.runtime.net.ftp.AFTPClient; 029import lucee.runtime.net.ftp.FTPConnection; 030import lucee.runtime.net.ftp.FTPConnectionImpl; 031import lucee.runtime.net.ftp.FTPConnectionPro; 032import lucee.runtime.net.ftp.FTPConstant; 033import lucee.runtime.net.ftp.FTPPath; 034import lucee.runtime.net.ftp.FTPPoolImpl; 035import lucee.runtime.op.Caster; 036import lucee.runtime.type.Collection.Key; 037import lucee.runtime.type.KeyImpl; 038import lucee.runtime.type.QueryImpl; 039import lucee.runtime.type.Struct; 040import lucee.runtime.type.StructImpl; 041import lucee.runtime.type.dt.DateTimeImpl; 042import lucee.runtime.type.util.ListUtil; 043import org.apache.commons.net.ftp.FTPFile; 044 045import java.io.IOException; 046import java.io.InputStream; 047import java.io.OutputStream; 048 049/** 050* 051* Lets users implement File Transfer Protocol (FTP) operations. 052* 053* 054* 055**/ 056public final class Ftp extends TagImpl { 057 058 private static final String ASCCI_EXT_LIST="txt;htm;html;cfm;cfml;shtm;shtml;css;asp;asa"; 059 060 private static final Key SUCCEEDED = KeyImpl.intern("succeeded"); 061 private static final Key ERROR_CODE = KeyImpl.intern("errorCode"); 062 private static final Key ERROR_TEXT = KeyImpl.intern("errorText"); 063 private static final Key RETURN_VALUE = KeyImpl.intern("returnValue"); 064 private static final Key CFFTP = KeyImpl.intern("cfftp"); 065 /*private static final Key = KeyImpl.getInstance(); 066 private static final Key = KeyImpl.getInstance(); 067 private static final Key = KeyImpl.getInstance(); 068 private static final Key = KeyImpl.getInstance(); 069 private static final Key = KeyImpl.getInstance(); 070 private static final Key = KeyImpl.getInstance();*/ 071 072 private FTPPoolImpl pool; 073 074 private String action; 075 private String username; 076 private String password; 077 private String server; 078 private int timeout=30; 079 private int port=21; 080 private String connectionName; 081 private int retrycount=1; 082 private int count=0; 083 private boolean stoponerror=true; 084 private boolean passive; 085 private String name; 086 private String directory; 087 private String ASCIIExtensionList=ASCCI_EXT_LIST; 088 private short transferMode=FTPConstant.TRANSFER_MODE_AUTO; 089 private String remotefile; 090 private String localfile; 091 private boolean failifexists=true; 092 private String existing; 093 private String _new; 094 private String item; 095 private String result; 096 097 private String proxyserver; 098 private int proxyport=80; 099 private String proxyuser; 100 private String proxypassword=""; 101 private String fingerprint; 102 private boolean secure; 103 104 private boolean recursive; 105 106 //private Struct cfftp=new StructImpl(); 107 108 @Override 109 public void release() { 110 super.release(); 111 this.pool=null; 112 113 this.action=null; 114 this.username=null; 115 this.password=null; 116 this.server=null; 117 this.timeout=30; 118 this.port=21; 119 this.connectionName=null; 120 this.proxyserver=null; 121 this.proxyport=80; 122 this.proxyuser=null; 123 this.proxypassword=""; 124 this.retrycount=1; 125 this.count=0; 126 this.stoponerror=true; 127 this.passive=false; 128 this.name=null; 129 this.directory=null; 130 this.ASCIIExtensionList=ASCCI_EXT_LIST; 131 this.transferMode=FTPConstant.TRANSFER_MODE_AUTO; 132 this.remotefile=null; 133 this.localfile=null; 134 this.failifexists=true; 135 this.existing=null; 136 this._new=null; 137 this.item=null; 138 this.result=null; 139 140 fingerprint=null; 141 secure=false; 142 recursive=false; 143 144 } 145 146 /** 147 * sets the attribute action 148 * @param action 149 */ 150 public void setAction(String action) { 151 this.action=action.trim().toLowerCase(); 152 } 153 154 @Override 155 public int doStartTag() { 156 return SKIP_BODY; 157 } 158 159 @Override 160 public int doEndTag() throws PageException { 161 pool=((PageContextImpl)pageContext).getFTPPoolImpl(); 162 AFTPClient client = null; 163 164 165 // retries 166 do { 167 try { 168 if(action.equals("open")) client=actionOpen(); 169 else if(action.equals("close")) client=actionClose(); 170 else if(action.equals("changedir")) client=actionChangeDir(); 171 else if(action.equals("createdir")) client=actionCreateDir(); 172 else if(action.equals("listdir")) client=actionListDir(); 173 else if(action.equals("removedir")) client=actionRemoveDir(); 174 else if(action.equals("getfile")) client=actionGetFile(); 175 else if(action.equals("putfile")) client=actionPutFile(); 176 else if(action.equals("rename")) client=actionRename(); 177 else if(action.equals("remove")) client=actionRemove(); 178 else if(action.equals("getcurrentdir")) client=actionGetCurrentDir(); 179 else if(action.equals("getcurrenturl")) client=actionGetCurrentURL(); 180 else if(action.equals("existsdir")) client=actionExistsDir(); 181 else if(action.equals("existsfile")) client=actionExistsFile(); 182 else if(action.equals("exists")) client=actionExists(); 183 //else if(action.equals("copy")) client=actionCopy(); 184 185 186 else throw new ApplicationException( 187 "attribute action has an invalid value ["+action+"]", 188 "valid values are [open,close,listDir,createDir,removeDir,changeDir,getCurrentDir," + 189 "getCurrentURL,existsFile,existsDir,exists,getFile,putFile,rename,remove]"); 190 191 } 192 catch(IOException ioe) { 193 if(count++<retrycount)continue; 194 throw Caster.toPageException(ioe); 195 } 196 197 if(client==null || !checkCompletion(client))break; 198 }while(true); 199 200 return EVAL_PAGE; 201 } 202 203 204 205 /** 206 * check if a directory exists or not 207 * @return FTPCLient 208 * @throws PageException 209 * @throws IOException 210 */ 211 private AFTPClient actionExistsDir() throws PageException, IOException { 212 required("directory",directory); 213 214 AFTPClient client = getClient(); 215 boolean res = existsDir(client,directory); 216 Struct cfftp = writeCfftp(client); 217 218 cfftp.setEL(RETURN_VALUE,Caster.toBoolean(res)); 219 cfftp.setEL(SUCCEEDED,Boolean.TRUE); 220 221 stoponerror=false; 222 return client; 223 } 224 225 /** 226 * check if a file exists or not 227 * @return FTPCLient 228 * @throws IOException 229 * @throws PageException 230 */ 231 private AFTPClient actionExistsFile() throws PageException, IOException { 232 required("remotefile",remotefile); 233 234 AFTPClient client = getClient(); 235 FTPFile file=existsFile(client,remotefile,true); 236 237 Struct cfftp = writeCfftp(client); 238 239 cfftp.setEL(RETURN_VALUE,Caster.toBoolean(file!=null && file.isFile())); 240 cfftp.setEL(SUCCEEDED,Boolean.TRUE); 241 242 stoponerror=false; 243 return client; 244 } 245 246 /** 247 * check if a file or directory exists 248 * @return FTPCLient 249 * @throws PageException 250 * @throws IOException 251 */ 252 private AFTPClient actionExists() throws PageException, IOException { 253 required("item",item); 254 255 AFTPClient client = getClient(); 256 FTPFile file=existsFile(client,item,false); 257 Struct cfftp = writeCfftp(client); 258 259 cfftp.setEL(RETURN_VALUE,Caster.toBoolean(file!=null)); 260 cfftp.setEL(SUCCEEDED,Boolean.TRUE); 261 262 return client; 263 } 264 265 266 267 268 /* * 269 * check if file or directory exists if it exists return FTPFile otherwise null 270 * @param client 271 * @param strPath 272 * @return FTPFile or null 273 * @throws IOException 274 * @throws PageException 275 * / 276 private FTPFile exists(FTPClient client, String strPath) throws PageException, IOException { 277 strPath=strPath.trim(); 278 279 // get parent path 280 FTPPath path=new FTPPath(client.printWorkingDirectory(),strPath); 281 String name=path.getName(); 282 print.out("path:"+name); 283 284 // when directory 285 FTPFile[] files=null; 286 try { 287 files = client.listFiles(path.getPath()); 288 } catch (IOException e) {} 289 290 if(files!=null) { 291 for(int i=0;i<files.length;i++) { 292 if(files[i].getName().equalsIgnoreCase(name)) { 293 return files[i]; 294 } 295 } 296 297 } 298 return null; 299 }*/ 300 301 private FTPFile existsFile(AFTPClient client, String strPath,boolean isFile) throws PageException, IOException { 302 strPath=strPath.trim(); 303 if(strPath.equals("/")) { 304 FTPFile file= new FTPFile(); 305 file.setName("/"); 306 file.setType(FTPFile.DIRECTORY_TYPE); 307 return file; 308 } 309 310 // get parent path 311 FTPPath path=new FTPPath(client,strPath); 312 String p=path.getPath(); 313 String n=path.getName(); 314 315 strPath=p; 316 if("//".equals(p))strPath="/"; 317 if(isFile)strPath+=n; 318 319 // when directory 320 FTPFile[] files=null; 321 try { 322 files = client.listFiles(p); 323 } catch (IOException e) {} 324 325 if(files!=null) { 326 for(int i=0;i<files.length;i++) { 327 if(files[i].getName().equalsIgnoreCase(n)) { 328 return files[i]; 329 } 330 } 331 332 } 333 return null; 334 } 335 336 private boolean existsDir(AFTPClient client, String strPath) throws PageException, IOException { 337 strPath=strPath.trim(); 338 339 // get parent path 340 FTPPath path=new FTPPath(client,strPath); 341 String p=path.getPath(); 342 String n=path.getName(); 343 344 strPath=p+""+n; 345 if("//".equals(p))strPath="/"+n; 346 if(!strPath.endsWith("/"))strPath+="/"; 347 348 return client.directoryExists(directory); 349 } 350 351 /** 352 * removes a file on the server 353 * @return FTPCLient 354 * @throws IOException 355 * @throws PageException 356 */ 357 private AFTPClient actionRemove() throws IOException, PageException { 358 required("item",item); 359 AFTPClient client = getClient(); 360 client.deleteFile(item); 361 writeCfftp(client); 362 363 return client; 364 } 365 366 /** 367 * rename a file on the server 368 * @return FTPCLient 369 * @throws PageException 370 * @throws IOException 371 */ 372 private AFTPClient actionRename() throws PageException, IOException { 373 required("existing",existing); 374 required("new",_new); 375 376 AFTPClient client = getClient(); 377 client.rename(existing,_new); 378 writeCfftp(client); 379 380 return client; 381 } 382 383 /** 384 * copy a local file to server 385 * @return FTPClient 386 * @throws IOException 387 * @throws PageException 388 */ 389 private AFTPClient actionPutFile() throws IOException, PageException { 390 required("remotefile",remotefile); 391 required("localfile",localfile); 392 393 AFTPClient client = getClient(); 394 Resource local=ResourceUtil.toResourceExisting(pageContext ,localfile);//new File(localfile); 395 // if(failifexists && local.exists()) throw new ApplicationException("File ["+local+"] already exist, if you want to overwrite, set attribute failIfExists to false"); 396 InputStream is=null; 397 398 try { 399 is=IOUtil.toBufferedInputStream(local.getInputStream()); 400 client.setFileType(getType(local)); 401 client.storeFile(remotefile,is); 402 } 403 finally { 404 IOUtil.closeEL(is); 405 } 406 writeCfftp(client); 407 408 return client; 409 } 410 411 /** 412 * gets a file from server and copy it local 413 * @return FTPCLient 414 * @throws PageException 415 * @throws IOException 416 */ 417 private AFTPClient actionGetFile() throws PageException, IOException { 418 required("remotefile",remotefile); 419 required("localfile",localfile); 420 421 422 AFTPClient client = getClient(); 423 Resource local=ResourceUtil.toResourceExistingParent(pageContext ,localfile);//new File(localfile); 424 pageContext.getConfig().getSecurityManager().checkFileLocation(local); 425 if(failifexists && local.exists()) throw new ApplicationException("File ["+local+"] already exist, if you want to overwrite, set attribute failIfExists to false"); 426 OutputStream fos=null; 427 client.setFileType(getType(local)); 428 boolean success=false; 429 try { 430 fos=IOUtil.toBufferedOutputStream(local.getOutputStream()); 431 success=client.retrieveFile(remotefile,fos); 432 } 433 finally { 434 IOUtil.closeEL(fos); 435 if(!success) local.delete(); 436 } 437 writeCfftp(client); 438 439 return client; 440 } 441 442 /** 443 * get url of the working directory 444 * @return FTPCLient 445 * @throws IOException 446 * @throws PageException 447 */ 448 private AFTPClient actionGetCurrentURL() throws PageException, IOException { 449 AFTPClient client = getClient(); 450 String pwd=client.printWorkingDirectory(); 451 Struct cfftp = writeCfftp(client); 452 cfftp.setEL("returnValue",client.getPrefix()+"://"+client.getRemoteAddress().getHostName()+pwd); 453 return client; 454 } 455 456 /** 457 * get path from the working directory 458 * @return FTPCLient 459 * @throws IOException 460 * @throws PageException 461 */ 462 private AFTPClient actionGetCurrentDir() throws PageException, IOException { 463 AFTPClient client = getClient(); 464 String pwd=client.printWorkingDirectory(); 465 Struct cfftp = writeCfftp(client); 466 cfftp.setEL("returnValue",pwd); 467 return client; 468 } 469 470 /** 471 * change working directory 472 * @return FTPCLient 473 * @throws IOException 474 * @throws PageException 475 */ 476 private AFTPClient actionChangeDir() throws IOException, PageException { 477 required("directory",directory); 478 479 AFTPClient client = getClient(); 480 client.changeWorkingDirectory(directory); 481 writeCfftp(client); 482 return client; 483 } 484 485 private AFTPClient getClient() throws PageException, IOException { 486 return pool.get(_createConnection()); 487 } 488 489 /** 490 * removes a remote directory on server 491 * @return FTPCLient 492 * @throws IOException 493 * @throws PageException 494 */ 495 private AFTPClient actionRemoveDir() throws IOException, PageException { 496 required("directory",directory); 497 498 AFTPClient client = getClient(); 499 if(recursive) { 500 removeRecursive(client,directory,FTPFile.DIRECTORY_TYPE); 501 } 502 else 503 client.removeDirectory(directory); 504 505 writeCfftp(client); 506 return client; 507 } 508 509 private static void removeRecursive(AFTPClient client, String path, int type) throws IOException { 510 // directory 511 if(FTPFile.DIRECTORY_TYPE==type) { 512 if(!path.endsWith("/")) path+="/"; 513 // first we remove the children 514 FTPFile[] children = client.listFiles(path); 515 for(FTPFile child:children){ 516 if(child.getName().equals(".") || child.getName().equals("..")) continue; 517 removeRecursive(client, path+child.getName(), child.getType()); 518 } 519 // then the directory itself 520 client.removeDirectory(path); 521 522 } 523 // file 524 else if(FTPFile.FILE_TYPE==type) { 525 client.deleteFile(path); 526 } 527 } 528 529 530 531 532 533 534 535 /** 536 * create a remote directory 537 * @return FTPCLient 538 * @throws IOException 539 * @throws PageException 540 */ 541 private AFTPClient actionCreateDir() throws IOException, PageException { 542 required("directory",directory); 543 544 AFTPClient client = getClient(); 545 client.makeDirectory(directory); 546 writeCfftp(client); 547 return client; 548 } 549 550 /** 551 * List data of a ftp connection 552 * @return FTPCLient 553 * @throws PageException 554 * @throws IOException 555 */ 556 private AFTPClient actionListDir() throws PageException, IOException { 557 required("name",name); 558 required("directory",directory); 559 560 AFTPClient client = getClient(); 561 FTPFile[] files = client.listFiles(directory); 562 if(files==null)files=new FTPFile[0]; 563 564 pageContext.setVariable(name,toQuery(files,"ftp",directory,client.getRemoteAddress().getHostName())); 565 writeCfftp(client); 566 return client; 567 } 568 569 public static lucee.runtime.type.Query toQuery(FTPFile[] files, String prefix, String directory, String hostName) throws PageException { 570 571 String[] cols = new String[]{"name","isdirectory","lastmodified","length","mode", 572 "path","url","type","raw","attributes"}; 573 String[] types = new String[]{"VARCHAR","BOOLEAN","DATE","DOUBLE","VARCHAR","VARCHAR", 574 "VARCHAR","VARCHAR","VARCHAR","VARCHAR"}; 575 576 lucee.runtime.type.Query query=new QueryImpl(cols,types,0,"query"); 577 578 // translate directory path for display 579 if(directory.length()==0)directory="/"; 580 else if(directory.startsWith("./"))directory=directory.substring(1); 581 else if(directory.charAt(0)!='/')directory='/'+directory; 582 if(directory.charAt(directory.length()-1)!='/')directory=directory+'/'; 583 584 int row; 585 for(int i=0;i<files.length;i++) { 586 FTPFile file = files[i]; 587 if(file.getName().equals(".") || file.getName().equals("..")) continue; 588 row=query.addRow(); 589 query.setAt("attributes",row,""); 590 query.setAt("isdirectory",row,Caster.toBoolean(file.isDirectory())); 591 query.setAt("lastmodified",row,new DateTimeImpl(file.getTimestamp())); 592 query.setAt("length",row,Caster.toDouble(file.getSize())); 593 query.setAt("mode",row,FTPConstant.getPermissionASInteger(file)); 594 query.setAt("type",row,FTPConstant.getTypeAsString(file.getType())); 595 //query.setAt("permission",row,FTPConstant.getPermissionASInteger(file)); 596 query.setAt("raw",row,file.getRawListing()); 597 query.setAt("name",row,file.getName()); 598 query.setAt("path",row,directory+file.getName()); 599 query.setAt("url",row,prefix+"://"+hostName+""+directory+file.getName()); 600 } 601 return query; 602 } 603 604 /** 605 * Opens a FTP Connection 606 * @return FTPCLinet 607 * @throws IOException 608 * @throws PageException 609 */ 610 private AFTPClient actionOpen() throws IOException, PageException { 611 required("server",server); 612 required("username",username); 613 required("password",password); 614 615 616 AFTPClient client = getClient(); 617 writeCfftp(client); 618 return client; 619 } 620 621 /** 622 * close a existing ftp connection 623 * @return FTPCLient 624 * @throws PageException 625 */ 626 private AFTPClient actionClose() throws PageException { 627 FTPConnection conn = _createConnection(); 628 AFTPClient client = pool.remove(conn); 629 630 Struct cfftp = writeCfftp(client); 631 cfftp.setEL("succeeded",Caster.toBoolean(client!=null)); 632 return client; 633 } 634 635 /** 636 * throw a error if the value is empty (null) 637 * @param attributeName 638 * @param atttributValue 639 * @throws ApplicationException 640 */ 641 private void required(String attributeName, String atttributValue) throws ApplicationException { 642 if(atttributValue==null) 643 throw new ApplicationException( 644 "invalid attribute constelation for the tag ftp", 645 "attribute ["+attributeName+"] is required, if action is ["+action+"]"); 646 } 647 648 /** 649 * writes cfftp variable 650 * @param client 651 * @return FTPCLient 652 * @throws PageException 653 */ 654 private Struct writeCfftp(AFTPClient client) throws PageException { 655 Struct cfftp=new StructImpl(); 656 if(result==null)pageContext.variablesScope().setEL(CFFTP,cfftp); 657 else pageContext.setVariable(result,cfftp); 658 if(client==null) { 659 cfftp.setEL(SUCCEEDED,Boolean.FALSE); 660 cfftp.setEL(ERROR_CODE,new Double(-1)); 661 cfftp.setEL(ERROR_TEXT,""); 662 cfftp.setEL(RETURN_VALUE,""); 663 return cfftp; 664 } 665 int repCode = client.getReplyCode(); 666 String repStr=client.getReplyString(); 667 cfftp.setEL(ERROR_CODE,new Double(repCode)); 668 cfftp.setEL(ERROR_TEXT,repStr); 669 670 cfftp.setEL(SUCCEEDED,Caster.toBoolean(client.isPositiveCompletion())); 671 cfftp.setEL(RETURN_VALUE,repStr); 672 return cfftp; 673 } 674 675 /** 676 * check completion status of the client 677 * @param client 678 * @return FTPCLient 679 * @throws ApplicationException 680 */ 681 private boolean checkCompletion(AFTPClient client) throws ApplicationException { 682 boolean isPositiveCompletion=client.isPositiveCompletion(); 683 if(isPositiveCompletion) return false; 684 if(count++<retrycount) return true; 685 if(stoponerror){ 686 throw new lucee.runtime.exp.FTPException(action,client); 687 } 688 689 return false; 690 } 691 692 /** 693 * get FTP. ... _FILE_TYPE 694 * @param file 695 * @return type 696 */ 697 private int getType(Resource file) { 698 if(transferMode==FTPConstant.TRANSFER_MODE_BINARY) return AFTPClient.FILE_TYPE_BINARY; 699 else if(transferMode==FTPConstant.TRANSFER_MODE_ASCCI) return AFTPClient.FILE_TYPE_TEXT; 700 else { 701 String ext=ResourceUtil.getExtension(file,null); 702 if(ext==null || ListUtil.listContainsNoCase(ASCIIExtensionList,ext,";",true,false)==-1) 703 return AFTPClient.FILE_TYPE_BINARY; 704 return AFTPClient.FILE_TYPE_TEXT; 705 } 706 } 707 708 /** 709 * @return return a new FTP Connection Object 710 */ 711 private FTPConnectionPro _createConnection() { 712 return new FTPConnectionImpl(connectionName,server,username,password,port,timeout,transferMode,passive, 713 proxyserver,proxyport,proxyuser,proxypassword, 714 fingerprint,stoponerror,secure); 715 } 716 717 /** 718 * @param password The password to set. 719 */ 720 public void setPassword(String password) { 721 this.password = password; 722 } 723 /** 724 * @param username The username to set. 725 */ 726 public void setUsername(String username) { 727 this.username = username; 728 } 729 /** 730 * @param server The server to set. 731 */ 732 public void setServer(String server) { 733 this.server = server; 734 } 735 /** 736 * @param timeout The timeout to set. 737 */ 738 public void setTimeout(double timeout) { 739 this.timeout = (int)timeout; 740 } 741 /** 742 * @param port The port to set. 743 */ 744 public void setPort(double port) { 745 this.port = (int)port; 746 } 747 /** 748 * @param connection The connection to set. 749 */ 750 public void setConnection(String connection) { 751 this.connectionName = connection; 752 } 753 /** 754 * @param proxyserver The proxyserver to set. 755 */ 756 public void setProxyserver(String proxyserver) { 757 this.proxyserver = proxyserver; 758 } 759 760 /** set the value proxyport 761 * The port number on the proxy server from which the object is requested. Default is 80. When 762 * used with resolveURL, the URLs of retrieved documents that specify a port number are automatically 763 * resolved to preserve links in the retrieved document. 764 * @param proxyport value to set 765 **/ 766 public void setProxyport(double proxyport) { 767 this.proxyport=(int)proxyport; 768 } 769 770 /** set the value username 771 * When required by a proxy server, a valid username. 772 * @param proxyuser value to set 773 **/ 774 public void setProxyuser(String proxyuser) { 775 this.proxyuser=proxyuser; 776 } 777 778 779 /** set the value password 780 * When required by a proxy server, a valid password. 781 * @param proxypassword value to set 782 **/ 783 public void setProxypassword(String proxypassword) { 784 this.proxypassword=proxypassword; 785 } 786 787 788 789 /** 790 * @param retrycount The retrycount to set. 791 */ 792 public void setRetrycount(double retrycount) { 793 this.retrycount = (int)retrycount; 794 } 795 /** 796 * @param stoponerror The stoponerror to set. 797 */ 798 public void setStoponerror(boolean stoponerror) { 799 this.stoponerror = stoponerror; 800 } 801 /** 802 * @param passive The passive to set. 803 */ 804 public void setPassive(boolean passive) { 805 this.passive = passive; 806 } 807 /** 808 * @param directory The directory to set. 809 */ 810 public void setDirectory(String directory) { 811 this.directory = directory; 812 } 813 /** 814 * @param name The name to set. 815 */ 816 public void setName(String name) { 817 this.name = name; 818 } 819 820 public void setRecurse(boolean recursive) { 821 this.recursive = recursive; 822 } 823 824 825 /** 826 * @param extensionList The aSCIIExtensionList to set. 827 */ 828 public void setAsciiextensionlist(String extensionList) { 829 ASCIIExtensionList = extensionList.toLowerCase().trim(); 830 } 831 /** 832 * @param transferMode The transferMode to set. 833 */ 834 public void setTransfermode(String transferMode) { 835 transferMode=transferMode.toLowerCase().trim(); 836 if(transferMode.equals("binary"))this.transferMode=FTPConstant.TRANSFER_MODE_BINARY; 837 else if(transferMode.equals("ascci"))this.transferMode=FTPConstant.TRANSFER_MODE_ASCCI; 838 else this.transferMode=FTPConstant.TRANSFER_MODE_AUTO; 839 } 840 841 /** 842 * @param localfile The localfile to set. 843 */ 844 public void setLocalfile(String localfile) { 845 this.localfile = localfile; 846 } 847 /** 848 * @param remotefile The remotefile to set. 849 */ 850 public void setRemotefile(String remotefile) { 851 this.remotefile = remotefile; 852 } 853 /** 854 * @param failifexists The failifexists to set. 855 */ 856 public void setFailifexists(boolean failifexists) { 857 this.failifexists = failifexists; 858 } 859 /** 860 * @param _new The _new to set. 861 */ 862 public void setNew(String _new) { 863 this._new = _new; 864 } 865 /** 866 * @param existing The existing to set. 867 */ 868 public void setExisting(String existing) { 869 this.existing = existing; 870 } 871 /** 872 * @param item The item to set. 873 */ 874 public void setItem(String item) { 875 this.item = item; 876 } 877 878 /** 879 * @param result The result to set. 880 */ 881 public void setResult(String result) { 882 this.result = result; 883 } 884 885 public void setSecure(boolean secure) { 886 this.secure = secure; 887 } 888 889 public void setFingerprint(String fingerprint) { 890 this.fingerprint = fingerprint; 891 } 892}