/** * Factory method that create instance where the response status set to FAILURE. * * @param requestId the request id * @return the sync context */ public static SyncContext failure(Integer requestId) { ServerSync response = new ServerSync(); response.setRequestId(requestId); response.setStatus(SyncStatus.FAILURE); return new SyncContext(response); }
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); } }
SyncContext context = new SyncContext(new ServerSync()); context.setNotificationVersion(state.getProfile()); context.setRequestId(request.getRequestId());
/** * make deep copy of <code>ServerSync</code> instance. * * @param source is source for copping * @return deep copy of <code>ServerSync</code> instance */ public static ServerSync deepCopy(ServerSync source) { if (source == null) { return null; } ServerSync copy = new ServerSync(); copy.setRequestId(source.getRequestId()); copy.setStatus(source.getStatus()); copy.setUserSync(deepCopy(source.getUserSync())); copy.setRedirectSync(deepCopy(source.getRedirectSync())); copy.setProfileSync(deepCopy(source.getProfileSync())); copy.setNotificationSync(deepCopy(source.getNotificationSync())); copy.setLogSync(deepCopy(source.getLogSync())); copy.setEventSync(deepCopy(source.getEventSync())); copy.setConfigurationSync(deepCopy(source.getConfigurationSync())); return copy; }