source: fedd/abac-src/ttg/process/NegotiationContext.java @ e794984

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

ABAC sources from Cobham

  • Property mode set to 100644
File size: 3.0 KB
Line 
1package com.nailabs.abac.process;
2
3import com.nailabs.abac.trust.*;
4import com.nailabs.abac.test.*;
5import edu.stanford.peer.rbtm.credential.*;
6import edu.stanford.peer.rbtm.engine.*;
7
8import java.util.*;
9
10/**
11 * A negotiation context contains all the objects necessary for performing
12 * a trust negotiation transaction.
13 */
14public class NegotiationContext {
15
16    // The frontiers for self are static in a context.
17
18    /** This a shared data structure for accessing a principal's credentials */
19    protected FrontierManager frontier;
20
21    /** The strategy for processing nodes in this negotiation. */
22    protected Strategy strategy;
23
24    /** The trust target graph used to store the nodes */
25    protected TTG trustGraph;
26
27    /** The remote negotiator in a two party negotiation */
28    protected Entity oppo;
29   
30    /** Credentials received from the opponent negotiator */
31    protected GraphEngine oppoCred;
32   
33    /** Observer for logging ttg information */
34    protected PropertiesObserver observer;
35
36    /** Construct a new context for a specific negotiation */
37    public NegotiationContext(HashMap mediationInfo) {
38        Entity self = (Entity)mediationInfo.get("EntityID");
39        Entity peer = (Entity)mediationInfo.get("Peer");
40        mediationInfo.put("context", this);
41        frontier = FrontierManager.getFrontier(self);
42        oppo = peer;
43        observer = new PropertiesObserver(self);
44        trustGraph = new TTG(this);
45        trustGraph.addObserver(observer);
46        strategy = StrategyFactory.getStrategy(mediationInfo);
47        strategy.addObserver(observer);
48    }
49
50    /** public accessor method for the trust target graph */
51    public TTG getGraph() { return trustGraph; }
52
53    /** public accessor mehotd for the processing instance */
54    public Strategy getStrategy() { return strategy; }
55
56    /** public accessor method for the opponent */
57    public Entity getOpponent() { return oppo; }
58
59    /** public accessor method for the frontier functions */
60    public FrontierManager getFrontier() { return frontier; }
61
62    /** public accessor method for the local negotiator's identity */
63    public Entity getSelf() { return frontier.getSelf(); }
64
65    /** adds a list of credentials from the opponent */
66    public void addCredentials(LinkedList otherCreds) {
67        oppoCred.addCredentials(otherCreds);
68    }
69   
70    /** Is the given credential a member of cS */
71    public boolean isTraceable(StaticCredential cred) {
72        return frontier.isSelfReachable(cred);
73    }
74
75    public boolean subjectTracesAll(RoleName name) {
76        return frontier.subjectTracesAll(name);
77    }
78
79    /** lookup method for Ack policy */
80    public EntityExpression getAck(EntityExpression e) {
81        return frontier.getAck(e);
82    }
83
84    /** lookup method for AC policy */
85    public EntityExpression getAC(Credential cred) {
86        return frontier.getAC(cred);
87    }
88
89
90    public String toString() {
91        StringBuffer buff = new StringBuffer("[NegotiationContext ");
92        buff.append(frontier).append(", ");
93        buff.append(trustGraph).append(", ");   
94        buff.append(strategy).append("]");
95        return(buff.toString());
96    }
97
98}
99
Note: See TracBrowser for help on using the repository browser.