Alex Shneyderman wrote:
> I am trying to develop a command line interface to my CRUD
> application. Command line is somewhat simple: cmd [param1 [param2]].
> Commands are registered as composites in application layer and will
> talk directly to the domain layer. To lookup my command composites I
> wanted to identify them by cmd tokens in assembly, since looking them
> up by type is a bit awkward.
>
> Is there no way to do identifiedBy for composites?
>
> Of course any other suggestion is appreciated.
You could use meta-info for that I think:
module.addComposites(MyComposite.class).setMetaInfo(new
CommandName("cmd1"));
in assembly, which you can look up later with an SPI visitor. Subclass
DescriptorVisitor, implement visit for CompositeDescriptor, do
"@Structure ApplicationSPI app" injection to get the application, visit
it and extract the meta-info using
descriptor.metaInfo().get(CommandName.class), and lastly instantiate
your Composite and associate with the CommandName.
Tada!
/Rickard
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev