shrinkwrap / descriptors

ShrinkWrap subproject for creating Archive Descriptors
Apache License 2.0
26 stars 30 forks source link

Shrinkdesc 38 - Descriptor.getDescriptorName #14

Closed aslakknutsen closed 13 years ago

aslakknutsen commented 13 years ago

I've added Descriptor name to the Descriptor interface, but how it is implemented makes me wonder..

Each time we go down a level in the Descriptor, e.g web.servlet().name() we create a new instance of the lower levels Desc object for so to pass along the current levels state down:

return new ServletDesc(getDescriptorName() /* main descriptor name /, getRootNode() / parent node /, servletNode / new current node /*)

(getRootNode we could infer from servletNode.parent in the constructor of the child.)

The impl works as is, but what i'm trying to say is.. it won't scale and seems a bit awkward. We don't have this issue in SW since we only have one level wrapped and always refer to the same Archive in the end.

Not sure which other Descriptor 'global' metadata like Name we need, but if we get more we should consider wrapping some of these object in some other way..

ALRubinger commented 13 years ago

I'm not worried about the levels issue for SD-38; I've known this has been coming down the pipes for quite some time, but it's unrelated here. :)

What we need is a separate mechanism to navigate back "up" the tree to a parent. But again, that's another thing. I like this commit; pushing upstream; thanks.