Package com.vmware.vim25.mo
Class InventoryNavigator
java.lang.Object
com.vmware.vim25.mo.InventoryNavigator
Locate ManagedEntity objects under a root folder. Supports two modes:
- Find-only (
searchManagedEntities(String)and friends) — returns entities whose subsequent property reads round-trip to the server. - Find-and-fetch (
searchManagedEntitiesWithProperties(String[][], boolean)) — single round-trip that returns entities with the requested properties pre-cached; subsequent reads of those properties via typed getters are served from the cache.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionsearchManagedEntities(boolean recurse) Retrieve container contents from specified parent recursively if requested.searchManagedEntities(String type) Get the first ManagedObjectReference from current node for the specified typesearchManagedEntities(String[][] typeinfo, boolean recurse) Retrieve content recursively with multiple properties.searchManagedEntitiesWithProperties(String[][] typeinfo, boolean recurse) LikesearchManagedEntities(String[][], boolean)but pre-populates each returned entity's property cache with the requested values.searchManagedEntity(String type, String name) Get the ManagedObjectReference for an item under the specified parent node that has the type and name specified.
-
Constructor Details
-
InventoryNavigator
-
-
Method Details
-
searchManagedEntities
public ManagedEntity[] searchManagedEntities(boolean recurse) throws InvalidProperty, RuntimeFault, RemoteException Retrieve container contents from specified parent recursively if requested.- Parameters:
recurse- retrieve contents recursively from the root down- Throws:
RemoteExceptionRuntimeFaultInvalidProperty
-
searchManagedEntities
public ManagedEntity[] searchManagedEntities(String type) throws InvalidProperty, RuntimeFault, RemoteException Get the first ManagedObjectReference from current node for the specified type -
searchManagedEntities
public ManagedEntity[] searchManagedEntities(String[][] typeinfo, boolean recurse) throws InvalidProperty, RuntimeFault, RemoteException Retrieve content recursively with multiple properties. Thetypeinfoarray contains {typename, prop1, prop2, ...} per type.Note: the requested property values are fetched from the server but discarded — only the entities are returned, and subsequent calls to entity getters round-trip to the server again. To keep the property values, use
searchManagedEntitiesWithProperties(String[][], boolean)instead.- Parameters:
typeinfo- 2D array of properties for each typenamerecurse- retrieve contents recursively from the root down- Returns:
- matching entities (without cached properties)
- Throws:
InvalidPropertyRuntimeFaultRemoteException
-
searchManagedEntitiesWithProperties
public ManagedEntity[] searchManagedEntitiesWithProperties(String[][] typeinfo, boolean recurse) throws InvalidProperty, RuntimeFault, RemoteException LikesearchManagedEntities(String[][], boolean)but pre-populates each returned entity's property cache with the requested values. Reading a cached property via the entity's typed getter (e.g.vm.getName()) returns the cached value without contacting the server. Reads of properties that weren't requested fall through to the server as usual.Cached values do not refresh — long-lived entities will return stale data if the underlying property changes on the server. For polling use cases, re-run the search.
Single round-trip equivalent of:
ManagedEntity[] mes = nav.searchManagedEntities(typename); Hashtable<String, Object>[] props = PropertyCollectorUtil.retrieveProperties(mes, typename, propNames);
- Parameters:
typeinfo- 2D array of {typename, prop1, prop2, ...} per typerecurse- retrieve contents recursively from the root down- Throws:
InvalidPropertyRuntimeFaultRemoteException
-
searchManagedEntity
public ManagedEntity searchManagedEntity(String type, String name) throws InvalidProperty, RuntimeFault, RemoteException Get the ManagedObjectReference for an item under the specified parent node that has the type and name specified.- Parameters:
type- type of the managed objectname- name to match- Returns:
- First ManagedEntity object of the type / name pair found
- Throws:
RemoteExceptionRuntimeFaultInvalidProperty
-