Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
PartFactory |
|
| 1.0;1 |
1 | /* | |
2 | * Copyright (c) 2009, Swiss Federal Department of Defence Civil Protection and Sport | |
3 | * (http://www.vbs.admin.ch) | |
4 | * Copyright (c) 2009, Ergon Informatik AG (http://www.ergon.ch) | |
5 | * All rights reserved. | |
6 | * | |
7 | * Licensed under the Open Permis License which accompanies this distribution, | |
8 | * and is available at http://www.openpermis.org/BSDlicenceKent.txt | |
9 | */ | |
10 | package org.openpermis.policy; | |
11 | ||
12 | import java.net.URI; | |
13 | import java.util.Collection; | |
14 | ||
15 | import org.joda.time.DateTimeZone; | |
16 | ||
17 | import org.openpermis.basic.TimePeriodConstraint; | |
18 | import org.openpermis.policy.bean.DomainBean; | |
19 | ||
20 | /** | |
21 | * Creates policy parts. | |
22 | * @since 0.1.0 | |
23 | */ | |
24 | public interface PartFactory { | |
25 | ||
26 | //---- Methods | |
27 | ||
28 | /** | |
29 | * Creates an action. | |
30 | * @param name the name that the created action will have. | |
31 | * @param parameterList a {@link ParameterList} that defines the arguments for this action. | |
32 | * @return an {@link Action} instance. | |
33 | * @since 0.1.0 | |
34 | */ | |
35 | public Action createAction (String name, ParameterList parameterList); | |
36 | ||
37 | /** | |
38 | * Creates a action collection. | |
39 | * @param collection of {@link Action}'s. | |
40 | * @return a {@link ActionCollection} instance. | |
41 | * @since 0.3.0 | |
42 | */ | |
43 | public ActionCollection createActionCollection (Collection<? extends Action> collection); | |
44 | ||
45 | /** | |
46 | * Creates a new authority. | |
47 | * @param identity the {@link URI} identifying the authority. | |
48 | * @return an {@link Authority} instance. | |
49 | * @since 0.1.0 | |
50 | */ | |
51 | public Authority createAuthority (URI identity); | |
52 | ||
53 | /** | |
54 | * Creates a new domain. | |
55 | * @param uri the {@link URI} identifying the domain. | |
56 | * @return a {@link Domain} instance. | |
57 | * @since 0.1.0 | |
58 | */ | |
59 | public Domain createDomain (URI uri); | |
60 | ||
61 | /** | |
62 | * Creates a new obligation. | |
63 | * @param text the {@link String} describing the obligation. | |
64 | * @return a {@link Obligation} instance. | |
65 | * @since 0.3.0 | |
66 | */ | |
67 | public Obligation createObligation (String text); | |
68 | ||
69 | /** | |
70 | * Creates a obligation collection. | |
71 | * @param collection of {@link Obligation}'s. | |
72 | * @return a {@link ObligationCollection} instance. | |
73 | * @since 0.3.0 | |
74 | */ | |
75 | public ObligationCollection createObligationCollection ( | |
76 | Collection<? extends Obligation> collection | |
77 | ); | |
78 | ||
79 | /** | |
80 | * Creates a new policy. | |
81 | * @return a {@link Policy} instance. | |
82 | * @since 0.1.0 | |
83 | */ | |
84 | public Policy createPolicy (); | |
85 | ||
86 | /** | |
87 | * Creates a new policy. | |
88 | * @param zone a {@link DateTimeZone} the time zone of this policy, | |
89 | * @param hierarchies a {@link RoleHierarchyCollection}. | |
90 | * @param targetAccessRules a {@link TargetAccessRuleCollection}. | |
91 | * @param roleAssignmentRules {@link RoleAssignmentRuleCollection}. | |
92 | * @return a {@link Policy} instance. | |
93 | * @since 0.3.0 | |
94 | */ | |
95 | public Policy createPolicy ( | |
96 | DateTimeZone zone, | |
97 | RoleHierarchyCollection hierarchies, | |
98 | TargetAccessRuleCollection targetAccessRules, | |
99 | RoleAssignmentRuleCollection roleAssignmentRules | |
100 | ); | |
101 | ||
102 | /** | |
103 | * Creates a new role hierarchy. | |
104 | * @param uri the {@link URI} uniquely identifying the role hierarchy. | |
105 | * @return a {@link RoleHierarchy} instance. | |
106 | * @since 0.3.0 | |
107 | */ | |
108 | public RoleHierarchy createRoleHierarchy (URI uri); | |
109 | ||
110 | /** | |
111 | * Creates a new role hierarchy collection. | |
112 | * @param collection of {@link RoleHierarchy}'s. | |
113 | * @return a {@link RoleHierarchyCollection} instance. | |
114 | * @since 0.3.0 | |
115 | */ | |
116 | public RoleHierarchyCollection createRoleHierarchyCollection ( | |
117 | Collection<? extends RoleHierarchy> collection | |
118 | ); | |
119 | ||
120 | /** | |
121 | * Creates a role assignment rule. | |
122 | * @param authority the {@link Authority} granting the right to delegate roles. | |
123 | * @param subjectDomain the {@link Domain} of subjects to which this role applies. | |
124 | * @param roles the {@link Role}s that the rule allows to be delegated. | |
125 | * @param constraint the {@link TimePeriodConstraint} of this rule. | |
126 | * @param delegationDepth the number of times a role may be delegated to somebody else. | |
127 | * @return a {@link RoleAssignmentRule} instance. | |
128 | * @since 0.3.0 | |
129 | */ | |
130 | public RoleAssignmentRule createRoleAssignmentRule ( | |
131 | Authority authority, | |
132 | DomainBean subjectDomain, | |
133 | Collection<Role> roles, | |
134 | TimePeriodConstraint constraint, | |
135 | int delegationDepth | |
136 | ); | |
137 | ||
138 | /** | |
139 | * Creates a role assignment rule collection. | |
140 | * @param collection of {@link RoleAssignmentRule}'s. | |
141 | * @return a {@link RoleAssignmentRuleCollection} instance. | |
142 | * @since 0.3.0 | |
143 | */ | |
144 | public RoleAssignmentRuleCollection createRoleAssignmentRuleCollection ( | |
145 | Collection<? extends RoleAssignmentRule> collection | |
146 | ); | |
147 | ||
148 | /** | |
149 | * Creates a target. | |
150 | * @param domain the {@link Domain} identifying the resources of this target. | |
151 | * @param actions the {@link ActionCollection} that can be performed on the resources. | |
152 | * @return a {@link Target} instance. | |
153 | * @since 0.3.0 | |
154 | */ | |
155 | public Target createTarget (Domain domain, ActionCollection actions); | |
156 | ||
157 | /** | |
158 | * Creates a target collection. | |
159 | * @param collection of {@link Target}'s. | |
160 | * @return a {@link TargetCollection} instance. | |
161 | * @since 0.3.0 | |
162 | */ | |
163 | public TargetCollection createTargetCollection (Collection<? extends Target> collection); | |
164 | ||
165 | /** | |
166 | * Creates a target access rule. | |
167 | * @param targets a {@link TargetCollection} for which this rule applies. | |
168 | * @param roles the {@link Role}s that a subject needs to get access to this target. | |
169 | * @param condition the predicate that must evaluate to <code>true</code> in order | |
170 | * for the rule to grant access. | |
171 | * @param obligations the {@link ObligationCollection}s for this rule. | |
172 | * @return a {@link TargetAccessRule} instance. | |
173 | * @since 0.3.0 | |
174 | */ | |
175 | public TargetAccessRule createTargetAccessRule ( | |
176 | TargetCollection targets, | |
177 | Collection<Role> roles, | |
178 | Predicate condition, | |
179 | ObligationCollection obligations | |
180 | ); | |
181 | ||
182 | /** | |
183 | * Creates a target access rule collection. | |
184 | * @param collection of {@link TargetAccessRule}'s. | |
185 | * @return a {@link TargetAccessRuleCollection} instance. | |
186 | * @since 0.3.0 | |
187 | */ | |
188 | public TargetAccessRuleCollection createTargetAccessRuleCollection ( | |
189 | Collection<? extends TargetAccessRule> collection | |
190 | ); | |
191 | ||
192 | } |