KickJava   Java API By Example, From Geeks To Geeks.

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


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 JNDI Enterprise Naming
28  * Context resource declaration elements.</p>
29  *
30  * @author Craig R. McClanahan
31  * @author Remy Maucherat
32  * @version $Revision: 467222 $ $Date: 2006-10-24 05:17:11 +0200 (mar., 24 oct. 2006) $
33  */

34
35 public class NamingRuleSet extends RuleSetBase {
36
37
38     // ----------------------------------------------------- Instance Variables
39

40
41     /**
42      * The matching pattern prefix to use for recognizing our elements.
43      */

44     protected String JavaDoc prefix = null;
45
46
47     // ------------------------------------------------------------ Constructor
48

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

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

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

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

89     public void addRuleInstances(Digester digester) {
90
91         digester.addObjectCreate(prefix + "Ejb",
92                                  "org.apache.catalina.deploy.ContextEjb");
93         digester.addRule(prefix + "Ejb", new SetAllPropertiesRule());
94         digester.addRule(prefix + "Ejb",
95                 new SetNextNamingRule("addEjb",
96                             "org.apache.catalina.deploy.ContextEjb"));
97
98         digester.addObjectCreate(prefix + "Environment",
99                                  "org.apache.catalina.deploy.ContextEnvironment");
100         digester.addSetProperties(prefix + "Environment");
101         digester.addRule(prefix + "Environment",
102                             new SetNextNamingRule("addEnvironment",
103                             "org.apache.catalina.deploy.ContextEnvironment"));
104
105         digester.addObjectCreate(prefix + "LocalEjb",
106                                  "org.apache.catalina.deploy.ContextLocalEjb");
107         digester.addRule(prefix + "LocalEjb", new SetAllPropertiesRule());
108         digester.addRule(prefix + "LocalEjb",
109                 new SetNextNamingRule("addLocalEjb",
110                             "org.apache.catalina.deploy.ContextLocalEjb"));
111
112         digester.addObjectCreate(prefix + "Resource",
113                                  "org.apache.catalina.deploy.ContextResource");
114         digester.addRule(prefix + "Resource", new SetAllPropertiesRule());
115         digester.addRule(prefix + "Resource",
116                 new SetNextNamingRule("addResource",
117                             "org.apache.catalina.deploy.ContextResource"));
118
119         digester.addObjectCreate(prefix + "ResourceEnvRef",
120             "org.apache.catalina.deploy.ContextResourceEnvRef");
121         digester.addRule(prefix + "ResourceEnvRef", new SetAllPropertiesRule());
122         digester.addRule(prefix + "ResourceEnvRef",
123                 new SetNextNamingRule("addResourceEnvRef",
124                             "org.apache.catalina.deploy.ContextResourceEnvRef"));
125
126         digester.addObjectCreate(prefix + "Transaction",
127             "org.apache.catalina.deploy.ContextTransaction");
128         digester.addRule(prefix + "Transaction", new SetAllPropertiesRule());
129         digester.addRule(prefix + "Transaction",
130                 new SetNextNamingRule("setTransaction",
131                             "org.apache.catalina.deploy.ContextTransaction"));
132
133     }
134
135
136 }
137
Popular Tags