A General Framework for Hierarchical Redundancy Resolution Under Arbitrary Constraints