Пример #1
0
  /** @return TraversalSpec specification to get to the Datacenter managed object. */
  private static TraversalSpec getDatacenterTraversalSpec() {
    // Create a traversal spec that starts from the 'root' objects
    SelectionSpec sSpec = new SelectionSpec();
    sSpec.setName("VisitFolders");

    // TraversalSpec to get to the DataCenter from rootFolder
    TraversalSpec traversalSpec = new TraversalSpec();
    traversalSpec.setName("VisitFolders");
    traversalSpec.setType("Folder");
    traversalSpec.setPath("childEntity");
    traversalSpec.setSkip(false);
    traversalSpec.getSelectSet().add(sSpec);
    return traversalSpec;
  }
Пример #2
0
  /** @return TraversalSpec specification to get to the VirtualMachine managed object. */
  private static 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 TraversalSpec();
    vAppToVM.setName("vAppToVM");
    vAppToVM.setType("VirtualApp");
    vAppToVM.setPath("vm");

    // Traversal spec 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<SelectionSpec>();
    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<SelectionSpec>();
    sSpecArr.add(sSpec);
    sSpecArr.add(dataCenterToVMFolder);
    sSpecArr.add(vAppToVM);
    sSpecArr.add(vAppToVApp);
    traversalSpec.getSelectSet().addAll(sSpecArr);
    return traversalSpec;
  }
Пример #3
0
 private static SelectionSpec getSelectionSpec(String name) {
   SelectionSpec genericSpec = new SelectionSpec();
   genericSpec.setName(name);
   return genericSpec;
 }