Java Code Examples for org.apache.tomcat.util.digester.Digester#addRule()

The following examples show how to use org.apache.tomcat.util.digester.Digester#addRule() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StoreLoader.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
/**
 * Create and configure the Digester we will be using for setup store
 * registry.
 * @return the XML digester that will be used to parse the configuration
 */
protected static Digester createDigester() {
    long t1 = System.currentTimeMillis();
    // Initialize the digester
    Digester digester = new Digester();
    digester.setValidating(false);
    digester.setClassLoader(StoreRegistry.class.getClassLoader());

    // Configure the actions we will be using
    digester.addObjectCreate("Registry",
            "org.apache.catalina.storeconfig.StoreRegistry", "className");
    digester.addSetProperties("Registry");
    digester
            .addObjectCreate("Registry/Description",
                    "org.apache.catalina.storeconfig.StoreDescription",
                    "className");
    digester.addSetProperties("Registry/Description");
    digester.addRule("Registry/Description", new StoreFactoryRule(
            "org.apache.catalina.storeconfig.StoreFactoryBase",
            "storeFactoryClass",
            "org.apache.catalina.storeconfig.StoreAppender",
            "storeAppenderClass"));
    digester.addSetNext("Registry/Description", "registerDescription",
            "org.apache.catalina.storeconfig.StoreDescription");
    digester.addCallMethod("Registry/Description/TransientAttribute",
            "addTransientAttribute", 0);
    digester.addCallMethod("Registry/Description/TransientChild",
            "addTransientChild", 0);

    long t2 = System.currentTimeMillis();
    if (log.isDebugEnabled())
        log.debug("Digester for server-registry.xml created " + (t2 - t1));
    return digester;

}
 
Example 2
Source File: ImplicitTldRuleSet.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
@Override
public void addRuleInstances(Digester digester) {

    digester.addCallMethod(PREFIX + "/tlibversion", "setTlibVersion", 0);
    digester.addCallMethod(PREFIX + "/tlib-version", "setTlibVersion", 0);
    digester.addCallMethod(PREFIX + "/jspversion", "setJspVersion", 0);
    digester.addCallMethod(PREFIX + "/jsp-version", "setJspVersion", 0);
    digester.addRule(PREFIX, new Rule() {
        // for TLD 2.0 and later, jsp-version is set by version attribute
        @Override
        public void begin(String namespace, String name, Attributes attributes) {
            TaglibXml taglibXml = (TaglibXml) digester.peek();
            taglibXml.setJspVersion(attributes.getValue("version"));
        }
    });
    digester.addCallMethod(PREFIX + "/shortname", "setShortName", 0);
    digester.addCallMethod(PREFIX + "/short-name", "setShortName", 0);

    // Elements not permitted
    digester.addRule(PREFIX + "/uri", new ElementNotAllowedRule());
    digester.addRule(PREFIX + "/info", new ElementNotAllowedRule());
    digester.addRule(PREFIX + "/description", new ElementNotAllowedRule());
    digester.addRule(PREFIX + "/listener/listener-class", new ElementNotAllowedRule());

    digester.addRule(VALIDATOR_PREFIX, new ElementNotAllowedRule());
    digester.addRule(TAG_PREFIX, new ElementNotAllowedRule());
    digester.addRule(TAGFILE_PREFIX, new ElementNotAllowedRule());
    digester.addRule(FUNCTION_PREFIX, new ElementNotAllowedRule());
}
 
Example 3
Source File: EngineRuleSet.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
/**
 * <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>
 *
 * @param digester Digester instance to which the new Rule instances
 *  should be added.
 */
@Override
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
                     ("org.apache.catalina.startup.EngineConfig",
                      "engineConfigClass"));
    digester.addSetNext(prefix + "Engine",
                        "setContainer",
                        "org.apache.catalina.Engine");

    //Cluster configuration start
    digester.addObjectCreate(prefix + "Engine/Cluster",
                             null, // MUST be specified in the element
                             "className");
    digester.addSetProperties(prefix + "Engine/Cluster");
    digester.addSetNext(prefix + "Engine/Cluster",
                        "setCluster",
                        "org.apache.catalina.Cluster");
    //Cluster configuration end

    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.addRuleSet(new RealmRuleSet(prefix + "Engine/"));

    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");

}
 
Example 4
Source File: NamingRuleSet.java    From tomcatsrc with Apache License 2.0 4 votes vote down vote up
/**
 * <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>
 *
 * @param digester Digester instance to which the new Rule instances
 *  should be added.
 */
@Override
public void addRuleInstances(Digester digester) {

    digester.addObjectCreate(prefix + "Ejb",
                             "org.apache.catalina.deploy.ContextEjb");
    digester.addRule(prefix + "Ejb", new SetAllPropertiesRule());
    digester.addRule(prefix + "Ejb",
            new SetNextNamingRule("addEjb",
                        "org.apache.catalina.deploy.ContextEjb"));

    digester.addObjectCreate(prefix + "Environment",
                             "org.apache.catalina.deploy.ContextEnvironment");
    digester.addSetProperties(prefix + "Environment");
    digester.addRule(prefix + "Environment",
                        new SetNextNamingRule("addEnvironment",
                        "org.apache.catalina.deploy.ContextEnvironment"));

    digester.addObjectCreate(prefix + "LocalEjb",
                             "org.apache.catalina.deploy.ContextLocalEjb");
    digester.addRule(prefix + "LocalEjb", new SetAllPropertiesRule());
    digester.addRule(prefix + "LocalEjb",
            new SetNextNamingRule("addLocalEjb",
                        "org.apache.catalina.deploy.ContextLocalEjb"));

    digester.addObjectCreate(prefix + "Resource",
                             "org.apache.catalina.deploy.ContextResource");
    digester.addRule(prefix + "Resource", new SetAllPropertiesRule());
    digester.addRule(prefix + "Resource",
            new SetNextNamingRule("addResource",
                        "org.apache.catalina.deploy.ContextResource"));

    digester.addObjectCreate(prefix + "ResourceEnvRef",
        "org.apache.catalina.deploy.ContextResourceEnvRef");
    digester.addRule(prefix + "ResourceEnvRef", new SetAllPropertiesRule());
    digester.addRule(prefix + "ResourceEnvRef",
            new SetNextNamingRule("addResourceEnvRef",
                        "org.apache.catalina.deploy.ContextResourceEnvRef"));

    digester.addObjectCreate(prefix + "ServiceRef",
        "org.apache.catalina.deploy.ContextService");
    digester.addRule(prefix + "ServiceRef", new SetAllPropertiesRule());
    digester.addRule(prefix + "ServiceRef",
            new SetNextNamingRule("addService",
                        "org.apache.catalina.deploy.ContextService"));

    digester.addObjectCreate(prefix + "Transaction",
        "org.apache.catalina.deploy.ContextTransaction");
    digester.addRule(prefix + "Transaction", new SetAllPropertiesRule());
    digester.addRule(prefix + "Transaction",
            new SetNextNamingRule("setTransaction",
                        "org.apache.catalina.deploy.ContextTransaction"));

}
 
Example 5
Source File: EngineRuleSet.java    From tomcatsrc with Apache License 2.0 4 votes vote down vote up
/**
 * <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>
 *
 * @param digester Digester instance to which the new Rule instances
 *  should be added.
 */
@Override
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
                     ("org.apache.catalina.startup.EngineConfig",
                      "engineConfigClass"));
    digester.addSetNext(prefix + "Engine",
                        "setContainer",
                        "org.apache.catalina.Container");

    //Cluster configuration start
    digester.addObjectCreate(prefix + "Engine/Cluster",
                             null, // MUST be specified in the element
                             "className");
    digester.addSetProperties(prefix + "Engine/Cluster");
    digester.addSetNext(prefix + "Engine/Cluster",
                        "setCluster",
                        "org.apache.catalina.Cluster");
    //Cluster configuration end

    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.addRuleSet(new RealmRuleSet(prefix + "Engine/"));

    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");

}
 
Example 6
Source File: HostRuleSet.java    From tomcatsrc with Apache License 2.0 4 votes vote down vote up
/**
 * <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>
 *
 * @param digester Digester instance to which the new Rule instances
 *  should be added.
 */
@Override
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.addRule(prefix + "Host",
                     new LifecycleListenerRule
                     ("org.apache.catalina.startup.HostConfig",
                      "hostConfigClass"));
    digester.addSetNext(prefix + "Host",
                        "addChild",
                        "org.apache.catalina.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",
                        "org.apache.catalina.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",
                        "org.apache.catalina.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",
                        "org.apache.catalina.Valve");

}
 
Example 7
Source File: NamingRuleSet.java    From Tomcat7.0.67 with Apache License 2.0 4 votes vote down vote up
/**
 * <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>
 *
 * @param digester Digester instance to which the new Rule instances
 *  should be added.
 */
@Override
public void addRuleInstances(Digester digester) {

    digester.addObjectCreate(prefix + "Ejb",
                             "org.apache.catalina.deploy.ContextEjb");
    digester.addRule(prefix + "Ejb", new SetAllPropertiesRule());
    digester.addRule(prefix + "Ejb",
            new SetNextNamingRule("addEjb",
                        "org.apache.catalina.deploy.ContextEjb"));

    digester.addObjectCreate(prefix + "Environment",
                             "org.apache.catalina.deploy.ContextEnvironment");
    digester.addSetProperties(prefix + "Environment");
    digester.addRule(prefix + "Environment",
                        new SetNextNamingRule("addEnvironment",
                        "org.apache.catalina.deploy.ContextEnvironment"));

    digester.addObjectCreate(prefix + "LocalEjb",
                             "org.apache.catalina.deploy.ContextLocalEjb");
    digester.addRule(prefix + "LocalEjb", new SetAllPropertiesRule());
    digester.addRule(prefix + "LocalEjb",
            new SetNextNamingRule("addLocalEjb",
                        "org.apache.catalina.deploy.ContextLocalEjb"));

    digester.addObjectCreate(prefix + "Resource",
                             "org.apache.catalina.deploy.ContextResource");
    digester.addRule(prefix + "Resource", new SetAllPropertiesRule());
    digester.addRule(prefix + "Resource",
            new SetNextNamingRule("addResource",
                        "org.apache.catalina.deploy.ContextResource"));

    digester.addObjectCreate(prefix + "ResourceEnvRef",
        "org.apache.catalina.deploy.ContextResourceEnvRef");
    digester.addRule(prefix + "ResourceEnvRef", new SetAllPropertiesRule());
    digester.addRule(prefix + "ResourceEnvRef",
            new SetNextNamingRule("addResourceEnvRef",
                        "org.apache.catalina.deploy.ContextResourceEnvRef"));

    digester.addObjectCreate(prefix + "ServiceRef",
        "org.apache.catalina.deploy.ContextService");
    digester.addRule(prefix + "ServiceRef", new SetAllPropertiesRule());
    digester.addRule(prefix + "ServiceRef",
            new SetNextNamingRule("addService",
                        "org.apache.catalina.deploy.ContextService"));

    digester.addObjectCreate(prefix + "Transaction",
        "org.apache.catalina.deploy.ContextTransaction");
    digester.addRule(prefix + "Transaction", new SetAllPropertiesRule());
    digester.addRule(prefix + "Transaction",
            new SetNextNamingRule("setTransaction",
                        "org.apache.catalina.deploy.ContextTransaction"));

}
 
Example 8
Source File: EngineRuleSet.java    From Tomcat7.0.67 with Apache License 2.0 4 votes vote down vote up
/**
 * <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>
 *
 * @param digester Digester instance to which the new Rule instances
 *  should be added.
 */
@Override
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
                     ("org.apache.catalina.startup.EngineConfig",
                      "engineConfigClass"));
    digester.addSetNext(prefix + "Engine",
                        "setContainer",
                        "org.apache.catalina.Container");

    //Cluster configuration start
    digester.addObjectCreate(prefix + "Engine/Cluster",
                             null, // MUST be specified in the element
                             "className");
    digester.addSetProperties(prefix + "Engine/Cluster");
    digester.addSetNext(prefix + "Engine/Cluster",
                        "setCluster",
                        "org.apache.catalina.Cluster");
    //Cluster configuration end

    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.addRuleSet(new RealmRuleSet(prefix + "Engine/"));

    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");

}
 
Example 9
Source File: HostRuleSet.java    From Tomcat7.0.67 with Apache License 2.0 4 votes vote down vote up
/**
 * <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>
 *
 * @param digester Digester instance to which the new Rule instances
 *  should be added.
 */
@Override
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.addRule(prefix + "Host",
                     new LifecycleListenerRule
                     ("org.apache.catalina.startup.HostConfig",
                      "hostConfigClass"));
    digester.addSetNext(prefix + "Host",
                        "addChild",
                        "org.apache.catalina.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",
                        "org.apache.catalina.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",
                        "org.apache.catalina.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",
                        "org.apache.catalina.Valve");

}
 
Example 10
Source File: TldRuleSet.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
@Override
public void addRuleInstances(Digester digester) {

    digester.addCallMethod(PREFIX + "/tlibversion", "setTlibVersion", 0);
    digester.addCallMethod(PREFIX + "/tlib-version", "setTlibVersion", 0);
    digester.addCallMethod(PREFIX + "/jspversion", "setJspVersion", 0);
    digester.addCallMethod(PREFIX + "/jsp-version", "setJspVersion", 0);
    digester.addRule(PREFIX, new Rule() {
        // for TLD 2.0 and later, jsp-version is set by version attribute
        @Override
        public void begin(String namespace, String name, Attributes attributes) {
            TaglibXml taglibXml = (TaglibXml) digester.peek();
            taglibXml.setJspVersion(attributes.getValue("version"));
        }
    });
    digester.addCallMethod(PREFIX + "/shortname", "setShortName", 0);
    digester.addCallMethod(PREFIX + "/short-name", "setShortName", 0);

    // common rules
    digester.addCallMethod(PREFIX + "/uri", "setUri", 0);
    digester.addCallMethod(PREFIX + "/info", "setInfo", 0);
    digester.addCallMethod(PREFIX + "/description", "setInfo", 0);
    digester.addCallMethod(PREFIX + "/listener/listener-class", "addListener", 0);

    // validator
    digester.addObjectCreate(VALIDATOR_PREFIX, ValidatorXml.class.getName());
    digester.addCallMethod(VALIDATOR_PREFIX + "/validator-class", "setValidatorClass", 0);
    digester.addCallMethod(VALIDATOR_PREFIX + "/init-param", "addInitParam", 2);
    digester.addCallParam(VALIDATOR_PREFIX + "/init-param/param-name", 0);
    digester.addCallParam(VALIDATOR_PREFIX + "/init-param/param-value", 1);
    digester.addSetNext(VALIDATOR_PREFIX, "setValidator", ValidatorXml.class.getName());


    // tag
    digester.addObjectCreate(TAG_PREFIX, TagXml.class.getName());
    addDescriptionGroup(digester, TAG_PREFIX);
    digester.addCallMethod(TAG_PREFIX + "/name", "setName", 0);
    digester.addCallMethod(TAG_PREFIX + "/tagclass", "setTagClass", 0);
    digester.addCallMethod(TAG_PREFIX + "/tag-class", "setTagClass", 0);
    digester.addCallMethod(TAG_PREFIX + "/teiclass", "setTeiClass", 0);
    digester.addCallMethod(TAG_PREFIX + "/tei-class", "setTeiClass", 0);
    digester.addCallMethod(TAG_PREFIX + "/bodycontent", "setBodyContent", 0);
    digester.addCallMethod(TAG_PREFIX + "/body-content", "setBodyContent", 0);

    digester.addRule(TAG_PREFIX + "/variable", new ScriptVariableRule());
    digester.addCallMethod(TAG_PREFIX + "/variable/name-given", "setNameGiven", 0);
    digester.addCallMethod(TAG_PREFIX + "/variable/name-from-attribute",
            "setNameFromAttribute", 0);
    digester.addCallMethod(TAG_PREFIX + "/variable/variable-class", "setClassName", 0);
    digester.addRule(TAG_PREFIX + "/variable/declare",
            new GenericBooleanRule(Variable.class, "setDeclare"));
    digester.addCallMethod(TAG_PREFIX + "/variable/scope", "setScope", 0);

    digester.addRule(TAG_PREFIX + "/attribute", new TagAttributeRule());
    digester.addCallMethod(TAG_PREFIX + "/attribute/description", "setDescription", 0);
    digester.addCallMethod(TAG_PREFIX + "/attribute/name", "setName", 0);
    digester.addRule(TAG_PREFIX + "/attribute/required",
            new GenericBooleanRule(Attribute.class, "setRequired"));
    digester.addRule(TAG_PREFIX + "/attribute/rtexprvalue",
            new GenericBooleanRule(Attribute.class, "setRequestTime"));
    digester.addCallMethod(TAG_PREFIX + "/attribute/type", "setType", 0);
    digester.addCallMethod(TAG_PREFIX + "/attribute/deferred-value", "setDeferredValue");
    digester.addCallMethod(TAG_PREFIX + "/attribute/deferred-value/type",
            "setExpectedTypeName", 0);
    digester.addCallMethod(TAG_PREFIX + "/attribute/deferred-method", "setDeferredMethod");
    digester.addCallMethod(TAG_PREFIX + "/attribute/deferred-method/method-signature",
            "setMethodSignature", 0);
    digester.addRule(TAG_PREFIX + "/attribute/fragment",
            new GenericBooleanRule(Attribute.class, "setFragment"));

    digester.addRule(TAG_PREFIX + "/dynamic-attributes",
            new GenericBooleanRule(TagXml.class, "setDynamicAttributes"));
    digester.addSetNext(TAG_PREFIX, "addTag", TagXml.class.getName());

    // tag-file
    digester.addObjectCreate(TAGFILE_PREFIX, TagFileXml.class.getName());
    addDescriptionGroup(digester, TAGFILE_PREFIX);
    digester.addCallMethod(TAGFILE_PREFIX + "/name", "setName", 0);
    digester.addCallMethod(TAGFILE_PREFIX + "/path", "setPath", 0);
    digester.addSetNext(TAGFILE_PREFIX, "addTagFile", TagFileXml.class.getName());

    // function
    digester.addCallMethod(FUNCTION_PREFIX, "addFunction", 3);
    digester.addCallParam(FUNCTION_PREFIX + "/name", 0);
    digester.addCallParam(FUNCTION_PREFIX + "/function-class", 1);
    digester.addCallParam(FUNCTION_PREFIX + "/function-signature", 2);
}
 
Example 11
Source File: NamingRuleSet.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
/**
 * <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>
 *
 * @param digester Digester instance to which the new Rule instances
 *  should be added.
 */
@Override
public void addRuleInstances(Digester digester) {

    digester.addObjectCreate(prefix + "Ejb",
                             "org.apache.tomcat.util.descriptor.web.ContextEjb");
    digester.addRule(prefix + "Ejb", new SetAllPropertiesRule());
    digester.addRule(prefix + "Ejb",
            new SetNextNamingRule("addEjb",
                        "org.apache.tomcat.util.descriptor.web.ContextEjb"));

    digester.addObjectCreate(prefix + "Environment",
                             "org.apache.tomcat.util.descriptor.web.ContextEnvironment");
    digester.addSetProperties(prefix + "Environment");
    digester.addRule(prefix + "Environment",
                        new SetNextNamingRule("addEnvironment",
                        "org.apache.tomcat.util.descriptor.web.ContextEnvironment"));

    digester.addObjectCreate(prefix + "LocalEjb",
                             "org.apache.tomcat.util.descriptor.web.ContextLocalEjb");
    digester.addRule(prefix + "LocalEjb", new SetAllPropertiesRule());
    digester.addRule(prefix + "LocalEjb",
            new SetNextNamingRule("addLocalEjb",
                        "org.apache.tomcat.util.descriptor.web.ContextLocalEjb"));

    digester.addObjectCreate(prefix + "Resource",
                             "org.apache.tomcat.util.descriptor.web.ContextResource");
    digester.addRule(prefix + "Resource", new SetAllPropertiesRule());
    digester.addRule(prefix + "Resource",
            new SetNextNamingRule("addResource",
                        "org.apache.tomcat.util.descriptor.web.ContextResource"));

    digester.addObjectCreate(prefix + "ResourceEnvRef",
        "org.apache.tomcat.util.descriptor.web.ContextResourceEnvRef");
    digester.addRule(prefix + "ResourceEnvRef", new SetAllPropertiesRule());
    digester.addRule(prefix + "ResourceEnvRef",
            new SetNextNamingRule("addResourceEnvRef",
                        "org.apache.tomcat.util.descriptor.web.ContextResourceEnvRef"));

    digester.addObjectCreate(prefix + "ServiceRef",
        "org.apache.tomcat.util.descriptor.web.ContextService");
    digester.addRule(prefix + "ServiceRef", new SetAllPropertiesRule());
    digester.addRule(prefix + "ServiceRef",
            new SetNextNamingRule("addService",
                        "org.apache.tomcat.util.descriptor.web.ContextService"));

    digester.addObjectCreate(prefix + "Transaction",
        "org.apache.tomcat.util.descriptor.web.ContextTransaction");
    digester.addRule(prefix + "Transaction", new SetAllPropertiesRule());
    digester.addRule(prefix + "Transaction",
            new SetNextNamingRule("setTransaction",
                        "org.apache.tomcat.util.descriptor.web.ContextTransaction"));

}
 
Example 12
Source File: HostRuleSet.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
/**
 * <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>
 *
 * @param digester Digester instance to which the new Rule instances
 *  should be added.
 */
@Override
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.addRule(prefix + "Host",
                     new LifecycleListenerRule
                     ("org.apache.catalina.startup.HostConfig",
                      "hostConfigClass"));
    digester.addSetNext(prefix + "Host",
                        "addChild",
                        "org.apache.catalina.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",
                        "org.apache.catalina.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",
                        "org.apache.catalina.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",
                        "org.apache.catalina.Valve");

}
 
Example 13
Source File: TldRuleSet.java    From Tomcat7.0.67 with Apache License 2.0 3 votes vote down vote up
/**
 * <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>
 *
 * @param digester Digester instance to which the new Rule instances
 *  should be added.
 */
@Override
public void addRuleInstances(Digester digester) {

    // Note the sharing of state between rules
    TaglibUriRule taglibUriRule = new TaglibUriRule(); 

    digester.addRule(prefix + "taglib", new TaglibRule(taglibUriRule));
    
    digester.addRule(prefix + "taglib/uri", taglibUriRule);

    digester.addRule(prefix + "taglib/listener/listener-class",
            new TaglibListenerRule(taglibUriRule));

}
 
Example 14
Source File: TldRuleSet.java    From tomcatsrc with Apache License 2.0 3 votes vote down vote up
/**
 * <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>
 *
 * @param digester Digester instance to which the new Rule instances
 *  should be added.
 */
@Override
public void addRuleInstances(Digester digester) {

    // Note the sharing of state between rules
    TaglibUriRule taglibUriRule = new TaglibUriRule(); 

    digester.addRule(prefix + "taglib", new TaglibRule(taglibUriRule));
    
    digester.addRule(prefix + "taglib/uri", taglibUriRule);

    digester.addRule(prefix + "taglib/listener/listener-class",
            new TaglibListenerRule(taglibUriRule));

}
 
Example 15
Source File: MemoryRuleSet.java    From Tomcat7.0.67 with Apache License 2.0 1 votes vote down vote up
/**
 * <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>
 *
 * @param digester Digester instance to which the new Rule instances
 *  should be added.
 */
@Override
public void addRuleInstances(Digester digester) {

    digester.addRule(prefix + "user", new MemoryUserRule());

}
 
Example 16
Source File: MemoryRuleSet.java    From Tomcat8-Source-Read with MIT License 1 votes vote down vote up
/**
 * <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>
 *
 * @param digester Digester instance to which the new Rule instances
 *  should be added.
 */
@Override
public void addRuleInstances(Digester digester) {

    digester.addRule(prefix + "user", new MemoryUserRule());

}
 
Example 17
Source File: MemoryRuleSet.java    From tomcatsrc with Apache License 2.0 1 votes vote down vote up
/**
 * <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>
 *
 * @param digester Digester instance to which the new Rule instances
 *  should be added.
 */
@Override
public void addRuleInstances(Digester digester) {

    digester.addRule(prefix + "user", new MemoryUserRule());

}