package com.nailabs.abac.trust; import edu.stanford.peer.rbtm.credential.*; import com.nailabs.abac.process.*; /** * A trivial trust target node is a leaf node which propagates satisfaction * state up towards the root of the graph. */ public class TrivialTTNode extends TargetNode { //NegotiationContext context = null; /** * Create a new trivial trust target node. */ public TrivialTTNode(Entity v, Entity subject) throws CredentialParsingException, TrustTargetParsingException { this(new TrustTarget(v, subject, subject)); // set up trust target } /** Create a new trivial TT node base on the supplied trust target */ public TrivialTTNode(TrustTarget tt) { super(tt); // set up trust target SatisfactionState satisfied = new SatisfactionState(SatisfactionState.SATISFIED); subName = "TrivialTarget"; processor = new ProcessingState(true, true); // node is fully processed when added into a graph setState(satisfied); } //public void init(NegotiationContext context) { //this.context = context; //receive((TrustTarget)getGoal(), //new SatisfactionState(SatisfactionState.SATISFIED)); //} /** public accessor method for the entity which is target and subject */ public Entity getEntity() { return (Entity)getSubject(); } /** process the node by the verifier of this node's trust target */ public void verifierProcess(NegotiationContext context) { process(); } /** process the node by the opponent of this node's trust target */ public void opponentProcess(NegotiationContext context) { process(); } public void addImplicationParent(StandardTTNode parent) { setChanged(); notifyObservers(new SatisfactionState(SatisfactionState.SATISFIED)); super.addImplicationParent(parent); } /** * Propagates satisfied satisfaction state to the parent listeners. * @param state The new satisfaction state to be propagated. */ public TTGNodeSet receive(TrustTarget src, SatisfactionState state) { return super.receive((TrustTarget)getGoal(), new SatisfactionState(SatisfactionState.SATISFIED)); } /** Processing is the same for verifier and opponent. */ private void process() { //int satisfaction = (getSubject().equals(getTargetExpression()))? //SatisfactionState.SATISFIED: SatisfactionState.FAILED; //receive((TrustTarget)getGoal(), new SatisfactionState(satisfaction)); } }