RuleSet for processing the contents of a Context definition element.
| 23 | * <strong>RuleSet</strong> for processing the contents of a Context definition element. |
| 24 | */ |
| 25 | public class ContextRuleSet implements RuleSet { |
| 26 | |
| 27 | // ----------------------------------------------------- Instance Variables |
| 28 | |
| 29 | /** |
| 30 | * The matching pattern prefix to use for recognizing our elements. |
| 31 | */ |
| 32 | protected final String prefix; |
| 33 | |
| 34 | |
| 35 | /** |
| 36 | * Should the context be created. |
| 37 | */ |
| 38 | protected final boolean create; |
| 39 | |
| 40 | |
| 41 | // ------------------------------------------------------------ Constructor |
| 42 | |
| 43 | /** |
| 44 | * Construct an instance of this <code>RuleSet</code> with the default matching pattern prefix. |
| 45 | * The context instance will be created by the digester. |
| 46 | */ |
| 47 | public ContextRuleSet() { |
| 48 | this(""); |
| 49 | } |
| 50 | |
| 51 | |
| 52 | /** |
| 53 | * Construct an instance of this <code>RuleSet</code> with the specified matching pattern prefix. |
| 54 | * The context instance will be created by the digester. |
| 55 | * |
| 56 | * @param prefix Prefix for matching pattern rules (including the trailing slash character) |
| 57 | */ |
| 58 | public ContextRuleSet(String prefix) { |
| 59 | this(prefix, true); |
| 60 | } |
| 61 | |
| 62 | |
| 63 | /** |
| 64 | * Construct an instance of this <code>RuleSet</code> with the specified matching pattern prefix. |
| 65 | * |
| 66 | * @param prefix Prefix for matching pattern rules (including the trailing slash character) |
| 67 | * @param create <code>true</code> if the main context instance should be created |
| 68 | */ |
| 69 | public ContextRuleSet(String prefix, boolean create) { |
| 70 | this.prefix = prefix; |
| 71 | this.create = create; |
| 72 | } |
| 73 | |
| 74 | |
| 75 | // --------------------------------------------------------- Public Methods |
| 76 | |
| 77 | @Override |
| 78 | public void addRuleInstances(Digester digester) { |
| 79 | |
| 80 | if (create) { |
| 81 | digester.addObjectCreate(prefix + "Context", "org.apache.catalina.core.StandardContext", "className"); |
| 82 | digester.addSetProperties(prefix + "Context"); |
nothing calls this directly
no outgoing calls
no test coverage detected