protected virtual string GenerateSubmissionFile(T data)
        {
            string serializedFilePath = null;

            try
            {
                if (_addHeader)
                {
                    AppendAuditLogEvent("Serializing results and making header...");
                    serializedFilePath = MakeHeaderFile(data);
                }
                else
                {
                    AppendAuditLogEvent("Serializing results to file...");
                    serializedFilePath = _serializationHelper.SerializeToTempFile(data);
                    if (_validateXml)
                    {
                        ValidateXmlFileAndAttachErrorsAndFileToTransaction(serializedFilePath, "xml_schema.xml_schema.zip",
                                                                           null, _dataRequest.TransactionId);
                    }
                }
            }
            catch (Exception)
            {
                FileUtils.SafeDeleteFile(serializedFilePath);
                throw;
            }
            return(serializedFilePath);
        }
Example #2
0
        protected virtual string GenerateSubmissionFile(T data)
        {
            string serializedFilePath = null;

            try
            {
                if (_addHeader)
                {
                    AppendAuditLogEvent("Serializing results and making header...");
                    serializedFilePath = MakeHeaderFile(data);
                }
                else
                {
                    AppendAuditLogEvent("Serializing results to file...");
                    serializedFilePath = _serializationHelper.SerializeToTempFile(data);
                    ValidateXmlFile(serializedFilePath);
                }
            }
            catch (Exception)
            {
                FileUtils.SafeDeleteFile(serializedFilePath);
                throw;
            }
            return(serializedFilePath);
        }
Example #3
0
        public void ProcessSolicit(string requestId)
        {
            try
            {
                AppendAuditLogEvent("Getting request...");
                LOG.DebugEnter(MethodBase.GetCurrentMethod(), requestId);

                LazyInit();

                DataRequest request = _requestManager.GetDataRequest(requestId);

                AppendAuditLogEvent("Getting data from request...");
                object returnData = GetObjectFromRequest(request);

                AppendAuditLogEvent("Serializing data to file...");
                LOG.Debug("Serializing results to file...");
                string serializedFilePath = _serializationHelper.SerializeToTempFile(returnData);
                LOG.Debug("Serialized file path: " + serializedFilePath);

                AppendAuditLogEvent("Compressing serialized data...");
                LOG.Debug("Compressing serialized file...");
                string compressedFilePath = _compressionHelper.CompressFile(serializedFilePath);
                LOG.Debug("Compressed file path: " + compressedFilePath);

                AppendAuditLogEvent("Saving compressed data...");
                LOG.Debug("Saving data");
                _documentManager.AddDocument(request.TransactionId,
                                             CommonTransactionStatusCode.Processed,
                                             "Request Processed: " + request.ToString(),
                                             compressedFilePath);

                AppendAuditLogEvent("Plugin done");
                LOG.Debug("OK");
            }
            catch (Exception ex)
            {
                LOG.Error(ex);
                AppendAuditLogEvent("Error: " + ex.StackTrace);
                throw new ApplicationException("Error while executing plugin", ex);
            }
        }
Example #4
0
        public void ProcessSolicit(string requestId)
        {
            LOG.DebugEnter(MethodBase.GetCurrentMethod(), requestId);

            LazyInit();

            _dataRequest = _requestManager.GetDataRequest(requestId);

            if (TryGetParameter(_dataRequest, PARAM_NAAS_SUBMIT_USERNAME, 0, ref _submitUsername))
            {
                if (_naasUsernameToPasswordMap == null)
                {
                    throw new ArgumentException(string.Format("A request parameter \"{0}\" = \"{1}\" was specified, but the service does not specify a \"{2}\" config parameter",
                                                              PARAM_NAAS_SUBMIT_USERNAME, _submitUsername, CONFIG_NAAS_USER_MAPPING_FILE_PATH));
                }
                if (!_naasUsernameToPasswordMap.ContainsKey(_submitUsername.ToUpper()))
                {
                    throw new ArgumentException(string.Format("A request parameter \"{0}\" = \"{1}\" was specified, but the username was not found in the mapping file specified by the \"{2}\" config parameter",
                                                              PARAM_NAAS_SUBMIT_USERNAME, _submitUsername, CONFIG_NAAS_USER_MAPPING_FILE_PATH));
                }
                UserSubmitInfo userSubmitInfo = _naasUsernameToPasswordMap[_submitUsername.ToUpper()];
                _rcraInfoUserId = userSubmitInfo.RCRAInfoUserID;
            }

            object returnData = GetObjectFromRequest(_dataRequest);

            string serializedFilePath = null;

            if (_addHeader)
            {
                LOG.Debug("Serializing results and making header...");
                AppendAuditLogEvent("Serializing results and making header...");
                serializedFilePath = MakeHeaderFile(returnData);
            }
            else
            {
                LOG.Debug("Serializing results to file...");
                AppendAuditLogEvent("Serializing results to file...");
                serializedFilePath = _serializationHelper.SerializeToTempFile(returnData);
                if (_validateXml)
                {
                    ValidateXmlFileAndAttachErrorsAndFileToTransaction(serializedFilePath, "xml_schema.xml_schema.zip",
                                                                       null, _dataRequest.TransactionId);
                }
            }

            LOG.Debug("Serialized file path: " + serializedFilePath);
            AppendAuditLogEvent("Serialized file path: " + serializedFilePath);

            LOG.Debug("Compressing serialized file...");
            AppendAuditLogEvent("Compressing serialized file...");
            string compressedFilePath = _compressionHelper.CompressFile(serializedFilePath);

            LOG.Debug("Compressed file path: " + compressedFilePath);
            AppendAuditLogEvent("Compressed file path: " + compressedFilePath);

            LOG.Debug("Adding document...");
            AppendAuditLogEvent("Adding document...");
            _documentManager.AddDocument(_dataRequest.TransactionId,
                                         CommonTransactionStatusCode.Processed,
                                         "Request Processed: " + _dataRequest.ToString(),
                                         compressedFilePath);

            if (_submitUsername != null)
            {
                SubmitFile(compressedFilePath, _dataRequest.TransactionId);
            }
            LOG.Debug("OK");
            AppendAuditLogEvent("ProcessQuery: OK");
        }