ISPN-4561 CacheManager.stop with indexing to Infinispan fails

https://issues.jboss.org/browse/ISPN-4561

As discussed, introduced a graph to store cache dependencies and enforce it at stop time, plus an API to interact with that. Query will register cache dependencies accordingly. Backporting should be straighforward.
Dependencies work on cache names, so it's not necessary to call getCache("name"). If it's doing that, it's a bug :)
If we have two directories around:
D1 with caches C1, MetaData1, Data1, Locking1
D2 with caches C1,MetaData2, Data2, Locking1 (inferred)
Stop order will likely be:
C1,MetaData1,MetaData2,Data1,Data2,Locking1

so it should not be a problem, but better to write tests