Skip to content
Permalink
Browse files

增加ftp服务器标志

  • Loading branch information
AriaLyy committed Dec 28, 2019
1 parent 685f6b5 commit bfc2cff5b0ab4e860cee1e3232fcdc50ca009f2d
Showing with 444 additions and 19,650 deletions.
  1. +274 −0 Aria/src/main/java/com/arialyy/aria/core/common/FtpOption.java
  2. +1 −1 Aria/src/main/java/com/arialyy/aria/core/download/DownloadReceiver.java
  3. +1 −1 Aria/src/main/java/com/arialyy/aria/core/upload/UploadReceiver.java
  4. +0 −1 AriaFtpPlug/.gitignore
  5. +0 −11 AriaFtpPlug/bintray-release.gradle
  6. +0 −14 AriaFtpPlug/build.gradle
  7. +0 −25 AriaFtpPlug/proguard-rules.pro
  8. +0 −287 AriaFtpPlug/src/main/java/aria/apache/commons/net/DatagramSocketClient.java
  9. +0 −67 AriaFtpPlug/src/main/java/aria/apache/commons/net/DatagramSocketFactory.java
  10. +0 −72 AriaFtpPlug/src/main/java/aria/apache/commons/net/DefaultDatagramSocketFactory.java
  11. +0 −204 AriaFtpPlug/src/main/java/aria/apache/commons/net/DefaultSocketFactory.java
  12. +0 −52 AriaFtpPlug/src/main/java/aria/apache/commons/net/MalformedServerReplyException.java
  13. +0 −190 AriaFtpPlug/src/main/java/aria/apache/commons/net/PrintCommandListener.java
  14. +0 −139 AriaFtpPlug/src/main/java/aria/apache/commons/net/ProtocolCommandEvent.java
  15. +0 −58 AriaFtpPlug/src/main/java/aria/apache/commons/net/ProtocolCommandListener.java
  16. +0 −123 AriaFtpPlug/src/main/java/aria/apache/commons/net/ProtocolCommandSupport.java
  17. +0 −869 AriaFtpPlug/src/main/java/aria/apache/commons/net/SocketClient.java
  18. +0 −34 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/Configurable.java
  19. +0 −1,777 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/FTP.java
  20. +0 −3,787 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/FTPClient.java
  21. +0 −713 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/FTPClientConfig.java
  22. +0 −75 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/FTPCmd.java
  23. +0 −170 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/FTPCommand.java
  24. +0 −52 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/FTPConnectionClosedException.java
  25. +0 −493 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/FTPFile.java
  26. +0 −129 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/FTPFileEntryParser.java
  27. +0 −72 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/FTPFileEntryParserImpl.java
  28. +0 −34 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/FTPFileFilter.java
  29. +0 −54 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/FTPFileFilters.java
  30. +0 −194 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/FTPHTTPClient.java
  31. +0 −311 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/FTPListParseEngine.java
  32. +0 −193 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/FTPReply.java
  33. +0 −931 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/FTPSClient.java
  34. +0 −52 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/FTPSCommand.java
  35. +0 −72 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/FTPSServerSocketFactory.java
  36. +0 −116 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/FTPSSocketFactory.java
  37. +0 −54 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/FTPSTrustManager.java
  38. +0 −33 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/OnFtpInputStreamListener.java
  39. +0 −21 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/package-info.java
  40. +0 −59 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/parser/CompositeFileEntryParser.java
  41. +0 −123 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/parser/ConfigurableFTPFileEntryParserImpl.java
  42. +0 −254 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/parser/DefaultFTPFileEntryParserFactory.java
  43. +0 −159 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/parser/EnterpriseUnixFTPEntryParser.java
  44. +0 −63 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/parser/FTPFileEntryParserFactory.java
  45. +0 −53 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/parser/FTPTimestampParser.java
  46. +0 −403 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/parser/FTPTimestampParserImpl.java
  47. +0 −260 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/parser/MLSxEntryParser.java
  48. +0 −537 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/parser/MVSFTPEntryParser.java
  49. +0 −245 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/parser/MacOsPeterFTPEntryParser.java
  50. +0 −142 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/parser/NTFTPEntryParser.java
  51. +0 −175 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/parser/NetwareFTPEntryParser.java
  52. +0 −127 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/parser/OS2FTPEntryParser.java
  53. +0 −399 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/parser/OS400FTPEntryParser.java
  54. +0 −60 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/parser/ParserInitializationException.java
  55. +0 −199 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/parser/RegexFTPFileEntryParserImpl.java
  56. +0 −335 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/parser/UnixFTPEntryParser.java
  57. +0 −251 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/parser/VMSFTPEntryParser.java
  58. +0 −153 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/parser/VMSVersioningFTPEntryParser.java
  59. +0 −21 AriaFtpPlug/src/main/java/aria/apache/commons/net/ftp/parser/package-info.java
  60. +0 −75 AriaFtpPlug/src/main/java/aria/apache/commons/net/io/CRLFLineReader.java
  61. +0 −111 AriaFtpPlug/src/main/java/aria/apache/commons/net/io/CopyStreamAdapter.java
  62. +0 −113 AriaFtpPlug/src/main/java/aria/apache/commons/net/io/CopyStreamEvent.java
  63. +0 −69 AriaFtpPlug/src/main/java/aria/apache/commons/net/io/CopyStreamException.java
  64. +0 −68 AriaFtpPlug/src/main/java/aria/apache/commons/net/io/CopyStreamListener.java
  65. +0 −238 AriaFtpPlug/src/main/java/aria/apache/commons/net/io/DotTerminatedMessageReader.java
  66. +0 −189 AriaFtpPlug/src/main/java/aria/apache/commons/net/io/DotTerminatedMessageWriter.java
  67. +0 −196 AriaFtpPlug/src/main/java/aria/apache/commons/net/io/FromNetASCIIInputStream.java
  68. +0 −150 AriaFtpPlug/src/main/java/aria/apache/commons/net/io/FromNetASCIIOutputStream.java
  69. +0 −64 AriaFtpPlug/src/main/java/aria/apache/commons/net/io/SocketInputStream.java
  70. +0 −80 AriaFtpPlug/src/main/java/aria/apache/commons/net/io/SocketOutputStream.java
  71. +0 −165 AriaFtpPlug/src/main/java/aria/apache/commons/net/io/ToNetASCIIInputStream.java
  72. +0 −105 AriaFtpPlug/src/main/java/aria/apache/commons/net/io/ToNetASCIIOutputStream.java
  73. +0 −351 AriaFtpPlug/src/main/java/aria/apache/commons/net/io/Util.java
  74. +0 −21 AriaFtpPlug/src/main/java/aria/apache/commons/net/io/package-info.java
  75. +0 −1,056 AriaFtpPlug/src/main/java/aria/apache/commons/net/util/Base64.java
  76. +0 −53 AriaFtpPlug/src/main/java/aria/apache/commons/net/util/Charsets.java
  77. +0 −236 AriaFtpPlug/src/main/java/aria/apache/commons/net/util/KeyManagerUtils.java
  78. +0 −59 AriaFtpPlug/src/main/java/aria/apache/commons/net/util/ListenerList.java
  79. +0 −77 AriaFtpPlug/src/main/java/aria/apache/commons/net/util/SSLContextUtils.java
  80. +0 −68 AriaFtpPlug/src/main/java/aria/apache/commons/net/util/SSLSocketUtils.java
  81. +0 −395 AriaFtpPlug/src/main/java/aria/apache/commons/net/util/SubnetUtils.java
  82. +0 −113 AriaFtpPlug/src/main/java/aria/apache/commons/net/util/TrustManagerUtils.java
  83. +0 −21 AriaFtpPlug/src/main/java/aria/apache/commons/net/util/package-info.java
  84. +1 −0 DEV_LOG.md
  85. +1 −1 FtpComponent/src/main/java/com/arialyy/aria/ftp/AbsFtpInfoThread.java
  86. +27 −0 FtpComponent/src/main/java/com/arialyy/aria/ftp/FtpTaskOption.java
  87. +1 −1 HttpComponent/src/main/java/com/arialyy/aria/http/HttpRecordAdapter.java
  88. +0 −15 PublicComponent/src/main/java/com/arialyy/aria/core/common/RecordHandler.java
  89. +16 −15 PublicComponent/src/main/java/com/arialyy/aria/core/common/RecordHelper.java
  90. +5 −0 PublicComponent/src/main/java/com/arialyy/aria/core/loader/ThreadStateManager.java
  91. +1 −1 PublicComponent/src/main/java/com/arialyy/aria/orm/DBConfig.java
  92. +61 −18 PublicComponent/src/main/java/com/arialyy/aria/orm/SqlHelper.java
  93. +46 −20 PublicComponent/src/main/java/com/arialyy/aria/orm/SqlUtil.java
  94. +3 −2 app/src/main/java/com/arialyy/simple/core/download/FtpDownloadActivity.java
  95. +2 −1 app/src/main/java/com/arialyy/simple/core/download/FtpDownloadModule.java
  96. +2 −2 app/src/main/java/com/arialyy/simple/core/download/SingleTaskActivity.java
  97. +1 −1 build.gradle
  98. +1 −1 settings.gradle
@@ -21,6 +21,12 @@
import com.arialyy.aria.core.processor.IFtpUploadInterceptor;
import com.arialyy.aria.util.ALog;
import com.arialyy.aria.util.CheckUtil;
import java.text.DateFormatSymbols;
import java.util.Collection;
import java.util.Locale;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.TreeMap;

/**
* Created by laoyuyu on 2018/3/9.
@@ -37,6 +43,15 @@
private int minPort, maxPort;
private String activeExternalIPAddress;

//---------------- ftp client 配置信息 start
private String defaultDateFormatStr = null;
private String recentDateFormatStr = null;
private String serverLanguageCode = null;
private String shortMonthNames = null;
private String serverTimeZoneId = null;
private String systemKey = FTPServerIdentifier.SYST_UNIX;
//---------------- ftp client 配置信息 end

public FtpOption() {
super();
}
@@ -203,6 +218,78 @@ public FtpOption setActiveExternalIPAddress(String ip) {
return this;
}

/**
* 设置ftp服务器所在的操作系统的标志,如果出现文件获取失败,请设置该标志为
* 默认使用{@link FTPServerIdentifier#SYST_UNIX}
*
* @param identifier {@link FTPServerIdentifier}
*/
public FtpOption setServerIdentifier(String identifier) {
this.systemKey = identifier;
return this;
}

/**
* 解析ftp信息时,默认的文件日期格式,如:setDefaultDateFormatStr("d MMM yyyy")
*
* @param defaultDateFormatStr 日期格式
*/
public FtpOption setDefaultDateFormatStr(String defaultDateFormatStr) {
this.defaultDateFormatStr = defaultDateFormatStr;
return this;
}

/**
* 解析ftp信息时,默认的文件修改日期格式,如:setRecentDateFormatStr("d MMM HH:mm")
*
* @param recentDateFormatStr 日期格式
*/
public FtpOption setRecentDateFormatStr(String recentDateFormatStr) {
this.recentDateFormatStr = recentDateFormatStr;
return this;
}

/**
* 设置服务器使用的时区,java.util.TimeZone,如:America/Chicago or Asia/Rangoon.
*
* @param serverTimeZoneId 时区
*/
public void setServerTimeZoneId(String serverTimeZoneId) {
this.serverTimeZoneId = serverTimeZoneId;
}

/**
* <p>
* setter for the shortMonthNames property.
* This property allows the user to specify a set of month names
* used by the server that is different from those that may be
* specified using the {@link #setServerLanguageCode(String) serverLanguageCode}
* property.
* </p><p>
* This should be a string containing twelve strings each composed of
* three characters, delimited by pipe (|) characters. Currently,
* only 8-bit ASCII characters are known to be supported. For example,
* a set of month names used by a hypothetical Icelandic FTP server might
* conceivably be specified as
* <code>"jan|feb|mar|apr|ma&#xED;|j&#xFA;n|j&#xFA;l|&#xE1;g&#xFA;|sep|okt|n&#xF3;v|des"</code>.
* </p>
*
* @param shortMonthNames The value to set to the shortMonthNames property.
*/
public void setShortMonthNames(String shortMonthNames) {
this.shortMonthNames = shortMonthNames;
}

/**
* 设置服务器语言代码
*
* @param serverLanguageCode {@link #LANGUAGE_CODE_MAP}
*/
public FtpOption setServerLanguageCode(String serverLanguageCode) {
this.serverLanguageCode = serverLanguageCode;
return this;
}

public void setUrlEntity(FtpUrlEntity urlEntity) {
this.urlEntity = urlEntity;
urlEntity.needLogin = isNeedLogin;
@@ -218,4 +305,191 @@ public void setUrlEntity(FtpUrlEntity urlEntity) {
urlEntity.isImplicit = isImplicit;
}
}

/**
* ftp 服务器所在的操作系统标志
*/
public interface FTPServerIdentifier {
/**
* Identifier by which a unix-based ftp server is known throughout
* the commons-net ftp system.
*/
String SYST_UNIX = "UNIX";

/**
* Identifier for alternate UNIX parser; same as {@link #SYST_UNIX} but leading spaces are
* trimmed from file names. This is to maintain backwards compatibility with
* the original behaviour of the parser which ignored multiple spaces between the date
* and the start of the file name.
*
* @since 3.4
*/
String SYST_UNIX_TRIM_LEADING = "UNIX_LTRIM";

/**
* Identifier by which a vms-based ftp server is known throughout
* the commons-net ftp system.
*/
String SYST_VMS = "VMS";

/**
* Identifier by which a WindowsNT-based ftp server is known throughout
* the commons-net ftp system.
*/
String SYST_NT = "WINDOWS";

/**
* Identifier by which an OS/2-based ftp server is known throughout
* the commons-net ftp system.
*/
String SYST_OS2 = "OS/2";

/**
* Identifier by which an OS/400-based ftp server is known throughout
* the commons-net ftp system.
*/
String SYST_OS400 = "OS/400";

/**
* Identifier by which an AS/400-based ftp server is known throughout
* the commons-net ftp system.
*/
String SYST_AS400 = "AS/400";

/**
* Identifier by which an MVS-based ftp server is known throughout
* the commons-net ftp system.
*/
String SYST_MVS = "MVS";

/**
* Some servers return an "UNKNOWN Type: L8" message
* in response to the SYST command. We set these to be a Unix-type system.
* This may happen if the ftpd in question was compiled without system
* information.
*
* NET-230 - Updated to be UPPERCASE so that the check done in
* createFileEntryParser will succeed.
*
* @since 1.5
*/
String SYST_L8 = "TYPE: L8";

/**
* Identifier by which an Netware-based ftp server is known throughout
* the commons-net ftp system.
*
* @since 1.5
*/
String SYST_NETWARE = "NETWARE";

/**
* Identifier by which a Mac pre OS-X -based ftp server is known throughout
* the commons-net ftp system.
*
* @since 3.1
*/
// Full string is "MACOS Peter's Server"; the substring below should be enough
String SYST_MACOS_PETER = "MACOS PETER"; // NET-436
}

/**
* 支持的语言代码
*/
private static final Map<String, Object> LANGUAGE_CODE_MAP = new TreeMap<>();

static {

// if there are other commonly used month name encodings which
// correspond to particular locales, please add them here.

// many locales code short names for months as all three letters
// these we handle simply.
LANGUAGE_CODE_MAP.put("en", Locale.ENGLISH);
LANGUAGE_CODE_MAP.put("de", Locale.GERMAN);
LANGUAGE_CODE_MAP.put("it", Locale.ITALIAN);
LANGUAGE_CODE_MAP.put("es", new Locale("es", "", "")); // spanish
LANGUAGE_CODE_MAP.put("pt", new Locale("pt", "", "")); // portuguese
LANGUAGE_CODE_MAP.put("da", new Locale("da", "", "")); // danish
LANGUAGE_CODE_MAP.put("sv", new Locale("sv", "", "")); // swedish
LANGUAGE_CODE_MAP.put("no", new Locale("no", "", "")); // norwegian
LANGUAGE_CODE_MAP.put("nl", new Locale("nl", "", "")); // dutch
LANGUAGE_CODE_MAP.put("ro", new Locale("ro", "", "")); // romanian
LANGUAGE_CODE_MAP.put("sq", new Locale("sq", "", "")); // albanian
LANGUAGE_CODE_MAP.put("sh", new Locale("sh", "", "")); // serbo-croatian
LANGUAGE_CODE_MAP.put("sk", new Locale("sk", "", "")); // slovak
LANGUAGE_CODE_MAP.put("sl", new Locale("sl", "", "")); // slovenian

// some don't
LANGUAGE_CODE_MAP.put("fr",
"jan|f\u00e9v|mar|avr|mai|jun|jui|ao\u00fb|sep|oct|nov|d\u00e9c"); //french
}

/**
* Looks up the supplied language code in the internally maintained table of
* language codes. Returns a DateFormatSymbols object configured with
* short month names corresponding to the code. If there is no corresponding
* entry in the table, the object returned will be that for
* <code>Locale.US</code>
*
* @param languageCode See {@link #setServerLanguageCode(String) serverLanguageCode}
* @return a DateFormatSymbols object configured with short month names
* corresponding to the supplied code, or with month names for
* <code>Locale.US</code> if there is no corresponding entry in the internal
* table.
*/
public static DateFormatSymbols lookupDateFormatSymbols(String languageCode) {
Object lang = LANGUAGE_CODE_MAP.get(languageCode);
if (lang != null) {
if (lang instanceof Locale) {
return new DateFormatSymbols((Locale) lang);
} else if (lang instanceof String) {
return getDateFormatSymbols((String) lang);
}
}
return new DateFormatSymbols(Locale.US);
}

/**
* Returns a DateFormatSymbols object configured with short month names
* as in the supplied string
*
* @param shortmonths This should be as described in
* {@link #setShortMonthNames(String) shortMonthNames}
* @return a DateFormatSymbols object configured with short month names
* as in the supplied string
*/
public static DateFormatSymbols getDateFormatSymbols(String shortmonths) {
String[] months = splitShortMonthString(shortmonths);
DateFormatSymbols dfs = new DateFormatSymbols(Locale.US);
dfs.setShortMonths(months);
return dfs;
}

private static String[] splitShortMonthString(String shortmonths) {
StringTokenizer st = new StringTokenizer(shortmonths, "|");
int monthcnt = st.countTokens();
if (12 != monthcnt) {
throw new IllegalArgumentException("expecting a pipe-delimited string containing 12 tokens");
}
String[] months = new String[13];
int pos = 0;
while (st.hasMoreTokens()) {
months[pos++] = st.nextToken();
}
months[pos] = "";
return months;
}

/**
* Returns a Collection of all the language codes currently supported
* by this class. See {@link #setServerLanguageCode(String) serverLanguageCode}
* for a functional descrption of language codes within this system.
*
* @return a Collection of all the language codes currently supported
* by this class
*/
public static Collection<String> getSupportedLanguageCodes() {
return LANGUAGE_CODE_MAP.keySet();
}
}
@@ -181,7 +181,7 @@ public void register() {
}
}
} else {
ALog.e(TAG, "没有Aria的注解方法");
ALog.e(TAG, "没有Aria的注解方法,详情见:https://aria.laoyuyu.me/aria_doc/other/annotaion_invalid.html");
}
}

@@ -267,7 +267,7 @@ public void register() {
}
}
} else {
ALog.e(TAG, "没有Aria的注解方法");
ALog.e(TAG, "没有Aria的注解方法,详情见:https://aria.laoyuyu.me/aria_doc/other/annotaion_invalid.html");
}
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit bfc2cff

Please sign in to comment.
You can’t perform that action at this time.