Exemplo n.º 1
0
        public GridUserServiceBase(IConfigSource config)
            : base(config)
        {
            string dllName    = String.Empty;
            string connString = String.Empty;
            string realm      = "GridUser";

            //
            // Try reading the [DatabaseService] section, if it exists
            //
            IConfig dbConfig = config.Configs["DatabaseService"];

            if (dbConfig != null)
            {
                if (dllName == String.Empty)
                {
                    dllName = dbConfig.GetString("StorageProvider", String.Empty);
                }
                if (connString == String.Empty)
                {
                    connString = dbConfig.GetString("ConnectionString", String.Empty);
                }
            }

            //
            // [GridUsetService] section overrides [DatabaseService], if it exists
            //
            IConfig presenceConfig = config.Configs["GridUserService"];

            if (presenceConfig != null)
            {
                dllName    = presenceConfig.GetString("StorageProvider", dllName);
                connString = presenceConfig.GetString("ConnectionString", connString);
                realm      = presenceConfig.GetString("Realm", realm);
            }

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

            m_Database = LoadPlugin <IGridUserData>(dllName, new Object[] { connString, realm });
            if (m_Database == null)
            {
                throw new Exception("Could not find a storage interface in the given module " + dllName);
            }
        }
Exemplo n.º 2
0
        public void Initialize(IConfigSource config, IRegistryCore registry)
        {
            string dllName = String.Empty;
            string connString = String.Empty;
            string realm = "GridUser";

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

            //
            // [GridUsetService] section overrides [DatabaseService], if it exists
            //
            IConfig presenceConfig = config.Configs["GridUserService"];
            if (presenceConfig != null)
            {
                dllName = presenceConfig.GetString("StorageProvider", dllName);
                connString = presenceConfig.GetString("ConnectionString", connString);
                realm = presenceConfig.GetString("Realm", realm);
            }

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

            m_Database = AuroraModuleLoader.LoadPlugin<IGridUserData>(dllName, new Object[] { connString, realm });
            if (m_Database == null)
                throw new Exception("Could not find a storage interface in the given module " + dllName);
            registry.RegisterModuleInterface<IGridUserService>(this);

            m_log.Debug("[USER GRID SERVICE]: Starting user grid service");
        }
Exemplo n.º 3
0
        public GridUserServiceBase(IConfigSource config) : base(config)
        {
            string dllName = String.Empty;
            string connString = String.Empty;
            string realm = "GridUser";

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

            //
            // [GridUsetService] section overrides [DatabaseService], if it exists
            //
            IConfig usersConfig = config.Configs["GridUserService"];
            if (usersConfig != null)
            {
                dllName = usersConfig.GetString("StorageProvider", dllName);
                connString = usersConfig.GetString("ConnectionString", connString);
                realm = usersConfig.GetString("Realm", realm);
            }
            
            //
            // We tried, but this doesn't exist. We can't proceed.
            //
            if (dllName.Equals(String.Empty))
                throw new Exception("No StorageProvider configured");

            m_Database = LoadPlugin<IGridUserData>(dllName, new Object[] { connString, realm });
            if (m_Database == null)
                throw new Exception("Could not find a storage interface in the given module " + dllName);
        }
Exemplo n.º 4
0
        public GroupsServiceBase(IConfigSource config, string cName)
            : base(config)
        {
            string dllName    = String.Empty;
            string connString = String.Empty;
            string realm      = "os_groups";
            string usersRealm = "GridUser";
            string configName = (cName == string.Empty) ? "Groups" : cName;

            //
            // Try reading the [DatabaseService] section, if it exists
            //
            IConfig dbConfig = config.Configs["DatabaseService"];

            if (dbConfig != null)
            {
                if (dllName == String.Empty)
                {
                    dllName = dbConfig.GetString("StorageProvider", String.Empty);
                }
                if (connString == String.Empty)
                {
                    connString = dbConfig.GetString("ConnectionString", String.Empty);
                }
            }

            //
            // [Groups] section overrides [DatabaseService], if it exists
            //
            IConfig groupsConfig = config.Configs[configName];

            if (groupsConfig != null)
            {
                dllName    = groupsConfig.GetString("StorageProvider", dllName);
                connString = groupsConfig.GetString("ConnectionString", connString);
                realm      = groupsConfig.GetString("Realm", realm);
            }

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

            m_Database = LoadPlugin <IGroupsData>(dllName, new Object[] { connString, realm });
            if (m_Database == null)
            {
                throw new Exception("Could not find a storage interface in the given module " + dllName);
            }

            //
            // [GridUserService] section overrides [DatabaseService], if it exists
            //
            IConfig usersConfig = config.Configs["GridUserService"];

            if (usersConfig != null)
            {
                dllName    = usersConfig.GetString("StorageProvider", dllName);
                connString = usersConfig.GetString("ConnectionString", connString);
                usersRealm = usersConfig.GetString("Realm", usersRealm);
            }

            m_GridUserService = LoadPlugin <IGridUserData>(dllName, new Object[] { connString, usersRealm });
            if (m_GridUserService == null)
            {
                throw new Exception("Could not find a storage inferface for the given users module " + dllName);
            }
        }