1 /**
2 * Copyright 2005-2007 the original author or authors.
3 *
4 * Licensed under the Gnu General Pubic License, Version 2.0 (the
5 * "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/gpl-license.php
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the Gnu General Public License for more details.
14 */
15 package org.figure8.join.control.config;
16
17 import org.apache.commons.digester.Digester;
18 import org.apache.commons.digester.RuleSetBase;
19 /**
20 * The set of Digester rules required to parse a Join access control
21 * configuration file (<code>join-access-control.xml</code>).
22 * @author <a href="mailto:laurent.broudoux@free.fr">Laurent Broudoux</a>
23 * @version $Revision: 1.2 $
24 */
25 public class AccessControlRuleSet extends RuleSetBase{
26
27
28
29 /**
30 * Add the set of Rule instances defined in this RuleSet to the
31 * specified <code>Digester</code> instance. This method should only
32 * be called by a Digester instance. These rules assume that an instance of
33 * {@link org.figure8.join.control.config.AccessControlConfig} is pushed
34 * onto the evaluation stack before parsing begins.
35 * @param digester Digester instance to which the new Rule instances should be added.
36 */
37 public void addRuleInstances(Digester digester){
38
39
40 digester.addObjectCreate(
41 "join-access-control/action-constraints/action",
42 "org.figure8.join.control.config.ActionConstraintConfig");
43 digester.addSetProperties("join-access-control/action-constraints/action");
44 digester.addSetNext(
45 "join-access-control/action-constraints/action",
46 "addActionConstraint",
47 "org.figure8.join.control.config.ActionConstraintConfig");
48
49
50 digester.addObjectCreate(
51 "join-access-control/action-constraints/action/role",
52 "org.figure8.join.control.config.RoleConfig");
53 digester.addSetProperties("join-access-control/action-constraints/action/role");
54 digester.addSetNext(
55 "join-access-control/action-constraints/action/role",
56 "addRole",
57 "org.figure8.join.control.config.RoleConfig");
58
59
60 digester.addObjectCreate(
61 "join-access-control/action-constraints/action/operation",
62 "org.figure8.join.control.config.OperationConstraintConfig");
63 digester.addSetProperties("join-access-control/action-constraints/action/operation");
64 digester.addSetNext(
65 "join-access-control/action-constraints/action/operation",
66 "addOperationConstraint",
67 "org.figure8.join.control.config.OperationConstraintConfig");
68
69
70 digester.addObjectCreate(
71 "join-access-control/action-constraints/action/operation/role",
72 "org.figure8.join.control.config.RoleConfig");
73 digester.addSetProperties("join-access-control/action-constraints/action/operation/role");
74 digester.addSetNext(
75 "join-access-control/action-constraints/action/operation/role",
76 "addRole",
77 "org.figure8.join.control.config.RoleConfig");
78 }
79 }