private ServerSync buildRedirectionResponse(RedirectionRule redirection, ClientSync request) { RedirectServerSync redirectSyncResponse = new RedirectServerSync( redirection.getAccessPointId()); ServerSync response = new ServerSync(); response.setRequestId(request.getRequestId()); response.setStatus(SyncStatus.REDIRECT); response.setRedirectSync(redirectSyncResponse); return response; }
@Override public void run() { MessageEncoderDecoder crypt = getOrInitCrypt(); Map<Integer, PlatformEncDec> platformEncDecMap = getOrInitMap(platformProtocols); try { ClientSync request = decodeRequest(message, crypt, platformEncDecMap); LOG.trace("Processing request {}", request); BootstrapClientSync bsRequest = request.getBootstrapSync(); Set<ProtocolConnectionData> transports = opsListService.filter(bsRequest.getKeys()); BootstrapServerSync bsResponse = new BootstrapServerSync( bsRequest.getRequestId(), transports); ServerSync response = new ServerSync(); response.setRequestId(request.getRequestId()); response.setStatus(SyncStatus.SUCCESS); response.setBootstrapSync(bsResponse); LOG.trace("Response {}", response); encodeAndForward(message, crypt, platformEncDecMap, response); LOG.trace("Response forwarded to specific transport {}", response); } catch (Exception ex) { processErrors(message.getChannelContext(), message.getErrorBuilder(), ex); } }
private SyncContext sync(ClientSync request) throws GetDeltaException { if (!request.isValid()) { LOG.warn("[{}] Request is not valid. It does not contain profile information!", endpointKey); return SyncContext.failure(request.getRequestId()); context.setRequestId(request.getRequestId()); context.setStatus(SyncStatus.SUCCESS); context.setEndpointKey(endpointKey);
LOG.trace("[{}] Merging original request {} with new request {}", channelUuid, request, other); request.setRequestId(other.getRequestId()); request.getClientSyncMetaData() .setProfileHash(other.getClientSyncMetaData().getProfileHash()); LOG.debug("[{}] Updated request id and profile hash", channelUuid); ClientSync diff = new ClientSync(); diff.setRequestId(other.getRequestId()); diff.setClientSyncMetaData(other.getClientSyncMetaData()); diff.setUseConfigurationRawSchema(other.isUseConfigurationRawSchema());
private void syncChannels(ActorContext context, Set<ChannelMetaData> channels, boolean cfUpdate, boolean nfUpdate) { for (ChannelMetaData channel : channels) { ClientSync originalRequest = channel.getRequestMessage().getRequest(); ClientSync newRequest = new ClientSync(); newRequest.setRequestId(originalRequest.getRequestId()); newRequest.setClientSyncMetaData(originalRequest.getClientSyncMetaData()); newRequest.setUseConfigurationRawSchema(originalRequest.isUseConfigurationRawSchema()); if (cfUpdate && originalRequest.getConfigurationSync() != null) { newRequest.setForceConfigurationSync(true); newRequest.setConfigurationSync(originalRequest.getConfigurationSync()); } if (nfUpdate && originalRequest.getNotificationSync() != null) { newRequest.setForceNotificationSync(true); newRequest.setNotificationSync(originalRequest.getNotificationSync()); } LOG.debug("[{}][{}] Processing request {}", endpointKey, actorKey, newRequest); sync(context, new SyncRequestMessage(channel.getRequestMessage().getSession(), newRequest, channel.getRequestMessage().getCommand(), channel.getRequestMessage().getOriginator())); } }