mirror of
https://gitee.com/huoyo/ko-time.git
synced 2025-12-06 16:58:26 +08:00
61 lines
1.4 KiB
Java
61 lines
1.4 KiB
Java
package cn.langpy.kotime.util;
|
|
|
|
import cn.langpy.kotime.config.DefaultConfig;
|
|
import cn.langpy.kotime.handler.InvokedHandler;
|
|
import cn.langpy.kotime.service.GraphService;
|
|
|
|
import javax.sql.DataSource;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* zhangchang
|
|
*/
|
|
public class Context {
|
|
|
|
private static DefaultConfig config;
|
|
private static List<InvokedHandler> invokedHandlers;
|
|
private static DataSource dataSource;
|
|
private static GraphService saver;
|
|
|
|
static {
|
|
config = new DefaultConfig();
|
|
config.setLogEnable(false);
|
|
config.setEnable(true);
|
|
config.setLogLanguage("chinese");
|
|
invokedHandlers = new ArrayList<>();
|
|
}
|
|
|
|
public static void setConfig(DefaultConfig koTimeConfig) {
|
|
config = koTimeConfig;
|
|
}
|
|
|
|
public static DefaultConfig getConfig() {
|
|
return config;
|
|
}
|
|
|
|
public static void addInvokedHandler(InvokedHandler invokedHandler) {
|
|
invokedHandlers.add(invokedHandler);
|
|
}
|
|
|
|
public static List<InvokedHandler> getInvokedHandlers() {
|
|
return invokedHandlers;
|
|
}
|
|
|
|
public static DataSource getDataSource() {
|
|
return dataSource;
|
|
}
|
|
|
|
public static void setDataSource(DataSource dataSource) {
|
|
Context.dataSource = dataSource;
|
|
}
|
|
|
|
public static GraphService getSaver() {
|
|
return saver;
|
|
}
|
|
|
|
public static void setSaver(GraphService saver) {
|
|
Context.saver = saver;
|
|
}
|
|
}
|