Ok, I'll try your suggestions... One thing I just noticed; The ServiceQualifier class "polluted" with "common case methods" when it doesn't seem necessary, and the pattern doesn't seem to promote 'extensibility'. Can we change that?
I will suggest another pattern later in the week... On Sun, Nov 21, 2010 at 7:36 PM, Rickard Öberg <[email protected]> wrote: > On 2010-11-21 03.21, Niclas Hedhman wrote: >> >> If I have this in Qi4j, >> layer1.uses(layer2) >> layer1.uses(layer3) >> layer2.uses(layer3) >> layer3.uses(layer4) >> >> there is nothing particularly illegal about it, and life goes on as usual. >> >> Then assume that "layer1" is the layer outside of Qi4j, in which case >> the there is no way to 'express' this in the current Assembly, without >> introducing an additional set of services. > > To me that seems correct. In Layer1 I would put the services that perform > the exporting of services to whatever wants to consume the internal > services. This is really just a special case of having a "UI layer", which > expose the application, either using Swing directly (or somesuch), or using > a REST API, a Web Services API, or similar. > > But it seems like you want the exporting service to be literally outside of > the app, correct? > >> I think what I looking for is a 'known' layer representing the outside >> world, so that the above then becomes; >> >> LayerAssembly.EXTERNAL.uses(layer2) >> LayerAssembly.EXTERNAL.layer1.uses(layer3) >> layer2.uses(layer3) >> layer3.uses(layer4) >> >> as this could then also prevent modules to be added to such layer, and >> the generic "exportServices" would know what to look for without >> additional configuration. > > I wouldn't do it that way... as for looking for the additional configuration > that tells what to expose, isn't that as simple as adding that metainfo in > the assembly, and then filter on that: > @Service @HasMetaInfo(WebServiceInfo.class) Iterable<ServiceReference> > exposedServices; > where @HasMetaInfo is a qualifier that checks if the ServiceReference has > the config in metaInfo()? > > Example: > @Service @HasMetaInfo(WebServiceInfo.class) Iterable<ServiceReference> > exportedServices; > > for (ServiceReference ref : exportedServices) > { > WebServiceInfo info = ref.metaInfo(WebServiceInfo.class); > ... export service using info ... > } > > /Rickard > > _______________________________________________ > qi4j-dev mailing list > [email protected] > http://lists.ops4j.org/mailman/listinfo/qi4j-dev > -- Niclas Hedhman, Software Developer http://www.qi4j.org - New Energy for Java I live here; http://tinyurl.com/2qq9er I work here; http://tinyurl.com/2ymelc I relax here; http://tinyurl.com/2cgsug _______________________________________________ qi4j-dev mailing list [email protected] http://lists.ops4j.org/mailman/listinfo/qi4j-dev

