FtpServerContext:FtpServer的扩展点

FtpServerContext中有什么啊,呵呵,什么都有了。

FtpServerContext 写道
public interface FtpServerContext extends FtpletContext {

ConnectionConfig getConnectionConfig();

/**
* Get message resource.
*/
MessageResource getMessageResource();

/**
* Get ftplet container.
*/
FtpletContainer getFtpletContainer();

Listener getListener(String name);

Map<String, Listener> getListeners();

/**
* Get the command factory.
*/
CommandFactory getCommandFactory();

/**
* Release all components.
*/
void dispose();
}

 ConnectionConfig:关于Connection的配置

 MessageResource:Message源

 CommandFactor:命令解析的

…………

这个可能没有什么说服力,开始我也没什么感觉,看了他的默认实现就知道了

写道
public class DefaultFtpServerContext implements FtpServerContext {

private final Logger LOG = LoggerFactory
.getLogger(DefaultFtpServerContext.class);

private MessageResource messageResource = new MessageResourceImpl();

private UserManager userManager = new PropertiesUserManager();

private FileSystemManager fileSystemManager = new NativeFileSystemManager();

private FtpletContainer ftpletContainer = new DefaultFtpletContainer();

private FtpStatistics statistics = new FtpStatisticsImpl();

private CommandFactory commandFactory = new DefaultCommandFactory();

private ConnectionConfig connectionConfig = new DefaultConnectionConfig();

private Map<String, Listener> listeners = new HashMap<String, Listener>();

 DefaultFtpServerContext的代码片段,看了就知道我们可以替换哪些了。。差不多FtpServer的家伙事儿都在这儿了

那么从这里为入手点,继续看ftpserver都是怎么摆弄这些的。

也有了自己写个其他实现的FtpServerContext的实现的冲动了。

很喜欢这东西,所有的东西都在这里,看上去一目了然,想替换?come on!不比很多其他的设计,可配置的东西都几乎“平均”分配到很多类中。难懂不说,如果想改,动一处往往很难解决问题。这也就导致了门槛的产生。

从这里break through

未完待续

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值