/// <summary>Process the set request described by request.</summary> /// <exception cref="NotSupportedException">Thrown when the requested operation is not supported.</exception> /// <param name="request">The request.</param> private void ProcessSetRequest(IRequestContext request) { BaselineSettingRequestContext requestContext = request as BaselineSettingRequestContext; if (requestContext == null) { throw new NotSupportedException("Can't process setting baseline with a invalid request context."); } try { using (PIS.Ground.DataPackage.DataPackageTrainServiceClient lTrainDataPackageClient = new PIS.Ground.DataPackage.DataPackageTrainServiceClient("DataPackageEndpoint", requestContext.Endpoint)) { try { string requestIdStr = request.RequestId.ToString(); lTrainDataPackageClient.SetBaselineVersion(requestIdStr, requestContext.BaselineVersion, requestContext.PISBasePackageVersion, requestContext.PISMissionPackageVersion, requestContext.PISInfotainmentPackageVersion, requestContext.LmtPackageVersion); requestContext.TransmissionStatus = true; requestContext.CompletionStatus = true; } catch (Exception ex) { if (false == requestContext.OnCommunicationError(ex)) { // At this stage nothing can be done, put the request state to completed in order to be deleted. requestContext.CompletionStatus = true; } } finally { if (lTrainDataPackageClient.State == CommunicationState.Faulted) { lTrainDataPackageClient.Abort(); } } } } catch (Exception ex) { if (false == requestContext.OnCommunicationError(ex)) { requestContext.CompletionStatus = true; } } }
/// <summary>Process the force request described by request.</summary> /// <exception cref="NotSupportedException">Thrown when the requested operation is not supported.</exception> /// <param name="request">The request.</param> private void ProcessForceRequest(IRequestContext request) { BaselineForcingRequestContext requestContext = request as BaselineForcingRequestContext; if (requestContext == null) { throw new NotSupportedException("Can't process forcing baseline with a invalid request context."); } try { using (PIS.Ground.DataPackage.DataPackageTrainServiceClient lTrainDataPackageClient = new PIS.Ground.DataPackage.DataPackageTrainServiceClient("DataPackageEndpoint", requestContext.Endpoint)) { try { string requestIdStr = requestContext.RequestId.ToString(); bool validCommand = true; switch (requestContext.CommandType) { case BaselineCommandType.FORCE_FUTURE: lTrainDataPackageClient.ForceFutureBaseline(requestIdStr); break; case BaselineCommandType.FORCE_ARCHIVED: lTrainDataPackageClient.ForceArchivedBaseline(requestIdStr); break; case BaselineCommandType.CLEAR_FORCING: lTrainDataPackageClient.CancelBaselineForcing(requestIdStr); break; default: validCommand = false; break; } if (validCommand) { if (requestContext.CommandType == BaselineCommandType.CLEAR_FORCING) { DataPackageService.sendNotificationToGroundApp(request.RequestId, PIS.Ground.GroundCore.AppGround.NotificationIdEnum.DataPackageBaselineClearForcingSent, request.ElementId); } else { DataPackageService.sendNotificationToGroundApp(request.RequestId, PIS.Ground.GroundCore.AppGround.NotificationIdEnum.DataPackageBaselineForcingSent, request.ElementId); } requestContext.TransmissionStatus = true; requestContext.CompletionStatus = true; } } catch (Exception ex) { if (false == requestContext.OnCommunicationError(ex)) { requestContext.CompletionStatus = true; } } finally { if (lTrainDataPackageClient.State == CommunicationState.Faulted) { lTrainDataPackageClient.Abort(); } } } } catch (Exception ex) { if (false == requestContext.OnCommunicationError(ex)) { requestContext.CompletionStatus = true; } } }