Пример #1
0
        public TestCommunicationsManager(NetworkServersInfo serversInfo)
            : base(serversInfo, new BaseHttpServer(666), null, false, null)
        {
            SQLAssetServer assetService = new SQLAssetServer(new TestAssetDataPlugin());

            m_assetCache = new AssetCache(assetService);

            LocalInventoryService lis = new LocalInventoryService();

            m_inventoryDataPlugin = new TestInventoryDataPlugin();
            lis.AddPlugin(m_inventoryDataPlugin);
            m_interServiceInventoryService = lis;
            AddInventoryService(lis);

            LocalUserServices lus = new LocalUserServices(991, 992, this);

            lus.AddPlugin(new TemporaryUserProfilePlugin());
            m_userDataPlugin = new TestUserDataPlugin();
            lus.AddPlugin(m_userDataPlugin);
            m_userService      = lus;
            m_userAdminService = lus;

            LocalBackEndServices gs = new LocalBackEndServices();

            m_gridService = gs;
        }
Пример #2
0
 public HGGridServicesGridMode(NetworkServersInfo servers_info, BaseHttpServer httpServe,
                               IAssetCache asscache, SceneManager sman, UserProfileCacheService userv)
     : base(servers_info, httpServe, asscache, sman)
 {
     m_remoteBackend    = new OGS1GridServices(servers_info, httpServe);
     m_userProfileCache = userv;
 }
Пример #3
0
        public CommunicationsLocal(
            ConfigSettings configSettings,
            NetworkServersInfo serversInfo,
            BaseHttpServer httpServer,
            IAssetCache assetCache,
            LibraryRootFolder libraryRootFolder)
            : base(serversInfo, httpServer, assetCache, libraryRootFolder)
        {
            PluginLoader <IInventoryStoragePlugin> loader = new PluginLoader <IInventoryStoragePlugin>();

            loader.Add("/OpenSim/InventoryStorage", new PluginProviderFilter(configSettings.InventoryPlugin));
            loader.Load();

            loader.Plugin.Initialize(configSettings);


            LocalUserServices lus
                = new LocalUserServices(
                      serversInfo.DefaultHomeLocX, serversInfo.DefaultHomeLocY, this);

            //lus.AddPlugin(new TemporaryUserProfilePlugin());
            lus.AddPlugin(configSettings.StandaloneUserPlugin, configSettings.StandaloneUserSource);
            m_userService      = lus;
            m_userAdminService = lus;
            m_avatarService    = lus;
            m_messageService   = lus;

            m_gridService = new LocalBackEndServices();
        }
        public CommunicationsOGS1(
            NetworkServersInfo serversInfo, BaseHttpServer httpServer,
            IAssetCache assetCache, LibraryRootFolder libraryRootFolder,
            ConfigSettings configSettings)
            : base(serversInfo, httpServer, assetCache, libraryRootFolder)
        {
            OGS1GridServices gridInterComms = new OGS1GridServices(serversInfo, httpServer);

            m_gridService = gridInterComms;

            // This plugin arrangement could eventually be configurable rather than hardcoded here.
            OGS1UserServices userServices = new OGS1UserServices(this);

            //userServices.AddPlugin(new TemporaryUserProfilePlugin());
            userServices.AddPlugin(new OGS1UserDataPlugin(this, configSettings));

            m_userService    = userServices;
            m_messageService = userServices;
            m_avatarService  = (IAvatarService)m_userService;

            PluginLoader <IInventoryStoragePlugin> loader = new PluginLoader <IInventoryStoragePlugin>();

            loader.Add("/OpenSim/InventoryStorage", new PluginProviderFilter(configSettings.InventoryPlugin));
            loader.Load();

            loader.Plugin.Initialize(configSettings);
        }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="serversInfo"></param>
 /// <param name="httpServer"></param>
 /// <param name="assetCache"></param>
 /// <param name="dumpAssetsToFile"></param>
 public CommunicationsManager(NetworkServersInfo serversInfo, IHttpServer httpServer, IAssetCache assetCache,
     bool dumpAssetsToFile, LibraryRootFolder libraryRootFolder)
 {
     m_networkServersInfo = serversInfo;
     m_userProfileCacheService = new UserProfileCacheService(this, libraryRootFolder);
     m_httpServer = httpServer;
 }
        public CommunicationsOGS1(
            NetworkServersInfo serversInfo, BaseHttpServer httpServer,
            IAssetCache assetCache, LibraryRootFolder libraryRootFolder)
            : base(serversInfo, httpServer, assetCache, false, libraryRootFolder)
        {
            OGS1GridServices gridInterComms = new OGS1GridServices(serversInfo, httpServer);

            m_gridService = gridInterComms;

            if (serversInfo.secureInventoryServer)
            {
                OGS1SecureInventoryService invService = new OGS1SecureInventoryService(serversInfo.InventoryURL);
                AddSecureInventoryService(invService);
                m_defaultInventoryHost = invService.Host;
            }
            else
            {
                OGS1InventoryService invService = new OGS1InventoryService(serversInfo.InventoryURL);
                AddInventoryService(invService);
                m_defaultInventoryHost = invService.Host;
            }

            // This plugin arrangement could eventually be configurable rather than hardcoded here.
            OGS1UserServices userServices = new OGS1UserServices(this);

            userServices.AddPlugin(new TemporaryUserProfilePlugin());
            userServices.AddPlugin(new OGS1UserDataPlugin(this));

            m_userService    = userServices;
            m_messageService = userServices;
            m_avatarService  = (IAvatarService)m_userService;
        }
Пример #7
0
 public HGGridServicesStandalone(NetworkServersInfo servers_info, BaseHttpServer httpServe, IAssetCache asscache, SceneManager sman)
     : base(servers_info, httpServe, asscache, sman)
 {
     //Respond to Grid Services requests
     httpServer.AddXmlRPCHandler("logoff_user", LogOffUser);
     httpServer.AddXmlRPCHandler("check", PingCheckReply);
     httpServer.AddXmlRPCHandler("land_data", LandData);
 }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="serversInfo"></param>
        /// <param name="httpServer"></param>
        /// <param name="assetCache"></param>
        public CommunicationsManager(NetworkServersInfo serversInfo, IHttpServer httpServer, IAssetCache assetCache,
                                     LibraryRootFolder libraryRootFolder)
        {
            m_networkServersInfo = serversInfo;
            m_assetCache         = assetCache;
            m_httpServer         = httpServer;
            LibraryRoot          = libraryRootFolder;

            Preload();
        }
Пример #9
0
        /// <summary>
        /// Contructor.  Adds "expect_user" and "check" xmlrpc method handlers
        /// </summary>
        /// <param name="servers_info"></param>
        /// <param name="httpServe"></param>
        public OGS1GridServices(NetworkServersInfo servers_info, BaseHttpServer httpServe)
        {
            serversInfo = servers_info;
            httpServer  = httpServe;

            //Respond to Grid Services requests
            //  httpServer.AddXmlRPCHandler("expect_user", ExpectUser);
            //  httpServer.AddXmlRPCHandler("logoff_user", LogOffUser);
            httpServer.AddXmlRPCHandler("check", PingCheckReply);
            httpServer.AddXmlRPCHandler("land_data", LandData);
        }
Пример #10
0
        public HGCommunicationsStandalone(
            ConfigSettings configSettings,
            NetworkServersInfo serversInfo,
            BaseHttpServer httpServer,
            IAssetCache assetCache,
            HGGridServices gridService,
            LibraryRootFolder libraryRootFolder,
            bool dumpAssetsToFile)
            : base(serversInfo, httpServer, assetCache, dumpAssetsToFile, libraryRootFolder)
        {
            LocalUserServices localUserService =
                new LocalUserServices(
                    serversInfo.DefaultHomeLocX, serversInfo.DefaultHomeLocY, this);

            localUserService.AddPlugin(configSettings.StandaloneUserPlugin, configSettings.StandaloneUserSource);

            HGInventoryServiceClient inventoryService
                = new HGInventoryServiceClient(serversInfo.InventoryURL, null, false);
            List <IInventoryDataPlugin> plugins
                = DataPluginFactory.LoadDataPlugins <IInventoryDataPlugin>(
                      configSettings.StandaloneInventoryPlugin,
                      configSettings.StandaloneInventorySource);

            foreach (IInventoryDataPlugin plugin in plugins)
            {
                // Using the OSP wrapper plugin should be made configurable at some point
                inventoryService.AddPlugin(new OspInventoryWrapperPlugin(plugin, this));
            }

            AddInventoryService(inventoryService);
            m_defaultInventoryHost            = inventoryService.Host;
            m_interServiceInventoryService    = inventoryService;
            inventoryService.UserProfileCache = UserProfileCacheService;

            m_assetCache = assetCache;
            // Let's swap to always be secure access to inventory
            AddSecureInventoryService((ISecureInventoryService)inventoryService);
            m_inventoryServices = null;

            HGUserServices hgUserService = new HGUserServices(this, localUserService);

            // This plugin arrangement could eventually be configurable rather than hardcoded here.
            hgUserService.AddPlugin(new TemporaryUserProfilePlugin());
            hgUserService.AddPlugin(new OGS1UserDataPlugin(this));

            m_userService      = hgUserService;
            m_userAdminService = hgUserService;
            m_avatarService    = hgUserService;
            m_messageService   = hgUserService;

            gridService.UserProfileCache = m_userProfileCacheService;
            m_gridService = gridService;
        }
Пример #11
0
        /// <summary>
        /// Contructor.  Adds "expect_user" and "check" xmlrpc method handlers
        /// </summary>
        /// <param name="servers_info"></param>
        /// <param name="httpServe"></param>
        public OGS1GridServices(NetworkServersInfo servers_info, BaseHttpServer httpServe)
        {
            serversInfo = servers_info;
            httpServer  = httpServe;

            //Respond to Grid Services requests
            httpServer.AddXmlRPCHandler("check", PingCheckReply);
            httpServer.AddXmlRPCHandler("land_data", LandData);

            // New Style
            httpServer.AddStreamHandler(new XmlRpcStreamHandler("POST", Util.XmlRpcRequestPrefix("check"), PingCheckReply));
            httpServer.AddStreamHandler(new XmlRpcStreamHandler("POST", Util.XmlRpcRequestPrefix("land_data"), LandData));
        }
        public LLStandaloneLoginService(
            UserProfileManager userManager, string welcomeMess, string mapServerURI, string profileServerURI,
            NetworkServersInfo serversInfo,
            bool authenticate, LibraryRootFolder libraryRootFolder, ILoginServiceToRegionsConnector regionsConnector)
            : base(userManager, libraryRootFolder, welcomeMess, mapServerURI, profileServerURI)
        {
            this.m_serversInfo = serversInfo;
            m_defaultHomeX     = this.m_serversInfo.DefaultHomeLocX;
            m_defaultHomeY     = this.m_serversInfo.DefaultHomeLocY;
            m_authUsers        = authenticate;

            m_regionsConnector = regionsConnector;
        }
Пример #13
0
        /// <summary>
        /// Contructor.  Adds "expect_hg_user" and "check" xmlrpc method handlers
        /// </summary>
        /// <param name="servers_info"></param>
        /// <param name="httpServe"></param>
        public HGGridServices(NetworkServersInfo servers_info, BaseHttpServer httpServe, IAssetCache asscache, SceneManager sman)
        {
            serversInfo  = servers_info;
            httpServer   = httpServe;
            m_assetcache = asscache;
            m_sceneman   = sman;

            random = new Random();

            httpServer.AddXmlRPCHandler("link_region", LinkRegionRequest);
            httpServer.AddXmlRPCHandler("expect_hg_user", ExpectHGUser);

            HGNetworkServersInfo.Init(servers_info.AssetURL, servers_info.InventoryURL, servers_info.UserURL);
        }
Пример #14
0
        public LLStandaloneLoginService(
            UserManagerBase userManager, string welcomeMess,
            IInterServiceInventoryServices interServiceInventoryService,
            NetworkServersInfo serversInfo,
            bool authenticate, LibraryRootFolder libraryRootFolder, ILoginServiceToRegionsConnector regionsConnector)
            : base(userManager, libraryRootFolder, welcomeMess)
        {
            this.m_serversInfo = serversInfo;
            m_defaultHomeX     = this.m_serversInfo.DefaultHomeLocX;
            m_defaultHomeY     = this.m_serversInfo.DefaultHomeLocY;
            m_authUsers        = authenticate;

            m_inventoryService = interServiceInventoryService;
            m_regionsConnector = regionsConnector;
        }
Пример #15
0
        public LLStandaloneLoginService(
            UserManagerBase userManager, string welcomeMess,
            IInventoryService interServiceInventoryService,
            NetworkServersInfo serversInfo,
            bool authenticate, LibraryRootFolder libraryRootFolder, ILoginServiceToRegionsConnector regionsConnector)
            : base(userManager, libraryRootFolder, welcomeMess)
        {
            this.m_serversInfo = serversInfo;
            m_defaultHomeX     = this.m_serversInfo.DefaultHomeLocX;
            m_defaultHomeY     = this.m_serversInfo.DefaultHomeLocY;
            m_authUsers        = authenticate;

            m_InventoryService = interServiceInventoryService;
            m_regionsConnector = regionsConnector;
            // Standard behavior: In StandAlone, silent logout of last hung session
            m_warn_already_logged = false;
        }
Пример #16
0
        public UserLoginAuthService(
            UserManagerBase userManager, IInterServiceInventoryServices inventoryService,
            LibraryRootFolder libraryRootFolder,
            UserConfig config, string welcomeMess, IRegionProfileRouter regionProfileService)
            : base(userManager, welcomeMess, inventoryService, null, true, libraryRootFolder, null)
        {
            m_config               = config;
            m_defaultHomeX         = m_config.DefaultX;
            m_defaultHomeY         = m_config.DefaultY;
            m_inventoryService     = inventoryService;
            m_regionProfileService = regionProfileService;

            NetworkServersInfo serversinfo = new NetworkServersInfo(1000, 1000);

            serversinfo.GridRecvKey  = m_config.GridRecvKey;
            serversinfo.GridSendKey  = m_config.GridSendKey;
            serversinfo.GridURL      = m_config.GridServerURL.ToString();
            serversinfo.InventoryURL = m_config.InventoryUrl.ToString();
            serversinfo.UserURL      = m_config.AuthUrl.ToString();
            SetServersInfo(serversinfo);
        }
        public CommunicationsLocal(
            ConfigSettings configSettings,
            NetworkServersInfo serversInfo,
            BaseHttpServer httpServer,
            IAssetCache assetCache,
            LibraryRootFolder libraryRootFolder,
            bool dumpAssetsToFile)
            : base(serversInfo, httpServer, assetCache, dumpAssetsToFile, libraryRootFolder)
        {
            LocalInventoryService       inventoryService = new LocalInventoryService();
            List <IInventoryDataPlugin> plugins
                = DataPluginFactory.LoadDataPlugins <IInventoryDataPlugin>(
                      configSettings.StandaloneInventoryPlugin,
                      configSettings.StandaloneInventorySource);

            foreach (IInventoryDataPlugin plugin in plugins)
            {
                // Using the OSP wrapper plugin for database plugins should be made configurable at some point
                inventoryService.AddPlugin(new OspInventoryWrapperPlugin(plugin, this));
            }

            AddInventoryService(inventoryService);
            m_defaultInventoryHost         = inventoryService.Host;
            m_interServiceInventoryService = inventoryService;

            LocalUserServices lus
                = new LocalUserServices(
                      serversInfo.DefaultHomeLocX, serversInfo.DefaultHomeLocY, this);

            lus.AddPlugin(new TemporaryUserProfilePlugin());
            lus.AddPlugin(configSettings.StandaloneUserPlugin, configSettings.StandaloneUserSource);
            m_userService      = lus;
            m_userAdminService = lus;
            m_avatarService    = lus;
            m_messageService   = lus;

            m_gridService = new LocalBackEndServices();

            //LocalLoginService loginService = CreateLoginService(libraryRootFolder, inventoryService, userService, backendService);
        }
Пример #18
0
        public HGCommunicationsGridMode(
            NetworkServersInfo serversInfo, BaseHttpServer httpServer,
            IAssetCache assetCache, SceneManager sman, LibraryRootFolder libraryRootFolder)
            : base(serversInfo, httpServer, assetCache, false, libraryRootFolder)
        {
            // From constructor at CommunicationsOGS1
            HGGridServices gridInterComms = new HGGridServicesGridMode(serversInfo, httpServer, assetCache, sman, m_userProfileCacheService);

            m_gridService = gridInterComms;
            m_osw         = gridInterComms;

            // The HG InventoryService always uses secure handlers
            HGInventoryServiceClient invService = new HGInventoryServiceClient(serversInfo.InventoryURL, this.m_userProfileCacheService, true);

            invService.UserProfileCache = m_userProfileCacheService;
            AddSecureInventoryService(invService);
            m_defaultInventoryHost = invService.Host;
            if (SecureInventoryService != null)
            {
                m_log.Info("[HG]: SecureInventoryService.");
            }
            else
            {
                m_log.Info("[HG]: Non-secureInventoryService.");
            }

            HGUserServices userServices = new HGUserServices(this);

            // This plugin arrangement could eventually be configurable rather than hardcoded here.
            userServices.AddPlugin(new TemporaryUserProfilePlugin());
            userServices.AddPlugin(new OGS1UserDataPlugin(this));

            m_userService    = userServices;
            m_messageService = userServices;
            m_avatarService  = userServices;
        }
Пример #19
0
        /// <summary>
        /// Loads the region configuration
        /// </summary>
        /// <param name="argvSource">Parameters passed into the process when started</param>
        /// <param name="configSettings"></param>
        /// <param name="networkInfo"></param>
        /// <returns>A configuration that gets passed to modules</returns>
        public OpenSimConfigSource LoadConfigSettings(
            IConfigSource argvSource, EnvConfigSource envConfigSource, out ConfigSettings configSettings,
            out NetworkServersInfo networkInfo)
        {
            if (m_log.IsDebugEnabled)
            {
                m_log.DebugFormat("{0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
            }

            m_configSettings     = configSettings = new ConfigSettings();
            m_networkServersInfo = networkInfo = new NetworkServersInfo();

            bool iniFileExists = false;

            IConfig startupConfig = argvSource.Configs["Startup"];

            List <string> sources = new List <string>();

            string iniFileName = startupConfig.GetString("inifile", "OpenSim.ini");

            if (IsUri(iniFileName))
            {
                if (!sources.Contains(iniFileName))
                {
                    sources.Add(iniFileName);
                }
                Application.iniFilePath = iniFileName;
            }
            else
            {
                Application.iniFilePath = Path.GetFullPath(
                    Path.Combine(Util.configDir(), iniFileName));

                if (!File.Exists(Application.iniFilePath))
                {
                    iniFileName             = "OpenSim.xml";
                    Application.iniFilePath = Path.GetFullPath(Path.Combine(Util.configDir(), iniFileName));
                }

                if (File.Exists(Application.iniFilePath))
                {
                    if (!sources.Contains(Application.iniFilePath))
                    {
                        sources.Add(Application.iniFilePath);
                    }
                }
            }

            string iniDirName = startupConfig.GetString("inidirectory", "config");
            string iniDirPath = Path.Combine(Util.configDir(), iniDirName);

            if (Directory.Exists(iniDirPath))
            {
                m_log.InfoFormat("Searching folder {0} for config ini files", iniDirPath);

                string[] fileEntries = Directory.GetFiles(iniDirName);
                foreach (string filePath in fileEntries)
                {
                    if (Path.GetExtension(filePath).ToLower() == ".ini")
                    {
                        if (!sources.Contains(Path.GetFullPath(filePath)))
                        {
                            sources.Add(Path.GetFullPath(filePath));
                        }
                    }
                }
            }

            m_config        = new OpenSimConfigSource();
            m_config.Source = new IniConfigSource();
            m_config.Source.Merge(DefaultConfig());

            m_log.Info("[CONFIG]: Reading configuration settings");

            if (sources.Count == 0)
            {
                m_log.FatalFormat("[CONFIG]: Could not load any configuration");
                Environment.Exit(1);
            }

            for (int i = 0; i < sources.Count; i++)
            {
                if (ReadConfig(sources[i]))
                {
                    iniFileExists = true;
                    AddIncludes(sources);
                }
            }

            if (!iniFileExists)
            {
                m_log.FatalFormat("[CONFIG]: Could not load any configuration");
                m_log.FatalFormat("[CONFIG]: Configuration exists, but there was an error loading it!");
                Environment.Exit(1);
            }

            // Make sure command line options take precedence
            m_config.Source.Merge(argvSource);

            IConfig enVars = m_config.Source.Configs["Environment"];

            if (enVars != null)
            {
                string[] env_keys = enVars.GetKeys();

                foreach (string key in env_keys)
                {
                    envConfigSource.AddEnv(key, string.Empty);
                }

                envConfigSource.LoadEnv();
                m_config.Source.Merge(envConfigSource);
            }

            m_config.Source.ExpandKeyValues();

            ReadConfigSettings();

            return(m_config);
        }
Пример #20
0
        /// <summary>
        /// Loads the region configuration
        /// </summary>
        /// <param name="argvSource">Parameters passed into the process when started</param>
        /// <param name="configSettings"></param>
        /// <param name="networkInfo"></param>
        /// <returns>A configuration that gets passed to modules</returns>
        public OpenSimConfigSource LoadConfigSettings(
            IConfigSource argvSource, out ConfigSettings configSettings,
            out NetworkServersInfo networkInfo)
        {
            m_configSettings     = configSettings = new ConfigSettings();
            m_networkServersInfo = networkInfo = new NetworkServersInfo();

            bool iniFileExists = false;

            IConfig startupConfig = argvSource.Configs["Startup"];

            List <string> sources = new List <string>();

            string masterFileName =
                startupConfig.GetString("inimaster", "OpenSimDefaults.ini");

            if (masterFileName == "none")
            {
                masterFileName = String.Empty;
            }

            if (IsUri(masterFileName))
            {
                if (!sources.Contains(masterFileName))
                {
                    sources.Add(masterFileName);
                }
            }
            else
            {
                string masterFilePath = Path.GetFullPath(
                    Path.Combine(Util.configDir(), masterFileName));

                if (masterFileName != String.Empty)
                {
                    if (File.Exists(masterFilePath))
                    {
                        if (!sources.Contains(masterFilePath))
                        {
                            sources.Add(masterFilePath);
                        }
                    }
                    else
                    {
                        m_log.ErrorFormat("Master ini file {0} not found", masterFilePath);
                        Environment.Exit(1);
                    }
                }
            }


            string iniFileName =
                startupConfig.GetString("inifile", "OpenSim.ini");

            if (IsUri(iniFileName))
            {
                if (!sources.Contains(iniFileName))
                {
                    sources.Add(iniFileName);
                }
                Application.iniFilePath = iniFileName;
            }
            else
            {
                Application.iniFilePath = Path.GetFullPath(
                    Path.Combine(Util.configDir(), iniFileName));

                if (!File.Exists(Application.iniFilePath))
                {
                    iniFileName             = "OpenSim.xml";
                    Application.iniFilePath = Path.GetFullPath(
                        Path.Combine(Util.configDir(), iniFileName));
                }

                if (File.Exists(Application.iniFilePath))
                {
                    if (!sources.Contains(Application.iniFilePath))
                    {
                        sources.Add(Application.iniFilePath);
                    }
                }
            }

            string iniDirName =
                startupConfig.GetString("inidirectory", "config");
            string iniDirPath =
                Path.Combine(Util.configDir(), iniDirName);

            if (Directory.Exists(iniDirPath))
            {
                m_log.InfoFormat("Searching folder {0} for config ini files",
                                 iniDirPath);

                string[] fileEntries = Directory.GetFiles(iniDirName);
                foreach (string filePath in fileEntries)
                {
                    if (Path.GetExtension(filePath).ToLower() == ".ini")
                    {
                        if (!sources.Contains(Path.GetFullPath(filePath)))
                        {
                            sources.Add(Path.GetFullPath(filePath));
                        }
                    }
                }
            }

            m_config        = new OpenSimConfigSource();
            m_config.Source = new IniConfigSource();
            m_config.Source.Merge(DefaultConfig());

            m_log.Info("[CONFIG]: Reading configuration settings");

            if (sources.Count == 0)
            {
                m_log.FatalFormat("[CONFIG]: Could not load any configuration");
                m_log.FatalFormat("[CONFIG]: Did you copy the OpenSimDefaults.ini.example file to OpenSimDefaults.ini?");
                Environment.Exit(1);
            }

            for (int i = 0; i < sources.Count; i++)
            {
                if (ReadConfig(sources[i]))
                {
                    iniFileExists = true;
                    AddIncludes(sources);
                }
            }

            if (!iniFileExists)
            {
                m_log.FatalFormat("[CONFIG]: Could not load any configuration");
                m_log.FatalFormat("[CONFIG]: Configuration exists, but there was an error loading it!");
                Environment.Exit(1);
            }

            // Make sure command line options take precedence
            m_config.Source.Merge(argvSource);

            ReadConfigSettings();

            return(m_config);
        }
        public OpenSimConfigSource LoadConfigSettings(IConfigSource configSource, out ConfigSettings configSettings,
                                                      out NetworkServersInfo networkInfo)
        {
            m_configSettings     = configSettings = new ConfigSettings();
            m_networkServersInfo = networkInfo = new NetworkServersInfo();
            bool iniFileExists = false;

            IConfig startupConfig = configSource.Configs["Startup"];

            //old style or new style settings?
            string iniFileName = startupConfig.GetString("inifile", "Halcyon.ini");

            ApplicationBase.iniFilePath = Path.Combine(Util.configDir(), iniFileName);

            string masterFileName = startupConfig.GetString("inimaster", String.Empty);
            string masterfilePath = Path.Combine(Util.configDir(), masterFileName);

            string iniDirName = startupConfig.GetString("inidirectory", "config");

            //string iniDirPath = Path.Combine(Util.configDir(), iniDirName);

            m_config        = new OpenSimConfigSource();
            m_config.Source = new IniConfigSource();
            m_config.Source.Merge(DefaultConfig());

            m_log.Info("[CONFIG] Reading configuration settings");

            Uri configUri;

            String xmlPath = Path.Combine(Util.configDir(), "Halcyon.xml");

            //check for master .INI file (name passed in command line, no default), or XML over http
            if (!String.IsNullOrEmpty(masterFileName)) // If a master file name is given ...
            {
                m_log.InfoFormat("[CONFIG] Reading config master file {0}", masterfilePath);

                bool isMasterUri = Uri.TryCreate(masterFileName, UriKind.Absolute, out configUri) &&
                                   configUri.Scheme == Uri.UriSchemeHttp;

                if (!ReadConfig(masterFileName, masterfilePath, m_config, isMasterUri))
                {
                    m_log.FatalFormat("[CONFIG] Could not open master config file {0}", masterfilePath);
                }
            }

            if (Directory.Exists(iniDirName))
            {
                m_log.InfoFormat("Searching folder: {0} , for config ini files", iniDirName);
                string[] fileEntries = Directory.GetFiles(iniDirName);
                foreach (string filePath in fileEntries)
                {
                    if (Path.GetExtension(filePath).ToLower() == ".ini")
                    {
                        // m_log.InfoFormat("reading ini file < {0} > from config dir", filePath);
                        ReadConfig(Path.GetFileName(filePath), filePath, m_config, false);
                    }
                }
            }

            // Check for .INI file (either default or name passed on command
            // line) or XML config source over http
            bool isIniUri = Uri.TryCreate(iniFileName, UriKind.Absolute, out configUri) &&
                            configUri.Scheme == Uri.UriSchemeHttp;

            iniFileExists = ReadConfig(iniFileName, ApplicationBase.iniFilePath, m_config, isIniUri);

            if (!iniFileExists)
            {
                // check for a xml config file
                if (File.Exists(xmlPath))
                {
                    ApplicationBase.iniFilePath = xmlPath;

                    m_log.InfoFormat("Reading XML configuration from {0}", Path.GetFullPath(xmlPath));
                    iniFileExists = true;

                    m_config.Source = new XmlConfigSource();
                    m_config.Source.Merge(new XmlConfigSource(ApplicationBase.iniFilePath));
                }
            }

            m_config.Source.Merge(configSource);

            if (!iniFileExists)
            {
                m_log.FatalFormat("[CONFIG] Could not load any configuration");
                if (!isIniUri)
                {
                    m_log.FatalFormat("[CONFIG] Tried to load {0}, ", Path.GetFullPath(ApplicationBase.iniFilePath));
                }
                else
                {
                    m_log.FatalFormat("[CONFIG] Tried to load from URI {0}, ", iniFileName);
                }
                m_log.FatalFormat("[CONFIG] and XML source {0}", Path.GetFullPath(xmlPath));

                string sampleName = Path.GetFileNameWithoutExtension(ApplicationBase.iniFilePath) + ".sample.ini";

                m_log.FatalFormat("[CONFIG] Did you copy the {0} file to {1}?", sampleName, ApplicationBase.iniFilePath);
                Environment.Exit(1);
            }

            ReadConfigSettings();

            return(m_config);
        }
Пример #22
0
        /// <summary>
        /// Loads the region configuration
        /// </summary>
        /// <param name="argvSource">Parameters passed into the process when started</param>
        /// <param name="configSettings"></param>
        /// <param name="networkInfo"></param>
        /// <returns>A configuration that gets passed to modules</returns>
        public OpenSimConfigSource LoadConfigSettings(
            IConfigSource argvSource, EnvConfigSource envConfigSource, out ConfigSettings configSettings,
            out NetworkServersInfo networkInfo)
        {
            m_configSettings     = configSettings = new ConfigSettings();
            m_networkServersInfo = networkInfo = new NetworkServersInfo();

            bool iniFileExists = false;

            IConfig startupConfig = argvSource.Configs["Startup"];

            List <string> sources = new List <string>();

            string masterFileName = startupConfig.GetString("inimaster", "OpenSimDefaults.ini");

            if (masterFileName == "none")
            {
                masterFileName = String.Empty;
            }

            if (IsUri(masterFileName))
            {
                if (!sources.Contains(masterFileName))
                {
                    sources.Add(masterFileName);
                }
            }
            else
            {
                string masterFilePath = Path.GetFullPath(
                    Path.Combine(Util.configDir(), masterFileName));

                if (masterFileName != String.Empty)
                {
                    if (File.Exists(masterFilePath))
                    {
                        if (!sources.Contains(masterFilePath))
                        {
                            sources.Add(masterFilePath);
                        }
                    }
                    else
                    {
                        m_log.ErrorFormat("Master ini file {0} not found", Path.GetFullPath(masterFilePath));
                        Environment.Exit(1);
                    }
                }
            }

            string iniFileName = startupConfig.GetString("inifile", "OpenSim.ini");

            if (IsUri(iniFileName))
            {
                if (!sources.Contains(iniFileName))
                {
                    sources.Add(iniFileName);
                }
                Application.iniFilePath = iniFileName;
            }
            else
            {
                Application.iniFilePath = Path.GetFullPath(
                    Path.Combine(Util.configDir(), iniFileName));

                if (!File.Exists(Application.iniFilePath))
                {
                    iniFileName             = "OpenSim.xml";
                    Application.iniFilePath = Path.GetFullPath(Path.Combine(Util.configDir(), iniFileName));
                }

                if (File.Exists(Application.iniFilePath))
                {
                    if (!sources.Contains(Application.iniFilePath))
                    {
                        sources.Add(Application.iniFilePath);
                    }
                }
            }

            m_config        = new OpenSimConfigSource();
            m_config.Source = new IniConfigSource();
            m_config.Source.Merge(DefaultConfig());

            m_log.Info("[CONFIG]: Reading configuration settings");

            for (int i = 0; i < sources.Count; i++)
            {
                if (ReadConfig(m_config, sources[i]))
                {
                    iniFileExists = true;
                    AddIncludes(m_config, sources);
                }
            }

            // Override distro settings with contents of inidirectory
            string iniDirName = startupConfig.GetString("inidirectory", "config");
            string iniDirPath = Path.Combine(Util.configDir(), iniDirName);

            if (Directory.Exists(iniDirPath))
            {
                m_log.InfoFormat("[CONFIG]: Searching folder {0} for config ini files", iniDirPath);
                List <string> overrideSources = new List <string>();

                string[] fileEntries = Directory.GetFiles(iniDirName);
                foreach (string filePath in fileEntries)
                {
                    if (Path.GetExtension(filePath).ToLower() == ".ini")
                    {
                        if (!sources.Contains(Path.GetFullPath(filePath)))
                        {
                            overrideSources.Add(Path.GetFullPath(filePath));
                            // put it in sources too, to avoid circularity
                            sources.Add(Path.GetFullPath(filePath));
                        }
                    }
                }


                if (overrideSources.Count > 0)
                {
                    OpenSimConfigSource overrideConfig = new OpenSimConfigSource();
                    overrideConfig.Source = new IniConfigSource();

                    for (int i = 0; i < overrideSources.Count; i++)
                    {
                        if (ReadConfig(overrideConfig, overrideSources[i]))
                        {
                            iniFileExists = true;
                            AddIncludes(overrideConfig, overrideSources);
                        }
                    }
                    m_config.Source.Merge(overrideConfig.Source);
                }
            }

            if (sources.Count == 0)
            {
                m_log.FatalFormat("[CONFIG]: Could not load any configuration");
                Environment.Exit(1);
            }
            else if (!iniFileExists)
            {
                m_log.FatalFormat("[CONFIG]: Could not load any configuration");
                m_log.FatalFormat("[CONFIG]: Configuration exists, but there was an error loading it!");
                Environment.Exit(1);
            }

            // Merge OpSys env vars
            m_log.Info("[CONFIG]: Loading environment variables for Config");
            Util.MergeEnvironmentToConfig(m_config.Source);

            // Make sure command line options take precedence
            m_config.Source.Merge(argvSource);

            m_config.Source.ReplaceKeyValues();

            ReadConfigSettings();

            return(m_config);
        }
Пример #23
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="serversInfo"></param>
        /// <param name="httpServer"></param>
        /// <param name="assetCache"></param>
        public CommunicationsManager(NetworkServersInfo serversInfo, IHttpServer httpServer, IAssetCache assetCache,
                                     LibraryRootFolder libraryRootFolder)
        {
            m_networkServersInfo = serversInfo;
            m_assetCache = assetCache;
            m_httpServer = httpServer;
            LibraryRoot = libraryRootFolder;

            Preload();
        }
Пример #24
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="serversInfo"></param>
 public CommunicationsManager(NetworkServersInfo serversInfo,
                              LibraryRootFolder libraryRootFolder)
 {
     m_networkServersInfo = serversInfo;
     m_userProfileCacheService = new UserProfileCacheService(this, libraryRootFolder);
 }
Пример #25
0
 public void SetServersInfo(NetworkServersInfo sinfo)
 {
     m_serversInfo = sinfo;
 }