There is a third way to define the structure (single assembler as one,
the one you mention being the other), and it works similar to what you
ask, see http://www.qi4j.org/70.html in the Explicit Assembly section
for a full example.

ApplicationAssembly app = factory.newApplicationAssembly();
LayerAssembly layer1 = app.newLayerAssembly();
ModuleAssembly moduleA = layer.newModuleAssembly():
moduleA.addComposites(... );
:
ApplicationContext context = factory.newApplication( app );

Very explicit. Since Layers are not necessarily like pancakes on top
of each other, I think it will be hard to come up with a good fluent
API to express it, and hence we went with the Array declaration
instead.

HTH

Cheers
Niclas

On Wed, Apr 30, 2008 at 12:27 PM, Sonny Gill <[EMAIL PROTECTED]> wrote:
> Hi!
>
>  We have a convenient way of specifying application assembly as -
>
>  ApplicationContext application = appFactory.newApplication( new 
> Assembler[][][]
>     {
>         { // Swing layer
>           {
>               new ModuleName( "Swing" ),
>               new ViewAssembler()
>           }
>         },
>         { // Domain layer
>           {
>               new ModuleName( "Domain" ),
>               new DomainAssembler()
>           }
>         },
>         { // Infrastructure layer
>           {
>               new ModuleName( "Infrastructure" ),
>               new InfrastructureAssembler() }
>         }
>     } );
>
>  For someone new to Qi4j, that can be a bit hard to understand if you
>  remove the comments.
>
>
>  Would it be good to have an alternative that names the layers more
>  explicitly, thus removing the need for the comments in the code above?
>
>  Something like -
>  ApplicatonAssembly assembly = new ApplicationAssembly(
>         new LayerAssembly( "Swing layer", new ModuleAssembly(
>  "Module1", assembler1, assembler2 ) ),
>         new LayerAssembly( "Domain layer", new ModuleAssembly(
>  "Module2", assembler3 ) ),
>         new LayerAssembly( "Infrastructure", new ModuleAssembly(
>  "Module3", new InfrastructureAssembler() ) )
>  )
>
>  or, something using a fluent interface, like -
>
>  ApplicationAssembly = ...;
>  assembly.addLayer( "layer1" ).addModule( "module1", assembler1,
>  assemler2 ).addModule( "module2", assembler3 ).
>         addLayer( "layer2" ).addModule( "module3", new MyAssembler() )
>
>
>  Just a thought... :)
>
>  Regards,
>  Sonny
>
>  _______________________________________________
>  qi4j-dev mailing list
>  [email protected]
>  http://lists.ops4j.org/mailman/listinfo/qi4j-dev
>

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to