当前位置: 首页>>代码示例>>Java>>正文


Java VBoxNetMode类代码示例

本文整理汇总了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");
    }
}
 
开发者ID:hyperbox,项目名称:vbox-4.3,代码行数:18,代码来源:VBoxHypervisor.java

示例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);
    }
}
 
开发者ID:hyperbox,项目名称:vbox-4.3,代码行数:9,代码来源:Model_4_3.java

示例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;
}
 
开发者ID:hyperbox,项目名称:vbox-4.3,代码行数:9,代码来源:VBoxHypervisor.java

示例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");
    }
}
 
开发者ID:hyperbox,项目名称:vbox-4.3,代码行数:16,代码来源:VBoxHypervisor.java

示例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;
}
 
开发者ID:hyperbox,项目名称:vbox-4.3,代码行数:12,代码来源:VBoxHypervisor.java

示例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));
    }
}
 
开发者ID:hyperbox,项目名称:vbox-4.3,代码行数:11,代码来源:VBoxHypervisor.java

示例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");
    }

}
 
开发者ID:hyperbox,项目名称:vbox-common,代码行数:12,代码来源:GenericModel.java

示例8: VBoxNatNetworkAdaptor

import io.kamax.vbox.VBoxNetMode; //导入依赖的package包/类
public VBoxNatNetworkAdaptor(INATNetwork natNet) {
    super(natNet.getNetworkName(), natNet.getNetworkName(), VBoxNetMode.NATNetwork, natNet.getEnabled());
}
 
开发者ID:hyperbox,项目名称:vbox-4.3,代码行数:4,代码来源:VBoxNatNetworkAdaptor.java

示例9: VBoxHostOnlyAdaptor

import io.kamax.vbox.VBoxNetMode; //导入依赖的package包/类
public VBoxHostOnlyAdaptor(IHostNetworkInterface nic) {
    super(nic.getId(), nic.getName(), VBoxNetMode.HostOnly, nic.getStatus().equals(HostNetworkInterfaceStatus.Up));
}
 
开发者ID:hyperbox,项目名称:vbox-4.3,代码行数:4,代码来源:VBoxHostOnlyAdaptor.java

示例10: VBoxBridgedAdaptor

import io.kamax.vbox.VBoxNetMode; //导入依赖的package包/类
public VBoxBridgedAdaptor(IHostNetworkInterface nic) {
    super(nic.getId(), nic.getName(), VBoxNetMode.Bridged, nic.getStatus().equals(HostNetworkInterfaceStatus.Up));
}
 
开发者ID:hyperbox,项目名称:vbox-4.3,代码行数:4,代码来源:VBoxBridgedAdaptor.java

示例11: listNetworkModes

import io.kamax.vbox.VBoxNetMode; //导入依赖的package包/类
@Override
public List<_NetMode> listNetworkModes() {
    return new ArrayList<_NetMode>(Arrays.asList(VBoxNetMode.values()));
}
 
开发者ID:hyperbox,项目名称:vbox-4.3,代码行数:5,代码来源:VBoxHypervisor.java

示例12: getNetworkMode

import io.kamax.vbox.VBoxNetMode; //导入依赖的package包/类
@Override
public _NetMode getNetworkMode(String id) {
    return VBoxNetMode.getEnum(id);
}
 
开发者ID:hyperbox,项目名称:vbox-4.3,代码行数:5,代码来源:VBoxHypervisor.java

示例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;
}
 
开发者ID:hyperbox,项目名称:vbox-4.3,代码行数:7,代码来源:VBoxHypervisor.java

示例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));
}
 
开发者ID:hyperbox,项目名称:vbox-4.3,代码行数:7,代码来源:VBoxHypervisor.java

示例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);
    }

}
 
开发者ID:hyperbox,项目名称:vbox-4.3,代码行数:43,代码来源:VBoxHypervisor.java


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