package org.fcrepo.binary;

import javax.jcr.Node;
import java.util.ArrayList;
import java.util.List;
import org.modeshape.jcr.value.binary.StrategyHint;

public class PolicyDecisionPoint {
	private List<Policy> policies;

	private static PolicyDecisionPoint instance = null;


	protected PolicyDecisionPoint() {
		policies = new ArrayList<Policy>();
	}


	public static PolicyDecisionPoint getInstance() {
		if(instance == null) {
			instance = new PolicyDecisionPoint();
		}
		return instance;
	}

	public void addPolicy(Policy p) {
		policies.add(p);
	}

	public StrategyHint evaluatePolicies(Node n) {
		for(Policy p : policies) {
			StrategyHint h = p.evaluatePolicy(n);
			if(h != null) {
				return h;
			}
		}

		return null;
	}


}

@@ -732,10 +732,91 @@
 l;%0A%09%7D%0A%0A%0A
+%09public void setPolicies(List%3CPolicy%3E policies) %7B%0A%09%09this.policies = policies;%0A%09%7D%0A
 %7D%0A

add setter for PDP policies.