source: fedd/abac-src/rbtm/engine/Oppo.java @ ecf679e

axis_examplecompt_changesinfo-opsversion-2.00version-3.01version-3.02
Last change on this file since ecf679e was 8780cbec, checked in by Jay Jacobs <Jay.Jacobs@…>, 15 years ago

ABAC sources from Cobham

  • Property mode set to 100644
File size: 1.6 KB
RevLine 
[8780cbec]1package edu.stanford.peer.rbtm.engine;
2
3import edu.stanford.peer.rbtm.credential.*;
4import edu.stanford.peer.rbtm.util.*;
5
6import java.util.*;
7
8/**
9 * A predicate on role expressions used by a verifier to determine if a target
10 * may be skipped over and not created.
11 */
12public class Oppo implements Predicate {
13    /** issuer-traces-all roles */
14    protected Vector issuerTraces;
15
16    /** create a new oppo predicate w/o traceable role names */
17    public Oppo() { issuerTraces = new Vector(); }
18
19    /** create a new oppo predicate with a set of traceable role names */
20    public Oppo(Vector roles) { issuerTraces = new Vector(roles); }
21
22    /** add a role name to the subject-traces-all list */
23    public void addSubject(String name) {
24        addSubject(new SimpleRoleName(name));
25    }
26
27    /** add a role name to the subject-traces-all list */
28    public void addSubject(RoleName role) {
29        issuerTraces.add(role);
30    }
31    /** add a set of role names to the subject-traces-all list */
32    public void addSubjects(Vector roles) { 
33        issuerTraces.addAll(roles); 
34    }
35
36    /** remove a role name from the subject-traces-all list */
37    public void removeSubject(String name) {
38        removeSubject(new SimpleRoleName(name));
39    }
40   
41    /** remove a role name from the subject-traces-all list */
42    public void removeSubject(RoleName role) {
43        issuerTraces.remove(role);
44    }
45
46    /** apply the predicate to determine if this role is subject-traces-all */
47    public boolean test(EntityExpression obj) {
48        if(obj instanceof Role) {
49            Role role = (Role)obj;
50            return (!issuerTraces.contains(role.getName()));
51        }
52        return true;
53    }
54
55}
Note: See TracBrowser for help on using the repository browser.