001: /*
002: * Copyright 1999-2001,2004 The Apache Software Foundation.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016:
017: package org.apache.catalina.startup;
018:
019: import org.apache.commons.digester.Digester;
020: import org.apache.commons.digester.RuleSetBase;
021:
022: /**
023: * <p><strong>RuleSet</strong> for processing the contents of a
024: * Cluster definition element. </p>
025: *
026: * @author Filip Hanik
027: * @version $Revision: 1.3 $ $Date: 2004/06/04 20:22:27 $
028: */
029:
030: public class ClusterRuleSet extends RuleSetBase {
031:
032: // ----------------------------------------------------- Instance Variables
033:
034: /**
035: * The matching pattern prefix to use for recognizing our elements.
036: */
037: protected String prefix = null;
038:
039: // ------------------------------------------------------------ Constructor
040:
041: /**
042: * Construct an instance of this <code>RuleSet</code> with the default
043: * matching pattern prefix.
044: */
045: public ClusterRuleSet() {
046:
047: this ("");
048:
049: }
050:
051: /**
052: * Construct an instance of this <code>RuleSet</code> with the specified
053: * matching pattern prefix.
054: *
055: * @param prefix Prefix for matching pattern rules (including the
056: * trailing slash character)
057: */
058: public ClusterRuleSet(String prefix) {
059: super ();
060: this .namespaceURI = null;
061: this .prefix = prefix;
062: }
063:
064: // --------------------------------------------------------- Public Methods
065:
066: /**
067: * <p>Add the set of Rule instances defined in this RuleSet to the
068: * specified <code>Digester</code> instance, associating them with
069: * our namespace URI (if any). This method should only be called
070: * by a Digester instance.</p>
071: *
072: * @param digester Digester instance to which the new Rule instances
073: * should be added.
074: */
075: public void addRuleInstances(Digester digester) {
076: //Cluster configuration start
077: digester.addObjectCreate(prefix + "Membership", null, // MUST be specified in the element
078: "className");
079: digester.addSetProperties(prefix + "Membership");
080: digester.addSetNext(prefix + "Membership",
081: "setMembershipService",
082: "org.apache.catalina.cluster.MembershipService");
083:
084: digester.addObjectCreate(prefix + "Sender", null, // MUST be specified in the element
085: "className");
086: digester.addSetProperties(prefix + "Sender");
087: digester.addSetNext(prefix + "Sender", "setClusterSender",
088: "org.apache.catalina.cluster.ClusterSender");
089:
090: digester.addObjectCreate(prefix + "Receiver", null, // MUST be specified in the element
091: "className");
092: digester.addSetProperties(prefix + "Receiver");
093: digester.addSetNext(prefix + "Receiver", "setClusterReceiver",
094: "org.apache.catalina.cluster.ClusterReceiver");
095:
096: digester.addObjectCreate(prefix + "Valve", null, // MUST be specified in the element
097: "className");
098: digester.addSetProperties(prefix + "Valve");
099: digester.addSetNext(prefix + "Valve", "addValve",
100: "org.apache.catalina.Valve");
101:
102: digester.addObjectCreate(prefix + "Deployer", null, // MUST be specified in the element
103: "className");
104: digester.addSetProperties(prefix + "Deployer");
105: digester.addSetNext(prefix + "Deployer", "setClusterDeployer",
106: "org.apache.catalina.cluster.ClusterDeployer");
107:
108: //Cluster configuration end
109: }
110:
111: }
|