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

The following examples show how to use org.apache.tomcat.util.digester.Digester#addSetProperties() . 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: Catalina.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
/**
 * Create and configure the Digester we will be using for shutdown.
 */
protected Digester createStopDigester() {

    // Initialize the digester
    Digester digester = new Digester();
    digester.setUseContextClassLoader(true);

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

}
 
Example 2
Source File: Catalina.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
/**
 * Create and configure the Digester we will be using for shutdown.
 */
protected Digester createStopDigester() {

    // Initialize the digester
    Digester digester = new Digester();
    digester.setUseContextClassLoader(true);

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

}
 
Example 3
Source File: Catalina.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
/**
 * Create and configure the Digester we will be using for shutdown.
 * @return the digester to process the stop operation
 */
protected Digester createStopDigester() {

    // Initialize the digester
    Digester digester = new Digester();
    digester.setUseContextClassLoader(true);

    // 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;

}
 
Example 4
Source File: HostConfig.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
/**
 * Create the digester which will be used to parse context config files.
 * @param contextClassName The class which will be used to create the
 *  context instance
 * @return the digester
 */
protected static Digester createDigester(String contextClassName) {
    Digester digester = new Digester();
    digester.setValidating(false);
    // Add object creation rule
    digester.addObjectCreate("Context", contextClassName, "className");
    // Set the properties on that object (it doesn't matter if extra
    // properties are set)
    digester.addSetProperties("Context");
    return digester;
}
 
Example 5
Source File: RealmRuleSet.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
private void addRuleInstances(Digester digester, String pattern, String methodName) {
    digester.addObjectCreate(pattern, null /* MUST be specified in the element */,
            "className");
    digester.addSetProperties(pattern);
    digester.addSetNext(pattern, methodName, "org.apache.catalina.Realm");
    digester.addRuleSet(new CredentialHandlerRuleSet(pattern + "/"));
}
 
Example 6
Source File: HostConfig.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
/**
 * Create the digester which will be used to parse context config files.
 */
protected static Digester createDigester(String contextClassName) {
    Digester digester = new Digester();
    digester.setValidating(false);
    // Add object creation rule
    digester.addObjectCreate("Context", contextClassName, "className");
    // Set the properties on that object (it doesn't matter if extra
    // properties are set)
    digester.addSetProperties("Context");
    return (digester);
}
 
Example 7
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 8
Source File: HostConfig.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
/**
 * Create the digester which will be used to parse context config files.
 */
protected static Digester createDigester(String contextClassName) {
    Digester digester = new Digester();
    digester.setValidating(false);
    // Add object creation rule
    digester.addObjectCreate("Context", contextClassName, "className");
    // Set the properties on that object (it doesn't matter if extra
    // properties are set)
    digester.addSetProperties("Context");
    return (digester);
}
 
Example 9
Source File: RealmRuleSet.java    From Tomcat7.0.67 with Apache License 2.0 5 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) {

    String pattern = prefix;

    for (int i = 0; i < MAX_NESTED_REALM_LEVELS; i++) {

        if (i > 0) {
            pattern += "/";
        }
        pattern += "Realm";

        digester.addObjectCreate(pattern,
                                 null, // MUST be specified in the element,
                                 "className");
        digester.addSetProperties(pattern);
        if (i == 0) {
            digester.addSetNext(pattern,
                                "setRealm",
                                "org.apache.catalina.Realm");
        } else {
            digester.addSetNext(pattern,
                                "addRealm",
                                "org.apache.catalina.Realm");
        }
    }
}
 
Example 10
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 11
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 12
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 13
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 14
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 15
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 16
Source File: MbeansDescriptorsDigesterSource.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
private static Digester createDigester() {

        Digester digester = new Digester();
        digester.setNamespaceAware(false);
        digester.setValidating(false);
        URL url = Registry.getRegistry(null, null).getClass().getResource
            ("/org/apache/tomcat/util/modeler/mbeans-descriptors.dtd");
        digester.register
            ("-//Apache Software Foundation//DTD Model MBeans Configuration File",
                url.toString());

        // Configure the parsing rules
        digester.addObjectCreate
            ("mbeans-descriptors/mbean",
            "org.apache.tomcat.util.modeler.ManagedBean");
        digester.addSetProperties
            ("mbeans-descriptors/mbean");
        digester.addSetNext
            ("mbeans-descriptors/mbean",
                "add",
            "java.lang.Object");

        digester.addObjectCreate
            ("mbeans-descriptors/mbean/attribute",
            "org.apache.tomcat.util.modeler.AttributeInfo");
        digester.addSetProperties
            ("mbeans-descriptors/mbean/attribute");
        digester.addSetNext
            ("mbeans-descriptors/mbean/attribute",
                "addAttribute",
            "org.apache.tomcat.util.modeler.AttributeInfo");

        digester.addObjectCreate
            ("mbeans-descriptors/mbean/notification",
            "org.apache.tomcat.util.modeler.NotificationInfo");
        digester.addSetProperties
            ("mbeans-descriptors/mbean/notification");
        digester.addSetNext
            ("mbeans-descriptors/mbean/notification",
                "addNotification",
            "org.apache.tomcat.util.modeler.NotificationInfo");

        digester.addObjectCreate
            ("mbeans-descriptors/mbean/notification/descriptor/field",
            "org.apache.tomcat.util.modeler.FieldInfo");
        digester.addSetProperties
            ("mbeans-descriptors/mbean/notification/descriptor/field");
        digester.addSetNext
            ("mbeans-descriptors/mbean/notification/descriptor/field",
                "addField",
            "org.apache.tomcat.util.modeler.FieldInfo");

        digester.addCallMethod
            ("mbeans-descriptors/mbean/notification/notification-type",
                "addNotifType", 0);

        digester.addObjectCreate
            ("mbeans-descriptors/mbean/operation",
            "org.apache.tomcat.util.modeler.OperationInfo");
        digester.addSetProperties
            ("mbeans-descriptors/mbean/operation");
        digester.addSetNext
            ("mbeans-descriptors/mbean/operation",
                "addOperation",
            "org.apache.tomcat.util.modeler.OperationInfo");

        digester.addObjectCreate
            ("mbeans-descriptors/mbean/operation/descriptor/field",
            "org.apache.tomcat.util.modeler.FieldInfo");
        digester.addSetProperties
            ("mbeans-descriptors/mbean/operation/descriptor/field");
        digester.addSetNext
            ("mbeans-descriptors/mbean/operation/descriptor/field",
                "addField",
            "org.apache.tomcat.util.modeler.FieldInfo");

        digester.addObjectCreate
            ("mbeans-descriptors/mbean/operation/parameter",
            "org.apache.tomcat.util.modeler.ParameterInfo");
        digester.addSetProperties
            ("mbeans-descriptors/mbean/operation/parameter");
        digester.addSetNext
            ("mbeans-descriptors/mbean/operation/parameter",
                "addParameter",
            "org.apache.tomcat.util.modeler.ParameterInfo");

        return digester;

    }
 
Example 17
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 18
Source File: CredentialHandlerRuleSet.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
private void addRuleInstances(Digester digester, String pattern, String methodName) {
    digester.addObjectCreate(pattern, null /* MUST be specified in the element */,
            "className");
    digester.addSetProperties(pattern);
    digester.addSetNext(pattern, methodName, "org.apache.catalina.CredentialHandler");
}
 
Example 19
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 20
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");

}