當前位置: 首頁>>代碼示例>>Java>>正文


Java Digester.clear方法代碼示例

本文整理匯總了Java中org.apache.commons.digester.Digester.clear方法的典型用法代碼示例。如果您正苦於以下問題:Java Digester.clear方法的具體用法?Java Digester.clear怎麽用?Java Digester.clear使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.commons.digester.Digester的用法示例。


在下文中一共展示了Digester.clear方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getEctMeasurementsType

import org.apache.commons.digester.Digester; //導入方法依賴的package包/類
static public EctFormProp getEctMeasurementsType(InputStream is) {
    EctFormProp ret = null;
    try {
        Digester digester = new Digester();
        digester.setValidating(false);
        
        digester.addObjectCreate("formProp", EctFormProp.class);
        digester.addObjectCreate("formProp/measurement", EctMeasurementTypesBean.class);
        digester.addBeanPropertySetter("formProp/measurement/type", "type");
        digester.addBeanPropertySetter("formProp/measurement/typeDesc", "typeDesc");
        digester.addBeanPropertySetter("formProp/measurement/typeDisplayName", "typeDisplayName");
        digester.addBeanPropertySetter("formProp/measurement/measuringInstrc", "measuringInstrc");
        digester.addBeanPropertySetter("formProp/measurement/canPrefill", "canPrefill");
        
        digester.addObjectCreate("formProp/measurement/validationRule", EctValidationsBean.class);
        digester.addBeanPropertySetter("formProp/measurement/validationRule/name", "name");
        digester.addBeanPropertySetter("formProp/measurement/validationRule/regularExp", "regularExp");
        digester.addBeanPropertySetter("formProp/measurement/validationRule/minValue", "minValue");
        digester.addBeanPropertySetter("formProp/measurement/validationRule/maxValue", "maxValue");
        digester.addBeanPropertySetter("formProp/measurement/validationRule/minLength", "minLength");
        digester.addBeanPropertySetter("formProp/measurement/validationRule/maxLength", "maxLength");
        digester.addBeanPropertySetter("formProp/measurement/validationRule/isNumeric", "isNumeric");
        digester.addBeanPropertySetter("formProp/measurement/validationRule/isDate", "isDate");
        digester.addSetNext("formProp/measurement/validationRule", "addValidationRule");
        
        digester.addSetNext("formProp/measurement", "addMeasurementType");
                    
        ret = (EctFormProp) digester.parse(is);
        digester.clear();
    } 
    catch (Exception exc) {
    	MiscUtils.getLogger().error("Error", exc);
    }
    return ret;
}
 
開發者ID:williamgrosset,項目名稱:OSCAR-ConCert,代碼行數:36,代碼來源:EctFindMeasurementTypeUtil.java

示例2: load

import org.apache.commons.digester.Digester; //導入方法依賴的package包/類
public void load(Resource resource){
    URL eis = this.getClass().getResource("VenusSystemExceptionRule.xml");
    if (eis == null) {
        throw new VenusConfigException("classpath resource 'VenusSystemExceptionRule.xml' not found");
    }
    RuleSet ruleSet = new FromXmlRuleSet(eis, new DigesterRuleParser());
    Digester digester = new Digester();
    digester.addRuleSet(ruleSet);
    try{
        List<ExceptionConfig> list = (List<ExceptionConfig>) digester.parse(resource.getInputStream());
        for (ExceptionConfig config : list) {

            if (config.getErrorCode() == 0) {
                Exception exception = (Exception) reflectionProvider.newInstance(config.getType());
                if (exception instanceof CodedException) {
                    config.setErrorCode(((CodedException) exception).getErrorCode());
                } else {
                    throw new VenusConfigException("exception type=" + config.getType()
                            + " must implement CodedException or errorCode must not be null");
                }
            }

            codeMap.put(config.getErrorCode(), config);
            classMap.put(config.getType(), config);
        }
    }catch(Exception e){
        try {
            logger.error("parser "+resource.getURL()+" error", e);
        } catch (IOException e1) {
            logger.error("parser "+resource.getFilename()+" error", e);
        }
    }finally{
        digester.clear();
    }
}
 
開發者ID:blusechen,項目名稱:venus,代碼行數:36,代碼來源:XmlVenusExceptionFactory.java

示例3: processStandardFacesConfig

import org.apache.commons.digester.Digester; //導入方法依賴的package包/類
private static void processStandardFacesConfig(
		DesignerProject designerProject, Digester digester,
		FacesConfigBean fcb) {

	IFile config = designerProject.getProject().getFile(FACESCONFIG_PATH);

	if (!config.exists()) {
		if (logger.isInfoEnabled()) {
			logger.info("faces-config.xml not found for project {0}",
					designerProject.getProject().getName());
		}
		return;
	}

	digester.clear();
	digester.push(fcb);

	try {

		digester.parse(config.getContents(false));

	} catch (Exception e) {

		if (logger.isErrorEnabled()) {
			logger.error(e,
					"Error Parsing Standard faces config for project {0}",
					designerProject.getProject().getName());
		}

	}

}
 
開發者ID:camac,項目名稱:Barista,代碼行數:33,代碼來源:BaristaUtil.java

示例4: getEctMeasurementsType

import org.apache.commons.digester.Digester; //導入方法依賴的package包/類
static public EctFormProp getEctMeasurementsType(InputStream is) {
    EctFormProp ret = null;
    try {
        Digester digester = new Digester();
        digester.setValidating(false);
        
        digester.addObjectCreate("formProp", EctFormProp.class);
        digester.addObjectCreate("formProp/measurement", EctMeasurementTypesBean.class);
        digester.addBeanPropertySetter("formProp/measurement/type", "type");
        digester.addBeanPropertySetter("formProp/measurement/typeDesc", "typeDesc");
        digester.addBeanPropertySetter("formProp/measurement/typeDisplayName", "typeDisplayName");
        digester.addBeanPropertySetter("formProp/measurement/measuringInstrc", "measuringInstrc");
        digester.addBeanPropertySetter("formProp/measurement/canPrefill", "canPrefill");
        
        digester.addObjectCreate("formProp/measurement/validationRule", EctValidationsBean.class);
        digester.addBeanPropertySetter("formProp/measurement/validationRule/name", "name");
        digester.addBeanPropertySetter("formProp/measurement/validationRule/regularExp", "regularExp");
        digester.addBeanPropertySetter("formProp/measurement/validationRule/minValue", "minValue");
        digester.addBeanPropertySetter("formProp/measurement/validationRule/maxValue", "maxValue");
 digester.addBeanPropertySetter("formProp/measurement/validationRule/minLength", "minLength");
 digester.addBeanPropertySetter("formProp/measurement/validationRule/maxLength", "maxLength");
        digester.addBeanPropertySetter("formProp/measurement/validationRule/isNumeric", "isNumeric");
        digester.addBeanPropertySetter("formProp/measurement/validationRule/isDate", "isDate");
        digester.addSetNext("formProp/measurement/validationRule", "addValidationRule");
        
        digester.addSetNext("formProp/measurement", "addMeasurementType");
                    
        //File input = new File(xmlPath);
        ret = (EctFormProp) digester.parse(is);
        digester.clear();
    } 
    catch (Exception exc) {
    	MiscUtils.getLogger().error("Error", exc);
    }
    return ret;
}
 
開發者ID:oscarservice,項目名稱:oscar-old,代碼行數:37,代碼來源:EctFindMeasurementTypeUtil.java

示例5: init

import org.apache.commons.digester.Digester; //導入方法依賴的package包/類
public void init() {
    doScanExtension();
    //兼容 3.0.8以前版本
    if(configFiles == null){
        return;
    }
    
    for (String configFile : configFiles) {
        configFile = (String) ConfigUtil.filter(configFile);
        configFile = configFile.trim();
        URL eis = this.getClass().getResource("VenusSystemExceptionRule.xml");
        if (eis == null) {
            throw new VenusConfigException("classpath resource 'VenusSystemExceptionRule.xml' not found");
        }
        RuleSet ruleSet = new FromXmlRuleSet(eis, new DigesterRuleParser());
        Digester digester = new Digester();
        digester.addRuleSet(ruleSet);

        try {
            InputStream is = null;
            if (configFile.startsWith("classpath:")) {
                configFile = configFile.substring("classpath:".length());
                is = this.getClass().getClassLoader().getResourceAsStream(configFile);
            } else {
                is = new FileInputStream(new File(configFile));
            }
            List<ExceptionConfig> list = (List<ExceptionConfig>) digester.parse(is);
            for (ExceptionConfig config : list) {

                if (config.getErrorCode() == 0) {
                    Exception exception = (Exception) reflectionProvider.newInstance(config.getType());
                    if (exception instanceof CodedException) {
                        config.setErrorCode(((CodedException) exception).getErrorCode());
                    } else {
                        throw new VenusConfigException("exception type=" + config.getType()
                                + " must implement CodedException or errorCode must not be null");
                    }
                }

                codeMap.put(config.getErrorCode(), config);
                classMap.put(config.getType(), config);
            }
        } catch (Exception e) {
            logger.error("parser VenusSystemExceptionRule.xml error", e);
        }finally{
            digester.clear();
        }
    }
}
 
開發者ID:blusechen,項目名稱:venus,代碼行數:50,代碼來源:XmlVenusExceptionFactory.java


注:本文中的org.apache.commons.digester.Digester.clear方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。