VMware {code} Community
kri-2
Hot Shot
Hot Shot

VIJava: getting childs of a ManagedEntity

Hi all,

I am trying to read the vCenter inventory step by step (not recursive) to lazy fill a TreeView. Starting with the rootFolder I want to get deeper into the vCenter structure without having to differ if the child object is a HostSystem, ClusterComputeResource, Folder, Datacenter, ...

For each Folder I can use folder.getChildEntity();

But how do I get the childs of all the others (Datacenter, ClusterComputeResource,...) ? I saw some examples using the InventoryNavigator, but they all used rootFolder as start. Is it somehow possible to pass any ManagedEntity?

I think of an method like this:

public static ManagedEntity[] returnChilds (ManagedEntity mE){

     // get all childs of mE (HostSystem, ClusterComputeResource, Datacenter, Folder, VM)

     ManagedEntity[] mEs = mE.getChilds();

     // and return them

     return mEs;

}

Any help would be appreciated!

Greatings, Chris

0 Kudos
0 Replies