Example usage for org.apache.commons.digester Digester addObjectCreate

List of usage examples for org.apache.commons.digester Digester addObjectCreate

Introduction

In this page you can find the example usage for org.apache.commons.digester Digester addObjectCreate.

Prototype

public void addObjectCreate(String pattern, String attributeName, Class<?> clazz) 

Source Link

Document

Add an "object create" rule for the specified parameters.

Usage

From source file:com.tonbeller.jpivot.core.ModelFactory.java

/**
 * creates a model from an xml configuration file
 * @param url url of model configuration file
 * @return Model//w w w.j  a  v a  2  s  .  c o  m
 * @throws SAXException
 * @throws IOException
 */
public static Model instance(URL url) throws SAXException, IOException {
    Digester digester = new Digester();
    digester.setValidating(false);

    ModelHolder root = new ModelHolder();
    digester.push(root);

    digester.addObjectCreate("model", "missing \"class\" attribute", "class");
    digester.addSetProperties("model");
    digester.addSetNext("model", "setModel");

    digester.addObjectCreate("model/extension", "missing \"class\" attribute", "class");
    digester.addSetProperties("model/extension");
    digester.addSetNext("model/extension", "addExtension");

    InputSource is = new InputSource(url.toExternalForm());
    digester.parse(is);
    return root.getModel();
}

From source file:com.liusoft.sc.startup.EngineRuleSet.java

/**
 * <p>Add the set of Rule instances defined in this RuleSet to the
 * specified <code>Digester</code> instance, associating them with
 * our namespace URI (if any).  This method should only be called
 * by a Digester instance.</p>/*from   w w  w. j a  va  2s . c  om*/
 *
 * @param digester Digester instance to which the new Rule instances
 *  should be added.
 */
public void addRuleInstances(Digester digester) {

    digester.addObjectCreate(prefix + "Engine", "com.liusoft.sc.core.StandardEngine", "className");
    digester.addSetProperties(prefix + "Engine");
    //        digester.addRule(prefix + "Engine", new LifecycleListenerRule("com.liusoft.sc.startup.EngineConfig", "engineConfigClass"));
    digester.addSetNext(prefix + "Engine", "setContainer", "com.liusoft.sc.Container");

}

From source file:com.npower.dm.multiplexor.MappingTableFactory.java

private Digester createNumberMappingDataDigester() {

    Digester digester = new Digester();
    digester.setValidating(false);/*from   ww  w  .  j a v a  2s .co  m*/

    digester.addObjectCreate("*/NumberMapping", "class", MappingRuleBasedRegExpress.class);
    digester.addBeanPropertySetter("*/NumberMapping/NumberPattern", "numberPattern");
    digester.addBeanPropertySetter("*/NumberMapping/QueueName", "queueName");
    digester.addSetNext("*/NumberMapping", "addRule");
    return digester;
}

From source file:com.liusoft.sc.startup.HostRuleSet.java

/**
 * <p>Add the set of Rule instances defined in this RuleSet to the
 * specified <code>Digester</code> instance, associating them with
 * our namespace URI (if any).  This method should only be called
 * by a Digester instance.</p>//  ww w  .j  a  v  a  2  s  . co  m
 *
 * @param digester Digester instance to which the new Rule instances
 *  should be added.
 */
public void addRuleInstances(Digester digester) {

    digester.addObjectCreate(prefix + "Host", "com.liusoft.sc.core.StandardHost", "className");
    digester.addSetProperties(prefix + "Host");
    // ? ?
    //        digester.addRule(prefix + "Host",
    //                         new CopyParentClassLoaderRule());
    digester.addRule(prefix + "Host",
            new LifecycleListenerRule("com.liusoft.sc.startup.HostConfig", "hostConfigClass"));
    digester.addSetNext(prefix + "Host", "addChild", "com.liusoft.sc.Container");

    //        digester.addCallMethod(prefix + "Host/Alias", "addAlias", 0);

    //Cluster configuration start
    //        digester.addObjectCreate(prefix + "Host/Cluster",
    //                                 null, // MUST be specified in the element
    //                                 "className");
    //        digester.addSetProperties(prefix + "Host/Cluster");
    //        digester.addSetNext(prefix + "Host/Cluster",
    //                            "setCluster",
    //                            "com.liusoft.sc.Cluster");
    //Cluster configuration end

    //        digester.addObjectCreate(prefix + "Host/Listener",
    //                                 null, // MUST be specified in the element
    //                                 "className");
    //        digester.addSetProperties(prefix + "Host/Listener");
    //        digester.addSetNext(prefix + "Host/Listener",
    //                            "addLifecycleListener",
    //                            "com.liusoft.sc.LifecycleListener");
    //
    //        digester.addRuleSet(new RealmRuleSet(prefix + "Host/"));

    digester.addObjectCreate(prefix + "Host/Valve", null, // MUST be specified in the element
            "className");
    digester.addSetProperties(prefix + "Host/Valve");
    digester.addSetNext(prefix + "Host/Valve", "addValve", "com.liusoft.sc.Valve");

}

From source file:catalina.startup.EngineRuleSet.java

/**
 * <p>Add the set of Rule instances defined in this RuleSet to the
 * specified <code>Digester</code> instance, associating them with
 * our namespace URI (if any).  This method should only be called
 * by a Digester instance.</p>// w w w . j  a  va  2s.  c  o m
 *
 * @param digester Digester instance to which the new Rule instances
 *  should be added.
 */
public void addRuleInstances(Digester digester) {

    digester.addObjectCreate(prefix + "Engine", "org.apache.catalina.core.StandardEngine", "className");
    digester.addSetProperties(prefix + "Engine");
    digester.addRule(prefix + "Engine", new LifecycleListenerRule(digester,
            "org.apache.catalina.startup.EngineConfig", "engineConfigClass"));
    digester.addSetNext(prefix + "Engine", "setContainer", "org.apache.catalina.Container");

    digester.addObjectCreate(prefix + "Engine/Listener", null, // MUST be specified in the element
            "className");
    digester.addSetProperties(prefix + "Engine/Listener");
    digester.addSetNext(prefix + "Engine/Listener", "addLifecycleListener",
            "org.apache.catalina.LifecycleListener");

    digester.addObjectCreate(prefix + "Engine/Logger", null, // MUST be specified in the element
            "className");
    digester.addSetProperties(prefix + "Engine/Logger");
    digester.addSetNext(prefix + "Engine/Logger", "setLogger", "org.apache.catalina.Logger");

    digester.addObjectCreate(prefix + "Engine/Realm", null, // MUST be specified in the element
            "className");
    digester.addSetProperties(prefix + "Engine/Realm");
    digester.addSetNext(prefix + "Engine/Realm", "setRealm", "org.apache.catalina.Realm");

    digester.addObjectCreate(prefix + "Engine/Valve", null, // MUST be specified in the element
            "className");
    digester.addSetProperties(prefix + "Engine/Valve");
    digester.addSetNext(prefix + "Engine/Valve", "addValve", "org.apache.catalina.Valve");

}

From source file:catalina.startup.HostRuleSet.java

/**
 * <p>Add the set of Rule instances defined in this RuleSet to the
 * specified <code>Digester</code> instance, associating them with
 * our namespace URI (if any).  This method should only be called
 * by a Digester instance.</p>//from w  w w  . j  a v a2s  .  c  o  m
 *
 * @param digester Digester instance to which the new Rule instances
 *  should be added.
 */
public void addRuleInstances(Digester digester) {

    digester.addObjectCreate(prefix + "Host", "org.apache.catalina.core.StandardHost", "className");
    digester.addSetProperties(prefix + "Host");
    digester.addRule(prefix + "Host", new CopyParentClassLoaderRule(digester));
    digester.addRule(prefix + "Host",
            new LifecycleListenerRule(digester, "org.apache.catalina.startup.HostConfig", "hostConfigClass"));
    digester.addSetNext(prefix + "Host", "addChild", "org.apache.catalina.Container");

    digester.addCallMethod(prefix + "Host/Alias", "addAlias", 0);

    digester.addObjectCreate(prefix + "Host/Cluster", null, // MUST be specified in the element
            "className");
    digester.addSetProperties(prefix + "Host/Cluster");
    digester.addSetNext(prefix + "Host/Cluster", "addCluster", "org.apache.catalina.Cluster");

    digester.addObjectCreate(prefix + "Host/Listener", null, // MUST be specified in the element
            "className");
    digester.addSetProperties(prefix + "Host/Listener");
    digester.addSetNext(prefix + "Host/Listener", "addLifecycleListener",
            "org.apache.catalina.LifecycleListener");

    digester.addObjectCreate(prefix + "Host/Logger", null, // MUST be specified in the element
            "className");
    digester.addSetProperties(prefix + "Host/Logger");
    digester.addSetNext(prefix + "Host/Logger", "setLogger", "org.apache.catalina.Logger");

    digester.addObjectCreate(prefix + "Host/Realm", null, // MUST be specified in the element
            "className");
    digester.addSetProperties(prefix + "Host/Realm");
    digester.addSetNext(prefix + "Host/Realm", "setRealm", "org.apache.catalina.Realm");

    digester.addObjectCreate(prefix + "Host/Valve", null, // MUST be specified in the element
            "className");
    digester.addSetProperties(prefix + "Host/Valve");
    digester.addSetNext(prefix + "Host/Valve", "addValve", "org.apache.catalina.Valve");

}

From source file:catalina.startup.ContextRuleSet.java

/**
 * <p>Add the set of Rule instances defined in this RuleSet to the
 * specified <code>Digester</code> instance, associating them with
 * our namespace URI (if any).  This method should only be called
 * by a Digester instance.</p>/*from w w  w.  j a  v a2  s. com*/
 *
 * @param digester Digester instance to which the new Rule instances
 *  should be added.
 */
public void addRuleInstances(Digester digester) {

    if (!isDefaultContext()) {
        digester.addObjectCreate(prefix + "Context", "org.apache.catalina.core.StandardContext", "className");
    } else {
        digester.addObjectCreate(prefix + "Context", "org.apache.catalina.core.StandardDefaultContext",
                "className");
    }
    digester.addSetProperties(prefix + "Context");
    if (!isDefaultContext()) {
        digester.addRule(prefix + "Context", new CopyParentClassLoaderRule(digester));
        digester.addRule(prefix + "Context", new LifecycleListenerRule(digester,
                "org.apache.catalina.startup.ContextConfig", "configClass"));
        digester.addSetNext(prefix + "Context", "addChild", "org.apache.catalina.Container");
    } else {
        digester.addSetNext(prefix + "Context", "addDefaultContext", "org.apache.catalina.DefaultContext");
    }

    digester.addCallMethod(prefix + "Context/InstanceListener", "addInstanceListener", 0);

    digester.addObjectCreate(prefix + "Context/Listener", null, // MUST be specified in the element
            "className");
    digester.addSetProperties(prefix + "Context/Listener");
    digester.addSetNext(prefix + "Context/Listener", "addLifecycleListener",
            "org.apache.catalina.LifecycleListener");

    digester.addRule(prefix + "Context/Loader",
            new CreateLoaderRule(digester, "org.apache.catalina.loader.WebappLoader", "className"));
    digester.addSetProperties(prefix + "Context/Loader");
    digester.addSetNext(prefix + "Context/Loader", "setLoader", "org.apache.catalina.Loader");

    digester.addObjectCreate(prefix + "Context/Logger", null, // MUST be specified in the element
            "className");
    digester.addSetProperties(prefix + "Context/Logger");
    digester.addSetNext(prefix + "Context/Logger", "setLogger", "org.apache.catalina.Logger");

    digester.addObjectCreate(prefix + "Context/Manager", "org.apache.catalina.session.StandardManager",
            "className");
    digester.addSetProperties(prefix + "Context/Manager");
    digester.addSetNext(prefix + "Context/Manager", "setManager", "org.apache.catalina.Manager");

    digester.addObjectCreate(prefix + "Context/Manager/Store", null, // MUST be specified in the element
            "className");
    digester.addSetProperties(prefix + "Context/Manager/Store");
    digester.addSetNext(prefix + "Context/Manager/Store", "setStore", "org.apache.catalina.Store");

    digester.addObjectCreate(prefix + "Context/Parameter", "org.apache.catalina.deploy.ApplicationParameter");
    digester.addSetProperties(prefix + "Context/Parameter");
    digester.addSetNext(prefix + "Context/Parameter", "addApplicationParameter",
            "org.apache.catalina.deploy.ApplicationParameter");

    digester.addObjectCreate(prefix + "Context/Realm", null, // MUST be specified in the element
            "className");
    digester.addSetProperties(prefix + "Context/Realm");
    digester.addSetNext(prefix + "Context/Realm", "setRealm", "org.apache.catalina.Realm");

    digester.addObjectCreate(prefix + "Context/ResourceLink", "org.apache.catalina.deploy.ContextResourceLink");
    digester.addSetProperties(prefix + "Context/ResourceLink");
    digester.addSetNext(prefix + "Context/ResourceLink", "addResourceLink",
            "org.apache.catalina.deploy.ContextResourceLink");

    digester.addObjectCreate(prefix + "Context/Resources", "org.apache.naming.resources.FileDirContext",
            "className");
    digester.addSetProperties(prefix + "Context/Resources");
    digester.addSetNext(prefix + "Context/Resources", "setResources", "javax.naming.directory.DirContext");

    digester.addObjectCreate(prefix + "Context/Valve", null, // MUST be specified in the element
            "className");
    digester.addSetProperties(prefix + "Context/Valve");
    digester.addSetNext(prefix + "Context/Valve", "addValve", "org.apache.catalina.Valve");

    digester.addCallMethod(prefix + "Context/WrapperLifecycle", "addWrapperLifecycle", 0);

    digester.addCallMethod(prefix + "Context/WrapperListener", "addWrapperListener", 0);

}

From source file:catalina.startup.Catalina.java

/**
 * Create and configure the Digester we will be using for shutdown.
 *//* w w w .j  av  a 2s  . com*/
protected Digester createStopDigester() {

    // Initialize the digester
    Digester digester = new Digester();
    if (debug)
        digester.setDebug(999);

    // Configure the rules we need for shutting down
    digester.addObjectCreate("Server", "org.apache.catalina.core.StandardServer", "className");
    digester.addSetProperties("Server");
    digester.addSetNext("Server", "setServer", "org.apache.catalina.Server");

    return (digester);

}

From source file:com.salmonllc.ideTools.Tomcat50Engine.java

/**
 * Create and configure the Digester we will be using for shutdown.
 *//*from   www.j a  v  a2 s  . c  o m*/
protected Digester createStopDigester() {

    // Initialize the digester
    Digester digester = new Digester();

    // Configure the rules we need for shutting down
    digester.addObjectCreate("Server", "com.salmonllc.ideTools.Tomcat50ShutdownProperties", "className");
    digester.addSetProperties("Server");
    digester.addSetNext("Server", "setShutdownProperties", "com.salmonllc.ideTools.Tomcat50ShutdownProperties");

    return (digester);

}

From source file:catalina.startup.Catalina.java

/**
 * Create and configure the Digester we will be using for startup.
 *//*from w w w .  j a  va2  s  .com*/
protected Digester createStartDigester() {

    // Initialize the digester
    Digester digester = new Digester();
    if (debug)
        digester.setDebug(999);
    digester.setValidating(false);

    // Configure the actions we will be using
    digester.addObjectCreate("Server", "org.apache.catalina.core.StandardServer", "className");
    digester.addSetProperties("Server");
    digester.addSetNext("Server", "setServer", "org.apache.catalina.Server");

    digester.addObjectCreate("Server/GlobalNamingResources", "org.apache.catalina.deploy.NamingResources");
    digester.addSetProperties("Server/GlobalNamingResources");
    digester.addSetNext("Server/GlobalNamingResources", "setGlobalNamingResources",
            "org.apache.catalina.deploy.NamingResources");

    digester.addObjectCreate("Server/Listener", null, // MUST be specified in the element
            "className");
    digester.addSetProperties("Server/Listener");
    digester.addSetNext("Server/Listener", "addLifecycleListener", "org.apache.catalina.LifecycleListener");

    digester.addObjectCreate("Server/Service", "org.apache.catalina.core.StandardService", "className");
    digester.addSetProperties("Server/Service");
    digester.addSetNext("Server/Service", "addService", "org.apache.catalina.Service");

    digester.addObjectCreate("Server/Service/Listener", null, // MUST be specified in the element
            "className");
    digester.addSetProperties("Server/Service/Listener");
    digester.addSetNext("Server/Service/Listener", "addLifecycleListener",
            "org.apache.catalina.LifecycleListener");

    digester.addObjectCreate("Server/Service/Connector", "org.apache.catalina.connector.http.HttpConnector",
            "className");
    digester.addSetProperties("Server/Service/Connector");
    digester.addSetNext("Server/Service/Connector", "addConnector", "org.apache.catalina.Connector");

    digester.addObjectCreate("Server/Service/Connector/Factory",
            "org.apache.catalina.net.DefaultServerSocketFactory", "className");
    digester.addSetProperties("Server/Service/Connector/Factory");
    digester.addSetNext("Server/Service/Connector/Factory", "setFactory",
            "org.apache.catalina.net.ServerSocketFactory");

    digester.addObjectCreate("Server/Service/Connector/Listener", null, // MUST be specified in the element
            "className");
    digester.addSetProperties("Server/Service/Connector/Listener");
    digester.addSetNext("Server/Service/Connector/Listener", "addLifecycleListener",
            "org.apache.catalina.LifecycleListener");

    // Add RuleSets for nested elements
    digester.addRuleSet(new NamingRuleSet("Server/GlobalNamingResources/"));
    digester.addRuleSet(new EngineRuleSet("Server/Service/"));
    digester.addRuleSet(new HostRuleSet("Server/Service/Engine/"));
    digester.addRuleSet(new ContextRuleSet("Server/Service/Engine/Default"));
    digester.addRuleSet(new NamingRuleSet("Server/Service/Engine/DefaultContext/"));
    digester.addRuleSet(new ContextRuleSet("Server/Service/Engine/Host/Default"));
    digester.addRuleSet(new NamingRuleSet("Server/Service/Engine/Host/DefaultContext/"));
    digester.addRuleSet(new ContextRuleSet("Server/Service/Engine/Host/"));
    digester.addRuleSet(new NamingRuleSet("Server/Service/Engine/Host/Context/"));

    digester.addRule("Server/Service/Engine", new SetParentClassLoaderRule(digester, parentClassLoader));

    return (digester);

}