dev@glassfish.java.net

Re: List of ConfigBeans

From: Jason Lee <jason.d.lee_at_oracle.com>
Date: Mon, 24 Oct 2011 21:28:56 -0500

That should help a lot. I'll give that a go. Thanks. :)

On 10/24/11 9:25 PM, Tom Mueller wrote:
> Here's one way to do it:
>
> Iterator<String> types = habitat.getAllTypes();
> String t;
> while (types.hasNext()) {
> t = types.next();
> if (t == null) continue;
> try {
> Class tclass = Class.forName(t);
> if (tclass != null &&
> ConfigBeanProxy.class.isAssignableFrom(tclass)) {
> report.addSubActionsReport().setMessage("Objects
> of type: " + t);
> for (Object o : habitat.getAllByType(tclass)) {
> report.addSubActionsReport().setMessage(" " +
> o.hashCode());
> }
> }
> } catch (ClassNotFoundException cnfe) {
> continue;
> }
> }
>
> Tom
>
>
> On 10/24/2011 3:22 PM, Jason Lee wrote:
>> I need to get a list of all of the ConfigBeans in the system. How do
>> I coax that list from the Habitat? I've tried getAllByContract() and
>> getAllByType() (and their various cousins) with no success. My only
>> thought left is to get the Domain then walk down the tree, but I'm
>> hoping there's a nicer way than that. Anyone? :)
>>


-- 
Jason Lee
Senior Member of Technical Staff, Oracle
GlassFish Team
Phone +1 (405) 216-3193
http://blogs.steeplesoft.com