• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ObjectUpdate类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



ObjectUpdate类属于com.vmware.vim25包,在下文中一共展示了ObjectUpdate类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: handleUpdate

import com.vmware.vim25.ObjectUpdate; //导入依赖的package包/类
private void handleUpdate(UpdateSet update) throws Exception
{
    ObjectUpdate[] vmUpdates;

    PropertyFilterUpdate[] pfus = update.getFilterSet();

    if (pfus == null) {
        return;
    }
    for (int pfui = 0; pfui < pfus.length; pfui++)
    {
        vmUpdates = pfus[pfui].getObjectSet();

        if (vmUpdates == null) {
            continue;
        }
        for (ObjectUpdate vmi : vmUpdates)
        {
            handleChanges(vmi);
        }
    }
}
 
开发者ID:Juniper,项目名称:contrail-vcenter-plugin,代码行数:23,代码来源:VCenterNotify.java


示例2: handleObjectUpdate

import com.vmware.vim25.ObjectUpdate; //导入依赖的package包/类
void handleObjectUpdate(ObjectUpdate oUpdate)
{
    PropertyChange[] pc = oUpdate.getChangeSet();
    System.out.println("Update kind = " + oUpdate.getKind());
    if (oUpdate.getKind() == ObjectUpdateKind.enter)
    {
        System.out.println(" New Data:");
        handleChanges(pc);
    } else if (oUpdate.getKind() == ObjectUpdateKind.leave)
    {
        System.out.println(" Removed Data:");
        handleChanges(pc);
    } else if (oUpdate.getKind() == ObjectUpdateKind.modify)
    {
        System.out.println(" Changed Data:");
        handleChanges(pc);
    }

}
 
开发者ID:Juniper,项目名称:vijava,代码行数:20,代码来源:VMEventsMonitor.java


示例3: handleUpdate

import com.vmware.vim25.ObjectUpdate; //导入依赖的package包/类
static void handleUpdate(UpdateSet update) 
{
   ArrayList vmUpdates = new ArrayList();
   ArrayList hostUpdates = new ArrayList();
   PropertyFilterUpdate[] pfus = update.getFilterSet(); 
   for(int i=0; i<pfus.length; i++) 
   {
      ObjectUpdate[] ous = pfus[i].getObjectSet();
      for(int j=0; j<ous.length; ++j) 
      {
         if(ous[j].getObj().getType().equals("VirtualMachine")) 
         {
            vmUpdates.add(ous[j]);
         } 
         else if(ous[j].getObj().getType().equals("HostSystem")) 
         {
            hostUpdates.add(ous[j]);
         }
      }
   }      
   if(vmUpdates.size() > 0) 
   {
      System.out.println("Virtual Machine updates:");
      for(Iterator vmi = vmUpdates.iterator(); vmi.hasNext();) 
      {
         handleObjectUpdate((ObjectUpdate)vmi.next());
      }
   }      
   if(hostUpdates.size() > 0) 
   {
      System.out.println("Host updates:");
      for(Iterator vmi = hostUpdates.iterator(); vmi.hasNext();) 
      {
         handleObjectUpdate((ObjectUpdate)vmi.next());
      }
   }
}
 
开发者ID:Juniper,项目名称:vijava,代码行数:38,代码来源:GetUpdates.java


示例4: handleUpdate

import com.vmware.vim25.ObjectUpdate; //导入依赖的package包/类
void handleUpdate(UpdateSet update)
{
    ObjectUpdate[] vmUpdates;
    PropertyFilterUpdate[] pfus = update.getFilterSet();
    for (int pfui = 0; pfui < pfus.length; pfui++)
    {
        System.out.println("Virtual Machine updates:");
        vmUpdates = pfus[pfui].getObjectSet();
        for (ObjectUpdate vmi : vmUpdates)
        {
            System.out.println("Handling object update");
            handleObjectUpdate(vmi);
        }
    }
}
 
开发者ID:Juniper,项目名称:vijava,代码行数:16,代码来源:VMEventsMonitor.java


示例5: update

import com.vmware.vim25.ObjectUpdate; //导入依赖的package包/类
public void update(Observable obj, Object arg)
{
    if (arg instanceof PropertyFilterUpdate[])
    {
        PropertyFilterUpdate[] pfus = (PropertyFilterUpdate[]) arg;
        
        for(int i=0; pfus!=null && i< pfus.length; i++)
        {
            ObjectUpdate[] ous = pfus[i].getObjectSet();
            for(int j=0; ous!=null && j < ous.length; j++)
            {
                ManagedObjectReference mor = ous[j].getObj();
                if(! items.containsKey(mor))
                {
                    items.put(mor, new ConcurrentHashMap<String, Object>());
                }
                Map<String, Object> moMap = items.get(mor);
                
                PropertyChange[] pcs = ous[j].getChangeSet();
                if(pcs==null)
                {
                  continue;
                }
                for(int k=0; k < pcs.length; k++)
                {
                	  Object value = pcs[k].getVal();
                	  value = value == null ? NULL : value; //null is not allowed as value in CHM
                	  String propName = pcs[k].getName();
                	  if(moMap.containsKey(propName))
                	  {
                	    moMap.put(propName, value);
                	  }
                	  else
                	  {
                	    String parentPropName = getExistingParentPropName(moMap, propName);
                	    if(parentPropName != null)
                	    {
                	      ManagedObject mo = MorUtil.createExactManagedObject(si.getServerConnection(), mor);
                	      moMap.put(parentPropName, mo.getPropertyByPath(parentPropName));
                	    }
                	    else
                	    { //almost impossible to be here.
                	      moMap.put(propName, value);
                	    }
                	  }
                }
            }
        }
    }
    isReady = true;
}
 
开发者ID:Juniper,项目名称:vijava,代码行数:52,代码来源:ManagedObjectCache.java


示例6: handleObjectUpdate

import com.vmware.vim25.ObjectUpdate; //导入依赖的package包/类
static void handleObjectUpdate(ObjectUpdate oUpdate) 
{
   PropertyChange[] pc = oUpdate.getChangeSet();
   System.out.println(oUpdate.getKind() + "Data:");
handleChanges(pc);
}
 
开发者ID:Juniper,项目名称:vijava,代码行数:7,代码来源:GetUpdates.java


示例7: wait

import com.vmware.vim25.ObjectUpdate; //导入依赖的package包/类
/**
 * Handle Updates for a single object. waits till expected values of
 * properties to check are reached Destroys the ObjectFilter when done.
 *
 * @param objMor         MOR of the Object to wait for param
 * @param filterProps    Properties list to filter
 * @param endWaitProps   Properties list to check for expected values these be properties
 *                       of a property in the filter properties list
 * @param expectedValues values for properties to end the wait
 * @return true indicating expected values were met, and false otherwise
 * @throws RuntimeFaultFaultMsg
 * @throws InvalidPropertyFaultMsg
 * @throws InvalidCollectorVersionFaultMsg
 */
public Object[] wait(ManagedObjectReference objMor, String[] filterProps, String[] endWaitProps, Object[][] expectedValues)
        throws InvalidPropertyFaultMsg, RuntimeFaultFaultMsg, InvalidCollectorVersionFaultMsg {

    String version = Constants.EMPTY;
    String stateVal = null;

    Object[] endValues = new Object[endWaitProps.length];
    Object[] filterValues = new Object[filterProps.length];

    PropertyFilterSpec spec = propertyFilterSpec(objMor, filterProps);
    ManagedObjectReference filterSpecRef = vimPort.createFilter(serviceContent.getPropertyCollector(), spec, true);

    boolean reached = false;
    UpdateSet updateset;
    while (!reached) {
        updateset = vimPort.waitForUpdatesEx(serviceContent.getPropertyCollector(), version, new WaitOptions());

        int waitForUpdateCounter = 0;
        if (updateset == null || updateset.getFilterSet() == null) {
            waitForUpdateCounter++;
            if (waitForUpdateCounter <= MAX_TRIED_WAIT_FOR_UPDATE_COUNTER) {
                continue;
            }
            break;
        }

        version = updateset.getVersion();
        for (PropertyFilterUpdate filtup : updateset.getFilterSet()) {
            for (ObjectUpdate objup : filtup.getObjectSet()) {
                if (objup.getKind() == ObjectUpdateKind.MODIFY || objup.getKind() == ObjectUpdateKind.ENTER ||
                        objup.getKind() == ObjectUpdateKind.LEAVE) {
                    for (PropertyChange propchg : objup.getChangeSet()) {
                        updateValues(endWaitProps, endValues, propchg);
                        updateValues(filterProps, filterValues, propchg);
                    }
                }
            }
        }
        // Check if the expected values have been reached and exit the loop if done.
        // Also exit the WaitForUpdates loop if this is the case.
        for (int chgi = 0; chgi < endValues.length && !reached; chgi++) {
            for (int vali = 0; vali < expectedValues[chgi].length && !reached; vali++) {
                Object expctdval = expectedValues[chgi][vali];
                if (endValues[chgi].toString().contains(KEY_VALUE_NULL_STRING)) {
                    Element stateElement = (Element) endValues[chgi];
                    if (stateElement != null && stateElement.getFirstChild() != null) {
                        stateVal = stateElement.getFirstChild().getTextContent();
                        reached = expctdval.toString().equalsIgnoreCase(stateVal);
                    }
                } else {
                    expctdval = expectedValues[chgi][vali];
                    reached = expctdval.equals(endValues[chgi]);
                    stateVal = FILTER_VALUES;
                }
            }
        }
    }
    try {
        vimPort.destroyPropertyFilter(filterSpecRef);
    } catch (RuntimeFaultFaultMsg e) {
        throw new RuntimeException(e.getMessage());
    }

    return getObjectState(stateVal, filterValues);
}
 
开发者ID:CloudSlang,项目名称:cs-actions,代码行数:80,代码来源:WaitForValues.java


示例8: waitForValues

import com.vmware.vim25.ObjectUpdate; //导入依赖的package包/类
private static Object[] waitForValues(VMwareConnection connection, ManagedObjectReference morObj, String[] filterProps,
        String[] endWaitProps, Object[][] expectedVals) throws InvalidPropertyFaultMsg, RuntimeFaultFaultMsg,
        InvalidCollectorVersionFaultMsg {
    String version = "";
    Object[] endVals = new Object[endWaitProps.length];
    Object[] filterVals = new Object[filterProps.length];

    PropertyFilterSpec spec = new PropertyFilterSpec();

    ObjectSpec oSpec = new ObjectSpec();

    oSpec.setObj(morObj);
    oSpec.setSkip(Boolean.FALSE);

    spec.getObjectSet().add(oSpec);

    PropertySpec pSpec = new PropertySpec();

    pSpec.getPathSet().addAll(Arrays.asList(filterProps));
    pSpec.setType(morObj.getType());

    spec.getPropSet().add(pSpec);

    ManagedObjectReference propertyCollector = connection.getServiceContent().getPropertyCollector();
    ManagedObjectReference filterSpecRef = connection.getVimPortType().createFilter(propertyCollector, spec, true);

    boolean reached = false;

    UpdateSet updateSet;
    List<PropertyFilterUpdate> lstPropertyFilterUpdates;
    List<ObjectUpdate> lstObjectUpdates;
    List<PropertyChange> lstPropertyChanges;

    while (!reached) {
        updateSet = connection.getVimPortType().waitForUpdates(propertyCollector, version);

        if (updateSet == null || updateSet.getFilterSet() == null) {
            continue;
        }

        version = updateSet.getVersion();

        lstPropertyFilterUpdates = updateSet.getFilterSet();

        for (PropertyFilterUpdate propertyFilterUpdate : lstPropertyFilterUpdates) {
            lstObjectUpdates = propertyFilterUpdate.getObjectSet();

            for (ObjectUpdate objUpdate : lstObjectUpdates) {
                if (objUpdate.getKind() == ObjectUpdateKind.MODIFY || objUpdate.getKind() == ObjectUpdateKind.ENTER ||
                        objUpdate.getKind() == ObjectUpdateKind.LEAVE) {
                    lstPropertyChanges = objUpdate.getChangeSet();

                    for (PropertyChange propchg : lstPropertyChanges) {
                        updateValues(endWaitProps, endVals, propchg);
                        updateValues(filterProps, filterVals, propchg);
                    }
                }
            }
        }

        Object expectedValue;

        // Check if the expected values have been reached and exit the loop if done.
        // Also, exit the WaitForUpdates loop if this is the case.
        for (int chgi = 0; chgi < endVals.length && !reached; chgi++) {
            for (int vali = 0; vali < expectedVals[chgi].length && !reached; vali++) {
                expectedValue = expectedVals[chgi][vali];

                reached = expectedValue.equals(endVals[chgi]) || reached;
            }
        }
    }

    // Destroy the filter when we are done.
    connection.getVimPortType().destroyPropertyFilter(filterSpecRef);

    return filterVals;
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:79,代码来源:VMwareUtil.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PlotLane类代码示例发布时间:2022-05-22
下一篇:
Java MongoRepositoryFactory类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap