On 7/18/01 8:48 PM, "Diethelm Guallar, Gonzalo" <[EMAIL PROTECTED]>
wrote:
>>> What is exactly the blessed way to implement the
>>> initialization (and termination) methods for a new service?
>>> Will this change for 3.0?
>>>
>>
>> Already changed in 3.0, there is only init() in 3.0. Services
>> in 3.0 are no longer coupled to ServletConfig or RunData. To
>> start a service early you do the following:
>
> Ok; so 2.1 keeps working with the same not-so-consistent way,
> right? I mean, multiple init() methods, etc., right?
Yes.
> One other question: I was looking for the blessed way to get
> properties defined for a service. I noticed TurbineGlobalCacheService
> does this:
>
> private long cacheCheckFrequency =
> TurbineResources.getLong("cache.check.frequency", 5000);
>
> and the property is defined as
>
> services.GlobalCacheService.cache.check.frequency = 5000
Whoops. I did that. The property should be retrieved in the init().
cacheCheckFrequency = getConfiguration().get("cache.check.frequency");
> So, I thought this is the correct way to get properties for all
> services. However, for one of my own services this doesn't work:
>
(1)
> services.STFParserService.database=gandalf
>
> The service does
>
> db_ = TurbineResources.getString("database", "default");
>
> and it is ALWAYS getting "default", no matter what I set in
> the properties file. Any ideas?
If a service property is defined as (1), then it must be retrieved
using the service Configuration, not TurbineResources. So
services.STFParserService.database=gandalf
should be retrieved in the services with
String database = getConfiguration().getString("database", "default");
Don't use TurbineResources, as the ServiceBroker processes the service
properties and makes them available via getConfiguration().
>> Jason van Zyl
>
> Thanks,
>
--
jvz.
Jason van Zyl
http://tambora.zenplex.org
http://jakarta.apache.org/turbine
http://jakarta.apache.org/velocity
http://jakarta.apache.org/alexandria
http://jakarta.apache.org/commons
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]