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