1 | package com.nailabs.abac.trust; |
---|
2 | |
---|
3 | import edu.stanford.peer.rbtm.credential.*; |
---|
4 | import com.nailabs.abac.process.*; |
---|
5 | |
---|
6 | /** |
---|
7 | * A trivial trust target node is a leaf node which propagates satisfaction |
---|
8 | * state up towards the root of the graph. |
---|
9 | */ |
---|
10 | public class TrivialTTNode extends TargetNode { |
---|
11 | |
---|
12 | //NegotiationContext context = null; |
---|
13 | |
---|
14 | /** |
---|
15 | * Create a new trivial trust target node. |
---|
16 | */ |
---|
17 | public TrivialTTNode(Entity v, Entity subject) |
---|
18 | throws CredentialParsingException, TrustTargetParsingException |
---|
19 | { |
---|
20 | this(new TrustTarget(v, subject, subject)); // set up trust target |
---|
21 | } |
---|
22 | |
---|
23 | /** Create a new trivial TT node base on the supplied trust target */ |
---|
24 | public TrivialTTNode(TrustTarget tt) |
---|
25 | { |
---|
26 | super(tt); // set up trust target |
---|
27 | SatisfactionState satisfied = |
---|
28 | new SatisfactionState(SatisfactionState.SATISFIED); |
---|
29 | subName = "TrivialTarget"; |
---|
30 | processor = new ProcessingState(true, true); |
---|
31 | // node is fully processed when added into a graph |
---|
32 | setState(satisfied); |
---|
33 | } |
---|
34 | |
---|
35 | //public void init(NegotiationContext context) { |
---|
36 | //this.context = context; |
---|
37 | //receive((TrustTarget)getGoal(), |
---|
38 | //new SatisfactionState(SatisfactionState.SATISFIED)); |
---|
39 | //} |
---|
40 | |
---|
41 | /** public accessor method for the entity which is target and subject */ |
---|
42 | public Entity getEntity() { return (Entity)getSubject(); } |
---|
43 | |
---|
44 | /** process the node by the verifier of this node's trust target */ |
---|
45 | public void verifierProcess(NegotiationContext context) { |
---|
46 | process(); |
---|
47 | } |
---|
48 | |
---|
49 | /** process the node by the opponent of this node's trust target */ |
---|
50 | public void opponentProcess(NegotiationContext context) { |
---|
51 | process(); |
---|
52 | } |
---|
53 | |
---|
54 | public void addImplicationParent(StandardTTNode parent) { |
---|
55 | setChanged(); |
---|
56 | notifyObservers(new SatisfactionState(SatisfactionState.SATISFIED)); |
---|
57 | super.addImplicationParent(parent); |
---|
58 | } |
---|
59 | |
---|
60 | /** |
---|
61 | * Propagates satisfied satisfaction state to the parent listeners. |
---|
62 | * @param state The new satisfaction state to be propagated. |
---|
63 | */ |
---|
64 | public TTGNodeSet receive(TrustTarget src, SatisfactionState state) { |
---|
65 | return super.receive((TrustTarget)getGoal(), |
---|
66 | new SatisfactionState(SatisfactionState.SATISFIED)); |
---|
67 | } |
---|
68 | |
---|
69 | /** Processing is the same for verifier and opponent. */ |
---|
70 | private void process() { |
---|
71 | //int satisfaction = (getSubject().equals(getTargetExpression()))? |
---|
72 | //SatisfactionState.SATISFIED: SatisfactionState.FAILED; |
---|
73 | //receive((TrustTarget)getGoal(), new SatisfactionState(satisfaction)); |
---|
74 | } |
---|
75 | |
---|
76 | } |
---|
77 | |
---|
78 | |
---|
79 | |
---|
80 | |
---|
81 | |
---|