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


Java GroupService.getGroups方法代码示例

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


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

示例1: populateTable

import org.onosproject.net.group.GroupService; //导入方法依赖的package包/类
@Override
protected void populateTable(TableModel tm, ObjectNode payload) {
    String uri = string(payload, "devId");
    if (!Strings.isNullOrEmpty(uri)) {
        DeviceId deviceId = DeviceId.deviceId(uri);
        GroupService gs = get(GroupService.class);
        for (Group group : gs.getGroups(deviceId)) {
            populateRow(tm.addRow(), group);
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:12,代码来源:GroupViewMessageHandler.java

示例2: getSortedGroups

import org.onosproject.net.group.GroupService; //导入方法依赖的package包/类
/**
 * Returns the list of devices sorted using the device ID URIs.
 *
 * @param deviceService device service
 * @param groupService group service
 * @return sorted device list
 */
protected SortedMap<Device, List<Group>>
    getSortedGroups(DeviceService deviceService,
                    GroupService groupService) {
    SortedMap<Device, List<Group>> sortedGroups =
            new TreeMap<>(Comparators.ELEMENT_COMPARATOR);
    List<Group> groups;
    GroupState s = null;
    if (state != null && !state.equals("any")) {
        s = GroupState.valueOf(state.toUpperCase());
    }
    Iterable<Device> devices = (uri == null) ? deviceService.getDevices() :
            Collections.singletonList(deviceService.getDevice(DeviceId.deviceId(uri)));
    for (Device d : devices) {
        if (s == null) {
            groups = newArrayList(groupService.getGroups(d.id()));
        } else {
            groups = newArrayList();
            for (Group g : groupService.getGroups(d.id())) {
                if (g.state().equals(s)) {
                    groups.add(g);
                }
            }
        }
        groups.sort(Comparators.GROUP_COMPARATOR);
        sortedGroups.put(d, groups);
    }
    return sortedGroups;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:36,代码来源:GroupsListCommand.java

示例3: getSortedGroups

import org.onosproject.net.group.GroupService; //导入方法依赖的package包/类
/**
 * Returns the list of devices sorted using the device ID URIs.
 *
 * @param deviceService device service
 * @param groupService group service
 * @return sorted device list
 */
protected SortedMap<Device, List<Group>>
    getSortedGroups(DeviceService deviceService,
                    GroupService groupService) {
    SortedMap<Device, List<Group>> sortedGroups =
            new TreeMap<>(Comparators.ELEMENT_COMPARATOR);
    List<Group> groups;
    GroupState s = null;
    if (state != null && !"any".equals(state)) {
        s = GroupState.valueOf(state.toUpperCase());
    }
    Iterable<Device> devices = deviceService.getDevices();
    if (uri != null) {
        Device dev = deviceService.getDevice(DeviceId.deviceId(uri));
        if (dev != null) {
            devices = Collections.singletonList(dev);
        }
    }
    for (Device d : devices) {
        if (s == null) {
            groups = newArrayList(groupService.getGroups(d.id()));
        } else {
            groups = newArrayList();
            for (Group g : groupService.getGroups(d.id())) {
                if (g.state().equals(s)) {
                    groups.add(g);
                }
            }
        }
        groups.sort(Comparators.GROUP_COMPARATOR);
        sortedGroups.put(d, groups);
    }
    if (type != null && !"any".equals(type))  {
        for (Device device : sortedGroups.keySet()) {
            sortedGroups.put(device, sortedGroups.get(device).stream()
                    .filter(group -> GroupDescription.Type.valueOf(type.toUpperCase()).equals(group.type()))
                    .collect(Collectors.toList()));
        }
    }
    return sortedGroups;
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:48,代码来源:GroupsListCommand.java

示例4: getGroups

import org.onosproject.net.group.GroupService; //导入方法依赖的package包/类
@Override
public List<Group> getGroups(NetworkId networkId, DeviceId deviceId) {
    GroupService groupService = virtualNetService.get(networkId, GroupService.class);
    Iterable<Group> entries = groupService.getGroups(deviceId);
    return Lists.newArrayList(entries);
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:7,代码来源:OFSwitchManager.java


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