private void extraneousGroup(Group group) { log.debug("Group {} is on device {} but not in store.", group, group.deviceId()); addOrUpdateExtraneousGroupEntry(group); }
@Override public PiActionProfileGroup translate(Group original, PiPipeconf pipeconf) throws PiTranslationException { return PiGroupTranslatorImpl .translate(original, pipeconf, getDevice(original.deviceId())); } }
private void groupAdded(Group group) { log.trace("Group {} Added or Updated in device {}", group, group.deviceId()); addOrUpdateGroupEntry(group); } }
@Override public PiMulticastGroupEntry translate(Group original, PiPipeconf pipeconf) throws PiTranslationException { return PiMulticastGroupTranslatorImpl.translate( original, pipeconf, getDevice(original.deviceId())); } }
@Override public void removeExtraneousGroupEntry(Group group) { ConcurrentMap<GroupId, Group> extraneousIdTable = getExtraneousGroupIdTable(group.deviceId()); extraneousIdTable.remove(group.id()); }
case PENDING_DELETE: log.debug("Group {} delete confirmation from device {}", group, group.deviceId()); removeGroupEntry(group); break; case PENDING_UPDATE: log.debug("Group {} is in store but not on device {}", group, group.deviceId()); StoredGroupEntry existing = (groupEntriesById.get( group.deviceId()) != null) ? groupEntriesById.get(group.deviceId()).get(group.id()) : null; log.trace("groupMissing: group "
@Override public void addOrUpdateExtraneousGroupEntry(Group group) { ConcurrentMap<GroupId, Group> extraneousIdTable = getExtraneousGroupIdTable(group.deviceId()); extraneousIdTable.put(group.id(), group); // Check the reference counter if (group.referenceCount() == 0) { notifyDelegate(new GroupEvent(Type.GROUP_REMOVE_REQUESTED, group)); } }
/** * Removes the group entry from store. * * @param group group entry */ @Override public void removeGroupEntry(Group group) { StoredGroupEntry existing = (groupEntriesById.get( group.deviceId()) != null) ? groupEntriesById.get(group.deviceId()).get(group.id()) : null; if (existing != null) { ConcurrentMap<GroupKey, StoredGroupEntry> keyTable = getGroupKeyTable(existing.deviceId()); ConcurrentMap<GroupId, StoredGroupEntry> idTable = getGroupIdTable(existing.deviceId()); idTable.remove(existing.id()); keyTable.remove(existing.appCookie()); notifyDelegate(new GroupEvent(Type.GROUP_REMOVED, existing)); } }
for (Group group:pendingGroupRequests.values()) { GroupDescription tmp = new DefaultGroupDescription( group.deviceId(), group.type(), group.buckets(),
final Group group = event.subject(); GroupProvider groupProvider = getProvider(group.deviceId()); GroupOperations groupOps = null; switch (event.type()) { case GROUP_ADD_REQUESTED: log.debug("GROUP_ADD_REQUESTED for Group {} on device {}", group.id(), group.deviceId()); GroupOperation groupAddOp = GroupOperation. createAddGroupOperation(group.id(), groupOps = new GroupOperations( Collections.singletonList(groupAddOp)); groupProvider.performGroupOperation(group.deviceId(), groupOps); break; group.id(), group.deviceId()); GroupOperation groupModifyOp = GroupOperation. createModifyGroupOperation(group.id(), groupOps = new GroupOperations( Collections.singletonList(groupModifyOp)); groupProvider.performGroupOperation(group.deviceId(), groupOps); break; group.id(), group.deviceId()); GroupOperation groupDeleteOp = GroupOperation. createDeleteGroupOperation(group.id(),
@Override public ObjectNode encode(Group group, CodecContext context) { checkNotNull(group, "Group cannot be null"); ObjectNode result = context.mapper().createObjectNode() .put(ID, group.id().id().toString()) .put(STATE, group.state().toString()) .put(LIFE, group.life()) .put(PACKETS, group.packets()) .put(BYTES, group.bytes()) .put(REFERENCE_COUNT, group.referenceCount()) .put(TYPE, group.type().toString()) .put(DEVICE_ID, group.deviceId().toString()); if (group.appId() != null) { result.put(APP_ID, group.appId().name()); } if (group.appCookie() != null) { result.put(APP_COOKIE, group.appCookie().toString()); } if (group.givenGroupId() != null) { result.put(GIVEN_GROUP_ID, group.givenGroupId().toString()); } ArrayNode buckets = context.mapper().createArrayNode(); group.buckets().buckets().forEach(bucket -> { ObjectNode bucketJson = context.codec(GroupBucket.class).encode(bucket, context); buckets.add(bucketJson); }); result.set(BUCKETS, buckets); return result; }
if (event.subject().deviceId() == deviceId && event.subject().appCookie().equals(groupKey)) { future.complete(event.subject());
GroupKey newCookie = (newAppCookie != null) ? newAppCookie : oldAppCookie; GroupDescription updatedGroupDesc = new DefaultGroupDescription( oldGroup.deviceId(), oldGroup.type(), updatedBuckets, getGroupKeyTable(oldGroup.deviceId()); ConcurrentMap<GroupId, StoredGroupEntry> idTable = getGroupIdTable(oldGroup.deviceId()); keyTable.remove(oldGroup.appCookie()); idTable.remove(oldGroup.id());