dev@glassfish.java.net

Re: params for getInhabitantByContract()? (issue 15195)

From: Bobby Bissett <bobby.bissett_at_oracle.com>
Date: Fri, 17 Dec 2010 14:40:51 -0500

> I don't think you should do it this way...
>
> 1. first, if you deal with a distribution where gms is not present, this will fail

Why? There are no gms dependencies in this class (attached). It's only for working on the config-api objects.

> 2. you start importing implementation types which makes your imports/exports more complicated.

I didn't need to change anything like that. My full diff is moving the file and then injecting GMSConfigUpgrade into 2 classes. No changes to anything else.

>
> why not doing :
>
> @Service(name="gms")
> public class GMSConfigUpgrade implements ConfigurationUpgrade, PostConstruct {...}
>
> and in your upgrade service, just do
>
>> + @Inject(name="gms", optional=true)
>> + ConfigurationUpgrade notUsed=null;
>
> that way you still only depends on ConfigurationUpgrade type and it does not fail if gms is not present.

It wouldn't fail anyway, but I'm happy to keep the class where it is and do what you suggest. Note, though, that if I do what you suggest, and gms isn't present, and domain.xml contains anything gms-related anyway, upgrade will just fail. I think that's expected (we don't have clusters without gms), but wanted to mention it.

Thanks,
Bobby