本文整理汇总了Java中com.vmware.vim25.RetrieveResult类的典型用法代码示例。如果您正苦于以下问题:Java RetrieveResult类的具体用法?Java RetrieveResult怎么用?Java RetrieveResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RetrieveResult类属于com.vmware.vim25包,在下文中一共展示了RetrieveResult类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: resultsToTgtMorefMap
import com.vmware.vim25.RetrieveResult; //导入依赖的package包/类
private void resultsToTgtMorefMap(RetrieveResult results,
Map<String, ManagedObjectReference> tgtMoref) {
List<ObjectContent> oCont = (results != null) ? results.getObjects() : null;
if (oCont != null) {
for (ObjectContent oc : oCont) {
ManagedObjectReference mr = oc.getObj();
String entityNm = null;
List<DynamicProperty> dps = oc.getPropSet();
if (dps != null) {
for (DynamicProperty dp : dps) {
entityNm = (String) dp.getVal();
}
}
tgtMoref.put(entityNm, mr);
}
}
}
开发者ID:vmware,项目名称:photon-model,代码行数:19,代码来源:GetMoRef.java
示例2: toMap
import com.vmware.vim25.RetrieveResult; //导入依赖的package包/类
public Map<String, ManagedObjectReference> toMap(RetrieveResult rslts)
throws InvalidPropertyFaultMsg, RuntimeFaultFaultMsg {
final Map<String, ManagedObjectReference> tgtMoref = new HashMap<String, ManagedObjectReference>();
String token = null;
token = populate(rslts, tgtMoref);
while (token != null && !token.isEmpty()) {
// fetch results based on new token
rslts = this.vimPort.continueRetrievePropertiesEx(
this.serviceContent.getPropertyCollector(), token);
token = populate(rslts, tgtMoref);
}
return tgtMoref;
}
开发者ID:vmware,项目名称:photon-model,代码行数:17,代码来源:GetMoRef.java
示例3: populate
import com.vmware.vim25.RetrieveResult; //导入依赖的package包/类
public static String populate(final RetrieveResult rslts,
final Map<String, ManagedObjectReference> tgtMoref) {
String token = null;
if (rslts != null) {
token = rslts.getToken();
for (ObjectContent oc : rslts.getObjects()) {
ManagedObjectReference mr = oc.getObj();
String entityNm = null;
List<DynamicProperty> dps = oc.getPropSet();
if (dps != null) {
for (DynamicProperty dp : dps) {
entityNm = (String) dp.getVal();
}
}
tgtMoref.put(entityNm, mr);
}
}
return token;
}
开发者ID:vmware,项目名称:photon-model,代码行数:20,代码来源:GetMoRef.java
示例4: populate
import com.vmware.vim25.RetrieveResult; //导入依赖的package包/类
private static String populate(final RetrieveResult results, final Map<String, ManagedObjectReference> tgtMoref) {
String token = null;
if (results != null) {
token = results.getToken();
for (ObjectContent oc : results.getObjects()) {
ManagedObjectReference mr = oc.getObj();
String entityNm = null;
List<DynamicProperty> dps = oc.getPropSet();
if (dps != null) {
for (DynamicProperty dp : dps) {
entityNm = (String) dp.getVal();
}
}
tgtMoref.put(entityNm, mr);
}
}
return token;
}
开发者ID:CloudSlang,项目名称:cs-actions,代码行数:20,代码来源:MoRefHandler.java
示例5: retrievePropertiesAllObjects
import com.vmware.vim25.RetrieveResult; //导入依赖的package包/类
/**
* Uses the new RetrievePropertiesEx method to emulate the now deprecated
* RetrieveProperties method
*
* @param filterSpecs
* @return list of object content
* @throws RuntimeFaultFaultMsg
* @throws InvalidPropertyFaultMsg
* @throws Exception
*/
private List<ObjectContent> retrievePropertiesAllObjects(
List<PropertyFilterSpec> filterSpecs)
throws InvalidPropertyFaultMsg, RuntimeFaultFaultMsg {
RetrieveOptions retrieveOptions = new RetrieveOptions();
ManagedObjectReference collector = serviceContent
.getPropertyCollector();
List<ObjectContent> contents = new ArrayList<ObjectContent>();
RetrieveResult results = vimPort.retrievePropertiesEx(collector,
filterSpecs, retrieveOptions);
if (results != null && results.getObjects() != null
&& !results.getObjects().isEmpty()) {
contents.addAll(results.getObjects());
}
String token = null;
if (results != null && results.getToken() != null) {
token = results.getToken();
}
while (token != null && token.length() > 0) {
results = vimPort.continueRetrievePropertiesEx(collector, token);
token = null;
if (results != null) {
token = results.getToken();
if (results.getObjects() != null
&& !results.getObjects().isEmpty()) {
contents.addAll(results.getObjects());
}
}
}
return contents;
}
开发者ID:servicecatalog,项目名称:oscm,代码行数:45,代码来源:ManagedObjectAccessor.java
示例6: containerViewByType
import com.vmware.vim25.RetrieveResult; //导入依赖的package包/类
public RetrieveResult containerViewByType(
final ManagedObjectReference container,
final String morefType,
final RetrieveOptions retrieveOptions
) throws RuntimeFaultFaultMsg, InvalidPropertyFaultMsg {
return this.containerViewByType(container, morefType, retrieveOptions, "name");
}
开发者ID:vmware,项目名称:photon-model,代码行数:8,代码来源:GetMoRef.java
示例7: inFolderByType
import com.vmware.vim25.RetrieveResult; //导入依赖的package包/类
/**
* Returns all the MOREFs of the specified type that are present under the
* folder
*
* @param folder {@link ManagedObjectReference} of the folder to begin the search
* from
* @param morefType Type of the managed entity that needs to be searched
* @return Map of name and MOREF of the managed objects present. If none
* exist then empty Map is returned
* @throws InvalidPropertyFaultMsg
*
* @throws RuntimeFaultFaultMsg
*
*/
public Map<String, ManagedObjectReference> inFolderByType(
final ManagedObjectReference folder, final String morefType,
final RetrieveOptions retrieveOptions
) throws RuntimeFaultFaultMsg, InvalidPropertyFaultMsg {
final PropertyFilterSpec[] propertyFilterSpecs = propertyFilterSpecs(folder, morefType,
"name");
// reuse this property collector again later to scroll through results
final ManagedObjectReference propertyCollector = this.serviceContent.getPropertyCollector();
RetrieveResult results = this.vimPort.retrievePropertiesEx(
propertyCollector,
Arrays.asList(propertyFilterSpecs),
retrieveOptions);
final Map<String, ManagedObjectReference> tgtMoref = new HashMap<>();
while (results != null && !results.getObjects().isEmpty()) {
resultsToTgtMorefMap(results, tgtMoref);
final String token = results.getToken();
// if we have a token, we can scroll through additional results, else there's nothing to do.
results =
(token != null) ?
this.vimPort.continueRetrievePropertiesEx(propertyCollector, token) : null;
}
return tgtMoref;
}
开发者ID:vmware,项目名称:photon-model,代码行数:42,代码来源:GetMoRef.java
示例8: retrievePropertiesAllObjects
import com.vmware.vim25.RetrieveResult; //导入依赖的package包/类
/**
* Uses the new RetrievePropertiesEx method to emulate the now deprecated
* RetrieveProperties method.
*
* @param listpfs
* @return list of object content
* @throws Exception
*/
public static List<ObjectContent> retrievePropertiesAllObjects(
VimPortType vimPort, ManagedObjectReference propCollectorRef,
List<PropertyFilterSpec> listpfs)
throws InvalidPropertyFaultMsg, RuntimeFaultFaultMsg {
RetrieveOptions propObjectRetrieveOpts = new RetrieveOptions();
List<ObjectContent> listobjcontent = new ArrayList<ObjectContent>();
RetrieveResult rslts = vimPort.retrievePropertiesEx(propCollectorRef,
listpfs, propObjectRetrieveOpts);
if (rslts != null && rslts.getObjects() != null
&& !rslts.getObjects().isEmpty()) {
listobjcontent.addAll(rslts.getObjects());
}
String token = null;
if (rslts != null && rslts.getToken() != null) {
token = rslts.getToken();
}
while (token != null && !token.isEmpty()) {
rslts = vimPort.continueRetrievePropertiesEx(propCollectorRef,
token);
token = null;
if (rslts != null) {
token = rslts.getToken();
if (rslts.getObjects() != null
&& !rslts.getObjects().isEmpty()) {
listobjcontent.addAll(rslts.getObjects());
}
}
}
return listobjcontent;
}
开发者ID:vmware,项目名称:vsphere-automation-sdk-java,代码行数:41,代码来源:VimUtil.java
示例9: initClusterHostMap
import com.vmware.vim25.RetrieveResult; //导入依赖的package包/类
/**
* initClusterHostMap is a self recursive method for generating VM/ESX to Cluster Hash Map.
* In the first iteration it gathers all clusters and in consecutive calls for each cluster it updates Hash Map.
* The logic here is use ComputeResource Entity as a base for gathering all virtual machines and ESX Hosts.
* As part of configurations, GraphiteReceiver invokes this method at regular intervals (configured) and during runtime
* if VM/ESX does not exist in the hash map.
*/
public static boolean initClusterHostMap(String clusterName, ManagedObjectReference rootFolder, ExecutionContext context, Map<String,String> clusterMap){
try {
if(clusterName == null){
clusterMap.clear();
}
VimConnection connection = context.getConnection();
RetrieveResult retrieveResult = getRetrieveResult(clusterName, connection, rootFolder);
while((retrieveResult != null) && (retrieveResult.getObjects() != null) && (retrieveResult.getObjects().size() > 0)){
String token = retrieveResult.getToken();
for(ObjectContent objectContent : retrieveResult.getObjects()){
List<DynamicProperty> dynamicProperties = objectContent.getPropSet();
if(clusterName != null){
String dpsGet = String.valueOf(dynamicProperties.get(0).getVal());
clusterMap.put(dpsGet.replace(" ", "_"), clusterName.replace(" ", "_"));
} else {
initClusterHostMap((String) (dynamicProperties.get(0).getVal()), objectContent.getObj(), context, clusterMap);
}
}
if (token == null) {
return true;
}
retrieveResult = connection.getVimPort().continueRetrievePropertiesEx(connection.getPropertyCollector(), token);
}
return true;
} catch(Exception e){
logger.fatal("Critical Error Detected.");
logger.fatal(e.getLocalizedMessage());
return false;
}
}
开发者ID:SYNAXON,项目名称:GraphiteReceiver,代码行数:42,代码来源:Utils.java
示例10: getRetrieveResult
import com.vmware.vim25.RetrieveResult; //导入依赖的package包/类
private static RetrieveResult getRetrieveResult(String clusterName, VimConnection connection, ManagedObjectReference rootFolder) throws RuntimeFaultFaultMsg, InvalidPropertyFaultMsg {
List<String> clusterList = new ArrayList<String>();
clusterList.add("ComputeResource");
clusterList.add("HostSystem");
clusterList.add("VirtualMachine");
ManagedObjectReference rootFolderAux = (clusterName == null)? connection.getRootFolder():rootFolder;
ManagedObjectReference viewManager = connection.getVimPort().createContainerView(connection.getViewManager(), rootFolderAux, clusterList, true);
if(viewManager == null) {
logger.debug("cViewRef is null: " + clusterName);
return null;
}
logger.debug("cViewRef is not null: " + clusterName);
ObjectSpec objectSpec = new ObjectSpec();
objectSpec.setObj(viewManager);
objectSpec.setSkip(true);
objectSpec.getSelectSet().add(getTraversalSpec(clusterName));
PropertyFilterSpec propertyFilterSpec = new PropertyFilterSpec();
propertyFilterSpec.getObjectSet().add(objectSpec);
if(clusterName == null){
propertyFilterSpec.getPropSet().add(getPropertySpec("ComputeResource"));
}else{
propertyFilterSpec.getPropSet().add(getPropertySpec("HostSystem"));
propertyFilterSpec.getPropSet().add(getPropertySpec("VirtualMachine"));
}
List<PropertyFilterSpec> propertyFilterSpecs = new LinkedList<PropertyFilterSpec>();
propertyFilterSpecs.add(propertyFilterSpec);
return connection.getVimPort().retrievePropertiesEx(connection.getPropertyCollector(), propertyFilterSpecs, new RetrieveOptions());
}
开发者ID:SYNAXON,项目名称:GraphiteReceiver,代码行数:34,代码来源:Utils.java
示例11: retrievePropertiesAllObjects
import com.vmware.vim25.RetrieveResult; //导入依赖的package包/类
/**
* Uses the new RetrievePropertiesEx method to emulate the now deprecated
* RetrieveProperties method
*
* @param propertyFilterSpecList
* @return list of object content
* @throws Exception
*/
private static List<ObjectContent> retrievePropertiesAllObjects(ConnectionResources connectionResources,
List<PropertyFilterSpec> propertyFilterSpecList)
throws RuntimeFaultFaultMsg, InvalidPropertyFaultMsg {
VimPortType vimPort = connectionResources.getVimPortType();
ManagedObjectReference serviceInstance = connectionResources.getServiceInstance();
ServiceContent serviceContent = vimPort.retrieveServiceContent(serviceInstance);
ManagedObjectReference propertyCollectorReference = serviceContent.getPropertyCollector();
RetrieveOptions propertyObjectRetrieveOptions = new RetrieveOptions();
List<ObjectContent> objectContentList = new ArrayList<>();
RetrieveResult results = vimPort.retrievePropertiesEx(propertyCollectorReference,
propertyFilterSpecList,
propertyObjectRetrieveOptions);
if (results != null && results.getObjects() != null && !results.getObjects().isEmpty()) {
objectContentList.addAll(results.getObjects());
}
String token = null;
if (results != null && results.getToken() != null) {
token = results.getToken();
}
while (token != null && !token.isEmpty()) {
results = vimPort.continueRetrievePropertiesEx(propertyCollectorReference, token);
token = null;
if (results != null) {
token = results.getToken();
if (results.getObjects() != null && !results.getObjects().isEmpty()) {
objectContentList.addAll(results.getObjects());
}
}
}
return objectContentList;
}
开发者ID:CloudSlang,项目名称:cs-actions,代码行数:46,代码来源:GetObjectProperties.java
示例12: containerViewByType
import com.vmware.vim25.RetrieveResult; //导入依赖的package包/类
/**
* Initialize the helper object on the current connection at invocation time. Do not initialize on construction
* since the connection may not be ready yet.
*/
private RetrieveResult containerViewByType(final ManagedObjectReference container,
final String morefType,
final RetrieveOptions retrieveOptions
) throws RuntimeFaultFaultMsg, InvalidPropertyFaultMsg {
return this.containerViewByType(container, morefType, retrieveOptions, ManagedObjectType.NAME.getValue());
}
开发者ID:CloudSlang,项目名称:cs-actions,代码行数:12,代码来源:MoRefHandler.java
示例13: toMap
import com.vmware.vim25.RetrieveResult; //导入依赖的package包/类
private Map<String, ManagedObjectReference> toMap(RetrieveResult result)
throws InvalidPropertyFaultMsg, RuntimeFaultFaultMsg {
final Map<String, ManagedObjectReference> tgtMoref = new HashMap<>();
String token = populate(result, tgtMoref);
while (token != null && !token.isEmpty()) {
// fetch results based on new token
result = vimPort.continueRetrievePropertiesEx(serviceContent.getPropertyCollector(), token);
token = populate(result, tgtMoref);
}
return tgtMoref;
}
开发者ID:CloudSlang,项目名称:cs-actions,代码行数:14,代码来源:MoRefHandler.java
示例14: findComponentReference
import com.vmware.vim25.RetrieveResult; //导入依赖的package包/类
private ManagedObjectReference findComponentReference(final PropertyFilterSpec[] propertyFilterSpecs,
final RetrieveOptions retrieveOptions, final String id) throws Exception {
String token = null;
ManagedObjectReference searched;
do {
final RetrieveResult retrieveResult = retrievePropertiesEx(Arrays.asList(propertyFilterSpecs), retrieveOptions, token);
token = retrieveResult.getToken();
searched = getFromRetrieveResult(retrieveResult, id);
} while (searched == null && StringUtilities.isNotEmpty(token));
return searched;
}
开发者ID:CloudSlang,项目名称:cs-actions,代码行数:12,代码来源:MoRefHandler.java
示例15: retrievePropertiesEx
import com.vmware.vim25.RetrieveResult; //导入依赖的package包/类
private RetrieveResult retrievePropertiesEx(final List<PropertyFilterSpec> propertyFilterSpecs, final RetrieveOptions retrieveOptions,
final String token) throws Exception {
if (isEmpty(token)) {
return vimPort.retrievePropertiesEx(serviceContent.getPropertyCollector(), propertyFilterSpecs, retrieveOptions);
}
return vimPort.continueRetrievePropertiesEx(serviceContent.getPropertyCollector(), token);
}
开发者ID:CloudSlang,项目名称:cs-actions,代码行数:8,代码来源:MoRefHandler.java
示例16: getFromRetrieveResult
import com.vmware.vim25.RetrieveResult; //导入依赖的package包/类
private ManagedObjectReference getFromRetrieveResult(final RetrieveResult retrieveResult, final String id) {
for (final ObjectContent oc : retrieveResult.getObjects()) {
if (StringUtilities.equals(id, oc.getObj().getValue())) {
return oc.getObj();
}
}
return null;
}
开发者ID:CloudSlang,项目名称:cs-actions,代码行数:9,代码来源:MoRefHandler.java
示例17: vmByVMname
import com.vmware.vim25.RetrieveResult; //导入依赖的package包/类
/**
* Get the MOR of the Virtual Machine by its name.
*
* @param vmName The name of the Virtual Machine
* @param propCollectorRef
* @return The Managed Object reference for this VM
* @throws RuntimeFaultFaultMsg
* @throws InvalidPropertyFaultMsg
*/
public ManagedObjectReference vmByVMname(
final String vmName, final ManagedObjectReference propCollectorRef
) throws InvalidPropertyFaultMsg, RuntimeFaultFaultMsg {
init();
ManagedObjectReference rootFolder = this.serviceContent.getRootFolder();
TraversalSpec tSpec = getVMTraversalSpec();
// Create Property Spec
PropertySpec propertySpec = new PropertySpecBuilder()
.all(Boolean.FALSE)
.pathSet("name")
.type("VirtualMachine");
// Now create Object Spec
ObjectSpec objectSpec = new ObjectSpecBuilder()
.obj(rootFolder)
.skip(Boolean.TRUE)
.selectSet(tSpec);
// Create PropertyFilterSpec using the PropertySpec and ObjectPec
// created above.
PropertyFilterSpec propertyFilterSpec = new PropertyFilterSpecBuilder()
.propSet(propertySpec)
.objectSet(objectSpec);
List<PropertyFilterSpec> listpfs =
new ArrayList<PropertyFilterSpec>(1);
listpfs.add(propertyFilterSpec);
RetrieveOptions options = new RetrieveOptions();
// Query returns a fixed number of results
// if token is returned we can get more results
RetrieveResult retrieveResult =
this.vimPort.retrievePropertiesEx(propCollectorRef, listpfs, options);
String token = null;
do {
token = (retrieveResult != null) ? retrieveResult.getToken() : null;
List<ObjectContent> listobcont =
(retrieveResult != null) ?
retrieveResult.getObjects() : null;
if (listobcont != null) {
for (ObjectContent oc : listobcont) {
ManagedObjectReference mr = oc.getObj();
String vmnm = null;
List<DynamicProperty> dps = oc.getPropSet();
if (dps != null) {
for (DynamicProperty dp : dps) {
vmnm = (String) dp.getVal();
if (vmName.equals(vmnm)) {
return mr;
}
}
}
}
}
if (token != null) {
retrieveResult = this.vimPort.continueRetrievePropertiesEx(propCollectorRef, token);
}
} while (token != null);
return null;
}
开发者ID:vmware,项目名称:photon-model,代码行数:74,代码来源:GetMoRef.java
示例18: entityProps
import com.vmware.vim25.RetrieveResult; //导入依赖的package包/类
/**
* Method to retrieve properties of list of {@link ManagedObjectReference}
*
* @param entityMors List of {@link ManagedObjectReference} for which the properties
* needs to be retrieved
* @param props Common properties that need to be retrieved for all the
* {@link ManagedObjectReference} passed
* @return Map of {@link ManagedObjectReference} and their corresponding name
* value pair of properties
* @throws InvalidPropertyFaultMsg
* @throws RuntimeFaultFaultMsg
*/
public Map<ManagedObjectReference, Map<String, Object>> entityProps(
List<ManagedObjectReference> entityMors, String[] props)
throws InvalidPropertyFaultMsg, RuntimeFaultFaultMsg {
init();
Map<ManagedObjectReference, Map<String, Object>> retVal =
new HashMap<ManagedObjectReference, Map<String, Object>>();
// Create PropertyFilterSpec
PropertyFilterSpecBuilder propertyFilterSpec = new PropertyFilterSpecBuilder();
Map<String, String> typesCovered = new HashMap<String, String>();
for (ManagedObjectReference mor : entityMors) {
if (!typesCovered.containsKey(mor.getType())) {
// Create & add new property Spec
propertyFilterSpec.propSet(
new PropertySpecBuilder()
.all(Boolean.FALSE)
.type(mor.getType())
.pathSet(props)
);
typesCovered.put(mor.getType(), "");
}
// Now create & add Object Spec
propertyFilterSpec.objectSet(
new ObjectSpecBuilder().obj(mor)
);
}
List<PropertyFilterSpec> propertyFilterSpecs =
new ArrayList<PropertyFilterSpec>();
propertyFilterSpecs.add(propertyFilterSpec);
RetrieveResult rslts =
this.vimPort.retrievePropertiesEx(this.serviceContent.getPropertyCollector(),
propertyFilterSpecs, new RetrieveOptions());
List<ObjectContent> listobjcontent = new ArrayList<ObjectContent>();
String token = populate(rslts, listobjcontent);
while (token != null && !token.isEmpty()) {
rslts =
this.vimPort.continueRetrievePropertiesEx(
this.serviceContent.getPropertyCollector(), token);
token = populate(rslts, listobjcontent);
}
for (ObjectContent oc : listobjcontent) {
List<DynamicProperty> dps = oc.getPropSet();
Map<String, Object> propMap = new HashMap<String, Object>();
if (dps != null) {
for (DynamicProperty dp : dps) {
propMap.put(dp.getName(), dp.getVal());
}
}
retVal.put(oc.getObj(), propMap);
}
return retVal;
}
开发者ID:vmware,项目名称:photon-model,代码行数:70,代码来源:GetMoRef.java
示例19: continueRetrievePropertiesEx
import com.vmware.vim25.RetrieveResult; //导入依赖的package包/类
/** @since SDK4.1 */
public RetrieveResult continueRetrievePropertiesEx(String token) throws InvalidProperty, RuntimeFault, RemoteException
{
return getVimService().continueRetrievePropertiesEx(getMOR(), token);
}
开发者ID:Juniper,项目名称:vijava,代码行数:6,代码来源:PropertyCollector.java
示例20: retrievePropertiesEx
import com.vmware.vim25.RetrieveResult; //导入依赖的package包/类
/** @since SDK4.1 */
public RetrieveResult retrievePropertiesEx(PropertyFilterSpec[] specSet, RetrieveOptions options) throws InvalidProperty, RuntimeFault, RemoteException
{
return getVimService().retrievePropertiesEx(getMOR(), specSet, options);
}
开发者ID:Juniper,项目名称:vijava,代码行数:6,代码来源:PropertyCollector.java
注:本文中的com.vmware.vim25.RetrieveResult类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论