Unfortunately, the federation capabiltiles in ModeShape 2.x do not support what you're trying to do. Basically, federation allows you to have multiple projections, where each projection places an entire subgraph into a particular location within your unified repository. At this time, the projected subgraph cannot overlap other projected subgraphs.
Most of the challenges with supporting the capability you describe above involve identifying the proper behaviors. When merging two independent subgraphs that have nodes with similar paths, when and which nodes should be merged and treated as a single node (e.g., '
/a/2011/10') and which should be kept distinct (e.g., '
/a/2011/10/4/filed.jpg')? Infering the behavior for files and folders is pretty easy, but it gets more complicated with other node types. Perhaps we could use extended node type attributes, or pre-defined behavior for built-in types and pre-defined mixins for use with custom types.
Another challenge is what to do when the user creates content. For example, consider a new file node being placed under '
/a/2011/10/4'. Both sources contain that folder, so in which source should the content be placed? Some simple rules can be used (e.g., the first source declared), but there are other complications, such as if the node cannot be placed in the first source (e.g., due to node type constraints, or because it doesn't support same-name siblings).
In addition to some of the behavioral challenges and specification, the federation connector in ModeShape 2.x doesn't allow many options for richer behaviors. We think, however, that the changes in the architecture for 3.x will allow us to do a lot more, including the use case you've outlined here.
BTW, your last example shows same-name-sibling indexes, but in JCR these start at '1' and not '0'. And in fact, every node has a SNS index; it's just that SNS indexes with a value of '1' are not printed in the paths or names. So your last example would look more like this:
Thanks for the answer.
I am currently investigating what is possible and what is not and this helps a lot