コード例 #1
0
        public static RepresentedConfiguration ExtractFromBroker(Broker b)
        {
            ConfigurationBroker c = new ConfigurationBroker();
            c.Connections = (from cc in b.MessageChannels.Connections
                             select new cConnection()
                             {
                                 Name = cc.Key,
                                 queueTypeName = cc.Value.QueueTypeName,
                                 QueueParameters = cc.Value.specParams.GetHolder()
                             }).ToArray();
            c.Channels = (from cc in b.MessageChannels.MChannelsList
                          select new cChannel()
                          {
                              connectionName = cc.ConnectionName,
                              Name = cc.UniqueName
                          }).ToArray();

            c.Tasks = (from tt in b.Tasks
                       select new cTask()
                       {
                           intervalType = tt.intervalType,
                           Description = tt.NameAndDescription,
                           ChannelName = tt.ChannelName,
                           intervalValue = tt.intervalValue,
                           ModuleName = tt.Module.UniqueName,
                           parameters = tt.Parameters == null ? null : tt.Parameters,
                           Auto = tt.Temp
                       }).ToArray();

            return c;
        }
コード例 #2
0
 public static bool ValidateMain(ref string json, out string errors, out ConfigurationBroker bc)
 {
     bc = null;
     try
     {
         bc = ConfigurationBroker.DeSerialiseJson(json);
         json = bc.SerialiseJsonString();
     }
     catch (Exception e)
     {
         errors = "Configuration broken: " + e.Message;
         return false;
     }
     errors = "ok";
     return true;
 }
コード例 #3
0
        /// <summary>
        /// 从配置文件中读取配置的最大Json尺寸
        /// </summary>
        /// <returns></returns>
        public static int GetMaxJsonLength()
        {
            int result = -1;

            ScriptingJsonSerializationSection scriptSection = (ScriptingJsonSerializationSection)ConfigurationBroker.GetSection("jsonSerialization");

            if (scriptSection == null)
            {
                scriptSection = (ScriptingJsonSerializationSection)ConfigurationBroker.GetSection("scriptJsonSerialization");
            }

            if (scriptSection != null)
            {
                result = scriptSection.MaxJsonLength;
            }

            if (result < 0)
            {
                result = int.MaxValue;
            }

            return(result);
        }
コード例 #4
0
        public static DropdownPropertyDataSourceSettings GetConfig()
        {
            DropdownPropertyDataSourceSettings settings = (DropdownPropertyDataSourceSettings)ConfigurationBroker.GetSection("dropdownPropertyDataSourceSettings");

            if (settings == null)
            {
                settings = new DropdownPropertyDataSourceSettings();
            }

            return(settings);
        }
コード例 #5
0
        public static ScriptingJsonSerializationSection GetJsonSerializationSection()
        {
            //原来的配置节的名称为jsonSerialization,现在更换为scriptJsonSerialization
            ScriptingJsonSerializationSection section = (ScriptingJsonSerializationSection)ConfigurationBroker.GetSection("deluxe.web/scriptJsonSerialization");

            if (section == null)
            {
                section = new ScriptingJsonSerializationSection();
            }

            return(section);
        }
コード例 #6
0
        public static void Apply(this ConfigurationBroker con, Broker broker)
        {
            logger.Debug("Trying to apply ---main configuration---\r\n with datetime stamp: {0} {1}", con.CreationDate.ToLongDateString(), con.CreationDate.ToLongTimeString());

            for (int i = 0; i < con.Connections.Length; i++)
            {
                cConnection connection = con.Connections[i];
                if (connection.Auto)
                {
                    logger.Warning("Skipping connection parameters for [{0}]:{1}", i, connection.Name);
                }
                else if (connection.queueTypeName == null)
                {
                    logger.Error("Connection has not auto specific property, ignored: {0}", i);
                }
                else if (connection.QueueParameters == null)
                {
                    logger.Error("Connection parameters for queue: {0} is absent, this queue will be ignored", connection.Name);
                }
                else
                {
                    var qinterface = broker.QueueInterfaces.GetQueue(connection.queueTypeName);
                    QueueSpecificParameters parameters = qinterface.GetParametersModel();
                    parameters.SetHolder(connection.QueueParameters);
                    broker.RegisterConnection(connection.Name, qinterface, parameters, false);
                }
            }

            foreach (var channel in con.Channels)
            {
                try
                {
                    if (channel.Auto)
                    {
                        logger.Warning("Skipping channel for {0}", channel.Name);
                    }
                    else
                    {
                        broker.RegisterChannel(channel.connectionName, channel.Name, false);
                    }
                }
                catch (Exception e)
                {
                    logger.Exception(e, "Channels configuration applying, ignored");
                }
            }
            for (int i = 0; i < con.Tasks.Length; i++)
            {
                var task = con.Tasks[i];
                if (task == null)
                {
                    logger.Error("Task has not auto specific property, ignored: {0}", i);
                }
                else if (!task.Auto)
                {
                    try
                    {
                        broker.RegisterTask(task.ChannelName, task.ModuleName, task.intervalType, task.intervalValue, task.parameters, task.Description);
                    }
                    catch (Exception e)
                    {
                        logger.Exception(e, "Tasks configuration applying, ignored");
                    }
                }
            }
        }
コード例 #7
0
 /// <summary>
 /// 获取Section实例
 /// </summary>
 /// <returns></returns>
 public static ApplicationErrorLogSection GetSection()
 {
     return((ApplicationErrorLogSection)ConfigurationBroker.GetSection("appicationErrorLog"));
 }
コード例 #8
0
        /// <summary>
        /// 得到配置信息
        /// </summary>
        /// <returns></returns>
        public static PermissionCenterToADSynchronizeSettings GetConfig()
        {
            PermissionCenterToADSynchronizeSettings result = (PermissionCenterToADSynchronizeSettings)ConfigurationBroker.GetSection("permissionCenterToADSynchronizeSettings");

            if (result == null)
            {
                result = new PermissionCenterToADSynchronizeSettings();
            }

            return(result);
        }
コード例 #9
0
        public static LogCategoryConfigSection GetConfig()
        {
            LogCategoryConfigSection settings = (LogCategoryConfigSection)ConfigurationBroker.GetSection("schemaLogCategorySettings");

            return(settings);
        }
コード例 #10
0
        public static PropertyEditorConfigurationSection GetConfig()
        {
            PropertyEditorConfigurationSection result = (PropertyEditorConfigurationSection)ConfigurationBroker.GetSection("propertyEditorConfig");

            if (result == null)
            {
                result = new PropertyEditorConfigurationSection();
            }

            return(result);
        }
コード例 #11
0
        public static MossServerInfoConfigurationSettings GetConfig()
        {
            MossServerInfoConfigurationSettings result = (MossServerInfoConfigurationSettings)ConfigurationBroker.GetSection("mossServerInfoConfigSettings");

            ConfigurationExceptionHelper.CheckSectionNotNull(result, "mossServerInfoConfigSettings");

            return(result);
        }
コード例 #12
0
        public static CutomerServiceExecutiveSetting GetConfig()
        {
            CutomerServiceExecutiveSetting settings = (CutomerServiceExecutiveSetting)ConfigurationBroker.GetSection("cutomerServiceExecutiveSetting");

            if (settings == null)
            {
                settings = new CutomerServiceExecutiveSetting();
            }

            return(settings);
        }
コード例 #13
0
ファイル: WebConfigFactory.cs プロジェクト: zyg0717/LJTH_SJSJ
        /// <summary>
        /// 获取WebControlsSection
        /// </summary>
        /// <returns>WebControlsSection</returns>
        /// <remarks>获取WebControlsSection</remarks>
        public static Framework.Web.Config.WebControlsSection GetWebControlsSection()
        {
            Framework.Web.Config.WebControlsSection section = (Framework.Web.Config.WebControlsSection)ConfigurationBroker.GetSection("Framework.web/webcontrols");

            if (section == null)
            {
                section = new Framework.Web.Config.WebControlsSection();
            }

            return(section);
        }
コード例 #14
0
        /// <summary>
        /// 获取Cache的配置信息
        /// </summary>
        /// <returns>Cache的配置信息</returns>
        public static SendInvalidNotificationSettingsSection GetConfig()
        {
            SendInvalidNotificationSettingsSection result = (SendInvalidNotificationSettingsSection)ConfigurationBroker.GetSection("sendInvalidNotificationSettings");

            if (result == null)
            {
                result = new SendInvalidNotificationSettingsSection();
            }

            return(result);
        }
コード例 #15
0
        public static JsonConverterRegisterSettings GetConfig()
        {
            JsonConverterRegisterSettings result = (JsonConverterRegisterSettings)ConfigurationBroker.GetSection("jsonConverterRegisterSettings");

            return(result ?? new JsonConverterRegisterSettings());
        }
コード例 #16
0
        public void Test()
        {
            IObjectBuilder builder = ConfigurationBroker.GetConfigurationObject <IObjectBuilder>();

            Assert.IsNotNull(builder);
        }
コード例 #17
0
        public static ObjectValueToPropertyValueSettings GetConfig()
        {
            ObjectValueToPropertyValueSettings settings = (ObjectValueToPropertyValueSettings)ConfigurationBroker.GetSection("objectValueToPropertyValueSettings");

            if (settings == null)
            {
                settings = new ObjectValueToPropertyValueSettings();
            }

            return(settings);
        }
コード例 #18
0
ファイル: SNTPSettings.cs プロジェクト: HarveyHuBJ/AK47Source
 /// <summary>
 /// 获取配置信息。如果不存在,则返回null
 /// </summary>
 /// <returns></returns>
 public static SNTPSettings GetConfig()
 {
     return((SNTPSettings)ConfigurationBroker.GetSection("sntpSettings"));
 }
コード例 #19
0
        private static readonly ConfigurationProperty _StandardManageDimensionality = new ConfigurationProperty("smdId", typeof(string), "", ConfigurationPropertyOptions.IsRequired);         // 标准管理维度

        public static PermissionBackwardCompatibilityConfigSection GetConfig()
        {
            PermissionBackwardCompatibilityConfigSection settings = (PermissionBackwardCompatibilityConfigSection)ConfigurationBroker.GetSection("pcBCConfig");

            if (settings == null)
            {
                settings = new PermissionBackwardCompatibilityConfigSection();
            }

            return(settings);
        }
コード例 #20
0
        /// <summary>
        /// 得到配置信息
        /// </summary>
        /// <returns></returns>
        public static WfControlOperationPlugInsSettings GetConfig()
        {
            WfControlOperationPlugInsSettings settings = (WfControlOperationPlugInsSettings)ConfigurationBroker.GetSection("wfControlOperationPlugInsSettings");

            if (settings == null)
            {
                settings = new WfControlOperationPlugInsSettings();
            }

            return(settings);
        }
コード例 #21
0
        public static ComponentHelperWrapperSettings GetConfig()
        {
            ComponentHelperWrapperSettings settings = (ComponentHelperWrapperSettings)ConfigurationBroker.GetSection("componentHelperWrapperSettings");

            if (settings == null)
            {
                settings = new ComponentHelperWrapperSettings();
            }

            return(settings);
        }
コード例 #22
0
        public void Load()
        {
            Type type = System.Type.GetType(ObjectBuilder.TypeName);

            ConfigurationBroker.Add(typeof(IObjectBuilder), Activator.CreateInstance(type));
        }
コード例 #23
0
        public static UserRecentDataConfigurationSection GetConfig()
        {
            UserRecentDataConfigurationSection settings = (UserRecentDataConfigurationSection)ConfigurationBroker.GetSection("userRecentDataSettings");

            if (settings == null)
            {
                settings = new UserRecentDataConfigurationSection();
            }

            return(settings);
        }
コード例 #24
0
 public static WorkflowSettings GetConfig()
 {
     return((WorkflowSettings)ConfigurationBroker.GetSection("workflowSettings", true));
 }
コード例 #25
0
        /// <summary>
        /// 获取WebControlsSection
        /// </summary>
        /// <returns>WebControlsSection</returns>
        /// <remarks>获取WebControlsSection</remarks>
        public static Lib.Web.Config.WebControlsSection GetWebControlsSection()
        {
            Lib.Web.Config.WebControlsSection section = (Lib.Web.Config.WebControlsSection)ConfigurationBroker.GetSection("lib.web/webcontrols");

            if (section == null)
            {
                section = new Lib.Web.Config.WebControlsSection();
            }

            return(section);
        }
コード例 #26
0
        public static ActivateWfProcessServiceSettings GetConfig()
        {
            ActivateWfProcessServiceSettings result = (ActivateWfProcessServiceSettings)ConfigurationBroker.GetSection("activateWfProcessConfig");

            if (result == null)
            {
                result = new ActivateWfProcessServiceSettings();
            }

            return(result);
        }
コード例 #27
0
        /// <summary>
        /// 获取JsonSerializationSection
        /// </summary>
        /// <returns>JsonSerializationSection</returns>
        /// <remarks>获取JsonSerializationSection</remarks>
        public static ScriptingJsonSerializationSection GetJsonSerializationSection()
        {
            ScriptingJsonSerializationSection section = (ScriptingJsonSerializationSection)ConfigurationBroker.GetSection("lib.web/jsonConverter");

            if (section == null)
            {
                section = new ScriptingJsonSerializationSection();
            }

            return(section);
        }
コード例 #28
0
        public void ExceedMaxJsonLengthSerializationLengthTest()
        {
            ScriptingJsonSerializationSection scriptSection = (ScriptingJsonSerializationSection)ConfigurationBroker.GetSection("jsonSerialization");

            Console.WriteLine(scriptSection.MaxJsonLength);
            string data = PrepateTestStringByLength(15000);

            string json = JSONSerializerExecute.Serialize(data);
        }
コード例 #29
0
        /// <summary>
        /// 获取JsonSerializationSection
        /// </summary>
        /// <returns>JsonSerializationSection</returns>
        /// <remarks>获取JsonSerializationSection</remarks>
        private static ScriptingJsonSerializationSection GetJsonSerializationSection()
        {
            ScriptingJsonSerializationSection section = (ScriptingJsonSerializationSection)ConfigurationBroker.GetSection("scriptJsonSerialization");

            if (section == null)
            {
                section = new ScriptingJsonSerializationSection();
            }

            return(section);
        }