本文整理汇总了Java中com.vmware.vim25.SelectionSpec类的典型用法代码示例。如果您正苦于以下问题:Java SelectionSpec类的具体用法?Java SelectionSpec怎么用?Java SelectionSpec使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SelectionSpec类属于com.vmware.vim25包,在下文中一共展示了SelectionSpec类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: ancestrySet
import com.vmware.vim25.SelectionSpec; //导入依赖的package包/类
private List<ObjectContent> ancestrySet(ManagedObjectReference ref)
throws InvalidPropertyFaultMsg, RuntimeFaultFaultMsg {
ObjectSpec ospec = new ObjectSpec();
ospec.setObj(ref);
ospec.setSkip(false);
TraversalSpec tspec = new TraversalSpec();
tspec.setSkip(false);
tspec.setPath("parent");
tspec.setType("ManagedEntity");
tspec.setName("traverseParent");
SelectionSpec selSpec = new SelectionSpec();
selSpec.setName("traverseParent");
tspec.getSelectSet().add(selSpec);
ospec.getSelectSet().add(tspec);
PropertySpec pspec = new PropertySpec();
pspec.setType("ManagedEntity");
pspec.getPathSet().add("name");
pspec.getPathSet().add("parent");
PropertyFilterSpec filter = new PropertyFilterSpec();
filter.getObjectSet().add(ospec);
filter.getPropSet().add(pspec);
return this.connection.getVimPort()
.retrieveProperties(this.connection.getServiceContent().getPropertyCollector(),
Collections.singletonList(filter));
}
开发者ID:vmware,项目名称:photon-model,代码行数:34,代码来源:Finder.java
示例2: buildTraversal
import com.vmware.vim25.SelectionSpec; //导入依赖的package包/类
/**
* @return An array of SelectionSpec covering Datacenter to DatastoreFolder.
*/
private static SelectionSpec[] buildTraversal() {
// For Folder -> Folder recursion
SelectionSpec sspecvfolders = new SelectionSpec();
sspecvfolders.setName("VisitFolders");
TraversalSpec dcToDf = new TraversalSpec();
dcToDf.setType("Datacenter");
dcToDf.setSkip(Boolean.FALSE);
dcToDf.setPath("datastoreFolder");
dcToDf.setName("dcToDf");
dcToDf.getSelectSet().add(sspecvfolders);
// DC -> DS
TraversalSpec dcToDs = new TraversalSpec();
dcToDs.setType("Datacenter");
dcToDs.setPath("datastore");
dcToDs.setName("dcToDs");
dcToDs.setSkip(Boolean.FALSE);
TraversalSpec visitFolders = new TraversalSpec();
visitFolders.setType("Folder");
visitFolders.setPath("childEntity");
visitFolders.setSkip(Boolean.FALSE);
visitFolders.setName("VisitFolders");
List<SelectionSpec> sspecarrvf = new ArrayList<SelectionSpec>();
sspecarrvf.add(dcToDs);
sspecarrvf.add(dcToDf);
sspecarrvf.add(sspecvfolders);
visitFolders.getSelectSet().addAll(sspecarrvf);
return new SelectionSpec[] { visitFolders };
}
开发者ID:vmware,项目名称:vsphere-automation-sdk-java,代码行数:38,代码来源:VimUtil.java
示例3: createEventFilterSpec
import com.vmware.vim25.SelectionSpec; //导入依赖的package包/类
private PropertyFilterSpec createEventFilterSpec(EventHistoryCollector collector)
throws Exception
{
// Set up a PropertySpec to use the latestPage attribute
// of the EventHistoryCollector
PropertySpec propSpec = new PropertySpec();
propSpec.setAll(new Boolean(false));
propSpec.setPathSet(new String[] { "latestPage" });
propSpec.setType(collector.getMOR().getType());
// PropertySpecs are wrapped in a PropertySpec array
PropertySpec[] propSpecAry = new PropertySpec[] { propSpec };
// Set up an ObjectSpec with the above PropertySpec for the
// EventHistoryCollector we just created
// as the Root or Starting Object to get Attributes for.
ObjectSpec objSpec = new ObjectSpec();
objSpec.setObj(collector.getMOR());
objSpec.setSkip(new Boolean(false));
// Get Event objects in "latestPage" from "EventHistoryCollector"
// and no "traversal" further, so, no SelectionSpec is specified
objSpec.setSelectSet(new SelectionSpec[] {});
// ObjectSpecs are wrapped in an ObjectSpec array
ObjectSpec[] objSpecAry = new ObjectSpec[] { objSpec };
PropertyFilterSpec spec = new PropertyFilterSpec();
spec.setPropSet(propSpecAry);
spec.setObjectSet(objSpecAry);
return spec;
}
开发者ID:Juniper,项目名称:contrail-vcenter-plugin,代码行数:33,代码来源:VCenterNotify.java
示例4: createEventFilterSpec
import com.vmware.vim25.SelectionSpec; //导入依赖的package包/类
private PropertyFilterSpec createEventFilterSpec()
{
// Set up a PropertySpec to use the latestPage attribute
// of the EventHistoryCollector
PropertySpec propSpec = new PropertySpec();
propSpec.setAll(new Boolean(false));
propSpec.setPathSet(new String[] { "latestPage" });
propSpec.setType(_eventHistoryCollector.getMOR().getType());
// PropertySpecs are wrapped in a PropertySpec array
PropertySpec[] propSpecAry = new PropertySpec[] { propSpec };
// Set up an ObjectSpec with the above PropertySpec for the
// EventHistoryCollector we just created
// as the Root or Starting Object to get Attributes for.
ObjectSpec objSpec = new ObjectSpec();
objSpec.setObj(_eventHistoryCollector.getMOR());
objSpec.setSkip(new Boolean(false));
// Get Event objects in "latestPage" from "EventHistoryCollector"
// and no "traversl" further, so, no SelectionSpec is specified
objSpec.setSelectSet(new SelectionSpec[] {});
// ObjectSpecs are wrapped in an ObjectSpec array
ObjectSpec[] objSpecAry = new ObjectSpec[] { objSpec };
PropertyFilterSpec spec = new PropertyFilterSpec();
spec.setPropSet(propSpecAry);
spec.setObjectSet(objSpecAry);
return spec;
}
开发者ID:Juniper,项目名称:vijava,代码行数:33,代码来源:VMEventsMonitor.java
示例5: getHostPropertiesOnDatacenterHostFolder
import com.vmware.vim25.SelectionSpec; //导入依赖的package包/类
public List<ObjectContent> getHostPropertiesOnDatacenterHostFolder(String[] propertyPaths) throws Exception {
PropertySpec pSpec = new PropertySpec();
pSpec.setType("HostSystem");
pSpec.getPathSet().addAll(Arrays.asList(propertyPaths));
TraversalSpec computeResource2HostTraversal = new TraversalSpec();
computeResource2HostTraversal.setType("ComputeResource");
computeResource2HostTraversal.setPath("host");
computeResource2HostTraversal.setName("computeResource2HostTraversal");
SelectionSpec recurseFolders = new SelectionSpec();
recurseFolders.setName("folder2childEntity");
TraversalSpec folder2childEntity = new TraversalSpec();
folder2childEntity.setType("Folder");
folder2childEntity.setPath("childEntity");
folder2childEntity.setName(recurseFolders.getName());
folder2childEntity.getSelectSet().add(recurseFolders);
folder2childEntity.getSelectSet().add(computeResource2HostTraversal);
TraversalSpec dc2HostFolderTraversal = new TraversalSpec();
dc2HostFolderTraversal.setType("Datacenter");
dc2HostFolderTraversal.setPath("hostFolder");
dc2HostFolderTraversal.setName("dc2HostFolderTraversal");
dc2HostFolderTraversal.getSelectSet().add(folder2childEntity);
ObjectSpec oSpec = new ObjectSpec();
oSpec.setObj(_mor);
oSpec.setSkip(Boolean.TRUE);
oSpec.getSelectSet().add(dc2HostFolderTraversal);
PropertyFilterSpec pfSpec = new PropertyFilterSpec();
pfSpec.getPropSet().add(pSpec);
pfSpec.getObjectSet().add(oSpec);
List<PropertyFilterSpec> pfSpecArr = new ArrayList<PropertyFilterSpec>();
pfSpecArr.add(pfSpec);
return _context.getService().retrieveProperties(_context.getPropertyCollector(), pfSpecArr);
}
开发者ID:apache,项目名称:cloudstack,代码行数:41,代码来源:DatacenterMO.java
示例6: getVmPropertiesOnDatacenterVmFolder
import com.vmware.vim25.SelectionSpec; //导入依赖的package包/类
public List<ObjectContent> getVmPropertiesOnDatacenterVmFolder(String[] propertyPaths) throws Exception {
PropertySpec pSpec = new PropertySpec();
pSpec.setType("VirtualMachine");
pSpec.getPathSet().addAll(Arrays.asList(propertyPaths));
TraversalSpec dc2VmFolderTraversal = new TraversalSpec();
dc2VmFolderTraversal.setType("Datacenter");
dc2VmFolderTraversal.setPath("vmFolder");
dc2VmFolderTraversal.setName("dc2VmFolderTraversal");
SelectionSpec recurseFolders = new SelectionSpec();
recurseFolders.setName("folder2childEntity");
TraversalSpec folder2childEntity = new TraversalSpec();
folder2childEntity.setType("Folder");
folder2childEntity.setPath("childEntity");
folder2childEntity.setName(recurseFolders.getName());
folder2childEntity.getSelectSet().add(recurseFolders);
dc2VmFolderTraversal.getSelectSet().add(folder2childEntity);
ObjectSpec oSpec = new ObjectSpec();
oSpec.setObj(_mor);
oSpec.setSkip(Boolean.TRUE);
oSpec.getSelectSet().add(dc2VmFolderTraversal);
PropertyFilterSpec pfSpec = new PropertyFilterSpec();
pfSpec.getPropSet().add(pSpec);
pfSpec.getObjectSet().add(oSpec);
List<PropertyFilterSpec> pfSpecArr = new ArrayList<PropertyFilterSpec>();
pfSpecArr.add(pfSpec);
return _context.getService().retrieveProperties(_context.getPropertyCollector(), pfSpecArr);
}
开发者ID:apache,项目名称:cloudstack,代码行数:34,代码来源:DatacenterMO.java
示例7: getOwnerDatacenter
import com.vmware.vim25.SelectionSpec; //导入依赖的package包/类
public static Pair<DatacenterMO, String> getOwnerDatacenter(VmwareContext context, ManagedObjectReference morEntity) throws Exception {
PropertySpec pSpec = new PropertySpec();
pSpec.setType("Datacenter");
pSpec.getPathSet().add("name");
TraversalSpec entityParentTraversal = new TraversalSpec();
entityParentTraversal.setType("ManagedEntity");
entityParentTraversal.setPath("parent");
entityParentTraversal.setName("entityParentTraversal");
SelectionSpec selSpec = new SelectionSpec();
selSpec.setName("entityParentTraversal");
entityParentTraversal.getSelectSet().add(selSpec);
ObjectSpec oSpec = new ObjectSpec();
oSpec.setObj(morEntity);
oSpec.setSkip(Boolean.TRUE);
oSpec.getSelectSet().add(entityParentTraversal);
PropertyFilterSpec pfSpec = new PropertyFilterSpec();
pfSpec.getPropSet().add(pSpec);
pfSpec.getObjectSet().add(oSpec);
List<PropertyFilterSpec> pfSpecArr = new ArrayList<PropertyFilterSpec>();
pfSpecArr.add(pfSpec);
List<ObjectContent> ocs = context.getService().retrieveProperties(context.getPropertyCollector(), pfSpecArr);
assert (ocs != null && ocs.size() > 0);
assert (ocs.get(0).getObj() != null);
assert (ocs.get(0).getPropSet().get(0) != null);
assert (ocs.get(0).getPropSet().get(0).getVal() != null);
String dcName = ocs.get(0).getPropSet().get(0).getVal().toString();
return new Pair<DatacenterMO, String>(new DatacenterMO(context, ocs.get(0).getObj()), dcName);
}
开发者ID:apache,项目名称:cloudstack,代码行数:36,代码来源:DatacenterMO.java
示例8: getSelectionSpec
import com.vmware.vim25.SelectionSpec; //导入依赖的package包/类
private SelectionSpec getSelectionSpec(String name) {
SelectionSpec genericSpec = new SelectionSpec();
genericSpec.setName(name);
return genericSpec;
}
开发者ID:vmware,项目名称:photon-model,代码行数:6,代码来源:EnumerationClient.java
示例9: listAllDatacenters
import com.vmware.vim25.SelectionSpec; //导入依赖的package包/类
public List<Element> listAllDatacenters() throws InvalidPropertyFaultMsg, RuntimeFaultFaultMsg {
PropertyFilterSpec spec = new PropertyFilterSpec();
ObjectSpec ospec = new ObjectSpec();
ospec.setObj(connection.getServiceContent().getRootFolder());
ospec.setSkip(false);
spec.getObjectSet().add(ospec);
TraversalSpec traverseFolders = new TraversalSpec();
traverseFolders.setPath("childEntity");
traverseFolders.setSkip(false);
String traversalName = "folder2child";
traverseFolders.setName(traversalName);
traverseFolders.setType(VimNames.TYPE_FOLDER);
SelectionSpec selSpec = new SelectionSpec();
selSpec.setName(traversalName);
traverseFolders.getSelectSet().add(selSpec);
ospec.getSelectSet().add(traverseFolders);
for (String t : new String[] { VimNames.TYPE_FOLDER, VimNames.TYPE_DATACENTER }) {
PropertySpec pspec = new PropertySpec();
pspec.setType(t);
pspec.getPathSet().add(VimNames.PROPERTY_NAME);
pspec.getPathSet().add(VimNames.PROPERTY_PARENT);
spec.getPropSet().add(pspec);
}
List<ObjectContent> ocs = retrieveProperties(spec);
List<Element> res = new ArrayList<>();
for (ObjectContent oc : ocs) {
if (oc.getObj().getType().equals(VimNames.TYPE_FOLDER)) {
continue;
}
String parentPath = buildPathToParent(prop(oc, VimNames.PROPERTY_PARENT), ocs);
res.add(Element.make(oc.getObj(), parentPath + "/" + prop(oc, VimNames.PROPERTY_NAME)));
}
return res;
}
开发者ID:vmware,项目名称:photon-model,代码行数:45,代码来源:DatacenterLister.java
示例10: getVMTraversalSpec
import com.vmware.vim25.SelectionSpec; //导入依赖的package包/类
/**
* @return TraversalSpec specification to get to the VirtualMachine managed
* object.
*/
public TraversalSpec getVMTraversalSpec() {
// Create a traversal spec that starts from the 'root' objects
// and traverses the inventory tree to get to the VirtualMachines.
// Build the traversal specs bottoms up
//Traversal to get to the VM in a VApp
TraversalSpec vAppToVM = new TraversalSpecBuilder()
.name("vAppToVM")
.type("VirtualApp")
.path("vm");
//Traversal spec for VApp to VApp
TraversalSpec vAppToVApp = new TraversalSpecBuilder()
.name("vAppToVApp")
.type("VirtualApp")
.path("resourcePool")
.selectSet(
//SelectionSpec for both VApp to VApp and VApp to VM
new SelectionSpecBuilder().name("vAppToVApp"),
new SelectionSpecBuilder().name("vAppToVM")
);
//This SelectionSpec is used for recursion for Folder recursion
SelectionSpec visitFolders = new SelectionSpecBuilder().name("VisitFolders");
// Traversal to get to the vmFolder from DataCenter
TraversalSpec dataCenterToVMFolder = new TraversalSpecBuilder()
.name("DataCenterToVMFolder")
.type("Datacenter")
.path("vmFolder")
.skip(false)
.selectSet(visitFolders);
// TraversalSpec to get to the DataCenter from rootFolder
return new TraversalSpecBuilder()
.name("VisitFolders")
.type("Folder")
.path("childEntity")
.skip(false)
.selectSet(
visitFolders,
dataCenterToVMFolder,
vAppToVM,
vAppToVApp
);
}
开发者ID:vmware,项目名称:photon-model,代码行数:51,代码来源:GetMoRef.java
示例11: init
import com.vmware.vim25.SelectionSpec; //导入依赖的package包/类
private void init() {
if (this.selectSet == null) {
this.selectSet = new ArrayList<SelectionSpec>();
}
}
开发者ID:vmware,项目名称:photon-model,代码行数:6,代码来源:TraversalSpecBuilder.java
示例12: selectSet
import com.vmware.vim25.SelectionSpec; //导入依赖的package包/类
public TraversalSpecBuilder selectSet(final SelectionSpec... selectionSpecs) {
init();
this.selectSet.addAll(Arrays.asList(selectionSpecs));
return this;
}
开发者ID:vmware,项目名称:photon-model,代码行数:6,代码来源:TraversalSpecBuilder.java
示例13: selectSet
import com.vmware.vim25.SelectionSpec; //导入依赖的package包/类
public ObjectSpecBuilder selectSet(final SelectionSpec... selectionSpecs) {
init();
this.selectSet.addAll(Arrays.asList(selectionSpecs));
return this;
}
开发者ID:vmware,项目名称:photon-model,代码行数:6,代码来源:ObjectSpecBuilder.java
示例14: getHosts
import com.vmware.vim25.SelectionSpec; //导入依赖的package包/类
/**
* Retrieves the list of hosts of the given cluster.
*
* @param vimPort
* vimPort
* @param serviceContent
* serviceContent
* @param cluster
* cluster
* @return the list of hosts of the clusters
* @throws InvalidPropertyFaultMsg
* @throws RuntimeFaultFaultMsg
*/
public static List<ManagedObjectReference> getHosts(VimPortType vimPort,
ServiceContent serviceContent, ManagedObjectReference cluster)
throws InvalidPropertyFaultMsg, RuntimeFaultFaultMsg {
PropertySpec hostPropSpec = new PropertySpec();
hostPropSpec.setType("HostSystem");
hostPropSpec.setAll(false);
hostPropSpec.getPathSet().addAll(Collections.<String>emptyList());
TraversalSpec hostTSpec = new TraversalSpec();
hostTSpec.setType("ComputeResource");
hostTSpec.setPath("host");
hostTSpec.setName("hosts");
final SelectionSpec selectionSpec = new SelectionSpec();
selectionSpec.setName(hostTSpec.getName());
hostTSpec.getSelectSet().add(selectionSpec);
List<ObjectSpec> ospecList = new ArrayList<>();
ObjectSpec ospec = new ObjectSpec();
ospec.setObj(cluster);
ospec.setSkip(true);
ospec.getSelectSet().addAll(Arrays.asList(hostTSpec));
ospecList.add(ospec);
PropertyFilterSpec propertyFilterSpec = new PropertyFilterSpec();
propertyFilterSpec.getPropSet().addAll(Arrays.asList(hostPropSpec));
propertyFilterSpec.getObjectSet().addAll(ospecList);
List<PropertyFilterSpec> listpfs = new ArrayList<>(1);
listpfs.add(propertyFilterSpec);
List<ObjectContent> listObjContent = VimUtil
.retrievePropertiesAllObjects(vimPort,
serviceContent.getPropertyCollector(), listpfs);
List<ManagedObjectReference> hosts = new ArrayList<>();
if (listObjContent != null) {
for (ObjectContent oc : listObjContent) {
hosts.add(oc.getObj());
}
}
return hosts;
}
开发者ID:vmware,项目名称:vsphere-automation-sdk-java,代码行数:58,代码来源:VimUtil.java
示例15: getVMTraversalSpec
import com.vmware.vim25.SelectionSpec; //导入依赖的package包/类
/**
* Gets the VM TraversalSpec.
*
* @return the VM TraversalSpec
*/
private static TraversalSpec getVMTraversalSpec() {
TraversalSpec vAppToVM = new TraversalSpec();
vAppToVM.setName("vAppToVM");
vAppToVM.setType("VirtualApp");
vAppToVM.setPath("vm");
TraversalSpec vAppToVApp = new TraversalSpec();
vAppToVApp.setName("vAppToVApp");
vAppToVApp.setType("VirtualApp");
vAppToVApp.setPath("resourcePool");
SelectionSpec vAppRecursion = new SelectionSpec();
vAppRecursion.setName("vAppToVApp");
SelectionSpec vmInVApp = new SelectionSpec();
vmInVApp.setName("vAppToVM");
List<SelectionSpec> vAppToVMSS = new ArrayList<SelectionSpec>();
vAppToVMSS.add(vAppRecursion);
vAppToVMSS.add(vmInVApp);
vAppToVApp.getSelectSet().addAll(vAppToVMSS);
SelectionSpec sSpec = new SelectionSpec();
sSpec.setName("VisitFolders");
TraversalSpec dataCenterToVMFolder = new TraversalSpec();
dataCenterToVMFolder.setName("DataCenterToVMFolder");
dataCenterToVMFolder.setType("Datacenter");
dataCenterToVMFolder.setPath("vmFolder");
dataCenterToVMFolder.setSkip(false);
dataCenterToVMFolder.getSelectSet().add(sSpec);
TraversalSpec traversalSpec = new TraversalSpec();
traversalSpec.setName("VisitFolders");
traversalSpec.setType("Folder");
traversalSpec.setPath("childEntity");
traversalSpec.setSkip(false);
List<SelectionSpec> sSpecArr = new ArrayList<SelectionSpec>();
sSpecArr.add(sSpec);
sSpecArr.add(dataCenterToVMFolder);
sSpecArr.add(vAppToVM);
sSpecArr.add(vAppToVApp);
traversalSpec.getSelectSet().addAll(sSpecArr);
return traversalSpec;
}
开发者ID:vmware,项目名称:vsphere-automation-sdk-java,代码行数:51,代码来源:VimUtil.java
示例16: init
import com.vmware.vim25.SelectionSpec; //导入依赖的package包/类
private void init() {
if (selectSet == null) {
selectSet = new ArrayList<SelectionSpec>();
}
}
开发者ID:jdgwartney,项目名称:vsphere-ws,代码行数:6,代码来源:TraversalSpecBuilder.java
示例17: getOwnerDatacenter
import com.vmware.vim25.SelectionSpec; //导入依赖的package包/类
public Pair<DatacenterMO, String> getOwnerDatacenter() throws Exception {
if (_ownerDc != null)
return _ownerDc;
PropertySpec pSpec = new PropertySpec();
pSpec.setType("Datacenter");
pSpec.getPathSet().add("name");
TraversalSpec folderParentTraversal = new TraversalSpec();
folderParentTraversal.setType("Folder");
folderParentTraversal.setPath("parent");
folderParentTraversal.setName("folderParentTraversal");
SelectionSpec sSpec = new SelectionSpec();
sSpec.setName("folderParentTraversal");
folderParentTraversal.getSelectSet().add(sSpec);
TraversalSpec dsParentTraversal = new TraversalSpec();
dsParentTraversal.setType("Datastore");
dsParentTraversal.setPath("parent");
dsParentTraversal.setName("dsParentTraversal");
dsParentTraversal.getSelectSet().add(folderParentTraversal);
ObjectSpec oSpec = new ObjectSpec();
oSpec.setObj(getMor());
oSpec.setSkip(Boolean.TRUE);
oSpec.getSelectSet().add(dsParentTraversal);
PropertyFilterSpec pfSpec = new PropertyFilterSpec();
pfSpec.getPropSet().add(pSpec);
pfSpec.getObjectSet().add(oSpec);
List<PropertyFilterSpec> pfSpecArr = new ArrayList<>();
pfSpecArr.add(pfSpec);
List<ObjectContent> ocs = _context.getService().retrieveProperties(_context.getPropertyCollector(), pfSpecArr);
assert (ocs != null && ocs.size() > 0);
assert (ocs.get(0).getObj() != null);
assert (ocs.get(0).getPropSet() != null);
String dcName = ocs.get(0).getPropSet().get(0).getVal().toString();
_ownerDc = new Pair<>(new DatacenterMO(_context, ocs.get(0).getObj()), dcName);
return _ownerDc;
}
开发者ID:apache,项目名称:cloudstack,代码行数:43,代码来源:DatastoreMO.java
示例18: getVMTraversalSpec
import com.vmware.vim25.SelectionSpec; //导入依赖的package包/类
private static TraversalSpec getVMTraversalSpec() {
// Create a TraversalSpec that starts from the 'root' objects
// and traverses the inventory tree to get to the VirtualMachines.
// Build the traversal specs bottoms up
// TraversalSpec to get to the VM in a vApp
TraversalSpec vAppToVM = new TraversalSpec();
vAppToVM.setName("vAppToVM");
vAppToVM.setType("VirtualApp");
vAppToVM.setPath("vm");
// TraversalSpec for vApp to vApp
TraversalSpec vAppToVApp = new TraversalSpec();
vAppToVApp.setName("vAppToVApp");
vAppToVApp.setType("VirtualApp");
vAppToVApp.setPath("resourcePool");
// SelectionSpec for vApp-to-vApp recursion
SelectionSpec vAppRecursion = new SelectionSpec();
vAppRecursion.setName("vAppToVApp");
// SelectionSpec to get to a VM in the vApp
SelectionSpec vmInVApp = new SelectionSpec();
vmInVApp.setName("vAppToVM");
// SelectionSpec for both vApp to vApp and vApp to VM
List<SelectionSpec> vAppToVMSS = new ArrayList<>();
vAppToVMSS.add(vAppRecursion);
vAppToVMSS.add(vmInVApp);
vAppToVApp.getSelectSet().addAll(vAppToVMSS);
// This SelectionSpec is used for recursion for Folder recursion
SelectionSpec sSpec = new SelectionSpec();
sSpec.setName("VisitFolders");
// Traversal to get to the vmFolder from DataCenter
TraversalSpec dataCenterToVMFolder = new TraversalSpec();
dataCenterToVMFolder.setName("DataCenterToVMFolder");
dataCenterToVMFolder.setType("Datacenter");
dataCenterToVMFolder.setPath("vmFolder");
dataCenterToVMFolder.setSkip(false);
dataCenterToVMFolder.getSelectSet().add(sSpec);
// TraversalSpec to get to the DataCenter from rootFolder
TraversalSpec traversalSpec = new TraversalSpec();
traversalSpec.setName("VisitFolders");
traversalSpec.setType("Folder");
traversalSpec.setPath("childEntity");
traversalSpec.setSkip(false);
List<SelectionSpec> sSpecArr = new ArrayList<>();
sSpecArr.add(sSpec);
sSpecArr.add(dataCenterToVMFolder);
sSpecArr.add(vAppToVM);
sSpecArr.add(vAppToVApp);
traversalSpec.getSelectSet().addAll(sSpecArr);
return traversalSpec;
}
开发者ID:apache,项目名称:cloudstack,代码行数:72,代码来源:VMwareUtil.java
注:本文中的com.vmware.vim25.SelectionSpec类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论