Carsten Ziegeler skrev:
Daniel Fagerstrom wrote
WDYT?

I'm not sure if a global registry really works. What happens if I want
to use a block twice but with different configurations? Can this be handled?

I think this depends on your use case. A block contains components (services) and a servlet (which also can be thought about as a service). If you want your services to be collectively configured in two different instances, you run into problems. But I doubt that such a case makes sense. Normally you want to configure a service (which in turn can involve lots of components in its wiring), then the service should be a factory rather than a singleton. And you can use the factory several times with different configurations.

The question is not that clear in wiring based CMs either actually. If you register the services with different names for the two instances you could as well use a global registry. If they instead have the same name, they must be part of disjunct dependency graphs in the blocks container. And then you have two completely separate applications anyway, so it doesn't make that much sense to deploy them together.

If the dependency graphs are not disjunct, the result of the component lookup must be based on some kind of search order in the graphs. Is this level of complication worthwhile?

I prefer the simplicity of a global registry, and the fact that OSGi use it is a rather good indication on that it is flexible enough.

/Daniel