本文整理匯總了Java中org.dasein.cloud.compute.VMFilterOptions類的典型用法代碼示例。如果您正苦於以下問題:Java VMFilterOptions類的具體用法?Java VMFilterOptions怎麽用?Java VMFilterOptions使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
VMFilterOptions類屬於org.dasein.cloud.compute包,在下文中一共展示了VMFilterOptions類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: listVirtualMachines
import org.dasein.cloud.compute.VMFilterOptions; //導入依賴的package包/類
@Nonnull
@Override
public Iterable<VirtualMachine> listVirtualMachines(@Nullable VMFilterOptions options) throws InternalException, CloudException {
APITrace.begin(provider, LIST_VIRTUAL_MACHINES);
try {
try {
VirtustreamMethod method = new VirtustreamMethod(provider);
List<VirtualMachine> list = new ArrayList<VirtualMachine>();
String obj = method.getString("/VirtualMachine?$filter=IsTemplate eq false and IsRemoved eq false", LIST_VIRTUAL_MACHINES);
if (obj != null && obj.length() > 0) {
JSONArray json = new JSONArray(obj);
for (int i= 0; i<json.length(); i++) {
VirtualMachine vm = toVirtualMachine(json.getJSONObject(i));
if (vm != null && (options == null || options.matches(vm))) {
list.add(vm);
}
}
}
return list;
}
catch (JSONException e) {
logger.error(e);
throw new InternalException("Unable to parse JSONObject "+e.getMessage());
}
}
finally {
APITrace.end();
}
}
示例2: getVirtualMachine
import org.dasein.cloud.compute.VMFilterOptions; //導入依賴的package包/類
@Override
public VirtualMachine getVirtualMachine(@Nonnull String vmId) throws InternalException, CloudException {
//TODO: Ditch this - do readtopology call instead then toVM and throw away non matching device IDs.
VMFilterOptions options = VMFilterOptions.getInstance(vmId);
ArrayList<VirtualMachine> vms = (ArrayList<VirtualMachine>)listVirtualMachines(options);
for(VirtualMachine vm : vms){
if(vm.getProviderVirtualMachineId().equals(vmId)) return vm;
}
throw new InternalException("Could not find VM with ID: " + vmId);
}
示例3: listVirtualMachines
import org.dasein.cloud.compute.VMFilterOptions; //導入依賴的package包/類
@Override
public Iterable<VirtualMachine> listVirtualMachines() throws InternalException, CloudException {
VMFilterOptions options = VMFilterOptions.getInstance();
return listVirtualMachines(options);
}
示例4: listVirtualMachines
import org.dasein.cloud.compute.VMFilterOptions; //導入依賴的package包/類
@Override
@Nonnull
public Iterable<VirtualMachine> listVirtualMachines(@Nullable VMFilterOptions options) throws InternalException, CloudException {
return listVirtualMachines();
}