First of all, thanks very much for producing the Cling libraries, it's just what I'm after. I decided to have a play around with UPNP earlier in the year, in particular I was trying to implement a media server without using any third party libraries. What I ended up with was a piece of rubbish as you can imagine, but it got me more familiar with a bunch of interesting technologies. I remember my decision to start from scratch was driven by the fact that I couldn't find any UPNP libraries that seemed suitable to use, mainly for the reasons that you mention on the Cling pages.
Anyhow, I just happened to be browsing java blogs the other day and stumbled across Cling. After following the instructions, I've moved some of my very basic content directory code to sit on top of it, and it all seems to be hanging together nicely.
Part of my previous implementation build up a tree of content, and porting that straight over to use the Container and Item classes in the Cling Support is okay, but when I create a JAXB context and marshal the DIDLLite object graph, I end up with a hierarchical structure of Container elements, and I know that strictly adhering to the schema this is going to happen! I'll just work around this, but I did end up finding your comment in the didl-lite-1-0.xsd:
That's just what I'm thinking! Having a brief look at the specs, I can't see anywhere that uses didl-lite in a hierarchical fashion (in fact Content Directory V3 specification explicitly states that the structure is flattened in section "2.2.18 DIDL-Lite XML Document"). How strange...
Not really sure that I have a question as such, was just joining in with your pondering!
Anyhow, I shall carry on playing around. I might be trying it out on Android too (though I suspect that I'll need to write some XML marshaling code for the DIDL). I notice that you mentioned it was compatible with 2.2 - guess I'll find out why that is soon enough (I've only got 2.1 on my phone, so can't volunteer to give it a test unfortunately!
Thanks for the feedback Pete, great that Cling is useful for what you are doing.
About the DIDL instance graph... I'm sure I'd have seen this problem again if I'd have written an example MediaServer instead of a MediaServer browser.
I think you should treat the DIDL classes in Cling Support as data transfer objects, in the sense that they are supposed to be instantiated for presentation and to deliver a representation of your state, nothing else. So you would still have your persistent data in some recursively processed and self-referencing structure (like a composite pattern, adjacency list, etc.) but you would definitely not expose that live to UPnP clients. When a Browse action hits your MediaServer you copy the data that is needed, flatten it into the DIDL graph and then let Cling Support marshall that.