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

项目:photon-model    文件:ObjectFactory.java   
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link DeviceNotSupported }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "urn:pbm", name = "DeviceNotSupportedFault")
public JAXBElement<DeviceNotSupported> createDeviceNotSupportedFault(DeviceNotSupported value) {
    return new JAXBElement<DeviceNotSupported>(_DeviceNotSupportedFault_QNAME, DeviceNotSupported.class, null, value);
}
项目:vijava    文件:VirtualMachineDeviceManager.java   
private static VirtualNetworkAdapterType validateNicType(GuestOsDescriptor[] guestOsDescriptorList,
   String guestId, VirtualNetworkAdapterType adapterType) throws DeviceNotSupported 
{
  VirtualNetworkAdapterType result = adapterType;

  GuestOsDescriptor guestOsInfo = null;

  for (GuestOsDescriptor desc : guestOsDescriptorList) 
  {
    if(desc.getId().equalsIgnoreCase(guestId))
    {
      guestOsInfo = desc;
      break;
    }
  }

  if (adapterType == VirtualNetworkAdapterType.Unknown) 
  {
    result = TryGetNetworkAdapterType(guestOsInfo);
  } 
  else 
  {
    if (guestOsInfo.getSupportedEthernetCard() != null) 
    {
      boolean supported = false;
      List<String> supportedTypeList = new ArrayList<String>();

      for(String supportedAdapterName : guestOsInfo.getSupportedEthernetCard()) 
      {
        VirtualNetworkAdapterType supportedAdapterType = GetNetworkAdapterTypeByApiType(supportedAdapterName);
        supportedTypeList.add(supportedAdapterType.toString());

        if (supportedAdapterType == adapterType) 
        {
          supported = true;
          break;
        }
      }

      if (!supported) 
      {
        DeviceNotSupported dns = new DeviceNotSupported();
        dns.setDevice("Virtual NIC");
        dns.setReason("The requested NIC is not supported in this OS.");
        throw dns;
      }
    }
  }
  return result;
}