001/* 002 * Version 0.70 01/04/2002 003 * 004 * Visit my url for update: http://www.geocities.com/beapetrovicova/ 005 * 006 * jFtp was developed by Bea Petrovicova <beapetrovicova@yahoo.com>. 007 * The design and implementation of jFtp are available for royalty-free 008 * adoption and use. This software is provided 'as is' without any 009 * guarantees. Copyright is retained by Bea Petrovicova. Redistribution 010 * of any part of jFtp or any derivative works must include this notice. 011 * 012 */ 013 014package cz.dhl.ftp; 015 016/** 017 * Wrapper for FTP client settings. 018 * 019 * @Version 0.70 01/04/2002 020 * @author Bea Petrovicova <beapetrovicova@yahoo.com> 021 * @see Ftp 022 */ 023public class FtpSetting 024{ 025 026 /* ServerSystemMode option, traditional UNIX system. 027 * <P><CODE>% ll<BR> 028 * -rw-r--r-- 1 owner group 239 Nov 9 1998 file<BR> 029 * drw-r--r-- 1 owner group 58 Nov 12 13:51 folder</CODE></P> */ 030 static final int UNIX = 1; 031 032 /* ServerSystemMode option, MS Windows system. 033 * <P><CODE>C:\> dir<BR> 034 * 10-16-01 11:35PM 1479 file <BR> 035 * 10-16-01 11:37PM <DIR> awt</P> */ 036 static final int WIN = 2; 037 038 /** ListCommandMode option, gives detailed information on 039 * file but might not work well on other than implemented 040 * server systems. 041 * 042 * <P>Traditional UNIX system:<BR> 043 * <CODE>% ll<BR> 044 * -rw-r--r-- 1 owner group 239 Nov 9 1998 file<BR> 045 * drw-r--r-- 1 owner group 58 Nov 12 13:51 dir</CODE></P> 046 * 047 * <P>MS Windows system:<BR> 048 * <CODE>C:\> dir<BR> 049 * 10-16-01 11:35PM 1479 file <BR> 050 * 10-16-01 11:37PM <DIR> folder</P> 051 */ 052 public static final int LIST = 1; 053 054 /** ListCommandMode option, lists only filenames using 055 * FTP NLST command. 056 * <P><I>Warning! Directories are recognized by not 057 * containing a dot (.) letter and might not correspond 058 * to real directories.</I></P> */ 059 public static final int NAME_LIST = 2; 060 061 /** ListCommandMode option, similar to NAME_LIST 062 * except directories are recognized. 063 * <P><I>Might not work well on other than UNIX server systems.</I></P> 064 * <P><CODE>% ls -p</CODE></P> 065 * Put a slash (/) after each file name if that file is 066 * a directory. */ 067 public static final int NAME_LIST_LS_P = 3; 068 069 /** ListCommandMode option, similar to NAME_LIST except 070 * directories, executables and special files are recognized. 071 * <P><I>Might not work well on other than UNIX server systems.</I></P> 072 * <P><CODE>% ls -F</CODE></P> 073 * Put a slash (/) after each file name if that file is 074 * a directory or a symbolic link to a directory; put an 075 * asterisk (*) after each file name if that file is 076 * executable; put an at sign (@) after each file name if 077 * that file is a symbolic link to a file. */ 078 public static final int NAME_LIST_LS_F = 4; 079 080 /** ListCommandMode option, gives detailed information on file. 081 * <P><I>Might not work well on other than UNIX server systems.</I></P> 082 * <P><CODE>% ls -la<BR> 083 * -rw-r--r-- 1 owner group 239 Nov 9 1998 file<BR> 084 * drw-r--r-- 1 owner group 58 Nov 12 13:51 folder</CODE></P> */ 085 public static final int NAME_LIST_LS_LA = 5; 086 087 private int serversystemmode = UNIX; 088 private int listcommandmode = LIST; 089 private char filetransfermode = 'S'; 090 private boolean activesocketmode = false; 091 private boolean securesocketmode = false; 092 093 public FtpSetting() {} 094 095 /* Sets type of server system used. 096 * Set by <code>{@link cz.dhl.ftp.FtpFile#listCoFile()}</code> 097 * @param serversystemmode must be one of following optional values; 098 * @see #UNIX 099 * @see #WIN */ 100 void setServerSystemMode(int serversystemmode) 101 { this.serversystemmode = serversystemmode; } 102 103 /* Gets type of server system used. 104 * @return one of following optional values; 105 * @see #UNIX 106 * @see #WIN */ 107 int getServerSystemMode() 108 { return serversystemmode; } 109 110 /** Sets type of list command used. 111 * @param listcommandmode must be one of following optional values; 112 * @see #LIST 113 * @see #NAME_LIST 114 * @see #NAME_LIST_LS_P 115 * @see #NAME_LIST_LS_F 116 * @see #NAME_LIST_LS_LA */ 117 public void setListCommandMode(int listcommandmode) 118 { this.listcommandmode = listcommandmode; } 119 120 /** Gets type of list command used. 121 * @return one of following optional values; 122 * @see #LIST 123 * @see #NAME_LIST 124 * @see #NAME_LIST_LS_P 125 * @see #NAME_LIST_LS_F 126 * @see #NAME_LIST_LS_LA */ 127 public int getListCommandMode() 128 { return listcommandmode; } 129 130 /** Sets transfer mode. 131 * @param filetransfermode must be one of following optional values; 132 * 'A'=ASCII, 'I'=BINARY files, 'S'=Smart; 133 * smart mode evaluates transfer mode by current TextFilter settings */ 134 public void setFileTransferMode(char filetransfermode) 135 { this.filetransfermode = filetransfermode; } 136 137 /** Gets transfer mode. 138 * @return one of following optional values; 139 * 'A'=ASCII, 'I'=BINARY files, 'S'=Smart; 140 * smart mode evaluates transfer mode by current TextFilter settings */ 141 public char getFileTransferMode() 142 { return filetransfermode; } 143 144 /** Get active socket mode. 145 * @return 146 * true stands for active socket / 147 * false for pasive socket */ 148 public boolean getActiveSocketMode() 149 { return activesocketmode; } 150 151 /** Sets active socket mode. 152 * @param activesocketmode 153 * true stands for active socket / 154 * false for pasive socket */ 155 public void setActiveSocketMode(boolean activesocketmode) 156 { this.activesocketmode = activesocketmode; } 157 158 /* Get secure socket mode. 159 * @return true 160 * stands for secure socket / 161 * false for plain socket */ 162 boolean getSecureSocketMode() 163 { return securesocketmode; } 164 165 /* Sets secure socket mode. 166 * @param securesocketmode 167 * true stands for secure socket / 168 * false for plain socket */ 169 void setSecureSocketMode(boolean securesocketmode) 170 { this.securesocketmode = securesocketmode; } 171}