dev@glassfish.java.net

Re: hk2 enhancement

From: Jerome Dochez <Jerome.Dochez_at_Sun.COM>
Date: Wed, 24 Mar 2010 09:03:56 -0700

I think you understood correctly.

I suppose we could indeed support the notion of property based value resolution

@Attribute
@PropertyValue("org.glassfish.grizzly.selector")
@DefaultValue("org.glassfish.grizzly.DefaultSelector")
String selector;

and have the configuration engine set with a PropertyResolver type of contract. By default, we could use the StartupContext to fetch the property values from, and it would be pluggable of course.

wdyt ?

jerome

On Mar 24, 2010, at 7:29 AM, Sahoo wrote:

> System properties make it harder for code to be embedded. We have something called StartupContext and that's what HK2 should be using to obtain any property values. Did I
> misunderstand your original question?
>
> Thanks,
> Sahoo
>
> Justin Lee wrote:
>> In grizzly, especially, we have several cases where we don't define default values on configuration properties because we need to be able to support various system properties. If the config value is null, we check System.getProperties(). If both are null, we apply a hard coded default value. This is cumbersome and problematic and makes it hard to document what the default value actually is. It also What I propose is to extend the Attribute annotation to take an option system property name and perhaps some precedence. If the value of the attribute is null (or is equal to the default value), the system property is checked to see if it's been set. If the attribute uses the default value and the system property is set, the precedence value is used to determine which value is applied.
>>
>> As distasteful as using system properties is, we need to support them in a number of areas for legacy support reasons. This enhancement would allow us to declaratively define what system properties are supported where. This would be massive gain in both code needed to support such arrangements and documentation for our users. What do you think?
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>