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


Java ObjectContent.getObj方法代码示例

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


在下文中一共展示了ObjectContent.getObj方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: resultsToTgtMorefMap

import com.vmware.vim25.ObjectContent; //导入方法依赖的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: populate

import com.vmware.vim25.ObjectContent; //导入方法依赖的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

示例3: populate

import com.vmware.vim25.ObjectContent; //导入方法依赖的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

示例4: findDatastore

import com.vmware.vim25.ObjectContent; //导入方法依赖的package包/类
public ManagedObjectReference findDatastore(String name) throws Exception {
    // added Apache CloudStack specific name convention, we will use custom field "cloud.uuid" as datastore name as well
    CustomFieldsManagerMO cfmMo = new CustomFieldsManagerMO(_context, _context.getServiceContent().getCustomFieldsManager());
    int key = cfmMo.getCustomFieldKey("Datastore", CustomFieldConstants.CLOUD_UUID);
    assert (key != 0);

    List<ObjectContent> ocs = getDatastorePropertiesOnHostDatastoreSystem(new String[] {"name", String.format("value[%d]", key)});
    if (ocs != null) {
        for (ObjectContent oc : ocs) {
            if (oc.getPropSet().get(0).getVal().equals(name))
                return oc.getObj();

            if (oc.getPropSet().size() > 1) {
                DynamicProperty prop = oc.getPropSet().get(1);
                if (prop != null && prop.getVal() != null) {
                    if (prop.getVal() instanceof CustomFieldStringValue) {
                        String val = ((CustomFieldStringValue)prop.getVal()).getValue();
                        if (val.equalsIgnoreCase(name))
                            return oc.getObj();
                    }
                }
            }
        }
    }
    return null;
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:27,代码来源:HostDatastoreSystemMO.java

示例5: getLocalDatastoreOnHost

import com.vmware.vim25.ObjectContent; //导入方法依赖的package包/类
public List<Pair<ManagedObjectReference, String>> getLocalDatastoreOnHost() throws Exception {
    List<Pair<ManagedObjectReference, String>> dsList = new ArrayList<Pair<ManagedObjectReference, String>>();

    ObjectContent[] ocs = getDatastorePropertiesOnHyperHost(new String[] {"name", "summary"});
    if (ocs != null) {
        for (ObjectContent oc : ocs) {
            DatastoreSummary dsSummary = (DatastoreSummary)VmwareHelper.getPropValue(oc, "summary");
            if (dsSummary.isMultipleHostAccess() == false && dsSummary.isAccessible() && dsSummary.getType().equalsIgnoreCase("vmfs")) {
                ManagedObjectReference morDs = oc.getObj();
                String name = (String)VmwareHelper.getPropValue(oc, "name");

                if (!name.startsWith("-iqn.") && !name.startsWith("_iqn.")) {
                    dsList.add(new Pair<ManagedObjectReference, String>(morDs, name));
                }
            }
        }
    }
    return dsList;
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:20,代码来源:HostMO.java

示例6: findVmFromObjectContent

import com.vmware.vim25.ObjectContent; //导入方法依赖的package包/类
public static VirtualMachineMO findVmFromObjectContent(VmwareContext context, ObjectContent[] ocs, String name, String instanceNameCustomField) {

        if (ocs != null && ocs.length > 0) {
            for (ObjectContent oc : ocs) {
                String vmNameInvCenter = null;
                String vmInternalCSName = null;
                List<DynamicProperty> objProps = oc.getPropSet();
                if (objProps != null) {
                    for (DynamicProperty objProp : objProps) {
                        if (objProp.getName().equals("name")) {
                            vmNameInvCenter = (String)objProp.getVal();
                        } else if (objProp.getName().contains(instanceNameCustomField)) {
                            if (objProp.getVal() != null)
                                vmInternalCSName = ((CustomFieldStringValue)objProp.getVal()).getValue();
                        }

                        if ((vmNameInvCenter != null && name.equalsIgnoreCase(vmNameInvCenter)) || (vmInternalCSName != null && name.equalsIgnoreCase(vmInternalCSName))) {
                            VirtualMachineMO vmMo = new VirtualMachineMO(context, oc.getObj());
                            return vmMo;
                        }
                    }
                }
            }
        }
        return null;
    }
 
开发者ID:apache,项目名称:cloudstack,代码行数:27,代码来源:HypervisorHostHelper.java

示例7: getTargetHyperHost

import com.vmware.vim25.ObjectContent; //导入方法依赖的package包/类
private VmwareHypervisorHost getTargetHyperHost(DatacenterMO dcMo, String destIp) throws Exception {

        VmwareManager mgr = dcMo.getContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME);

        List<ObjectContent> ocs = dcMo.getHostPropertiesOnDatacenterHostFolder(new String[] {"name", "parent"});
        if (ocs != null && ocs.size() > 0) {
            for (ObjectContent oc : ocs) {
                HostMO hostMo = new HostMO(dcMo.getContext(), oc.getObj());
                VmwareHypervisorHostNetworkSummary netSummary = hostMo.getHyperHostNetworkSummary(mgr.getManagementPortGroupByHost(hostMo));
                if (destIp.equalsIgnoreCase(netSummary.getHostIp())) {
                    return new HostMO(dcMo.getContext(), oc.getObj());
                }
            }
        }

        throw new Exception("Unable to locate dest host by " + destIp);
    }
 
开发者ID:apache,项目名称:cloudstack,代码行数:18,代码来源:VmwareResource.java

示例8: AbstractOverlay

import com.vmware.vim25.ObjectContent; //导入方法依赖的package包/类
protected AbstractOverlay(ObjectContent cont) {
    this(cont.getObj(), new HashMap<>());

    for (DynamicProperty dp : cont.getPropSet()) {
        this.props.put(dp.getName(), dp.getVal());
    }
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:8,代码来源:AbstractOverlay.java

示例9: getName

import com.vmware.vim25.ObjectContent; //导入方法依赖的package包/类
private String getName(ObjectContent oc) throws FinderException {
    for (DynamicProperty dp : oc.getPropSet()) {
        if (dp.getName().equals("name")) {
            return (String) dp.getVal();
        }
    }

    throw new FinderException("No name fetched for " + oc.getObj());
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:10,代码来源:Lister.java

示例10: findByRef

import com.vmware.vim25.ObjectContent; //导入方法依赖的package包/类
private ObjectContent findByRef(ManagedObjectReference ref, List<ObjectContent> ocs) {
    if (ref == null) {
        return null;
    }

    for (ObjectContent oc : ocs) {
        ManagedObjectReference obj = oc.getObj();
        if (Objects.equals(ref.getValue(), obj.getValue())) {
            return oc;
        }
    }

    return null;
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:15,代码来源:DatacenterLister.java

示例11: findByParent

import com.vmware.vim25.ObjectContent; //导入方法依赖的package包/类
private ObjectContent findByParent(ManagedObjectReference ref, List<ObjectContent> ocs) {
    if (ref == null) {
        return null;
    }

    for (ObjectContent oc : ocs) {
        ManagedObjectReference obj = oc.getObj();
        if (Objects.equals(ref.getValue(), obj.getValue())) {
            return findByRef(prop(oc, VimNames.PROPERTY_PARENT), ocs);
        }
    }

    return null;
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:15,代码来源:DatacenterLister.java

示例12: getFromRetrieveResult

import com.vmware.vim25.ObjectContent; //导入方法依赖的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

示例13: getHostDatastoreMO

import com.vmware.vim25.ObjectContent; //导入方法依赖的package包/类
private DatastoreMO getHostDatastoreMO(String datastoreName) throws Exception {
    ObjectContent[] ocs = getDatastorePropertiesOnHyperHost(new String[] {"name"});
    if (ocs != null && ocs.length > 0) {
        for (ObjectContent oc : ocs) {
            List<DynamicProperty> objProps = oc.getPropSet();
            if (objProps != null) {
                for (DynamicProperty objProp : objProps) {
                    if (objProp.getVal().toString().equals(datastoreName))
                        return new DatastoreMO(_context, oc.getObj());
                }
            }
        }
    }
    return null;
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:16,代码来源:HostMO.java

示例14: getNetworkMor

import com.vmware.vim25.ObjectContent; //导入方法依赖的package包/类
public ManagedObjectReference getNetworkMor(String portGroupName) throws Exception {
    PropertySpec pSpec = new PropertySpec();
    pSpec.setType("Network");
    pSpec.getPathSet().add("summary.name");

    TraversalSpec host2NetworkTraversal = new TraversalSpec();
    host2NetworkTraversal.setType("HostSystem");
    host2NetworkTraversal.setPath("network");
    host2NetworkTraversal.setName("host2NetworkTraversal");

    ObjectSpec oSpec = new ObjectSpec();
    oSpec.setObj(_mor);
    oSpec.setSkip(Boolean.TRUE);
    oSpec.getSelectSet().add(host2NetworkTraversal);

    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);

    if (ocs != null) {
        for (ObjectContent oc : ocs) {
            List<DynamicProperty> props = oc.getPropSet();
            if (props != null) {
                for (DynamicProperty prop : props) {
                    if (prop.getVal().equals(portGroupName))
                        return oc.getObj();
                }
            }
        }
    }
    return null;
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:37,代码来源:HostMO.java

示例15: getDatastoreMountsOnHost

import com.vmware.vim25.ObjectContent; //导入方法依赖的package包/类
public List<Pair<ManagedObjectReference, String>> getDatastoreMountsOnHost() throws Exception {
    List<Pair<ManagedObjectReference, String>> mounts = new ArrayList<Pair<ManagedObjectReference, String>>();

    ObjectContent[] ocs = getDatastorePropertiesOnHyperHost(new String[] {String.format("host[\"%s\"].mountInfo.path", _mor.getValue())});
    if (ocs != null) {
        for (ObjectContent oc : ocs) {
            Pair<ManagedObjectReference, String> mount = new Pair<ManagedObjectReference, String>(oc.getObj(), oc.getPropSet().get(0).getVal().toString());
            mounts.add(mount);
        }
    }
    return mounts;
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:13,代码来源:HostMO.java


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