Example #1
0
        public UserServiceBase(IConfigSource config) : base(config)
        {
            IConfig userConfig = config.Configs["UserService"];

            if (userConfig == null)
            {
                throw new Exception("No UserService configuration");
            }

            string dllName = userConfig.GetString("StorageProvider",
                                                  String.Empty);

            if (dllName == String.Empty)
            {
                throw new Exception("No StorageProvider configured");
            }

            string connString = userConfig.GetString("ConnectionString",
                                                     String.Empty);

            m_Database = LoadPlugin <IUserDataPlugin>(dllName);

            if (m_Database == null)
            {
                throw new Exception("Could not find a storage interface in the given module");
            }

            m_Database.Initialise(connString);
        }
Example #2
0
        public UserServiceBase(IConfigSource config) : base(config)
        {
            IConfig userConfig = config.Configs["UserService"];
            if (userConfig == null)
                throw new Exception("No UserService configuration");

            string dllName = userConfig.GetString("StorageProvider",
                    String.Empty);

            if (dllName == String.Empty)
                throw new Exception("No StorageProvider configured");

            string connString = userConfig.GetString("ConnectionString",
                    String.Empty);

            m_Database = LoadPlugin<IUserDataPlugin>(dllName);

            if (m_Database == null)
                throw new Exception("Could not find a storage interface in the given module");

            m_Database.Initialise(connString);
        }
Example #3
0
        public HGAuthenticationService(IConfigSource config) : base(config)
        {
            string dllName = String.Empty;
            string connString = String.Empty;

            //
            // Try reading the [DatabaseService] section first, if it exists
            //
            IConfig dbConfig = config.Configs["DatabaseService"];
            if (dbConfig != null)
            {
                dllName = dbConfig.GetString("StorageProvider", String.Empty);
                connString = dbConfig.GetString("ConnectionString", String.Empty);
            }

            //
            // Try reading the more specific [InventoryService] section, if it exists
            //
            IConfig authConfig = config.Configs["AuthenticationService"];
            if (authConfig != null)
            {
                dllName = authConfig.GetString("StorageProvider", dllName);
                connString = authConfig.GetString("ConnectionString", connString);

                m_PerformAuthentication = authConfig.GetBoolean("Authenticate", true);
                m_AuthorityURL = "http://" + authConfig.GetString("Authority", "localhost");
                if (!m_AuthorityURL.EndsWith("/"))
                    m_AuthorityURL += "/";
            }

            //
            // We tried, but this doesn't exist. We can't proceed.
            //
            if (dllName.Equals(String.Empty))
                throw new Exception("No InventoryService configuration");

            m_Database = LoadPlugin<IUserDataPlugin>(dllName);
            if (m_Database == null)
                throw new Exception("Could not find a storage interface in the given module");

            m_Database.Initialise(connString);
        } 
Example #4
0
        public override void Initialise(IPlugin plugin)
        {
            IUserDataPlugin p = plugin as IUserDataPlugin;

            p.Initialise(connect);
        }