Package org.apache.commons.digester

Examples of org.apache.commons.digester.Digester


*
*/
public class MetainfoParser {

  public Metainfo parse(InputStream metainfoStream) throws IOException {
    Digester digester = new Digester();
    digester.setValidating(false);

    digester.addObjectCreate("metainfo", Metainfo.class);
    digester.addBeanPropertySetter("metainfo/schemaVersion");

    digester.addObjectCreate("*/service", Service.class);
    digester.addBeanPropertySetter("*/service/name");
    digester.addBeanPropertySetter("*/service/comment");
    digester.addBeanPropertySetter("*/service/version");

    digester.addObjectCreate("*/commandOrder", CommandOrder.class);
    digester.addBeanPropertySetter("*/commandOrder/command");
    digester.addBeanPropertySetter("*/commandOrder/requires");
    digester.addSetNext("*/commandOrder", "addCommandOrder");

    digester.addObjectCreate("*/exportGroup", ExportGroup.class);
    digester.addBeanPropertySetter("*/exportGroup/name");
    digester.addObjectCreate("*/export", Export.class);
    digester.addBeanPropertySetter("*/export/name");
    digester.addBeanPropertySetter("*/export/value");
    digester.addSetNext("*/export", "addExport");
    digester.addSetNext("*/exportGroup", "addExportGroup");

    digester.addObjectCreate("*/component", Component.class);
    digester.addBeanPropertySetter("*/component/name");
    digester.addBeanPropertySetter("*/component/category");
    digester.addBeanPropertySetter("*/component/publishConfig");
    digester.addBeanPropertySetter("*/component/minInstanceCount");
    digester.addBeanPropertySetter("*/component/maxInstanceCount");
    digester.addSetNext("*/component", "addComponent");

    digester.addObjectCreate("*/commandScript", CommandScript.class);
    digester.addBeanPropertySetter("*/commandScript/script");
    digester.addBeanPropertySetter("*/commandScript/scriptType");
    digester.addBeanPropertySetter("*/commandScript/timeout");
    digester.addSetNext("*/commandScript", "addCommandScript");

    digester.addObjectCreate("*/osSpecific", OSSpecific.class);
    digester.addBeanPropertySetter("*/osSpecific/osType");
    digester.addObjectCreate("*/package", OSPackage.class);
    digester.addBeanPropertySetter("*/package/type");
    digester.addBeanPropertySetter("*/package/name");
    digester.addSetNext("*/package", "addOSPackage");
    digester.addSetNext("*/osSpecific", "addOSSpecific");

    digester.addObjectCreate("*/configuration-dependencies",
                             ConfigurationDependencies.class);
    digester.addBeanPropertySetter("*/config-type", "configType");
    digester.addSetNext("*/configuration-dependencies", "setConfigDependencies");

    digester.addSetNext("*/service", "addService");

    try {
      return (Metainfo) digester.parse(metainfoStream);
    } catch (IOException e) {

    } catch (SAXException e) {

    } finally {
View Full Code Here


            }
            // parse the included xml file
            DigesterRuleParser includedSet =
                        new DigesterRuleParser(targetDigester, patternStack, includedFiles);
            includedSet.setDigesterRulesDTD(getDigesterRulesDTD());
            Digester digester = new Digester();
            digester.addRuleSet(includedSet);
            digester.push(DigesterRuleParser.this);
            digester.parse(fileName);
            includedFiles.remove(fileName);
        }
View Full Code Here

     * Constructs a FromXmlRuleSet using the default DigesterRuleParser and
     * rulesDigester.
     * @param rulesXml the path to the XML document defining the Digester rules
     */
    public FromXmlRuleSet(URL rulesXml) {
        this(rulesXml, new DigesterRuleParser(), new Digester());
    }
View Full Code Here

    /**
     * @param rulesXml the path to the XML document defining the Digester rules
     * @param parser an instance of DigesterRuleParser, for parsing the rules from XML
     */
    public FromXmlRuleSet(URL rulesXml, DigesterRuleParser parser) {
        this(rulesXml, parser, new Digester());
    }
View Full Code Here

     * Constructs a FromXmlRuleSet using the default DigesterRuleParser and
     * rulesDigester.
     * @param inputSource load the xml rules from this InputSource
     */
    public FromXmlRuleSet(InputSource inputSource) {
        this(inputSource, new DigesterRuleParser(), new Digester());
    }
View Full Code Here

    /**
     * @param inputSource load the xml rules from this InputSource
     * @param parser an instance of DigesterRuleParser, for parsing the rules from XML
     */
    public FromXmlRuleSet(InputSource inputSource, DigesterRuleParser parser) {
        this(inputSource, parser, new Digester());
    }
View Full Code Here

     * @param rulesSource load the xml rules from this InputSource
     * @return a new Digester initialized with the rules
     */
    public static Digester createDigester(InputSource rulesSource) {
        RuleSet ruleSet = new FromXmlRuleSet(rulesSource);
        Digester digester = new Digester();
        digester.addRuleSet(ruleSet);
        return digester;
    }
View Full Code Here

     * @param rulesDigester digester to load the specified XML file.
     * @return a new Digester initialized with the rules
     */
    public static Digester createDigester(InputSource rulesSource, Digester rulesDigester) {
        RuleSet ruleSet = new FromXmlRuleSet(rulesSource, rulesDigester);
        Digester digester = new Digester();
        digester.addRuleSet(ruleSet);
        return digester;
    }
View Full Code Here

     * @param rulesXml URL to the XML file defining the digester rules
     * @return a new Digester initialized with the rules
     */
    public static Digester createDigester(URL rulesXml) {
        RuleSet ruleSet = new FromXmlRuleSet(rulesXml);
        Digester digester = new Digester();
        digester.addRuleSet(ruleSet);
        return digester;
    }
View Full Code Here

     * @param rulesDigester digester to load the specified XML file.
     * @return a new Digester initialized with the rules
     */
    public static Digester createDigester(URL rulesXml, Digester rulesDigester) {
        RuleSet ruleSet = new FromXmlRuleSet(rulesXml, rulesDigester);
        Digester digester = new Digester();
        digester.addRuleSet(ruleSet);
        return digester;
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.digester.Digester

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.