RE: Service Configuration, ApplicationDefaults and String parameter in constructor

2008-05-30 Thread Russell Brown
Ok,
Sorry all. Scratch that. I RTFM. Here
http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html#Injecting
%20Dependencies at the bottom of the page it says

" Every once and a while, you'll have a conflict between a resource type
and an object injection. For example, the following does not work as
expected:

It doesn't work because type String always gets the service id, as a
resource (as with the serviceId parameter). In order to get this to
work, we need to turn off the resource injection for the alertEmail
parameter. That's what the Inject annotation does:"

Sorry all

Cheers

Russell

-Original Message-
From: Russell Brown [mailto:[EMAIL PROTECTED] 
Sent: 30 May 2008 12:14
To: Tapestry users
Subject: Service Configuration, ApplicationDefaults and String parameter
in constructor

Hi Again,

Now I have a Service that I want to configure with a string parameter
and an int parameter. I add a couple of values to the
ApplicationDefaults like this:

 

configuration.add("my.long.key.string-value",
"aStringINeedInMyService");

configuration.add("my.long.key.int-value", "180");

 

 

And in my service I have a constructor like this:

 

private final int intINeedInMyService;

private final String stringINeedInMyService;

 

 

public MyNewServiceImpl (@Value("${my.long.key.int-value
}")

final int cookieAgeInDays,
@Value("${my.long.key.string-value }")

final String cookieName) {

this. intINeedInMyService =
intINeedInMyService;

this. stringINeedInMyService =
stringINeedInMyService;

}

 

}

 

This seems to work except that the value of "stringINeedInMyService" is
always the Service's Service Id. I verified this by changing the Id of
the service in the AppModule by calling binder.bind(MyNewService.class,
MyNewServiceImpl.class).withId("MyDifferentId") and behold the value
injected into the String constructor parameter for the MyNewServiceImpl
was the new service Id. Is this expected behavior (IE have I miss
understood how to configure my service)? Or is there something else
going on? Has anyone configured a service this way before?

 

Many thanks

 

Russell



Communications on or through ioko's computer systems may be monitored or
recorded to secure effective system operation and for other lawful
purposes.

Unless otherwise agreed expressly in writing, this communication is to
be treated as confidential and the information in it may not be used or
disclosed except for the purpose for which it has been sent. If you have
reason to believe that you are not the intended recipient of this
communication, please contact the sender immediately. No employee is
authorised to conclude any binding agreement on behalf of ioko with
another party by e-mail without prior express written confirmation.

ioko365 Ltd.  VAT reg 656 2443 31. Reg no 3048367. All rights reserved.


Communications on or through ioko's computer systems may be monitored or 
recorded to secure effective system operation and for other lawful purposes.

Unless otherwise agreed expressly in writing, this communication is to be 
treated as confidential and the information in it may not be used or disclosed 
except for the purpose for which it has been sent. If you have reason to 
believe that you are not the intended recipient of this communication, please 
contact the sender immediately. No employee is authorised to conclude any 
binding agreement on behalf of ioko with another party by e-mail without prior 
express written confirmation.

ioko365 Ltd.  VAT reg 656 2443 31. Reg no 3048367. All rights reserved.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Service Configuration, ApplicationDefaults and String parameter in constructor

2008-05-30 Thread Russell Brown
Hi Again,

Now I have a Service that I want to configure with a string parameter
and an int parameter. I add a couple of values to the
ApplicationDefaults like this:

 

configuration.add("my.long.key.string-value",
"aStringINeedInMyService");

configuration.add("my.long.key.int-value", "180");

 

 

And in my service I have a constructor like this:

 

private final int intINeedInMyService;

private final String stringINeedInMyService;

 

 

public MyNewServiceImpl (@Value("${my.long.key.int-value
}")

final int cookieAgeInDays,
@Value("${my.long.key.string-value }")

final String cookieName) {

this. intINeedInMyService =
intINeedInMyService;

this. stringINeedInMyService =
stringINeedInMyService;

}

 

}

 

This seems to work except that the value of "stringINeedInMyService" is
always the Service's Service Id. I verified this by changing the Id of
the service in the AppModule by calling binder.bind(MyNewService.class,
MyNewServiceImpl.class).withId("MyDifferentId") and behold the value
injected into the String constructor parameter for the MyNewServiceImpl
was the new service Id. Is this expected behavior (IE have I miss
understood how to configure my service)? Or is there something else
going on? Has anyone configured a service this way before?

 

Many thanks

 

Russell



Communications on or through ioko's computer systems may be monitored or 
recorded to secure effective system operation and for other lawful purposes.

Unless otherwise agreed expressly in writing, this communication is to be 
treated as confidential and the information in it may not be used or disclosed 
except for the purpose for which it has been sent. If you have reason to 
believe that you are not the intended recipient of this communication, please 
contact the sender immediately. No employee is authorised to conclude any 
binding agreement on behalf of ioko with another party by e-mail without prior 
express written confirmation.

ioko365 Ltd.  VAT reg 656 2443 31. Reg no 3048367. All rights reserved.