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


Java DeviceEvent.subject方法代码示例

本文整理汇总了Java中org.onosproject.net.device.DeviceEvent.subject方法的典型用法代码示例。如果您正苦于以下问题:Java DeviceEvent.subject方法的具体用法?Java DeviceEvent.subject怎么用?Java DeviceEvent.subject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.onosproject.net.device.DeviceEvent的用法示例。


在下文中一共展示了DeviceEvent.subject方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleEvent

import org.onosproject.net.device.DeviceEvent; //导入方法依赖的package包/类
private void handleEvent(DeviceEvent event) {
    Device device = event.subject();
    switch (event.type()) {
        case DEVICE_ADDED:
            break;
        case DEVICE_AVAILABILITY_CHANGED:
            if (hostRemovalEnabled &&
                    !deviceService.isAvailable(device.id())) {
                removeHosts(hostService.getConnectedHosts(device.id()));
            }
            break;
        case DEVICE_SUSPENDED:
        case DEVICE_UPDATED:
            // Nothing to do?
            break;
        case DEVICE_REMOVED:
            if (hostRemovalEnabled) {
                removeHosts(hostService.getConnectedHosts(device.id()));
            }
            break;
        case PORT_ADDED:
            break;
        case PORT_UPDATED:
            if (hostRemovalEnabled) {
                ConnectPoint point =
                        new ConnectPoint(device.id(), event.port().number());
                removeHosts(hostService.getConnectedHosts(point));
            }
            break;
        case PORT_REMOVED:
            // Nothing to do?
            break;
        default:
            break;
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:37,代码来源:HostLocationProvider.java

示例2: augment

import org.onosproject.net.device.DeviceEvent; //导入方法依赖的package包/类
/**
 * Transform Port instance on the event to Optical specific port, if it is well-formed.
 *
 * @param event original event to transform
 * @return transformed {@link DeviceEvent}
 */
public DeviceEvent augment(DeviceEvent event) {
    final Port port = augment(event.port());
    if (port == event.port()) {
        // If the Port not changed, pass through
        return event;
    }
    return new DeviceEvent(event.type(), event.subject(), port, event.time());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:15,代码来源:OpticalDeviceServiceView.java

示例3: handleEvent

import org.onosproject.net.device.DeviceEvent; //导入方法依赖的package包/类
private void handleEvent(DeviceEvent event) {
    Device device = event.subject();
    boolean isRelevant = mastershipService.isLocalMaster(device.id())
            && device.is(FlowRuleProgrammable.class)
            && (event.type() == DEVICE_ADDED ||
                event.type() == DEVICE_UPDATED ||
                (event.type() == DEVICE_AVAILABILITY_CHANGED && deviceService.isAvailable(device.id())));
    if (isRelevant) {
        pollDeviceFlowEntries(event.subject());
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:12,代码来源:FlowRuleDriverProvider.java

示例4: run

import org.onosproject.net.device.DeviceEvent; //导入方法依赖的package包/类
@Override
public void run() {

    if (event instanceof  DeviceEvent) {
        DeviceEvent deviceEvent = (DeviceEvent) event;

        switch (deviceEvent.type()) {
            case DEVICE_ADDED:
                log.debug("device {} is added", deviceEvent.subject().id());
                break;
            case DEVICE_AVAILABILITY_CHANGED:
                Device device = deviceEvent.subject();
                if (deviceService.isAvailable(device.id())) {
                    log.debug("device {} is added", device.id());
                }
                break;
            case PORT_ADDED:
                processPortUpdated(deviceEvent.subject(), deviceEvent.port());
                break;
            case PORT_UPDATED:
                processPortUpdated(deviceEvent.subject(), deviceEvent.port());
                break;
            case PORT_REMOVED:
                processPortRemoved(deviceEvent.port());
                break;
            default:
                log.debug("Unsupported deviceEvent type {}", deviceEvent.type().toString());
                break;
        }
    } else if (event instanceof HostEvent) {
        HostEvent hostEvent = (HostEvent) event;

        switch (hostEvent.type()) {
            case HOST_REMOVED:
                log.debug("host {} was removed", hostEvent.subject().toString());
                break;
            default:
                log.debug("Unsupported hostEvent type {}", hostEvent.type().toString());
                break;
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:43,代码来源:OpenstackSwitchingManager.java


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