Search in sources :

Example 21 with ConfigBean

use of org.eweb4j.config.bean.ConfigBean in project eweb4j-framework by laiweiwei.

the class CheckConfigBean method checkMVCInterceptor.

public static String checkMVCInterceptor(InterConfigBean inter, String xmlFile) {
    String error = null;
    ConfigBean cb = (ConfigBean) SingleBeanCache.get(ConfigBean.class.getName());
    if ("true".equalsIgnoreCase(cb.getMvc().getOpen()) || "1".equals(cb.getMvc().getOpen())) {
        StringBuilder sb = new StringBuilder();
        if (!"".equals(inter.getClazz())) {
            try {
                if (Thread.currentThread().getContextClassLoader().loadClass(inter.getClazz()) == null) {
                    sb.append("当前您填写的( class=").append(inter.getClazz()).append(" )是错误的!它必须是一个有效的类 ;\n");
                }
            } catch (ClassNotFoundException e) {
                sb.append("当前您填写的( class=").append(inter.getClazz()).append(" )是错误的!它必须是一个有效的类 ;\n");
            }
        }
        if (inter.getType() == null)
            inter.setType("");
        if (!"".equals(inter.getType()) && !"before".equalsIgnoreCase(inter.getType()) && !"after".equalsIgnoreCase(inter.getType())) {
            sb.append("当前您填写的:( type=").append(inter.getType()).append(" )是错误的!它只能填写为:before|after|留空  中的一种 ;").append("\n");
        }
        if (inter.getPolicy() != null && !"".equals(inter.getPolicy()) && !"and".equalsIgnoreCase(inter.getPolicy()) && !"or".equalsIgnoreCase(inter.getPolicy())) {
            sb.append("当前您填写的:( policy=").append(inter.getPolicy()).append(" )是错误的!它只能填写为:and|or|留空  中的一种 ;").append("\n");
        }
        for (Uri url : inter.getUri()) {
            if (url.getType() == null)
                url.setType("");
            if (!"start".equalsIgnoreCase(url.getType()) && !"end".equalsIgnoreCase(url.getType()) && !"contains".equalsIgnoreCase(url.getType()) && !"all".equalsIgnoreCase(url.getType()) && !"regex".equalsIgnoreCase(url.getType()) && !"!start".equalsIgnoreCase(url.getType()) && !"!end".equalsIgnoreCase(url.getType()) && !"!contains".equalsIgnoreCase(url.getType()) && !"!all".equalsIgnoreCase(url.getType()) && !"!regex".equalsIgnoreCase(url.getType()) && !"*".equals(url.getType()) && !"actions".equals(url.getType()) && !"!actions".equals(url.getType()) && !"".equals(url.getType())) {
                sb.append("当前您填写的:( type=").append(url.getType()).append(" )是错误的!它只能填写为:start|end|contains|all|regex|!start|!end|!contains|!all|!regex|*|留空  中的一种 ;").append("\n");
            }
        }
        if (!"".equals(sb.toString())) {
            error = "\n<br /><b>" + xmlFile + ":[bean name=" + inter.getName() + "]</b>\n" + sb.toString();
        }
    }
    return error;
}
Also used : ORMConfigBean(org.eweb4j.orm.config.bean.ORMConfigBean) FieldConfigBean(org.eweb4j.mvc.config.bean.FieldConfigBean) DBInfoConfigBean(org.eweb4j.orm.dao.config.bean.DBInfoConfigBean) ParamConfigBean(org.eweb4j.mvc.config.bean.ParamConfigBean) ResultConfigBean(org.eweb4j.mvc.config.bean.ResultConfigBean) IOCConfigBean(org.eweb4j.ioc.config.bean.IOCConfigBean) LogConfigBean(org.eweb4j.config.bean.LogConfigBean) ActionConfigBean(org.eweb4j.mvc.config.bean.ActionConfigBean) ConfigBean(org.eweb4j.config.bean.ConfigBean) InterConfigBean(org.eweb4j.mvc.config.bean.InterConfigBean) ValidatorConfigBean(org.eweb4j.mvc.config.bean.ValidatorConfigBean) Uri(org.eweb4j.mvc.config.bean.Uri)

Example 22 with ConfigBean

use of org.eweb4j.config.bean.ConfigBean in project eweb4j-framework by laiweiwei.

the class CheckConfigBean method checkORM.

/**
	 * Check the ORM independent components configuration files
	 * 
	 * @param orm
	 * @return
	 */
public static String checkORM(ORMConfigBean orm, String xmlFile) {
    String error = null;
    ConfigBean cb = (ConfigBean) SingleBeanCache.get(ConfigBean.class.getName());
    if ("true".equalsIgnoreCase(cb.getOrm().getOpen()) || "1".equals(cb.getOrm().getOpen())) {
        StringBuilder sb = new StringBuilder();
        if (!"".equals(orm.getClazz())) {
            try {
                if (Thread.currentThread().getContextClassLoader().loadClass(orm.getClazz()) == null) {
                    sb.append("当前您填写的( class=").append(orm.getClazz()).append(" )是错误的!它必须是一个有效的类 ;\n");
                }
            } catch (ClassNotFoundException e) {
                sb.append("当前您填写的( class=").append(orm.getClazz()).append(" )是错误的!它必须是一个有效的类 ;\n");
            }
        }
        if (!"".equals(sb.toString())) {
            error = "\n<br /><b>" + xmlFile + ":[bean name=" + orm.getId() + "]</b>\n" + sb.toString();
        }
    }
    return error;
}
Also used : ORMConfigBean(org.eweb4j.orm.config.bean.ORMConfigBean) FieldConfigBean(org.eweb4j.mvc.config.bean.FieldConfigBean) DBInfoConfigBean(org.eweb4j.orm.dao.config.bean.DBInfoConfigBean) ParamConfigBean(org.eweb4j.mvc.config.bean.ParamConfigBean) ResultConfigBean(org.eweb4j.mvc.config.bean.ResultConfigBean) IOCConfigBean(org.eweb4j.ioc.config.bean.IOCConfigBean) LogConfigBean(org.eweb4j.config.bean.LogConfigBean) ActionConfigBean(org.eweb4j.mvc.config.bean.ActionConfigBean) ConfigBean(org.eweb4j.config.bean.ConfigBean) InterConfigBean(org.eweb4j.mvc.config.bean.InterConfigBean) ValidatorConfigBean(org.eweb4j.mvc.config.bean.ValidatorConfigBean)

Example 23 with ConfigBean

use of org.eweb4j.config.bean.ConfigBean in project eweb4j-framework by laiweiwei.

the class CheckConfigBean method checkORMProperty.

/**
	 * Check the Property part of ORM components configuration
	 * 
	 * @param pList
	 * @param ormList
	 * @return
	 */
public static String checkORMProperty(List<Property> pList, List<ORMConfigBean> ormList, String beanID, String xmlFile) {
    String error = null;
    ConfigBean cb = (ConfigBean) SingleBeanCache.get(ConfigBean.class.getName());
    if ("true".equalsIgnoreCase(cb.getOrm().getOpen()) || "1".equals(cb.getOrm().getOpen())) {
        StringBuilder sb = new StringBuilder();
        if (!"".equals(sb.toString())) {
            error = "\n<br /><b>" + xmlFile + "[bean id=" + beanID + "][property]:</b>\n" + sb.toString();
        }
    }
    return error;
}
Also used : ORMConfigBean(org.eweb4j.orm.config.bean.ORMConfigBean) FieldConfigBean(org.eweb4j.mvc.config.bean.FieldConfigBean) DBInfoConfigBean(org.eweb4j.orm.dao.config.bean.DBInfoConfigBean) ParamConfigBean(org.eweb4j.mvc.config.bean.ParamConfigBean) ResultConfigBean(org.eweb4j.mvc.config.bean.ResultConfigBean) IOCConfigBean(org.eweb4j.ioc.config.bean.IOCConfigBean) LogConfigBean(org.eweb4j.config.bean.LogConfigBean) ActionConfigBean(org.eweb4j.mvc.config.bean.ActionConfigBean) ConfigBean(org.eweb4j.config.bean.ConfigBean) InterConfigBean(org.eweb4j.mvc.config.bean.InterConfigBean) ValidatorConfigBean(org.eweb4j.mvc.config.bean.ValidatorConfigBean)

Example 24 with ConfigBean

use of org.eweb4j.config.bean.ConfigBean in project eweb4j-framework by laiweiwei.

the class CheckConfigBean method checkORMDBInfo.

/**
	 * Check the IOC component DBInfo part configuration
	 * 
	 * @param dcb
	 * @return
	 */
public static String checkORMDBInfo(DBInfoConfigBean dcb, String filePath) {
    String error = null;
    ConfigBean cb = (ConfigBean) SingleBeanCache.get(ConfigBean.class.getName());
    if ("true".equals(cb.getOrm().getOpen()) || "1".equals(cb.getOrm().getOpen())) {
        StringBuilder sb = new StringBuilder();
        if (!"".equals(sb.toString())) {
            error = "\n<br /><b>" + filePath + ":</b>\n" + sb.toString();
        }
    }
    return error;
}
Also used : ORMConfigBean(org.eweb4j.orm.config.bean.ORMConfigBean) FieldConfigBean(org.eweb4j.mvc.config.bean.FieldConfigBean) DBInfoConfigBean(org.eweb4j.orm.dao.config.bean.DBInfoConfigBean) ParamConfigBean(org.eweb4j.mvc.config.bean.ParamConfigBean) ResultConfigBean(org.eweb4j.mvc.config.bean.ResultConfigBean) IOCConfigBean(org.eweb4j.ioc.config.bean.IOCConfigBean) LogConfigBean(org.eweb4j.config.bean.LogConfigBean) ActionConfigBean(org.eweb4j.mvc.config.bean.ActionConfigBean) ConfigBean(org.eweb4j.config.bean.ConfigBean) InterConfigBean(org.eweb4j.mvc.config.bean.InterConfigBean) ValidatorConfigBean(org.eweb4j.mvc.config.bean.ValidatorConfigBean)

Example 25 with ConfigBean

use of org.eweb4j.config.bean.ConfigBean in project eweb4j-framework by laiweiwei.

the class ConfigBeanCreator method create.

public static ConfigBean create() {
    ConfigBean cb = new ConfigBean();
    I18N i18n = new I18N();
    Locale locale = new Locale();
    locale.setLanguage(java.util.Locale.CHINA.getLanguage());
    locale.setCountry(java.util.Locale.CHINA.getCountry());
    i18n.getLocale().add(locale);
    cb.setLocales(i18n);
    Properties props = new Properties();
    Prop file = new Prop();
    props.getFile().add(file);
    cb.setProperties(props);
    LogsConfigBean lcb = new LogsConfigBean();
    ConfigIOC ioc = new ConfigIOC();
    IOCXmlFiles iocXmlFiles = new IOCXmlFiles();
    iocXmlFiles.setPath(new ArrayList<String>());
    ioc.setIocXmlFiles(iocXmlFiles);
    ioc.setLogs(lcb);
    cb.setIoc(ioc);
    ConfigORM orm = new ConfigORM();
    orm.setLogs(lcb);
    Ddl ddl = new Ddl();
    orm.setDdl(ddl);
    ORMXmlFiles ormXmlFiles = new ORMXmlFiles();
    orm.setOrmXmlFiles(ormXmlFiles);
    ScanPojoPackage spp = new ScanPojoPackage();
    orm.setScanPojoPackage(spp);
    DBInfoXmlFiles dbInfoXmlFiles = new DBInfoXmlFiles();
    dbInfoXmlFiles.setPath(new ArrayList<String>());
    orm.setDbInfoXmlFiles(dbInfoXmlFiles);
    cb.setOrm(orm);
    ConfigMVC mvc = new ConfigMVC();
    mvc.setLogs(lcb);
    UploadConfigBean upload = new UploadConfigBean();
    mvc.setUpload(upload);
    ActionXmlFile actionFiles = new ActionXmlFile();
    actionFiles.setPath(new ArrayList<String>());
    mvc.setActionXmlFiles(actionFiles);
    InterXmlFile intFiles = new InterXmlFile();
    intFiles.setPath(new ArrayList<String>());
    mvc.setInterXmlFiles(intFiles);
    ScanActionPackage sap = new ScanActionPackage();
    mvc.setScanActionPackage(sap);
    ScanInterceptorPackage sip = new ScanInterceptorPackage();
    mvc.setScanInterceptorPackage(sip);
    cb.setMvc(mvc);
    return cb;
}
Also used : Locale(org.eweb4j.config.bean.Locale) ActionXmlFile(org.eweb4j.config.bean.ActionXmlFile) Prop(org.eweb4j.config.bean.Prop) ConfigIOC(org.eweb4j.config.bean.ConfigIOC) ConfigMVC(org.eweb4j.config.bean.ConfigMVC) InterXmlFile(org.eweb4j.config.bean.InterXmlFile) UploadConfigBean(org.eweb4j.config.bean.UploadConfigBean) ConfigBean(org.eweb4j.config.bean.ConfigBean) LogsConfigBean(org.eweb4j.config.bean.LogsConfigBean) ScanInterceptorPackage(org.eweb4j.config.bean.ScanInterceptorPackage) Properties(org.eweb4j.config.bean.Properties) ScanPojoPackage(org.eweb4j.config.bean.ScanPojoPackage) Ddl(org.eweb4j.config.bean.Ddl) IOCXmlFiles(org.eweb4j.config.bean.IOCXmlFiles) ConfigORM(org.eweb4j.config.bean.ConfigORM) LogsConfigBean(org.eweb4j.config.bean.LogsConfigBean) ScanActionPackage(org.eweb4j.config.bean.ScanActionPackage) ORMXmlFiles(org.eweb4j.config.bean.ORMXmlFiles) I18N(org.eweb4j.config.bean.I18N) DBInfoXmlFiles(org.eweb4j.config.bean.DBInfoXmlFiles) UploadConfigBean(org.eweb4j.config.bean.UploadConfigBean)

Aggregations

ConfigBean (org.eweb4j.config.bean.ConfigBean)28 DBInfoConfigBean (org.eweb4j.orm.dao.config.bean.DBInfoConfigBean)13 LogConfigBean (org.eweb4j.config.bean.LogConfigBean)12 ORMConfigBean (org.eweb4j.orm.config.bean.ORMConfigBean)12 File (java.io.File)10 IOCConfigBean (org.eweb4j.ioc.config.bean.IOCConfigBean)10 ActionConfigBean (org.eweb4j.mvc.config.bean.ActionConfigBean)10 InterConfigBean (org.eweb4j.mvc.config.bean.InterConfigBean)10 FieldConfigBean (org.eweb4j.mvc.config.bean.FieldConfigBean)9 ParamConfigBean (org.eweb4j.mvc.config.bean.ParamConfigBean)9 ResultConfigBean (org.eweb4j.mvc.config.bean.ResultConfigBean)9 ValidatorConfigBean (org.eweb4j.mvc.config.bean.ValidatorConfigBean)9 XMLReader (org.eweb4j.util.xml.XMLReader)6 CheckConfigBean (org.eweb4j.config.CheckConfigBean)5 Method (java.lang.reflect.Method)4 Prop (org.eweb4j.config.bean.Prop)4 ReflectUtil (org.eweb4j.util.ReflectUtil)4 IOException (java.io.IOException)3 LogsConfigBean (org.eweb4j.config.bean.LogsConfigBean)3 FileInputStream (java.io.FileInputStream)2