protected LoginProvider(IIdpHandlerLogic handler, IConfigSectionNode cfg) : base(handler) { cfg.NonEmpty(nameof(cfg)); m_Name = cfg.Of(Configuration.CONFIG_NAME_ATTR).ValueAsAtom(Atom.ZERO).Value; m_Name.NonBlank("attribute ${0}".Args(Configuration.CONFIG_NAME_ATTR)); m_DefaultLoginType = cfg.Of(CONFIG_DEFAULT_LOGIN_TYPE_ATTR).ValueAsAtom(Atom.ZERO); SupportedLoginTypes.Any(t => t == m_DefaultLoginType) .IsTrue("Known login type"); }
protected internal Shard(ShardSet set, IConfigSectionNode conf) { m_Set = set.NonNull(nameof(set)); ConfigAttribute.Apply(this, conf.NonEmpty(nameof(conf))); m_Name = conf.ValOf(Configuration.CONFIG_NAME_ATTR).NonBlank("$name"); m_NameHash = ShardKey.ForString(m_Name); m_Weight = conf.Of(CONFIG_WEIGHT_ATTR).ValueAsDouble(1.0d); m_ConnectString = conf.Of(CONFIG_CONNECT_ATTR, CONFIG_CONNECT_STRING_ATTR).Value.NonBlank($"${CONFIG_CONNECT_ATTR}"); m_DatabaseName = conf.Of(CONFIG_DB_ATTR).Value.NonBlank($"${CONFIG_DB_ATTR}"); }
protected override void DoConfigure(IConfigSectionNode node) { node.NonEmpty(nameof(GdidProviderModule) + ".conf"); base.DoConfigure(node); var isLocal = node.Of(CONFIG_LOCAL_ATTR).ValueAsBool(false); var naccessor = node[CONFIG_ACCESSOR_SECT]; if (!isLocal && naccessor.Exists) { var accessor = FactoryUtils.MakeAndConfigureDirectedComponent <IGdidAuthorityAccessor>(this, naccessor); m_Generator = new GdidGenerator(this, nameof(GdidProviderModule), ScopePrefix, SequencePrefix, accessor); } else { if (isLocal) { m_Generator = new LocalGdidGenerator(this); } else { m_Generator = new GdidGenerator(this, nameof(GdidProviderModule)); } } var ngen = node[CONFIG_GENERATOR_SECT]; if (ngen.Exists && m_Generator is IConfigurable configurable) { configurable.Configure(ngen); } }
protected override void DoConfigure(IConfigSectionNode node) { base.DoConfigure(node); if (node == null) { return; } var nbundled = node[CONFIG_BUNDLED_MONGO_SECTION]; if (nbundled.Exists) { DisposeAndNull(ref m_Bundled); m_Bundled = FactoryUtils.MakeAndConfigureDirectedComponent <BundledMongoDb>(this, nbundled, typeof(BundledMongoDb)); m_EffectiveServerNode = m_Bundled.ServerNode; } else { var n = node.Of(CONFIG_SERVER_NODE_ATTR); if (!n.Exists || n.Value.IsNullOrWhiteSpace()) { throw new CallGuardException(nameof(MongoDbAppliance), CONFIG_SERVER_NODE_ATTR, "Attribute must be specified when no bundled Mongo instance hosted"); } m_EffectiveServerNode = new Node(n.Value); } }
protected override void DoConfigure(IConfigSectionNode node) { base.DoConfigure(node); m_SenseCase = node.Of(CONFIG_CASE_ATTR).ValueAsBool(); var d = node.Of(CONFIG_DELIMITER_ATTR).ValueAsString(DELIMITER)[0]; m_Includes = node.Of(CONFIG_INCLUDE_ATTR) .Value .Default() .Split(d) .Select(v => v.Trim()) .Where(s => s.IsNotNullOrWhiteSpace()) .ToArray(); m_Excludes = node.Of(CONFIG_EXCLUDE_ATTR) .Value .Default() .Split(d) .Select(v => v.Trim()) .Where(s => s.IsNotNullOrWhiteSpace()) .ToArray(); }
/// <summary> /// A shortcut to node.Of(attrName).Value /// </summary> public static string ValOf(this IConfigSectionNode node, string attrName) => node.Of(attrName).Value;