dev@glassfish.java.net

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

From: Tom Mueller <tom.mueller_at_oracle.com>
Date: Fri, 17 Dec 2010 09:14:01 -0600

  If you don't mind changing all 15 implementers of
ConfigurationUpgrade, you could add a method to that interface that
returns a priority, and then sort the list that is returned by
getInhabitants before running them.

Tom


On 12/17/2010 8:56 AM, Bobby Bissett wrote:
> Hi all,
>
> Can someone tell me how to use Habitat#getInhabitantByContract?
>
> http://javadoc.glassfish.org/v3/apidoc/index.html
>
> The first param is a fully qualified name, but of what? And what's the second name param? I've tried several combinations of contract name and impl name there but can't get it to return anything but null. This is the class I'm trying to grab out of the habitat:
>
> package org.glassfish.gms;
> [imports]
> /**
> * Startup service to upgrade cluster/gms elements in domain.xml
> * @author Bhakti Mehta
> *
> */
> @Service
> public class GMSConfigUpgrade implements ConfigurationUpgrade, PostConstruct {...}
>
> Can someone tell me how to get this besides using getInhabitants(ConfigurationUpgrade.class) and iterating through the results? I need to do this in the admin/config-api package, so I can't use one of the method that takes a Class without using reflection (we don't want the config-api package to depend on gms-adapter).
>
> OR, is there anything I can do in GMSConfigUpgrade to request that it runs first? I know other classes can inject an instance of it to make sure it runs before they do, but that would introduce some odd dependencies at this point. Am just asking if there's some priority mechanism that a particular contract impl class can use.
>
> Thanks,
> Bobby
>