/// <summary>
        /// if retrycount >0, need to check retrywaitinterval mandatory
        /// </summary>
        private void BatchExecutionRetryMandatorySettings()
        {
            int retryCount;

            try
            {
                retryCount = Convert.ToInt32(BatchConfigurationDataTypeEnum.BATCH_EXECUTION_RETRY_COUNT_ON_EXCEPTION.GetValue());
            }
            catch (Exception ex)
            {
                MessageData messageData         = new MessageData("fbce00036", Properties.Resources.fbce00036);
                Framework.SystemException sysEx = new Framework.SystemException(messageData, ex);
                throw sysEx;
            }

            if (retryCount == 0)
            {
                return;              //normal
            }
            else if (retryCount > 0) //if retry count > 0 then check wait interval
            {
                //batchexecution retry wait intervl on exception check
                CheckMandatorySettings(BatchConfigurationDataTypeEnum.BATCH_EXECUTION_RETRY_WAIT_INTERVAL_ON_EXCEPTION, "fbce00009", Properties.Resources.fbce00009);

                ExceptionRetryWaitTimeSpanValidation();
            }
            else                        //else throw execption
            {
                MessageData messageData         = new MessageData("fbce00040", Properties.Resources.fbce00040);
                Framework.SystemException sysEx = new Framework.SystemException(messageData, new FormatException());
                throw sysEx;
            }
        }
        /// <summary>
        /// to chech the timespan validation
        /// </summary>
        /// <param name="value"></param>
        private void MultpileInvokeRetryWaitTimeSpanValidation()
        {
            //null value check is not necessary, after mandatory check it was called
            string   value = BatchConfigurationDataTypeEnum.PREVENT_MULTIPLE_INVOKE_WAIT_INTERVAL.GetValue();
            TimeSpan timeSpanValue;

            try
            {
                timeSpanValue = TimeSpan.Parse(value);
            }
            catch (Exception ex)
            {
                MessageData messageData         = new MessageData("fbce00046", Properties.Resources.fbce00046);
                Framework.SystemException sysEx = new Framework.SystemException(messageData, ex);
                throw sysEx;
            }

            //value check
            if (timeSpanValue >= TimeSpan.Parse("0")) // if value >= 0 , then return
            {
                return;
            }
            else                                     // else throw system exception
            {
                MessageData messageData         = new MessageData("fbce00047", Properties.Resources.fbce00047);
                Framework.SystemException sysEx = new Framework.SystemException(messageData, new FormatException());
                throw sysEx;
            }
        }
        /// <summary>
        /// to chech the timespan validation
        /// </summary>
        /// <param name="value"></param>
        private void ExceptionRetryWaitTimeSpanValidation()
        {
            //null value check is not necessary, after mandatory check it was called
            string   value = BatchConfigurationDataTypeEnum.BATCH_EXECUTION_RETRY_WAIT_INTERVAL_ON_EXCEPTION.GetValue();
            TimeSpan timeSpanValue;

            try
            {
                timeSpanValue = TimeSpan.Parse(value);
            }
            catch (Exception ex)
            {
                MessageData messageData         = new MessageData("fbce00044", Properties.Resources.fbce00044);
                Framework.SystemException sysEx = new Framework.SystemException(messageData, ex);
                throw sysEx;
            }

            //value check
            if (timeSpanValue >= TimeSpan.Parse("0")) // if value >= 0 , then return
            {
                return;
            }
            else                                     // else throw system exception
            {
                MessageData messageData         = new MessageData("fbce00045", Properties.Resources.fbce00045);
                Framework.SystemException sysEx = new Framework.SystemException(messageData, new FormatException());
                throw sysEx;
            }
        }
        /// <summary>
        /// Validate the DEFAULT_CACHE_CLEANER_THREAD_INTERVAL value provided in the settings file
        /// </summary>
        private void ValidateCacheCleanerThreadInterval()
        {
            String intervalValue = ServerConfigurationDataTypeEnum.DEFAULT_CACHE_CLEANER_THREAD_MILLISECONDS_INTERVAL.GetValue();

            int interval = 0;

            try
            {
                interval = Convert.ToInt32(intervalValue);
            }
            catch (Exception ex)
            {
                MessageData messageData         = new MessageData("fsce00056", Properties.Resources.fsce00056, intervalValue);
                Framework.SystemException sysEx = new Framework.SystemException(messageData, ex);

                InitializationSystemExceptionHandler.GetInstance().HandleException(sysEx);
            }
            if (interval <= 0)
            {
                MessageData messageData         = new MessageData("fsce00054", Properties.Resources.fsce00054, interval.ToString());
                Framework.SystemException sysEx = new Framework.SystemException(messageData);

                InitializationSystemExceptionHandler.GetInstance().HandleException(sysEx);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// popup for particular exception
        /// </summary>
        /// <param name="unhandledException"></param>
        public void HandleException(Framework.SystemException sysException)
        {
            logger.Error(sysException.GetMessageData(), sysException);
            ShowMessage(sysException.GetMessageData());

            AbnormalEnd();
        }
        /// <summary>
        /// pqm configuration mandatory check
        /// </summary>
        private void PQMConfigMandatorySettings()
        {
            String checkValue = ServerConfigurationDataTypeEnum.DEFAULT_PQM_CONFIG_MANDATORY_CHECK_ON.GetValue();

            bool checkMandatory = false;

            try
            {
                checkMandatory = Convert.ToBoolean(checkValue);
            }
            catch (Exception ex)
            {
                MessageData messageData         = new MessageData("fsce00059", Properties.Resources.fsce00059, checkValue);
                Framework.SystemException sysEx = new Framework.SystemException(messageData, ex);

                InitializationSystemExceptionHandler.GetInstance().HandleException(sysEx);
            }

            if (!checkMandatory)
            {
                return;
            }

            CheckServerMandatorySettings(ServerConfigurationDataTypeEnum.DEFAULT_PQM_CONFIG_URL, "fsce00038", Properties.Resources.fsce00038);
        }
        /// <summary>
        /// if preventmultipleinvoke is true, need to check the retrycount and waitinterval mandatory
        /// </summary>
        private void PreventMultipleInvokeMandatorySettings()
        {
            bool preventMultipleInvoke;

            try
            {
                preventMultipleInvoke = Convert.ToBoolean(BatchConfigurationDataTypeEnum.PREVENT_MULTIPLE_INVOKE.GetValue());
            }
            catch (Exception ex)
            {
                MessageData messageData         = new MessageData("fbce00037", Properties.Resources.fbce00037);
                Framework.SystemException sysEx = new Framework.SystemException(messageData, ex);
                throw sysEx;
            }

            //if preventmultipleinvoke = false, return
            if (!preventMultipleInvoke)
            {
                return;
            }

            //preventmultipleinvoke retry count check if already running
            CheckMandatorySettings(BatchConfigurationDataTypeEnum.PREVENT_MULTIPLE_INVOKE_RETRY_COUNT, "fbce00011", Properties.Resources.fbce00011);

            int retryCount;

            try
            {
                retryCount = Convert.ToInt32(BatchConfigurationDataTypeEnum.PREVENT_MULTIPLE_INVOKE_RETRY_COUNT.GetValue());
            }
            catch (Exception ex)
            {
                MessageData messageData         = new MessageData("fbce00041", Properties.Resources.fbce00041);
                Framework.SystemException sysEx = new Framework.SystemException(messageData, ex);
                throw sysEx;
            }

            if (retryCount == 0)
            {
                return;              //normal
            }
            else if (retryCount > 0) //if retrycount > 0 then check wait interval
            {
                //preventmultipleinvoke wait interval check if already running
                CheckMandatorySettings(BatchConfigurationDataTypeEnum.PREVENT_MULTIPLE_INVOKE_WAIT_INTERVAL, "fbce00012", Properties.Resources.fbce00012);
                MultpileInvokeRetryWaitTimeSpanValidation();
            }
            else                            //else throw execption
            {
                MessageData messageData         = new MessageData("fbce00042", Properties.Resources.fbce00042);
                Framework.SystemException sysEx = new Framework.SystemException(messageData, new FormatException());
                throw sysEx;
            }
        }
        /// <summary>
        /// check mandatory settings value
        /// </summary>
        /// <param name="settingValue"></param>
        /// <param name="messageCode"></param>
        /// <param name="message"></param>
        /// <exception cref="SystemException"></exception>
        private void CheckMandatorySettings(string settingValue,
                                            string messageCode, string message)
        {
            if (string.IsNullOrWhiteSpace(settingValue))
            {
                MessageData messageData         = new MessageData(messageCode, message, Properties.Resources.fsce00016);
                Framework.SystemException sysEx = new Framework.SystemException(messageData);

                InitializationSystemExceptionHandler.GetInstance().HandleException(sysEx);
            }
        }
Esempio n. 9
0
        /// <summary>
        /// constructor
        /// </summary>
        public DefaultBatchController(string batchMainSettingsFileName)
        {
            if (string.IsNullOrWhiteSpace(batchMainSettingsFileName))
            {
                //implement system exception
                MessageData messageData = new MessageData("fbce00050", Properties.Resources.fbce00050);
                Exception   nullEx      = new NullReferenceException();
                logger.Error(messageData, nullEx);

                throw new Framework.SystemException(messageData, nullEx);
            }

            ConfigurationReader batchConfigReader;

            try
            {
                batchConfigReader = new Framework.BatchStaticCachedConfigurationReader(batchMainSettingsFileName);
            }
            catch (Exception readerEx)
            {
                //implement system exception
                MessageData messageData = new MessageData("fbce00052", Properties.Resources.fbce00052);
                logger.Error(messageData, readerEx);

                throw new Framework.SystemException(messageData, readerEx);
            }

            //set the
            BatchConfigurationDataTypeEnum.SetConfigurationReader(batchConfigReader);


            //check the settings file values and logg
            try
            {
                DefaultBatchApplicationInitializer.GetInstance().Init();
            }
            catch (Exception ex)
            {
                if (ex is Framework.SystemException) //systemexception throw from mandatory check in initializer
                {
                    Framework.SystemException sysEx = (Framework.SystemException)ex;
                    logger.Error(sysEx.GetMessageData(), ex);
                    ExitApplication(Properties.Settings.Default.SCHED_RETURN_IN_APPLICATION_INITIALIZER_SYSTEM_EXCEPTION);
                }
                else                                //unhandledexception throw from mandatory check in initializer
                {
                    MessageData messageData = new MessageData("fbce00043", Properties.Resources.fbce00043);
                    logger.Error(messageData, ex);
                    ExitApplication(Properties.Settings.Default.SCHED_RETURN_IN_APPLICATION_INITIALIZER_UNHANDLED_EXCEPTION);
                }
            }
        }
        /// <summary>
        /// sap configuration mandatory check
        /// </summary>
        private void SAPConfigMandatorySettings()
        {
            String checkValue = ServerConfigurationDataTypeEnum.DEFAULT_SAP_CONFIG_MANDATORY_CHECK_ON.GetValue();

            bool checkMandatory = false;

            try
            {
                checkMandatory = Convert.ToBoolean(checkValue);
            }
            catch (Exception ex)
            {
                MessageData messageData         = new MessageData("fsce00058", Properties.Resources.fsce00058, checkValue);
                Framework.SystemException sysEx = new Framework.SystemException(messageData, ex);

                InitializationSystemExceptionHandler.GetInstance().HandleException(sysEx);
            }

            if (!checkMandatory)
            {
                return;
            }

            CheckServerMandatorySettings(ServerConfigurationDataTypeEnum.DEFAULT_SAP_PLANT_CODE, "fsce00060", Properties.Resources.fsce00060);

            CheckServerMandatorySettings(ServerConfigurationDataTypeEnum.DEFAULT_SAP_CONFIG_NAME, "fsce00023", Properties.Resources.fsce00023);

            CheckServerMandatorySettings(ServerConfigurationDataTypeEnum.DEFAULT_SAP_CONFIG_LOGON_GROUP, "fsce00024", Properties.Resources.fsce00024);

            CheckServerMandatorySettings(ServerConfigurationDataTypeEnum.DEFAULT_SAP_CONFIG_MESSAGE_SERVER_HOST, "fsce00025", Properties.Resources.fsce00025);

            CheckServerMandatorySettings(ServerConfigurationDataTypeEnum.DEFAULT_SAP_CONFIG_SYSTEM_ID, "fsce00026", Properties.Resources.fsce00026);

            CheckServerMandatorySettings(ServerConfigurationDataTypeEnum.DEFAULT_SAP_CONFIG_SYSTEM_NUMBER, "fsce00027", Properties.Resources.fsce00027);

            CheckServerMandatorySettings(ServerConfigurationDataTypeEnum.DEFAULT_SAP_CONFIG_CLIENT, "fsce00030", Properties.Resources.fsce00030);

            CheckServerMandatorySettings(ServerConfigurationDataTypeEnum.DEFAULT_SAP_CONFIG_LANGUAGE, "fsce00031", Properties.Resources.fsce00031);

            CheckServerMandatorySettings(ServerConfigurationDataTypeEnum.DEFAULT_SAP_CONFIG_POOL_SIZE, "fsce00033", Properties.Resources.fsce00033);

            CheckServerMandatorySettings(ServerConfigurationDataTypeEnum.DEFAULT_SAP_CONFIG_PEAK_CONNECTIONS_LIMIT, "fsce00034", Properties.Resources.fsce00034);

            CheckServerMandatorySettings(ServerConfigurationDataTypeEnum.DEFAULT_SAP_CONFIG_IDLE_TIMEOUT, "fsce00035", Properties.Resources.fsce00035);

            CheckServerMandatorySettings(ServerConfigurationDataTypeEnum.DEFAULT_SAP_CONFIG_IDLE_CHECKTIME, "fsce00036", Properties.Resources.fsce00036);
        }
        /// <summary>
        /// check mandatory application settings value
        /// </summary>
        /// <param name="settingsdata"></param>
        /// <param name="messageCode"></param>
        /// <param name="message"></param>
        /// <exception cref="SystemException"></exception>
        private void CheckApplicationMandatorySettings(ConfigurationDataTypeEnum settingsdata, string messageCode, string message)
        {
            string settingValue = null;

            try
            {
                settingValue = settingsdata.GetValue();
            }
            catch (Exception ex)
            {
                MessageData messageData         = new MessageData(messageCode, message, Properties.Resources.fsce00017);
                Framework.SystemException sysEx = new Framework.SystemException(messageData, ex);

                InitializationSystemExceptionHandler.GetInstance().HandleException(sysEx);
            }
            CheckMandatorySettings(settingValue, messageCode, message);
        }
        /// <summary>
        /// if executiontype = "1", need to check executionwaitinterval mandatory
        /// </summary>
        private void BatchExecutionMandatorySettings()
        {
            string batchExecutionType = BatchConfigurationDataTypeEnum.BATCH_EXECUTION_TYPE.GetValue();

            //check the batchExecutionType input value to fix the process
            switch (batchExecutionType)
            {
            case "1":
                //batchexecution wait interval check
                CheckMandatorySettings(BatchConfigurationDataTypeEnum.BATCH_EXECUTION_WAIT_INTERVAL, "fbce00007", Properties.Resources.fbce00007);
                break;

            case "0":
                break;

            default:
                MessageData messageData         = new MessageData("fbce00035", Properties.Resources.fbce00035);
                Framework.SystemException sysEx = new Framework.SystemException(messageData, new FormatException());
                throw sysEx;
            }
        }
        /// <summary>
        /// check mandatory applicationsettings value
        /// </summary>
        private void CheckMandatorySettings(BatchConfigurationDataTypeEnum settingsdata,
                                            string messageCode, string message)
        {
            try
            {
                string settingValue = settingsdata.GetValue();

                if (string.IsNullOrWhiteSpace(settingValue))
                {
                    MessageData messageData         = new MessageData(messageCode, message, Properties.Resources.fbce00014);
                    Framework.SystemException sysEx = new Framework.SystemException(messageData);
                    throw sysEx;
                }
            }
            catch (Exception ex)
            {
                MessageData messageData         = new MessageData(messageCode, message, Properties.Resources.fbce00015);
                Framework.SystemException sysEx = new Framework.SystemException(messageData, ex);
                throw sysEx;
            }
        }
Esempio n. 14
0
        /// <summary>
        /// check mandatory applicationsettings value
        /// </summary>
        private void CheckServerMandatorySettings(ServerConfigurationDataTypeEnum settingsdata,
                                                  string messageCode, string message)
        {
            try
            {
                string settingValue = settingsdata.GetValue();

                if (string.IsNullOrWhiteSpace(settingValue))
                {
                    MessageData messageData         = new MessageData(messageCode, message, Properties.Resources.fsce00016);
                    Framework.SystemException sysEx = new Framework.SystemException(messageData);

                    InitializationSystemExceptionHandler.GetInstance().HandleException(sysEx);
                }
            }
            catch (Exception ex)
            {
                MessageData messageData         = new MessageData(messageCode, message, Properties.Resources.fsce00017);
                Framework.SystemException sysEx = new Framework.SystemException(messageData, ex);

                InitializationSystemExceptionHandler.GetInstance().HandleException(sysEx);
            }
        }
Esempio n. 15
0
        private void CheckMandatorySettingsInXml()
        {
            if (ServerConfigurationDataTypeEnum.MANDATORY_CHECK.GetValue() == "1")
            {
                DataSet dsMandatoryXmlList = new DataSet();

                dsMandatoryXmlList.ReadXml(ServerConfigurationDataTypeEnum.DEFAULT_MANDATORY_CHECK_XML.GetValue());

                if (dsMandatoryXmlList == null || dsMandatoryXmlList.Tables.Count == 0)
                {
                    return;
                }

                DataTable dtMandatory = dsMandatoryXmlList.Tables[0];
                if (dtMandatory.Rows.Count > 0)
                {
                    foreach (DataRow dr in dtMandatory.Rows)
                    {
                        if (string.Equals(dr["Name"].ToString(), ServerConfigurationDataTypeEnum.DEFAULT_SAP_CONFIG_NAME.ToString()))
                        {
                            CheckServerMandatorySettings(ServerConfigurationDataTypeEnum.DEFAULT_SAP_CONFIG_NAME, "fsce00023", Properties.Resources.fsce00023);
                        }
                        else if (string.Equals(dr["Name"].ToString(), ServerConfigurationDataTypeEnum.DEFAULT_SAP_CONFIG_LOGON_GROUP.ToString()))
                        {
                            CheckServerMandatorySettings(ServerConfigurationDataTypeEnum.DEFAULT_SAP_CONFIG_LOGON_GROUP, "fsce00024", Properties.Resources.fsce00024);
                        }
                        else if (string.Equals(dr["Name"].ToString(), ServerConfigurationDataTypeEnum.DEFAULT_SAP_CONFIG_MESSAGE_SERVER_HOST.ToString()))
                        {
                            CheckServerMandatorySettings(ServerConfigurationDataTypeEnum.DEFAULT_SAP_CONFIG_MESSAGE_SERVER_HOST, "fsce00025", Properties.Resources.fsce00025);
                        }
                        else if (string.Equals(dr["Name"].ToString(), ServerConfigurationDataTypeEnum.DEFAULT_SAP_CONFIG_SYSTEM_ID.ToString()))
                        {
                            CheckServerMandatorySettings(ServerConfigurationDataTypeEnum.DEFAULT_SAP_CONFIG_SYSTEM_ID, "fsce00026", Properties.Resources.fsce00026);
                        }
                        else if (string.Equals(dr["Name"].ToString(), ServerConfigurationDataTypeEnum.DEFAULT_SAP_CONFIG_SYSTEM_NUMBER.ToString()))
                        {
                            CheckServerMandatorySettings(ServerConfigurationDataTypeEnum.DEFAULT_SAP_CONFIG_SYSTEM_NUMBER, "fsce00027", Properties.Resources.fsce00027);
                        }
                        else if (string.Equals(dr["Name"].ToString(), ServerConfigurationDataTypeEnum.DEFAULT_SAP_CONFIG_CLIENT.ToString()))
                        {
                            CheckServerMandatorySettings(ServerConfigurationDataTypeEnum.DEFAULT_SAP_CONFIG_CLIENT, "fsce00030", Properties.Resources.fsce00030);
                        }
                        else if (string.Equals(dr["Name"].ToString(), ServerConfigurationDataTypeEnum.DEFAULT_SAP_CONFIG_LANGUAGE.ToString()))
                        {
                            CheckServerMandatorySettings(ServerConfigurationDataTypeEnum.DEFAULT_SAP_CONFIG_LANGUAGE, "fsce00031", Properties.Resources.fsce00031);
                        }
                        else if (string.Equals(dr["Name"].ToString(), ServerConfigurationDataTypeEnum.DEFAULT_SAP_CONFIG_POOL_SIZE.ToString()))
                        {
                            CheckServerMandatorySettings(ServerConfigurationDataTypeEnum.DEFAULT_SAP_CONFIG_POOL_SIZE, "fsce00033", Properties.Resources.fsce00033);
                        }
                        else if (string.Equals(dr["Name"].ToString(), ServerConfigurationDataTypeEnum.DEFAULT_SAP_CONFIG_PEAK_CONNECTIONS_LIMIT.ToString()))
                        {
                            CheckServerMandatorySettings(ServerConfigurationDataTypeEnum.DEFAULT_SAP_CONFIG_PEAK_CONNECTIONS_LIMIT, "fsce00034", Properties.Resources.fsce00034);
                        }
                        else if (string.Equals(dr["Name"].ToString(), ServerConfigurationDataTypeEnum.DEFAULT_SAP_CONFIG_IDLE_TIMEOUT.ToString()))
                        {
                            CheckServerMandatorySettings(ServerConfigurationDataTypeEnum.DEFAULT_SAP_CONFIG_IDLE_TIMEOUT, "fsce00035", Properties.Resources.fsce00035);
                        }
                        else if (string.Equals(dr["Name"].ToString(), ServerConfigurationDataTypeEnum.DEFAULT_SAP_CONFIG_IDLE_CHECKTIME.ToString()))
                        {
                            CheckServerMandatorySettings(ServerConfigurationDataTypeEnum.DEFAULT_SAP_CONFIG_IDLE_CHECKTIME, "fsce00036", Properties.Resources.fsce00036);
                        }
                        else if (string.Equals(dr["Name"].ToString(), ServerConfigurationDataTypeEnum.DEFAULT_PQM_CONFIG_URL.ToString()))
                        {
                            CheckServerMandatorySettings(ServerConfigurationDataTypeEnum.DEFAULT_PQM_CONFIG_URL, "fsce00038", Properties.Resources.fsce00038);
                        }
                        else
                        {
                            MessageData messageData         = new MessageData("fsce00032", Properties.Resources.fsce00032, dr["Name"].ToString());
                            Framework.SystemException sysEx = new Framework.SystemException(messageData);

                            InitializationSystemExceptionHandler.GetInstance().HandleException(sysEx);
                        }
                    }
                }
            }
        }