Пример #1
0
        public void AddRegion(Scene scene)
        {
            if (!m_enabled)
                return;

            m_log.DebugFormat("[DATASNAPSHOT]: Module added to Scene {0}.", scene.RegionInfo.RegionName);

            if (!m_servicesNotified)
            {
                m_hostname = scene.RegionInfo.ExternalHostName;
                m_snapStore = new SnapshotStore(m_snapsDir, m_gridinfo, m_listener_port, m_hostname);

                //Hand it the first scene, assuming that all scenes have the same BaseHTTPServer
                new DataRequestHandler(scene, this);

                if (m_dataServices != "" && m_dataServices != "noservices")
                    NotifyDataServices(m_dataServices, "online");

                m_servicesNotified = true;
            }

            m_scenes.Add(scene);
            m_snapStore.AddScene(scene);

            Assembly currentasm = Assembly.GetExecutingAssembly();

            foreach (Type pluginType in currentasm.GetTypes())
            {
                if (pluginType.IsPublic)
                {
                    if (!pluginType.IsAbstract)
                    {
                        if (pluginType.GetInterface("IDataSnapshotProvider") != null)
                        {
                            IDataSnapshotProvider module = (IDataSnapshotProvider)Activator.CreateInstance(pluginType);
                            module.Initialize(scene, this);
                            module.OnStale += MarkDataStale;

                            m_dataproviders.Add(module);
                            m_snapStore.AddProvider(module);

                            m_log.Debug("[DATASNAPSHOT]: Added new data provider type: " + pluginType.Name);
                        }
                    }
                }
            }

        }
        public void Initialise(Scene scene, IConfigSource config)
        {
            if (!m_configLoaded) 
            {
                m_configLoaded = true;
                //m_log.Debug("[DATASNAPSHOT]: Loading configuration");
                //Read from the config for options
                lock (m_syncInit)
                {
                    try
                    {
                        m_enabled = config.Configs["DataSnapshot"].GetBoolean("index_sims", m_enabled);
                        IConfig conf = config.Configs["GridService"];
                        if (conf != null)
                            m_gridinfo.Add("gridserverURL", conf.GetString("GridServerURI", "http://127.0.0.1:8003"));

                        m_gridinfo.Add(
                            "Name", config.Configs["DataSnapshot"].GetString("gridname", "the lost continent of hippo"));
                        m_exposure_level = config.Configs["DataSnapshot"].GetString("data_exposure", m_exposure_level);
                        m_period = config.Configs["DataSnapshot"].GetInt("default_snapshot_period", m_period);
                        m_maxStales = config.Configs["DataSnapshot"].GetInt("max_changes_before_update", m_maxStales);
                        m_snapsDir = config.Configs["DataSnapshot"].GetString("snapshot_cache_directory", m_snapsDir);
                        m_dataServices = config.Configs["DataSnapshot"].GetString("data_services", m_dataServices);
                        m_listener_port = config.Configs["Network"].GetString("http_listener_port", m_listener_port);

                        String[] annoying_string_array = config.Configs["DataSnapshot"].GetString("disable_modules", "").Split(".".ToCharArray());
                        foreach (String bloody_wanker in annoying_string_array)
                        {
                            m_disabledModules.Add(bloody_wanker);
                        }
                        m_lastUpdate = Environment.TickCount;
                    }
                    catch (Exception)
                    {
                        m_log.Warn("[DATASNAPSHOT]: Could not load configuration. DataSnapshot will be disabled.");
                        m_enabled = false;
                        return;
                    }
                }

                if (m_enabled)
                {
                    //Hand it the first scene, assuming that all scenes have the same BaseHTTPServer
                    new DataRequestHandler(scene, this);

                    m_hostname = scene.RegionInfo.ExternalHostName;
                    m_snapStore = new SnapshotStore(m_snapsDir, m_gridinfo, m_listener_port, m_hostname);

                    MakeEverythingStale();

                    if (m_dataServices != "" &&  m_dataServices != "noservices")
                        NotifyDataServices(m_dataServices, "online");
                }
            }

            if (m_enabled)
            {
                m_log.Info("[DATASNAPSHOT]: Scene added to module.");

                m_snapStore.AddScene(scene);
                m_scenes.Add(scene);

                Assembly currentasm = Assembly.GetExecutingAssembly();

                foreach (Type pluginType in currentasm.GetTypes())
                {
                    if (pluginType.IsPublic)
                    {
                        if (!pluginType.IsAbstract)
                        {
                            if (pluginType.GetInterface("IDataSnapshotProvider") != null)
                            {
                                IDataSnapshotProvider module = (IDataSnapshotProvider)Activator.CreateInstance(pluginType);
                                module.Initialize(scene, this);
                                module.OnStale += MarkDataStale;

                                m_dataproviders.Add(module);
                                m_snapStore.AddProvider(module);

                                m_log.Info("[DATASNAPSHOT]: Added new data provider type: " + pluginType.Name);
                            }
                        }
                    }
                }

                //scene.OnRestart += OnSimRestart;
                scene.EventManager.OnShutdown += delegate() { OnSimRestart(scene.RegionInfo); };
            }
            else
            {
                //m_log.Debug("[DATASNAPSHOT]: Data snapshot disabled, not adding scene to module (or anything else).");
            }
        }
Пример #3
0
        public void AddRegion(Scene scene)
        {
            if (m_enabled)
            {
                //Hand it the first scene, assuming that all scenes have the same BaseHTTPServer
                new DataRequestHandler(scene, this);

                m_hostname = scene.RegionInfo.ExternalHostName;
                m_snapStore = new SnapshotStore(m_snapsDir, m_gridinfo, m_listener_port, m_hostname);

                MakeEverythingStale();

                if (m_dataServices != "" && m_dataServices != "noservices")
                    NotifyDataServices(m_dataServices, "online");
            }

            if (m_enabled)
            {
                //m_log.Info("[DATASNAPSHOT]: Scene added to module.");

                m_snapStore.AddScene(scene);
                m_scenes.Add(scene);

                Assembly currentasm = Assembly.GetExecutingAssembly();

                foreach (Type pluginType in currentasm.GetTypes())
                {
                    if (pluginType.IsPublic)
                    {
                        if (!pluginType.IsAbstract)
                        {
                            if (pluginType.GetInterface("IDataSnapshotProvider") != null)
                            {
                                IDataSnapshotProvider module = (IDataSnapshotProvider)Activator.CreateInstance(pluginType);
                                module.Initialize(scene, this);
                                module.OnStale += MarkDataStale;

                                m_dataproviders.Add(module);
                                m_snapStore.AddProvider(module);

                                //m_log.Info("[DATASNAPSHOT]: Added new data provider type: " + pluginType.Name);
                            }
                        }
                    }
                }

                //scene.OnRestart += OnSimRestart;
                scene.EventManager.OnShutdown += delegate() { OnSimRestart(scene.RegionInfo); };
                scene.RegisterModuleInterface<IDataSnapshot>(this);
            }
            else
            {
                //m_log.Debug("[DATASNAPSHOT]: Data snapshot disabled, not adding scene to module (or anything else).");
            }
        }
Пример #4
0
        public void Initialise(Scene scene, IConfigSource config)
        {
            if (!m_configLoaded)
            {
                m_configLoaded = true;
                //m_log.Debug("[DATASNAPSHOT]: Loading configuration");
                //Read from the config for options
                lock (m_syncInit)
                {
                    try
                    {
                        m_enabled = config.Configs["DataSnapshot"].GetBoolean("index_sims", m_enabled);
                        IConfig conf = config.Configs["GridService"];
                        if (conf != null)
                        {
                            m_gridinfo.Add("gatekeeperURL", conf.GetString("Gatekeeper", String.Empty));
                        }

                        m_gridinfo.Add(
                            "name", config.Configs["DataSnapshot"].GetString("gridname", "the lost continent of hippo"));
                        m_exposure_level = config.Configs["DataSnapshot"].GetString("data_exposure", m_exposure_level);
                        m_period         = config.Configs["DataSnapshot"].GetInt("default_snapshot_period", m_period);
                        m_maxStales      = config.Configs["DataSnapshot"].GetInt("max_changes_before_update", m_maxStales);
                        m_snapsDir       = config.Configs["DataSnapshot"].GetString("snapshot_cache_directory", m_snapsDir);
                        m_dataServices   = config.Configs["DataSnapshot"].GetString("data_services", m_dataServices);
                        m_listener_port  = config.Configs["Network"].GetString("http_listener_port", m_listener_port);

                        String[] annoying_string_array = config.Configs["DataSnapshot"].GetString("disable_modules", "").Split(".".ToCharArray());
                        foreach (String bloody_wanker in annoying_string_array)
                        {
                            m_disabledModules.Add(bloody_wanker);
                        }
                        m_lastUpdate = Environment.TickCount;
                    }
                    catch (Exception)
                    {
                        m_log.Warn("[DATASNAPSHOT]: Could not load configuration. DataSnapshot will be disabled.");
                        m_enabled = false;
                        return;
                    }
                }

                if (m_enabled)
                {
                    //Hand it the first scene, assuming that all scenes have the same BaseHTTPServer
                    new DataRequestHandler(scene, this);

                    m_hostname  = scene.RegionInfo.ExternalHostName;
                    m_snapStore = new SnapshotStore(m_snapsDir, m_gridinfo, m_listener_port, m_hostname);

                    MakeEverythingStale();

                    if (m_dataServices != "" && m_dataServices != "noservices")
                    {
                        NotifyDataServices(m_dataServices, "online");
                    }
                }
            }

            if (m_enabled)
            {
                m_log.Info("[DATASNAPSHOT]: Scene added to module.");

                m_snapStore.AddScene(scene);
                m_scenes.Add(scene);

                Assembly currentasm = Assembly.GetExecutingAssembly();

                foreach (Type pluginType in currentasm.GetTypes())
                {
                    if (pluginType.IsPublic)
                    {
                        if (!pluginType.IsAbstract)
                        {
                            if (pluginType.GetInterface("IDataSnapshotProvider") != null)
                            {
                                IDataSnapshotProvider module = (IDataSnapshotProvider)Activator.CreateInstance(pluginType);
                                module.Initialize(scene, this);
                                module.OnStale += MarkDataStale;

                                m_dataproviders.Add(module);
                                m_snapStore.AddProvider(module);

                                m_log.Info("[DATASNAPSHOT]: Added new data provider type: " + pluginType.Name);
                            }
                        }
                    }
                }

                //scene.OnRestart += OnSimRestart;
                scene.EventManager.OnShutdown += delegate() { OnSimRestart(scene.RegionInfo); };
            }
            else
            {
                //m_log.Debug("[DATASNAPSHOT]: Data snapshot disabled, not adding scene to module (or anything else).");
            }
        }
        public void Initialise(IConfigSource config)
        {
            if (!m_configLoaded) 
            {
                m_configLoaded = true;
                //m_log.Debug("[DATASNAPSHOT]: Loading configuration");
                //Read from the config for options
                lock (m_syncInit)
                {
                    try
                    {
                        m_enabled = config.Configs["DataSnapshot"].GetBoolean("index_sims", m_enabled);
                        IConfig conf = config.Configs["GridService"];
                        if (conf != null)
                            m_gridinfo.Add("gatekeeperURL", conf.GetString("Gatekeeper", String.Empty));

                        m_gridinfo.Add(
                            "name", config.Configs["DataSnapshot"].GetString("gridname", "the lost continent of hippo"));
                        m_exposure_level = config.Configs["DataSnapshot"].GetString("data_exposure", m_exposure_level);
                        m_period = config.Configs["DataSnapshot"].GetInt("default_snapshot_period", m_period);
                        m_maxStales = config.Configs["DataSnapshot"].GetInt("max_changes_before_update", m_maxStales);
                        m_snapsDir = config.Configs["DataSnapshot"].GetString("snapshot_cache_directory", m_snapsDir);
                        m_dataServices = config.Configs["DataSnapshot"].GetString("data_services", m_dataServices);
                        m_listener_port = config.Configs["Network"].GetString("http_listener_port", m_listener_port);

                        String[] annoying_string_array = config.Configs["DataSnapshot"].GetString("disable_modules", "").Split(".".ToCharArray());
                        foreach (String bloody_wanker in annoying_string_array)
                        {
                            m_disabledModules.Add(bloody_wanker);
                        }
                        m_lastUpdate = Environment.TickCount;
                    }
                    catch (Exception)
                    {
                        m_log.Warn("[DATASNAPSHOT]: Could not load configuration. DataSnapshot will be disabled.");
                        m_enabled = false;
                        return;
                    }

                    if (m_enabled)
                        m_snapStore = new SnapshotStore(m_snapsDir, m_gridinfo, m_listener_port, m_hostname);
                }

            }

        }