I started with wanting to create a Chain of service instances using an
ordered contribution point. Unlike usual though, the implementation isn't
custom each time. Instead, there's multiple repeat uses of an
implementation which does different work based on a String supplied it.
This String also happens to be unique to it and can be its ServiceId.

I was thinking I'd end up able to do something like this:


> orderedConfiguration.addInstance("SomeService",
>  PremadeRepeatUseImpl.class, "before:SomeOtherService,after:DiffService");

a different module...

> orderedConfiguration.addInstance("AnotherService", PremadeRepeatUseImpl.class,
> "before:SomeService");


What the PremadeServiceImpl class needs to know is the string:
"SomeService". I was hoping it could receive the ID because otherwise I
must create the instance manually and feed it the String.

My goal is to make it simple for a new Module to addin and contribute more
instances. One contrib method with one line and TapIoC autobuilds all the
instances and injects the desired params. Then the root Module uses the
contribs to build the chain with ChainBuilder.

Without it being able to learn it through some automatic means I ended up
with the below. It uses a builder method which uses its method name to
assign the service ID and constructs the instance directly. Then, inject
the built instance into the contrib method via InjectService and use add()
instead of addInstance():

public static PremadeInterface buildSomeService(..inject the constructor
> needs...)
>   return new PremadeServiceImpl("SomeService", provide needs...);


It works, but, use of the ID is repetitive and has some unsafe uses, like,
the method name, which can't use a constant value. And it looks a little
odd.



On Mon, Mar 18, 2013 at 7:57 AM, Thiago H de Paula Figueiredo <
thiag...@gmail.com> wrote:

> Answering the queston in the subject: no, it's not possible to receive an
> OrderedConfiguration id. Why do you want that?
>
> --
> Thiago H. de Paula Figueiredo
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: 
> users-unsubscribe@tapestry.**apache.org<users-unsubscr...@tapestry.apache.org>
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

Reply via email to