当前位置: 首页>>代码示例>>Java>>正文


Java SelectionSpec.setName方法代码示例

本文整理汇总了Java中com.vmware.vim25.SelectionSpec.setName方法的典型用法代码示例。如果您正苦于以下问题:Java SelectionSpec.setName方法的具体用法?Java SelectionSpec.setName怎么用?Java SelectionSpec.setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.vmware.vim25.SelectionSpec的用法示例。


在下文中一共展示了SelectionSpec.setName方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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.setName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。