private void parseLogClientSync(ClientSync sync, ByteBuffer buf, int options, int payloadLength) { LogClientSync logSync = new LogClientSync(); logSync.setRequestId(getIntFromUnsignedShort(buf)); int size = getIntFromUnsignedShort(buf); List<LogEntry> logs = new ArrayList<>(size); for (int i = 0; i < size; i++) { logs.add(new LogEntry(getNewByteBuffer(buf, buf.getInt()))); } logSync.setLogEntries(logs); sync.setLogSync(logSync); }
private void processLogUpload(ActorContext context, ClientSync syncRequest, SyncContext responseHolder) { LogClientSync request = syncRequest.getLogSync(); if (request != null) { if (request.getLogEntries() != null && request.getLogEntries().size() > 0) { LOG.debug("[{}][{}] Processing log upload request {}", endpointKey, actorKey, request.getLogEntries().size()); EndpointProfileDataDto profileDto = convert(responseHolder.getEndpointProfile()); List<LogEvent> logEvents = new ArrayList<>(request.getLogEntries().size()); for (LogEntry logEntry : request.getLogEntries()) { LogEvent logEvent = new LogEvent(); logEvent.setLogData(logEntry.getData().array()); logEvents.add(logEvent); } BaseLogEventPack logPack = new BaseLogEventPack(profileDto, System.currentTimeMillis(), responseHolder.getEndpointProfile().getLogSchemaVersion(), logEvents); logPack.setUserId(state.getUserId()); context.parent().tell(new LogEventPackMessage( request.getRequestId(), context.self(), logPack), context.self()); } if (logUploadResponseMap.size() > 0) { responseHolder.getResponse().setLogSync(EntityConvertUtils.convert(logUploadResponseMap)); logUploadResponseMap.clear(); } } }
/** * Updates a request. */ public void updateRequest(ServerSync response) { UUID channelUuid = getChannelUuid(); LOG.debug("[{}] Cleanup profile request", channelUuid); request.setProfileSync(null); if (request.getUserSync() != null) { LOG.debug("[{}] Cleanup user request", channelUuid); request.setUserSync(new UserClientSync()); } if (request.getEventSync() != null) { LOG.debug("[{}] Cleanup event request", channelUuid); request.setEventSync(new EventClientSync()); } if (request.getLogSync() != null) { LOG.debug("[{}] Cleanup log request", channelUuid); request.getLogSync().setLogEntries(null); } if (request.getNotificationSync() != null) { LOG.debug("[{}] Cleanup/update notification request", channelUuid); request.getNotificationSync().setSubscriptionCommands(null); request.getNotificationSync().setAcceptedUnicastNotifications(null); } }
return false; return logSync != null ? logSync.equals(that.logSync) : that.logSync == null;
@Override public int hashCode() { int result = requestId; result = 31 * result + (clientSyncMetaData != null ? clientSyncMetaData.hashCode() : 0); result = 31 * result + (bootstrapSync != null ? bootstrapSync.hashCode() : 0); result = 31 * result + (profileSync != null ? profileSync.hashCode() : 0); result = 31 * result + (forceConfigurationSync ? 1 : 0); result = 31 * result + (configurationSync != null ? configurationSync.hashCode() : 0); result = 31 * result + (forceNotificationSync ? 1 : 0); result = 31 * result + (notificationSync != null ? notificationSync.hashCode() : 0); result = 31 * result + (userSync != null ? userSync.hashCode() : 0); result = 31 * result + (eventSync != null ? eventSync.hashCode() : 0); result = 31 * result + (logSync != null ? logSync.hashCode() : 0); result = 31 * result + (useConfigurationRawSchema ? 1 : 0); return result; }
private static LogClientSync convert(LogSyncRequest source) { if (source == null) { return null; } LogClientSync sync = new LogClientSync(); sync.setRequestId(source.getRequestId()); if (source.getLogEntries() != null) { List<LogEntry> logs = new ArrayList<LogEntry>(source.getLogEntries().size()); for (org.kaaproject.kaa.common.endpoint.gen.LogEntry log : source.getLogEntries()) { logs.add(new LogEntry(log.getData())); } sync.setLogEntries(logs); } return sync; }