KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > catalina > startup > ClusterRuleSet


1 /*
2  * Copyright 1999-2001,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17
18 package org.apache.catalina.startup;
19
20
21 import org.apache.tomcat.util.digester.Digester;
22 import org.apache.tomcat.util.digester.RuleSetBase;
23
24
25 /**
26  * <p><strong>RuleSet</strong> for processing the contents of a
27  * Cluster definition element. </p>
28  *
29  * @author Filip Hanik
30  * @version $Revision: 1.4 $ $Date: 2004/06/26 17:41:31 $
31  */

32
33 public class ClusterRuleSet extends RuleSetBase {
34
35
36     // ----------------------------------------------------- Instance Variables
37

38
39     /**
40      * The matching pattern prefix to use for recognizing our elements.
41      */

42     protected String JavaDoc prefix = null;
43
44
45     // ------------------------------------------------------------ Constructor
46

47
48     /**
49      * Construct an instance of this <code>RuleSet</code> with the default
50      * matching pattern prefix.
51      */

52     public ClusterRuleSet() {
53
54         this("");
55
56     }
57
58
59     /**
60      * Construct an instance of this <code>RuleSet</code> with the specified
61      * matching pattern prefix.
62      *
63      * @param prefix Prefix for matching pattern rules (including the
64      * trailing slash character)
65      */

66     public ClusterRuleSet(String JavaDoc prefix) {
67         super();
68         this.namespaceURI = null;
69         this.prefix = prefix;
70     }
71
72
73     // --------------------------------------------------------- Public Methods
74

75
76     /**
77      * <p>Add the set of Rule instances defined in this RuleSet to the
78      * specified <code>Digester</code> instance, associating them with
79      * our namespace URI (if any). This method should only be called
80      * by a Digester instance.</p>
81      *
82      * @param digester Digester instance to which the new Rule instances
83      * should be added.
84      */

85     public void addRuleInstances(Digester digester) {
86         //Cluster configuration start
87
digester.addObjectCreate(prefix + "Membership",
88                                  null, // MUST be specified in the element
89
"className");
90         digester.addSetProperties(prefix + "Membership");
91         digester.addSetNext(prefix + "Membership",
92                             "setMembershipService",
93                             "org.apache.catalina.cluster.MembershipService");
94         
95         digester.addObjectCreate(prefix + "Sender",
96                                  null, // MUST be specified in the element
97
"className");
98         digester.addSetProperties(prefix + "Sender");
99         digester.addSetNext(prefix + "Sender",
100                             "setClusterSender",
101                             "org.apache.catalina.cluster.ClusterSender");
102
103         digester.addObjectCreate(prefix + "Receiver",
104                                  null, // MUST be specified in the element
105
"className");
106         digester.addSetProperties(prefix + "Receiver");
107         digester.addSetNext(prefix + "Receiver",
108                             "setClusterReceiver",
109                             "org.apache.catalina.cluster.ClusterReceiver");
110
111         digester.addObjectCreate(prefix + "Valve",
112                                  null, // MUST be specified in the element
113
"className");
114         digester.addSetProperties(prefix + "Valve");
115         digester.addSetNext(prefix + "Valve",
116                             "addValve",
117                             "org.apache.catalina.Valve");
118         
119         digester.addObjectCreate(prefix + "Deployer",
120                                  null, // MUST be specified in the element
121
"className");
122         digester.addSetProperties(prefix + "Deployer");
123         digester.addSetNext(prefix + "Deployer",
124                             "setClusterDeployer",
125                             "org.apache.catalina.cluster.ClusterDeployer");
126
127
128
129         //Cluster configuration end
130
}
131
132
133 }
134
Popular Tags