@Deactivate public void deactivate() { deviceService.removeListener(deviceListener); cfgService.unregisterProperties(getClass(), false); store.unsetDelegate(delegate); eventDispatcher.removeSink(GroupEvent.class); log.info("Stopped"); }
@Activate public void activate(ComponentContext context) { store.setDelegate(delegate); eventDispatcher.addSink(GroupEvent.class, listenerRegistry); deviceService.addListener(deviceListener); cfgService.registerProperties(getClass()); modified(context); log.info("Started"); }
/** * Remove buckets from existing group. The caller can optionally associate a new cookie during * this updation. GROUP_UPDATED or GROUP_UPDATE_FAILED notifications would be provided along with * cookie depending on the result of the operation on the device. * * @param deviceId device identifier * @param oldCookie cookie to be used to retrieve the existing group * @param buckets immutable list of group bucket to be removed * @param newCookie immutable cookie to be used post update operation * @param appId Application Id */ @Override public void removeBucketsFromGroup( DeviceId deviceId, GroupKey oldCookie, GroupBuckets buckets, GroupKey newCookie, ApplicationId appId) { checkPermission(GROUP_WRITE); store.updateGroupDescription(deviceId, oldCookie, UpdateType.REMOVE, buckets, newCookie); }
@Override public Iterable<Group> getGroups(DeviceId deviceId) { checkPermission(GROUP_READ); return store.getGroups(deviceId); }
/** * Delete a group associated to an application cookie. GROUP_DELETED or GROUP_DELETE_FAILED * notifications would be provided along with cookie depending on the result of the operation on * the device. * * @param deviceId device identifier * @param appCookie application cookie to be used for lookup * @param appId Application Id */ @Override public void removeGroup(DeviceId deviceId, GroupKey appCookie, ApplicationId appId) { checkPermission(GROUP_WRITE); store.deleteGroupDescription(deviceId, appCookie); }
/** * Return a group object associated to an application cookie. * * <p>NOTE1: The presence of group object in the system does not guarantee that the "group" is * actually created in device. GROUP_ADDED notification would confirm the creation of this group * in data plane. * * @param deviceId device identifier * @param appCookie application cookie to be used for lookup * @return group associated with the application cookie or NULL if Group is not found for the * provided cookie */ @Override public Group getGroup(DeviceId deviceId, GroupKey appCookie) { checkPermission(GROUP_READ); return store.getGroup(deviceId, appCookie); }
/** * Create a group in the specified device with the provided parameters. * * @param groupDesc group creation parameters */ @Override public void addGroup(GroupDescription groupDesc) { checkPermission(GROUP_WRITE); store.storeGroupDescription(groupDesc); }