本文整理汇总了Java中io.kamax.vbox.VBoxNetMode类的典型用法代码示例。如果您正苦于以下问题:Java VBoxNetMode类的具体用法?Java VBoxNetMode怎么用?Java VBoxNetMode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
VBoxNetMode类属于io.kamax.vbox包,在下文中一共展示了VBoxNetMode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeAdaptor
import io.kamax.vbox.VBoxNetMode; //导入依赖的package包/类
@Override
public void removeAdaptor(String modeId, String adaptorId) throws InvalidNetworkModeException {
VBoxNetMode mode = VBoxNetMode.getEnum(modeId);
switch (mode) {
case HostOnly:
removeHostOnlyAdaptor(adaptorId);
break;
case NATNetwork:
removeNatNetworkAdaptor(adaptorId);
break;
default:
if (mode.canRemoveAdaptor()) {
Logger.warning("Got a valid but non supported net mode: " + modeId);
}
throw new InvalidNetworkModeException(modeId, modeId + " does not support adaptor removal");
}
}
示例2: getNetAdaptorConfig
import io.kamax.vbox.VBoxNetMode; //导入依赖的package包/类
@Override
public _NetAdaptorConfigureView getNetAdaptorConfig(String srvId, String modeId, String adaptId) {
if (VBoxNetMode.NATNetwork.is(modeId)) {
return new NATNetworkNicEditor(srvId, modeId, adaptId);
} else {
return super.getNetAdaptorConfig(srvId, modeId, adaptId);
}
}
示例3: listAdaptors
import io.kamax.vbox.VBoxNetMode; //导入依赖的package包/类
@Override
public List<_NetAdaptor> listAdaptors() {
List<_NetAdaptor> listInfo = new ArrayList<_NetAdaptor>();
for (VBoxNetMode mode : VBoxNetMode.values()) {
listInfo.addAll(listAdaptors(mode.getId()));
}
return listInfo;
}
示例4: createAdaptor
import io.kamax.vbox.VBoxNetMode; //导入依赖的package包/类
@Override
public _NetAdaptor createAdaptor(String modeId, String name) throws InvalidNetworkModeException {
VBoxNetMode mode = VBoxNetMode.getEnum(modeId);
switch (mode) {
case HostOnly:
return createHostOnlyAdaptor(name);
case NATNetwork:
return createNatNetworkAdaptor(name);
default:
if (mode.canAddAdaptor()) {
Logger.warning("Got a valid but non supported net mode: " + modeId);
}
throw new InvalidNetworkModeException(modeId, modeId + " does not support adaptor creation");
}
}
示例5: createHostOnlyAdaptor
import io.kamax.vbox.VBoxNetMode; //导入依赖的package包/类
public _NetAdaptor createHostOnlyAdaptor(String name) {
Holder<IHostNetworkInterface> holder = new Holder<IHostNetworkInterface>();
IProgress p = VBox.get().getHost().createHostOnlyNetworkInterface(holder);
p.waitForCompletion(-1);
if (p.getResultCode() != 0) {
throw new HyperboxException("Error creating host only interface: " + p.getErrorInfo().getText());
}
_NetAdaptor adaptor = getNetAdaptor(VBoxNetMode.HostOnly.getId(), holder.value.getId());
EventManager.post(new NetAdaptorAddedEvent(this, adaptor.getMode().getId(), adaptor.getId()));
return adaptor;
}
示例6: removeHostOnlyAdaptor
import io.kamax.vbox.VBoxNetMode; //导入依赖的package包/类
public void removeHostOnlyAdaptor(String adaptorId) {
Logger.verbose("Removing Host-Only adaptor: " + adaptorId);
IProgress p = VBox.get().getHost().removeHostOnlyNetworkInterface(adaptorId);
p.waitForCompletion(-1);
if (p.getResultCode() != 0) {
throw new HyperboxException("Error removing host only interface: " + p.getErrorInfo().getText());
} else {
EventManager.post(new NetAdaptorRemovedEvent(this, VBoxNetMode.HostOnly.getId(), adaptorId));
}
}
示例7: getNetAdaptorConfig
import io.kamax.vbox.VBoxNetMode; //导入依赖的package包/类
@Override
public _NetAdaptorConfigureView getNetAdaptorConfig(String srvId, String modeId, String adaptId) {
if (VBoxNetMode.HostOnly.is(modeId)) {
return new HostOnlyNicEditor(srvId, modeId, adaptId);
} else if (VBoxNetMode.NATNetwork.is(modeId)) {
return new NATNetworkNicEditor(srvId, modeId, adaptId);
} else {
throw new HyperboxException(modeId + " is not supported in GUI");
}
}
示例8: VBoxNatNetworkAdaptor
import io.kamax.vbox.VBoxNetMode; //导入依赖的package包/类
public VBoxNatNetworkAdaptor(INATNetwork natNet) {
super(natNet.getNetworkName(), natNet.getNetworkName(), VBoxNetMode.NATNetwork, natNet.getEnabled());
}
示例9: VBoxHostOnlyAdaptor
import io.kamax.vbox.VBoxNetMode; //导入依赖的package包/类
public VBoxHostOnlyAdaptor(IHostNetworkInterface nic) {
super(nic.getId(), nic.getName(), VBoxNetMode.HostOnly, nic.getStatus().equals(HostNetworkInterfaceStatus.Up));
}
示例10: VBoxBridgedAdaptor
import io.kamax.vbox.VBoxNetMode; //导入依赖的package包/类
public VBoxBridgedAdaptor(IHostNetworkInterface nic) {
super(nic.getId(), nic.getName(), VBoxNetMode.Bridged, nic.getStatus().equals(HostNetworkInterfaceStatus.Up));
}
示例11: listNetworkModes
import io.kamax.vbox.VBoxNetMode; //导入依赖的package包/类
@Override
public List<_NetMode> listNetworkModes() {
return new ArrayList<_NetMode>(Arrays.asList(VBoxNetMode.values()));
}
示例12: getNetworkMode
import io.kamax.vbox.VBoxNetMode; //导入依赖的package包/类
@Override
public _NetMode getNetworkMode(String id) {
return VBoxNetMode.getEnum(id);
}
示例13: createNatNetworkAdaptor
import io.kamax.vbox.VBoxNetMode; //导入依赖的package包/类
public _NetAdaptor createNatNetworkAdaptor(String name) {
VBox.get().createNATNetwork(name);
_NetAdaptor adaptor = getNetAdaptor(VBoxNetMode.NATNetwork.getId(), name);
EventManager.post(new NetAdaptorAddedEvent(this, adaptor.getMode().getId(), adaptor.getId()));
return adaptor;
}
示例14: removeNatNetworkAdaptor
import io.kamax.vbox.VBoxNetMode; //导入依赖的package包/类
public void removeNatNetworkAdaptor(String name) {
Logger.verbose("Removing NAT Network: " + name);
INATNetwork natNet = VBox.get().findNATNetworkByName(name);
VBox.get().removeNATNetwork(natNet);
EventManager.post(new NetAdaptorRemovedEvent(this, VBoxNetMode.NATNetwork.getId(), name));
}
示例15: getNetAdaptor
import io.kamax.vbox.VBoxNetMode; //导入依赖的package包/类
@Override
public _NetAdaptor getNetAdaptor(String modeId, String adaptorId) throws NetworkAdaptorNotFoundException {
VBoxNetMode type = VBoxNetMode.getEnum(modeId);
IHostNetworkInterface nic = null;
switch (type) {
case Bridged:
nic = vbMgr.getVBox().getHost().findHostNetworkInterfaceById(adaptorId);
if (!nic.getInterfaceType().equals(HostNetworkInterfaceType.Bridged)) {
throw new HyperboxException("Adaptor of type " + type + " with ID " + adaptorId + " was not found");
}
return new VBoxBridgedAdaptor(nic);
case Generic:
for (String driver : vbMgr.getVBox().getGenericNetworkDrivers()) {
if (driver.equalsIgnoreCase(adaptorId)) {
return new VBoxAdaptor(driver, driver, type, true);
}
}
throw new HyperboxException("Adaptor of type " + type + " with ID " + adaptorId + " was not found");
case HostOnly:
nic = vbMgr.getVBox().getHost().findHostNetworkInterfaceById(adaptorId);
if (!nic.getInterfaceType().equals(HostNetworkInterfaceType.HostOnly)) {
throw new HyperboxException("Adaptor of type " + type + " with ID " + adaptorId + " was not found");
}
return new VBoxHostOnlyAdaptor(nic);
case Internal:
for (String internalNet : vbMgr.getVBox().getInternalNetworks()) {
if (internalNet.equalsIgnoreCase(adaptorId)) {
return new VBoxAdaptor(internalNet, internalNet, type, true);
}
}
throw new HyperboxException("Adaptor of type " + type + " with ID " + adaptorId + " was not found");
case NAT:
throw new InvalidNetworkModeException(modeId, modeId + " does not support network adaptor");
case NATNetwork:
INATNetwork natNet = vbMgr.getVBox().findNATNetworkByName(adaptorId);
return new VBoxNatNetworkAdaptor(natNet);
default:
Logger.warning("Got a valid but non supported net mode: " + modeId);
throw new InvalidNetworkModeException(modeId);
}
}