Java 类com.vmware.vim25.ArrayOfManagedObjectReference 实例源码

项目:photon-model    文件:InstanceClient.java   
private boolean isSameDatastore(ManagedObjectReference datastore, ManagedObjectReference vm,
        GetMoRef get) throws InvalidPropertyFaultMsg, RuntimeFaultFaultMsg {
    if (datastore == null) {
        return false;
    }
    ArrayOfManagedObjectReference datastores = get.entityProp(vm,
            VimPath.vm_datastore);
    if (null != datastores) {
        for (ManagedObjectReference p : datastores.getManagedObjectReference()) {
            if (p.getValue().equals(datastore.getValue())) {
                return true;
            }
        }
    }
    return false;
}
项目:photon-model    文件:InstanceClient.java   
/**
 * Finds the datastore to use for the VM from the ComputeState.description.datastoreId.
 */
private ManagedObjectReference getDatastore()
        throws RuntimeFaultFaultMsg, InvalidPropertyFaultMsg, FinderException {
    if (this.datastore != null) {
        return this.datastore;
    }

    String datastorePath = this.ctx.child.description.dataStoreId;

    if (datastorePath == null) {
        ArrayOfManagedObjectReference datastores = findDatastoresForPlacement(
                this.ctx.computeMoRef);
        if (datastores == null || datastores.getManagedObjectReference().isEmpty()) {
            this.datastore = this.finder.defaultDatastore().object;
        } else {
            this.datastore = datastores.getManagedObjectReference().get(0);
        }
    } else {
        this.datastore = this.finder.datastore(datastorePath).object;
    }

    return this.datastore;
}
项目:photon-model    文件:ComputeResourceOverlay.java   
public Collection<ManagedObjectReference> getHosts() {
    ArrayOfManagedObjectReference hosts = (ArrayOfManagedObjectReference) getOrDefault(
            VimPath.res_host, null);
    if (hosts != null) {
        return hosts.getManagedObjectReference();
    } else {
        return Collections.emptyList();
    }
}
项目:photon-model    文件:ComputeResourceOverlay.java   
public List<ManagedObjectReference> getDatastore() {
    ArrayOfManagedObjectReference res = (ArrayOfManagedObjectReference) getOrDefault(VimPath.res_datastore, null);
    if (res == null) {
        return Collections.emptyList();
    } else {
        return res.getManagedObjectReference();
    }
}
项目:photon-model    文件:ComputeResourceOverlay.java   
public List<ManagedObjectReference> getNetwork() {
    ArrayOfManagedObjectReference res = (ArrayOfManagedObjectReference) getOrDefault(VimPath.res_network, null);
    if (res == null) {
        return Collections.emptyList();
    } else {
        return res.getManagedObjectReference();
    }
}
项目:photon-model    文件:VmOverlay.java   
public String getDatastoreMorefsAsString() {
    ArrayOfManagedObjectReference morefs = (ArrayOfManagedObjectReference) getOrDefault(
            VimPath.vm_datastore, null);
    if (morefs != null && morefs.getManagedObjectReference() != null && !morefs
            .getManagedObjectReference().isEmpty()) {
        return String.join(DATASTORE_MOREF_DELIMITER,
                morefs.getManagedObjectReference().stream().map(moref -> VimUtils
                        .convertMoRefToString(moref)).collect(Collectors.toList()));
    }
    return null;
}
项目:photon-model    文件:HostSystemOverlay.java   
public List<ManagedObjectReference> getDatastore() {
    ArrayOfManagedObjectReference res = (ArrayOfManagedObjectReference) getOrDefault(VimPath.res_datastore, null);
    if (res == null) {
        return Collections.emptyList();
    } else {
        return res.getManagedObjectReference();
    }
}
项目:photon-model    文件:HostSystemOverlay.java   
public List<ManagedObjectReference> getNetwork() {
    ArrayOfManagedObjectReference res = (ArrayOfManagedObjectReference) getOrDefault(VimPath.res_network, null);
    if (res == null) {
        return Collections.emptyList();
    } else {
        return res.getManagedObjectReference();
    }
}
项目:photon-model    文件:InstanceClient.java   
private ArrayOfManagedObjectReference findDatastoresForPlacement(ManagedObjectReference target)
        throws InvalidPropertyFaultMsg, RuntimeFaultFaultMsg {
    if (VimNames.TYPE_RESOURCE_POOL.equals(target.getType())) {
        ManagedObjectReference owner = this.get.entityProp(target, VimNames.PROPERTY_OWNER);
        return findDatastoresForPlacement(owner);
    }
    // at this point a target is either host or ComputeResource: both have a property
    // "datastore"
    return this.get.entityProp(target, VimPath.res_datastore);
}
项目:cs-actions    文件:VmUtils.java   
private ManagedObjectReference findChildFolder(ConnectionResources connectionResources, MorObjectHandler morObjectHandler,
                                               ManagedObjectReference folder, String childName) throws Exception {
    Object childEntity = new MorObjectHandler().getObjectProperties(connectionResources, folder, CHILD_ENTITY_PROPERTY);
    if (childEntity instanceof ArrayOfManagedObjectReference) {
        ArrayOfManagedObjectReference children = (ArrayOfManagedObjectReference) childEntity;
        for (ManagedObjectReference mor : children.getManagedObjectReference()) {
            if (StringUtils.equals(mor.getType(), FOLDER.getValue()) &&
                equalsIgnoreCase(childName, unEscapeFolderPath(morObjectHandler.getObjectProperties(connectionResources, mor, NAME_PROPERTY).toString()))) {
                return mor;
            }
        }
        throw new RuntimeException(ErrorMessages.FOLDER_NOT_FOUND);
    }
    throw new RuntimeException("Unexpected exception occurred.");
}
项目:cs-actions    文件:VmUtils.java   
private ManagedObjectReference getDataStore(String dataStoreName, ConnectionResources connectionResources,
                                            ManagedObjectReference vmMor) throws InvalidPropertyFaultMsg, RuntimeFaultFaultMsg {
    ArrayOfManagedObjectReference dataStoresArray = (ArrayOfManagedObjectReference) new MorObjectHandler()
            .getObjectProperties(connectionResources, vmMor, ManagedObjectType.DATA_STORE.getValue());
    List<ManagedObjectReference> dataStores = dataStoresArray.getManagedObjectReference();
    for (ManagedObjectReference dataStore : dataStores) {
        DatastoreSummary datastoreSummary = (DatastoreSummary) new MorObjectHandler()
                .getObjectProperties(connectionResources, dataStore, ManagedObjectType.SUMMARY.getValue());
        if (dataStoreName.equalsIgnoreCase(datastoreSummary.getName())) {
            return dataStore;
        }
    }
    return null;
}