This class handles collections of
AbstractPolicy
instances, and provides some commonly useful operations. Specifically, it lets you retrieve matching policies (based on reference or context), it optionally handles wrapping multiple matches under a single PolicySet, and it manages different versions of policies correctly. This class is intended for use as a backing store to
PolicyFinderModule
s, but in practice may have many uses.
Note that this class will accept multiple versions of the same policy. This means that when you retieve a policy by reference, you will get the correct version. It also means that when you retrieve a policy based on context, there may be multiple revisions of the same policy, any number of which may apply. Generally speaking, the correct behavior here is not to return all of these policies, since they are (virtually speaking) the same policy, but may have conflicting rules. So, as a simplification, and to handle the most common cases, only the most recent version of a policy is returned in these cases. If you need a more complex solution, you will need to implement it yourself. Because the support modules use this class as their backing store, this is true also of those modules.
Note that this is not a heavily optimized class. It is intended more as an example, support code for the finder modules, and a starting utility for other programmers than as an enterprise-quality implementation. That said, it is fully functional, and should be useful for many applications.
@since 2.0
@author Seth Proctor