Re: TapestryIoC: Is it possible to receive an OrderedConfiguration's ID?

2013-03-18 Thread Thiago H de Paula Figueiredo
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-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: TapestryIoC: Is it possible to receive an OrderedConfiguration's ID?

2013-03-18 Thread Eli Doran
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.orgusers-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org




Re: TapestryIoC: Is it possible to receive an OrderedConfiguration's ID?

2013-03-17 Thread Steve Eynon
Nothing specific that I know of...

...you could iterate over the ServiceActivities in the
ServiceActivityScoreboard service looking for a matching service
interface and take the ID from there. It's not nice, but as long as
you know the type of the service, it should work.

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: TapestryIoC: Is it possible to receive an OrderedConfiguration's ID?

2013-03-16 Thread Eli Doran
Using a String param in the service implementation constructor causes a
RuntimeException stating No service implements the interface
java.lang.String. It is mentioned in multiple places in the documentation
that a String type without the Inject or InjectService annotations will
receive the ServiceId  as a Resource, but, I'm causing this exception
instead.

For an example below is a ServiceBinder call and the service implementation
constructor prototype.

serviceBinder.bind(ServiceIdAware.class,
 ServiceIdAwareImpl.class).withId(TestId);

serviceBinder.bind(ServiceIdAware.class,
 ServiceIdAwareImpl.class).withId(TestId2);



public ServiceIdAwareImpl(String serviceId)


Shouldn't that constructor receive the ServiceId specified in the withId
method?



On Fri, Mar 15, 2013 at 6:53 AM, Steve Eynon steve.ey...@alienfactory.co.uk
 wrote:

 No, but if your contribution is a service then you can inject the
 ServiceId using the @Symbol annotation:

 http://tapestry.apache.org/symbols.html#Symbols-InjectingValuesfromSymbols

 Steve.


 On 15 March 2013 11:26, Eli Doran e...@elidoran.com wrote:
  When using OrderedConfiguration the add method's first argument is an ID.
  Is it possible to inject that ID into the corresponding instance's
  constructor?

 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org




Re: TapestryIoC: Is it possible to receive an OrderedConfiguration's ID?

2013-03-16 Thread Eli Doran
Also, it seems the fourth example in this
sectionhttp://tapestry.apache.org/defining-tapestry-ioc-services.html#DefiningTapestryIOCServices-InjectingResources
doesn't
work with Tapestry-IoC-5.3.6 (service builder method in the module
accepting 'String serviceId' parameter).

Has this behavior changed in recent updates and the documentation is behind?



On Sat, Mar 16, 2013 at 11:15 PM, Eli Doran e...@elidoran.com wrote:

 Using a String param in the service implementation constructor causes a
 RuntimeException stating No service implements the interface
 java.lang.String. It is mentioned in multiple places in the documentation
 that a String type without the Inject or InjectService annotations will
 receive the ServiceId  as a Resource, but, I'm causing this exception
 instead.

 For an example below is a ServiceBinder call and the service
 implementation constructor prototype.

 serviceBinder.bind(ServiceIdAware.class,
 ServiceIdAwareImpl.class).withId(TestId);

 serviceBinder.bind(ServiceIdAware.class,
 ServiceIdAwareImpl.class).withId(TestId2);



 public ServiceIdAwareImpl(String serviceId)


 Shouldn't that constructor receive the ServiceId specified in the withId
 method?



 On Fri, Mar 15, 2013 at 6:53 AM, Steve Eynon 
 steve.ey...@alienfactory.co.uk wrote:

 No, but if your contribution is a service then you can inject the
 ServiceId using the @Symbol annotation:

 http://tapestry.apache.org/symbols.html#Symbols-InjectingValuesfromSymbols

 Steve.


 On 15 March 2013 11:26, Eli Doran e...@elidoran.com wrote:
  When using OrderedConfiguration the add method's first argument is an
 ID.
  Is it possible to inject that ID into the corresponding instance's
  constructor?

 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org





Re: TapestryIoC: Is it possible to receive an OrderedConfiguration's ID?

2013-03-16 Thread Eli Doran
Also, in this 
sectionhttp://tapestry.apache.org/injection-in-detail.html#InjectioninDetail-Checkforserviceresourcesit
doesn't list String and service ID as a resource.

As a side note, if you look at the list item for ServiceResources it looks
like the last part should actually be a new list item. Anyone agree?


On Sun, Mar 17, 2013 at 12:06 AM, Eli Doran e...@elidoran.com wrote:

 Also, it seems the fourth example in this 
 sectionhttp://tapestry.apache.org/defining-tapestry-ioc-services.html#DefiningTapestryIOCServices-InjectingResources
  doesn't
 work with Tapestry-IoC-5.3.6 (service builder method in the module
 accepting 'String serviceId' parameter).

 Has this behavior changed in recent updates and the documentation is
 behind?



 On Sat, Mar 16, 2013 at 11:15 PM, Eli Doran e...@elidoran.com wrote:

 Using a String param in the service implementation constructor causes a
 RuntimeException stating No service implements the interface
 java.lang.String. It is mentioned in multiple places in the documentation
 that a String type without the Inject or InjectService annotations will
 receive the ServiceId  as a Resource, but, I'm causing this exception
 instead.

 For an example below is a ServiceBinder call and the service
 implementation constructor prototype.

 serviceBinder.bind(ServiceIdAware.class,
 ServiceIdAwareImpl.class).withId(TestId);

 serviceBinder.bind(ServiceIdAware.class,
 ServiceIdAwareImpl.class).withId(TestId2);



 public ServiceIdAwareImpl(String serviceId)


 Shouldn't that constructor receive the ServiceId specified in the withId
 method?



 On Fri, Mar 15, 2013 at 6:53 AM, Steve Eynon 
 steve.ey...@alienfactory.co.uk wrote:

 No, but if your contribution is a service then you can inject the
 ServiceId using the @Symbol annotation:


 http://tapestry.apache.org/symbols.html#Symbols-InjectingValuesfromSymbols

 Steve.


 On 15 March 2013 11:26, Eli Doran e...@elidoran.com wrote:
  When using OrderedConfiguration the add method's first argument is an
 ID.
  Is it possible to inject that ID into the corresponding instance's
  constructor?

 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org






Re: TapestryIoC: Is it possible to receive an OrderedConfiguration's ID?

2013-03-16 Thread Eli Doran
Found this Git 
changehttps://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;a=commit;h=7a521c1185fef67bf24a69ec248164f33d4ae136which
removed the automatic injection of service id from the
AbstractServiceCreator.java source file. There are corresponding changes
which remove the Inject annotation (as it's no longer necessary to override
the resource injection).

Is there a *new* way to cause the ServiceId injection?


On Sun, Mar 17, 2013 at 12:13 AM, Eli Doran e...@elidoran.com wrote:

 Also, in this 
 sectionhttp://tapestry.apache.org/injection-in-detail.html#InjectioninDetail-Checkforserviceresourcesit
  doesn't list String and service ID as a resource.

 As a side note, if you look at the list item for ServiceResources it looks
 like the last part should actually be a new list item. Anyone agree?


 On Sun, Mar 17, 2013 at 12:06 AM, Eli Doran e...@elidoran.com wrote:

 Also, it seems the fourth example in this 
 sectionhttp://tapestry.apache.org/defining-tapestry-ioc-services.html#DefiningTapestryIOCServices-InjectingResources
  doesn't
 work with Tapestry-IoC-5.3.6 (service builder method in the module
 accepting 'String serviceId' parameter).

 Has this behavior changed in recent updates and the documentation is
 behind?



 On Sat, Mar 16, 2013 at 11:15 PM, Eli Doran e...@elidoran.com wrote:

 Using a String param in the service implementation constructor causes a
 RuntimeException stating No service implements the interface
 java.lang.String. It is mentioned in multiple places in the documentation
 that a String type without the Inject or InjectService annotations will
 receive the ServiceId  as a Resource, but, I'm causing this exception
 instead.

 For an example below is a ServiceBinder call and the service
 implementation constructor prototype.

 serviceBinder.bind(ServiceIdAware.class,
 ServiceIdAwareImpl.class).withId(TestId);

 serviceBinder.bind(ServiceIdAware.class,
 ServiceIdAwareImpl.class).withId(TestId2);



 public ServiceIdAwareImpl(String serviceId)


 Shouldn't that constructor receive the ServiceId specified in the withId
 method?



 On Fri, Mar 15, 2013 at 6:53 AM, Steve Eynon 
 steve.ey...@alienfactory.co.uk wrote:

 No, but if your contribution is a service then you can inject the
 ServiceId using the @Symbol annotation:


 http://tapestry.apache.org/symbols.html#Symbols-InjectingValuesfromSymbols

 Steve.


 On 15 March 2013 11:26, Eli Doran e...@elidoran.com wrote:
  When using OrderedConfiguration the add method's first argument is an
 ID.
  Is it possible to inject that ID into the corresponding instance's
  constructor?

 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org







Re: TapestryIoC: Is it possible to receive an OrderedConfiguration's ID?

2013-03-15 Thread Steve Eynon
No, but if your contribution is a service then you can inject the
ServiceId using the @Symbol annotation:

http://tapestry.apache.org/symbols.html#Symbols-InjectingValuesfromSymbols

Steve.


On 15 March 2013 11:26, Eli Doran e...@elidoran.com wrote:
 When using OrderedConfiguration the add method's first argument is an ID.
 Is it possible to inject that ID into the corresponding instance's
 constructor?

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org