com.silentgo.core.config.BaseConfig Maven / Gradle / Ivy
package com.silentgo.core.config;
import com.silentgo.core.action.ActionChain;
import com.silentgo.core.aop.annotationintercept.IAnnotation;
import com.silentgo.core.aop.annotationintercept.support.AnnotationInterceptor;
import com.silentgo.core.aop.aspect.support.AspectInterceptor;
import com.silentgo.core.aop.validator.support.ValidatorInterceptor;
import com.silentgo.core.cache.CacheManager;
import com.silentgo.core.cache.EhCache;
import com.silentgo.core.ioc.bean.BeanFactory;
import com.silentgo.core.ioc.bean.SilentGoBeanFactory;
import com.silentgo.core.plugin.event.EventListener;
import com.silentgo.core.route.RoutePaser;
import com.silentgo.core.route.support.routeparse.DefaultRouteParser;
import com.silentgo.core.support.BaseFactory;
import com.silentgo.orm.base.DBConnect;
import com.silentgo.orm.base.DBType;
import com.silentgo.utils.ClassKit;
import com.silentgo.utils.CollectionKit;
import com.silentgo.utils.json.GsonPaser;
import com.silentgo.utils.json.JsonPaser;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Project : silentgo
* com.silentgo.core.config
*
* @author teddyzhu
*
* Created by teddyzhu on 16/9/2.
*/
public class BaseConfig extends InterConfig {
Map abstractConfigMap = new HashMap() {{
put(Const.FileUploadConfig, new FileUploadConfig(ClassKit.getWebRootPath() + "/UploadFile", -1, 10240, true));
}};
private String propfile = "application.properties";
private Class extends BeanFactory> beanClass = SilentGoBeanFactory.class;
private List> annotationIntecepters = new ArrayList<>();
private JsonPaser jsonPaser = new GsonPaser();
private RoutePaser routePaser = new DefaultRouteParser();
private List> factories = new ArrayList<>();
private String dbType;
private String BaseViewPath = Const.BaseView;
private List actionChains = new ArrayList<>();
private Map staticMapping = new HashMap<>();
private List> eventListeners = new ArrayList<>();
private Class extends CacheManager> cacheClz = EhCache.class;
private List staticEndWith = new ArrayList<>();
private List staticStartWith = new ArrayList<>();
private List scanPackages = new ArrayList<>();
private List scanJars = new ArrayList<>();
private List extraConfig = new ArrayList<>();
private boolean devMode = false;
private String encoding = "utf-8";
private int contextPathLength;
public Class extends CacheManager> getCacheClz() {
return cacheClz;
}
public void setCacheClz(Class extends CacheManager> cacheClz) {
this.cacheClz = cacheClz;
}
@SuppressWarnings("unchecked")
private ArrayList interceptors = new ArrayList() {{
add(new AnnotationInterceptor());
add(new AspectInterceptor());
add(new ValidatorInterceptor());
}};
public List> getFactories() {
return factories;
}
public List> getAnnotationIntecepters() {
return annotationIntecepters;
}
public List getActionChains() {
return actionChains;
}
public Map getStaticMapping() {
return staticMapping;
}
public JsonPaser getJsonPaser() {
return jsonPaser;
}
public void setJsonPaser(JsonPaser jsonPaser) {
this.jsonPaser = jsonPaser;
}
public RoutePaser getRoutePaser() {
return routePaser;
}
public void setRoutePaser(RoutePaser routePaser) {
this.routePaser = routePaser;
}
public String getBaseViewPath() {
return BaseViewPath;
}
public void setBaseViewPath(String baseViewPath) {
BaseViewPath = baseViewPath;
}
public List getStaticStartWith() {
return staticStartWith;
}
public List getStaticEndWith() {
return staticEndWith;
}
public void setStaticStartWith(List staticStartWith) {
this.staticStartWith = staticStartWith;
}
public List getScanPackages() {
return scanPackages;
}
public void setScanPackages(List scanPackages) {
this.scanPackages = scanPackages;
}
public List getScanJars() {
return scanJars;
}
public void setScanJars(List scanJars) {
this.scanJars = scanJars;
}
public boolean isDevMode() {
return devMode;
}
public void setDevMode(boolean devMode) {
this.devMode = devMode;
}
public String getEncoding() {
return encoding;
}
public void setEncoding(String encoding) {
this.encoding = encoding;
}
public int getContextPathLength() {
return contextPathLength;
}
public void setContextPathLength(int contextPathLength) {
this.contextPathLength = contextPathLength;
}
public ArrayList getInterceptors() {
return interceptors;
}
public void setInterceptors(ArrayList interceptors) {
this.interceptors = interceptors;
}
public boolean addAbstractConfig(AbstractConfig config) {
return CollectionKit.MapAdd(abstractConfigMap, config.name(), config);
}
public AbstractConfig getConfig(String type) {
return abstractConfigMap.get(type);
}
public AbstractConfig getConfig(DBType type) {
return abstractConfigMap.get(type.getName());
}
public String getDbType() {
return dbType;
}
public void setDbType(String dbType) {
this.dbType = dbType.toLowerCase();
}
public Class extends BeanFactory> getBeanClass() {
return beanClass;
}
public void setBeanClass(Class extends BeanFactory> beanClass) {
this.beanClass = beanClass;
}
public String getPropfile() {
return propfile;
}
public void setPropfile(String propfile) {
this.propfile = propfile;
}
public List getExtraConfig() {
return extraConfig;
}
public List> getEventListeners() {
return eventListeners;
}
}