com.acgist.main.Application Maven / Gradle / Ivy
package com.acgist.main;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.acgist.snail.gui.GuiHandler;
import com.acgist.snail.system.context.SystemContext;
/**
* Snail系统启动类
* Snail(蜗牛)是一款下载软件,支持下载协议:BT(BitTorrent)、FTP、HTTP。
*
* @author acgist
* @since 1.0.0
*/
public final class Application {
private static final Logger LOGGER = LoggerFactory.getLogger(Application.class);
/**
* 启动系统
*
*
* 启动参数
* 功能
*
*
* args[0]
* gui:本地GUI;daemo:后台模式;
*
*
*
* @param args 启动参数
*/
public static final void main(String[] args) {
LOGGER.info("系统开始启动");
SystemContext.info();
final boolean enable = listen();
if(enable) {
buildContext();
buildWindow(args);
}
LOGGER.info("系统启动完成");
}
/**
* 启动系统监听
*
* @return true-成功;false-失败;
*/
private static final boolean listen() {
return SystemContext.listen();
}
/**
* 初始化系统上下文
*/
private static final void buildContext() {
SystemContext.init();
}
/**
* 初始化GUI窗口
*
* @param args 启动参数
*/
private static final void buildWindow(String ... args) {
GuiHandler.getInstance().init(args).build();
}
}