dev@glassfish.java.net

params for getInhabitantByContract()? (issue 15195)

From: Bobby Bissett <bobby.bissett_at_oracle.com>
Date: Fri, 17 Dec 2010 09:56:26 -0500

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