KickJava   Java API By Example, From Geeks To Geeks.

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


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

17
18
19 package org.apache.catalina.startup;
20
21
22 import org.apache.tomcat.util.digester.Digester;
23 import org.apache.tomcat.util.digester.RuleSetBase;
24
25
26 /**
27  * <p><strong>RuleSet</strong> for processing the contents of a
28  * Engine definition element. This <code>RuleSet</code> does NOT include
29  * any rules for nested Host or DefaultContext elements, which should
30  * be added via instances of <code>HostRuleSet</code> or
31  * <code>ContextRuleSet</code>, respectively.</p>
32  *
33  * @author Craig R. McClanahan
34  * @version $Revision: 468957 $ $Date: 2006-10-29 20:28:37 +0100 (dim., 29 oct. 2006) $
35  */

36
37 public class EngineRuleSet extends RuleSetBase {
38
39
40     // ----------------------------------------------------- Instance Variables
41

42
43     /**
44      * The matching pattern prefix to use for recognizing our elements.
45      */

46     protected String JavaDoc prefix = null;
47
48
49     // ------------------------------------------------------------ Constructor
50

51
52     /**
53      * Construct an instance of this <code>RuleSet</code> with the default
54      * matching pattern prefix.
55      */

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

70     public EngineRuleSet(String JavaDoc prefix) {
71
72         super();
73         this.namespaceURI = null;
74         this.prefix = prefix;
75
76     }
77
78
79     // --------------------------------------------------------- Public Methods
80

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

91     public void addRuleInstances(Digester digester) {
92
93         digester.addObjectCreate(prefix + "Engine",
94                                  "org.apache.catalina.core.StandardEngine",
95                                  "className");
96         digester.addSetProperties(prefix + "Engine");
97         digester.addRule(prefix + "Engine",
98                          new LifecycleListenerRule
99                          ("org.apache.catalina.startup.EngineConfig",
100                           "engineConfigClass"));
101         digester.addSetNext(prefix + "Engine",
102                             "setContainer",
103                             "org.apache.catalina.Container");
104
105         //Cluster configuration start
106
digester.addObjectCreate(prefix + "Engine/Cluster",
107                                  null, // MUST be specified in the element
108
"className");
109         digester.addSetProperties(prefix + "Engine/Cluster");
110         digester.addSetNext(prefix + "Engine/Cluster",
111                             "setCluster",
112                             "org.apache.catalina.Cluster");
113         //Cluster configuration end
114

115         digester.addObjectCreate(prefix + "Engine/Listener",
116                                  null, // MUST be specified in the element
117
"className");
118         digester.addSetProperties(prefix + "Engine/Listener");
119         digester.addSetNext(prefix + "Engine/Listener",
120                             "addLifecycleListener",
121                             "org.apache.catalina.LifecycleListener");
122
123
124         digester.addObjectCreate(prefix + "Engine/Realm",
125                                  null, // MUST be specified in the element
126
"className");
127         digester.addSetProperties(prefix + "Engine/Realm");
128         digester.addSetNext(prefix + "Engine/Realm",
129                             "setRealm",
130                             "org.apache.catalina.Realm");
131
132         digester.addObjectCreate(prefix + "Engine/Valve",
133                                  null, // MUST be specified in the element
134
"className");
135         digester.addSetProperties(prefix + "Engine/Valve");
136         digester.addSetNext(prefix + "Engine/Valve",
137                             "addValve",
138                             "org.apache.catalina.Valve");
139
140     }
141
142
143 }
144
Popular Tags