~james-page/ubuntu/natty/tomcat6/fix-662588

« back to all changes in this revision

Viewing changes to java/org/apache/catalina/startup/RealmRuleSet.java

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug, Iulian Udrea
  • Date: 2009-06-09 12:35:19 UTC
  • mfrom: (1.2.1 upstream) (2.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20090609123519-7owjbso5ttnka6ur
Tags: 6.0.20-1ubuntu1
[ Iulian Udrea ]
* Merge from debian unstable (LP: #385262), remaining changes:
  - debian/control, debian/rules: Use default-jdk to build
  - debian/control: Run using default-jre-headless by default

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 Realm definition
 
28
 * element.  This <code>RuleSet</code> supports Realms such as the
 
29
 * <code>CombinedRealm</code> that used nested Realms.</p>
 
30
 *
 
31
 * @version $Revision: 707757 $ $Date: 2008-10-24 23:54:48 +0200 (Fri, 24 Oct 2008) $
 
32
 */
 
33
 
 
34
public class RealmRuleSet extends RuleSetBase {
 
35
 
 
36
 
 
37
    // ----------------------------------------------------- Instance Variables
 
38
 
 
39
 
 
40
    /**
 
41
     * The matching pattern prefix to use for recognizing our elements.
 
42
     */
 
43
    protected String prefix = null;
 
44
 
 
45
 
 
46
    // ------------------------------------------------------------ Constructor
 
47
 
 
48
 
 
49
    /**
 
50
     * Construct an instance of this <code>RuleSet</code> with the default
 
51
     * matching pattern prefix.
 
52
     */
 
53
    public RealmRuleSet() {
 
54
 
 
55
        this("");
 
56
 
 
57
    }
 
58
 
 
59
 
 
60
    /**
 
61
     * Construct an instance of this <code>RuleSet</code> with the specified
 
62
     * matching pattern prefix.
 
63
     *
 
64
     * @param prefix Prefix for matching pattern rules (including the
 
65
     *  trailing slash character)
 
66
     */
 
67
    public RealmRuleSet(String prefix) {
 
68
 
 
69
        super();
 
70
        this.namespaceURI = null;
 
71
        this.prefix = prefix;
 
72
 
 
73
    }
 
74
 
 
75
 
 
76
    // --------------------------------------------------------- Public Methods
 
77
 
 
78
 
 
79
    /**
 
80
     * <p>Add the set of Rule instances defined in this RuleSet to the
 
81
     * specified <code>Digester</code> instance, associating them with
 
82
     * our namespace URI (if any).  This method should only be called
 
83
     * by a Digester instance.</p>
 
84
     *
 
85
     * @param digester Digester instance to which the new Rule instances
 
86
     *  should be added.
 
87
     */
 
88
    public void addRuleInstances(Digester digester) {
 
89
 
 
90
        digester.addObjectCreate(prefix + "Realm",
 
91
                                 null, // MUST be specified in the element,
 
92
                                 "className");
 
93
        digester.addSetProperties(prefix + "Realm");
 
94
        digester.addSetNext(prefix + "Realm",
 
95
                            "setRealm",
 
96
                            "org.apache.catalina.Realm");
 
97
 
 
98
        digester.addObjectCreate(prefix + "Realm/Realm",
 
99
                                 null, // MUST be specified in the element
 
100
                                 "className");
 
101
        digester.addSetProperties(prefix + "Realm/Realm");
 
102
        digester.addSetNext(prefix + "Realm/Realm",
 
103
                            "addRealm",
 
104
                            "org.apache.catalina.Realm");
 
105
 
 
106
    }
 
107
 
 
108
 
 
109
}