The controller in a Model-View-Controller framework. This controller catches actions by the avatars, creates work packets, loops through these work packets in a separate thread, then dictates to the model how the data should change and dictates to the view which data should be displayed. The main mechanism for interaction is through the simchat system.
Example #1
0
        public void Initialise(Scene scene, IConfigSource source)
        {
            string databaseDir = "./";
            string database    = "FileSystemDatabase";
            int    channel     = 345;

            try
            {
                if (source.Configs["CMS"] == null)
                {
                    return;
                }

                m_enabled   = source.Configs["CMS"].GetBoolean("enabled", false);
                databaseDir = source.Configs["CMS"].GetString("directory", databaseDir);
                database    = source.Configs["CMS"].GetString("database", database);
                channel     = source.Configs["CMS"].GetInt("channel", channel);

                if (database != "FileSystemDatabase" && database != "GitDatabase")
                {
                    m_log.ErrorFormat("[Content Management]: The Database attribute must be defined as either FileSystemDatabase or GitDatabase");
                    m_enabled = false;
                }
            }
            catch (Exception e)
            {
                m_log.ErrorFormat("[Content Management]: Exception thrown while reading parameters from configuration file. Message: " + e);
                m_enabled = false;
            }

            if (!m_enabled)
            {
                m_log.Info("[Content Management]: Content Management System is not Enabled.");
                return;
            }

            lock (this)
            {
                if (!initialised) //only init once
                {
                    m_view    = new CMView();
                    m_model   = new CMModel();
                    m_control = new CMController(m_model, m_view, scene, channel);
                    m_model.Initialise(database);
                    m_view.Initialise(m_model);

                    initialised = true;
                    m_model.InitialiseDatabase(scene, databaseDir);
                }
                else
                {
                    m_model.InitialiseDatabase(scene, databaseDir);
                    m_control.RegisterNewRegion(scene);
                }
            }
        }
        public void Initialise(Scene scene, IConfigSource source)
        {
            string databaseDir = "./";
            string database = "FileSystemDatabase";
            int channel = 345;
            try
            {
                if (source.Configs["CMS"] == null)
                    return;

                m_enabled = source.Configs["CMS"].GetBoolean("enabled", false);
                databaseDir = source.Configs["CMS"].GetString("directory", databaseDir);
                database = source.Configs["CMS"].GetString("database", database);
                channel = source.Configs["CMS"].GetInt("channel", channel);

                if (database != "FileSystemDatabase" && database != "GitDatabase")
                {
                    m_log.ErrorFormat("[Content Management]: The Database attribute must be defined as either FileSystemDatabase or GitDatabase");
                    m_enabled = false;
                }
            }
            catch (Exception e)
            {
                m_log.ErrorFormat("[Content Management]: Exception thrown while reading parameters from configuration file. Message: " + e);
                m_enabled = false;
            }

            if (!m_enabled)
            {
                m_log.Info("[Content Management]: Content Management System is not Enabled.");
                return;
            }

            lock (this)
            {
                if (!initialised) //only init once
                {
                    m_view = new CMView();
                    m_model = new CMModel();
                    m_control = new CMController(m_model, m_view, scene, channel);
                    m_model.Initialise(database);
                    m_view.Initialise(m_model);

                    initialised = true;
                    m_model.InitialiseDatabase(scene, databaseDir);
                }
                else
                {
                    m_model.InitialiseDatabase(scene, databaseDir);
                    m_control.RegisterNewRegion(scene);
                }
            }
        }