本文整理汇总了Java中io.kamax.hbox.exception.HyperboxException类的典型用法代码示例。如果您正苦于以下问题:Java HyperboxException类的具体用法?Java HyperboxException怎么用?Java HyperboxException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HyperboxException类属于io.kamax.hbox.exception包,在下文中一共展示了HyperboxException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: listNetworkInterfaces
import io.kamax.hbox.exception.HyperboxException; //导入依赖的package包/类
@Override
public Set<_RawNetworkInterface> listNetworkInterfaces() {
Set<_RawNetworkInterface> nics = new HashSet<_RawNetworkInterface>();
// TODO do this better to avoid endless loop - Check using ISystemProperties maybe?
long i = 0;
try {
while (i < 8) {
getRaw().getNetworkAdapter(i);
nics.add(new VBoxNetworkInterface(this, i));
i++;
}
} catch (VBoxException e) {
throw new HyperboxException("Unable to list NICs", e);
}
return nics;
}
示例2: get
import io.kamax.hbox.exception.HyperboxException; //导入依赖的package包/类
public static _Setting get(VBoxMedium medium, Object name) {
String uniqueId = Settings.getUniqueId(name);
if (!mediumActions.containsKey(uniqueId)) {
Logger.debug("Possible values for Medium :");
for (String key : mediumActions.keySet()) {
Logger.debug(key);
}
throw new ConfigurationException("No action defined for setting [" + uniqueId + "]");
}
IMedium rawMedium = VBox.get().openMedium(medium.getLocation(), DeviceType.valueOf(medium.getDeviceType()), AccessMode.ReadOnly, false);
try {
return mediumActions.get(uniqueId).get(rawMedium);
} catch (VBoxException e) {
throw new HyperboxException(e.getMessage());
}
}
示例3: getService
import io.kamax.hbox.exception.HyperboxException; //导入依赖的package包/类
@Override
public _NetService getService(String serviceTypeId) {
IHostNetworkInterface nic = VBox.get().getHost().findHostNetworkInterfaceById(getId());
if (NetServiceType.IPv4.is(serviceTypeId)) {
return new NetService_IP4_IO(true, nic.getIPAddress(), nic.getNetworkMask());
} else if (NetServiceType.IPv6.is(serviceTypeId)) {
return new NetService_IP6_IO(nic.getIPV6Supported(), nic.getIPV6Address(), nic.getIPV6NetworkMaskPrefixLength());
} else if (NetServiceType.DHCP_IPv4.is(serviceTypeId)) {
IDHCPServer dhcpSrv;
try {
dhcpSrv = VBox.get().findDHCPServerByNetworkName(nic.getNetworkName());
} catch (VBoxException e) {
return new NetService_DHCP_IP4_IO(false);
}
_NetService_IP4_DHCP svc = new NetService_DHCP_IP4_IO(dhcpSrv.getEnabled());
svc.setAddress(dhcpSrv.getIPAddress());
svc.setNetmask(dhcpSrv.getNetworkMask());
svc.setStartAddress(dhcpSrv.getLowerIP());
svc.setEndAddress(dhcpSrv.getUpperIP());
return svc;
} else {
throw new HyperboxException("Service type " + serviceTypeId + " is not supported on " + getMode().getId() + " adaptor");
}
}
示例4: detachMedium
import io.kamax.hbox.exception.HyperboxException; //导入依赖的package包/类
@Override
public void detachMedium(_RawMedium medium) {
boolean hasBeenFound = false;
lockAuto();
try {
for (IMediumAttachment medAttach : getVm().getMediumAttachmentsOfController(strCtrName)) {
if (medium.getUuid().contentEquals(medAttach.getMedium().getId())) {
detachMedium(medAttach.getPort(), medAttach.getDevice());
hasBeenFound = true;
break;
}
}
if (!hasBeenFound) {
throw new HyperboxException("No such media is attached");
}
} finally {
unlockAuto();
}
}
示例5: beforeClass
import io.kamax.hbox.exception.HyperboxException; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() throws HyperboxException {
hypervisor = new VBoxMscomHypervisor();
hypervisor.setEventManager(new DummyEventManager());
HypervisorTest.init();
}
示例6: getNetworkInterface
import io.kamax.hbox.exception.HyperboxException; //导入依赖的package包/类
@Override
public _RawNetworkInterface getNetworkInterface(long nicId) {
try {
// We try to get the interface simply for validation - this class is not "useful" as there are no link back to the VM from it.
getRaw().getNetworkAdapter(nicId);
return new VBoxNetworkInterface(this, nicId);
} catch (VBoxException e) {
throw new HyperboxException("Couldn't get NIC #" + nicId + " from " + getName() + " because : " + e.getMessage());
}
}
示例7: listStoroageControllers
import io.kamax.hbox.exception.HyperboxException; //导入依赖的package包/类
@Override
public Set<_RawStorageController> listStoroageControllers() {
Set<_RawStorageController> storageCtrls = new HashSet<_RawStorageController>();
try {
for (IStorageController vboxStrCtrl : getRaw().getStorageControllers()) {
storageCtrls.add(new VBoxStorageController(this, vboxStrCtrl));
}
return storageCtrls;
} catch (VBoxException e) {
throw new HyperboxException(e);
}
}
示例8: getSnapshot
import io.kamax.hbox.exception.HyperboxException; //导入依赖的package包/类
@Override
public _RawSnapshot getSnapshot(String id) {
try {
ISnapshot snap = getRaw().findSnapshot(id);
_RawSnapshot rawSnap = new VBoxSnapshot(snap);
return rawSnap;
} catch (VBoxException e) {
throw new HyperboxException(e);
}
}
示例9: getCurrentSnapshot
import io.kamax.hbox.exception.HyperboxException; //导入依赖的package包/类
@Override
public _RawSnapshot getCurrentSnapshot() {
try {
return new VBoxSnapshot(getRaw().getCurrentSnapshot());
} catch (VBoxException e) {
throw new HyperboxException(e);
}
}
示例10: hasHypervisorTools
import io.kamax.hbox.exception.HyperboxException; //导入依赖的package包/类
@Override
public boolean hasHypervisorTools() {
lockAuto();
try {
return !session.getConsole().getGuest().getAdditionsStatus(AdditionsRunLevelType.None);
} catch (VBoxException e) {
throw new HyperboxException(e);
} finally {
unlockAuto();
}
}
示例11: getHypervisorTools
import io.kamax.hbox.exception.HyperboxException; //导入依赖的package包/类
@Override
public _RawHypervisorTools getHypervisorTools() {
// TODO Auto-generated method stub
lockAuto();
try {
return null;
} catch (VBoxException e) {
throw new HyperboxException(e);
} finally {
unlockAuto();
}
}
示例12: setProperty
import io.kamax.hbox.exception.HyperboxException; //导入依赖的package包/类
@Override
public void setProperty(String key, String value) {
ISession session = VBoxSessionManager.get().lockAuto(machine.getUuid());
try {
Logger.debug("Setting VRDE Property with key " + key + " and value " + value);
session.getMachine().getVRDEServer().setVRDEProperty(key, value);
} catch (VBoxException e) {
throw new HyperboxException(e.getMessage());
} finally {
VBoxSessionManager.get().unlockAuto(machine.getUuid(), true);
}
}
示例13: loadSnapshotActions
import io.kamax.hbox.exception.HyperboxException; //导入依赖的package包/类
private static void loadSnapshotActions() throws HyperboxException {
snapshotActions = new HashMap<String, _SnapshotSettingAction>();
Set<_SnapshotSettingAction> subTypes = ClassManager.getAllOrFail(_SnapshotSettingAction.class);
for (_SnapshotSettingAction item : subTypes) {
snapshotActions.put(item.getSettingName(), item);
Logger.debug("Linking " + item.getSettingName() + " to " + item.getClass().getSimpleName());
}
}
示例14: loadMachineActions
import io.kamax.hbox.exception.HyperboxException; //导入依赖的package包/类
private static void loadMachineActions() throws HyperboxException {
vmActions = new HashMap<String, _MachineSettingAction>();
Set<_MachineSettingAction> subTypes = ClassManager.getAllOrFail(_MachineSettingAction.class);
for (_MachineSettingAction item : subTypes) {
vmActions.put(item.getSettingName(), item);
}
}
示例15: loadNicActions
import io.kamax.hbox.exception.HyperboxException; //导入依赖的package包/类
private static void loadNicActions() throws HyperboxException {
nicActions = new HashMap<String, _NetworkInterfaceSettingAction>();
// TODO replace with .getAtLeastOneOrFail()
Set<_NetworkInterfaceSettingAction> subTypes = ClassManager.getAllOrFail(_NetworkInterfaceSettingAction.class);
for (_NetworkInterfaceSettingAction item : subTypes) {
nicActions.put(item.getSettingName(), item);
}
}