使用spi机制优化组件的加载
This commit is contained in:
@@ -45,7 +45,9 @@ final class FtpDGLoader extends AbsGroupLoader {
|
||||
|
||||
@Override
|
||||
protected AbsSubDLoadUtil createSubLoader(DTaskWrapper wrapper, boolean needGetFileInfo) {
|
||||
return new FtpSubDLoaderUtil(wrapper, getScheduler(), needGetFileInfo, getKey());
|
||||
FtpSubDLoaderUtil subUtil = new FtpSubDLoaderUtil(getScheduler(), needGetFileInfo, getKey());
|
||||
subUtil.setParams(wrapper, null);
|
||||
return subUtil;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.arialyy.aria.ftp.download;
|
||||
import com.arialyy.aria.core.download.DGTaskWrapper;
|
||||
import com.arialyy.aria.core.group.AbsGroupLoader;
|
||||
import com.arialyy.aria.core.group.AbsGroupLoaderUtil;
|
||||
import com.arialyy.aria.core.listener.IEventListener;
|
||||
import com.arialyy.aria.core.loader.LoaderStructure;
|
||||
import com.arialyy.aria.core.wrapper.AbsTaskWrapper;
|
||||
import com.arialyy.aria.ftp.FtpTaskOption;
|
||||
@@ -29,13 +28,12 @@ import com.arialyy.aria.ftp.FtpTaskOption;
|
||||
*/
|
||||
public final class FtpDGLoaderUtil extends AbsGroupLoaderUtil {
|
||||
|
||||
public FtpDGLoaderUtil(AbsTaskWrapper wrapper, IEventListener listener) {
|
||||
super(wrapper, listener);
|
||||
wrapper.generateTaskOption(FtpTaskOption.class);
|
||||
}
|
||||
|
||||
@Override protected AbsGroupLoader getLoader() {
|
||||
return mLoader == null ? new FtpDGLoader(getTaskWrapper(), getListener()) : mLoader;
|
||||
if (mLoader == null) {
|
||||
((AbsTaskWrapper) getTaskWrapper()).generateTaskOption(FtpTaskOption.class);
|
||||
mLoader = new FtpDGLoader((AbsTaskWrapper) getTaskWrapper(), getListener());
|
||||
}
|
||||
return mLoader;
|
||||
}
|
||||
|
||||
@Override protected LoaderStructure buildLoaderStructure() {
|
||||
|
||||
@@ -16,14 +16,12 @@
|
||||
package com.arialyy.aria.ftp.download;
|
||||
|
||||
import com.arialyy.aria.core.download.DTaskWrapper;
|
||||
import com.arialyy.aria.core.listener.IEventListener;
|
||||
import com.arialyy.aria.core.loader.AbsNormalLoader;
|
||||
import com.arialyy.aria.core.loader.AbsNormalLoaderUtil;
|
||||
import com.arialyy.aria.core.loader.LoaderStructure;
|
||||
import com.arialyy.aria.core.loader.NormalLoader;
|
||||
import com.arialyy.aria.core.loader.NormalTTBuilder;
|
||||
import com.arialyy.aria.core.loader.NormalThreadStateManager;
|
||||
import com.arialyy.aria.core.wrapper.AbsTaskWrapper;
|
||||
import com.arialyy.aria.ftp.FtpTaskOption;
|
||||
|
||||
/**
|
||||
@@ -32,13 +30,12 @@ import com.arialyy.aria.ftp.FtpTaskOption;
|
||||
*/
|
||||
public final class FtpDLoaderUtil extends AbsNormalLoaderUtil {
|
||||
|
||||
public FtpDLoaderUtil(AbsTaskWrapper wrapper, IEventListener listener) {
|
||||
super(wrapper, listener);
|
||||
wrapper.generateTaskOption(FtpTaskOption.class);
|
||||
}
|
||||
|
||||
@Override public AbsNormalLoader getLoader() {
|
||||
return mLoader == null ? new NormalLoader(getTaskWrapper(), getListener()) : mLoader;
|
||||
if (mLoader == null){
|
||||
getTaskWrapper().generateTaskOption(FtpTaskOption.class);
|
||||
mLoader = new NormalLoader(getTaskWrapper(), getListener());
|
||||
}
|
||||
return mLoader ;
|
||||
}
|
||||
|
||||
public LoaderStructure BuildLoaderStructure() {
|
||||
|
||||
@@ -32,9 +32,8 @@ final class FtpSubDLoaderUtil extends AbsSubDLoadUtil {
|
||||
* @param schedulers 调度器
|
||||
* @param needGetInfo {@code true} 需要获取文件信息。{@code false} 不需要获取文件信息
|
||||
*/
|
||||
FtpSubDLoaderUtil(DTaskWrapper taskWrapper, Handler schedulers, boolean needGetInfo,
|
||||
String parentKey) {
|
||||
super(taskWrapper, schedulers, needGetInfo, parentKey);
|
||||
FtpSubDLoaderUtil(Handler schedulers, boolean needGetInfo, String parentKey) {
|
||||
super(schedulers, needGetInfo, parentKey);
|
||||
}
|
||||
|
||||
@Override protected SubLoader getLoader() {
|
||||
|
||||
@@ -17,7 +17,6 @@ package com.arialyy.aria.ftp.upload;
|
||||
|
||||
import com.arialyy.aria.core.TaskRecord;
|
||||
import com.arialyy.aria.core.common.SubThreadConfig;
|
||||
import com.arialyy.aria.core.listener.IEventListener;
|
||||
import com.arialyy.aria.core.loader.AbsNormalLoader;
|
||||
import com.arialyy.aria.core.loader.AbsNormalLoaderUtil;
|
||||
import com.arialyy.aria.core.loader.AbsNormalTTBuilderAdapter;
|
||||
@@ -26,7 +25,6 @@ import com.arialyy.aria.core.loader.NormalTTBuilder;
|
||||
import com.arialyy.aria.core.loader.NormalThreadStateManager;
|
||||
import com.arialyy.aria.core.task.IThreadTaskAdapter;
|
||||
import com.arialyy.aria.core.upload.UTaskWrapper;
|
||||
import com.arialyy.aria.core.wrapper.AbsTaskWrapper;
|
||||
import com.arialyy.aria.ftp.FtpTaskOption;
|
||||
|
||||
/**
|
||||
@@ -35,14 +33,12 @@ import com.arialyy.aria.ftp.FtpTaskOption;
|
||||
*/
|
||||
public final class FtpULoaderUtil extends AbsNormalLoaderUtil {
|
||||
|
||||
public FtpULoaderUtil(AbsTaskWrapper wrapper, IEventListener listener) {
|
||||
super(wrapper, listener);
|
||||
wrapper.generateTaskOption(FtpTaskOption.class);
|
||||
}
|
||||
|
||||
@Override public AbsNormalLoader getLoader() {
|
||||
return mLoader == null ? new FtpULoader((UTaskWrapper) getTaskWrapper(), getListener())
|
||||
: mLoader;
|
||||
if (mLoader == null) {
|
||||
getTaskWrapper().generateTaskOption(FtpTaskOption.class);
|
||||
mLoader = new FtpULoader((UTaskWrapper) getTaskWrapper(), getListener());
|
||||
}
|
||||
return mLoader;
|
||||
}
|
||||
|
||||
@Override public LoaderStructure BuildLoaderStructure() {
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
com.arialyy.aria.ftp.download.FtpDLoaderUtil
|
||||
com.arialyy.aria.ftp.download.FtpDGLoaderUtil
|
||||
com.arialyy.aria.ftp.upload.FtpULoaderUtil
|
||||
Reference in New Issue
Block a user