dev@glassfish.java.net

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

From: Jerome Dochez <jerome.dochez_at_oracle.com>
Date: Fri, 17 Dec 2010 11:09:21 -0800

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
2. you start importing implementation types which makes your imports/exports more complicated.

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.

jerome

On Dec 17, 2010, at 9:44 AM, Bobby Bissett wrote:

> Thanks Tim/Tom for the suggestions.
>
> I think I'm going with just moving the GMSConfigUpgrade class -- it has no dependencies on GMS and only works on the config-api objects. Thus, it's now in the same package as similar classes (e.g. GrizzlyConfigSchemaMigrator). So the whole fix is 4 lines of code plus comments. I think Tim actually gave me this idea, courtesy of Jerome:
>
> http://wikis.sun.com/display/GlassFish/V3.1UpgradeDashboard#V3.1UpgradeDashboard-Howtoimplementupgrade
>
> So the only diffs, besides moving the one file, look like this:
>
> Index: admin/config-api/src/main/java/org/glassfish/config/support/UpgradeService.java
> ===================================================================
> --- admin/config-api/src/main/java/org/glassfish/config/support/UpgradeService.java (revision 43776)
> +++ admin/config-api/src/main/java/org/glassfish/config/support/UpgradeService.java (working copy)
> @@ -72,6 +72,14 @@
> @Inject
> Domain domain;
>
> + /*
> + * Required to make gms changes before any changes to a cluster
> + * or config can be saved. This is because GMS changed attribute
> + * names from v2 to 3.1. (Issue 15195.)
> + */
> + @Inject
> + GMSConfigUpgrade notUsed;
> +
> private final static Logger logger = Logger.getAnonymousLogger();
>
> Will check to see where else it's needed, but I know I need it in UpgradeService and SystemPropertyUpgrade.
>
> Cheers,
> Bobby
>