Ejemplo n.º 1
0
        /// <summary>
        /// Checks for a valid system estate. Adds or corrects if required
        /// </summary>
        /// <param name="estateConnector">Estate connector.</param>
        private void CheckSystemEstateInfo()
        {
            // these should have already been checked but just make sure...
            if (m_estateConnector == null)
            {
                return;
            }

            if (m_estateConnector.RemoteCalls())
            {
                return;
            }

            EstateSettings ES;

            //            ES = estateConnector.GetEstateSettings (Constants.SystemEstateName);
            //ES = m_estateConnector.GetEstateSettings (SystemEstateName);
            ES = m_estateConnector.GetEstateSettings(Constants.SystemEstateID);
            if (ES != null)
            {
                // ensure correct ID
                if (ES.EstateID != Constants.SystemEstateID)
                {
                    UpdateSystemEstates(m_estateConnector, ES);
                }

                // in case of configuration changes
                if (ES.EstateName != SystemEstateName)
                {
                    ES.EstateName = SystemEstateName;
                    m_estateConnector.SaveEstateSettings(ES);
                    MainConsole.Instance.Info("[EstateService]: The system Estate name has been updated to " + SystemEstateName);
                }

                return;
            }

            // Create a new estate
            ES             = new EstateSettings();
            ES.EstateName  = SystemEstateName;
            ES.EstateOwner = (UUID)Constants.RealEstateOwnerUUID;

            ES.EstateID = (uint)m_estateConnector.CreateNewEstate(ES);
            if (ES.EstateID == 0)
            {
                MainConsole.Instance.Warn("There was an error in creating the system estate: " + ES.EstateName);
                //EstateName holds the error. See LocalEstateConnector for more info.
            }
            else
            {
                MainConsole.Instance.InfoFormat("[EstateService]: The estate '{0}' owned by '{1}' has been created.",
                                                SystemEstateName, SystemEstateOwnerName);
            }
        }
        /// <summary>
        /// Checks for a valid system estate. Adds or corrects if required
        /// </summary>
        /// <param name="estateID">Estate I.</param>
        /// <param name="estateName">Estate name.</param>
        /// <param name="ownerUUID">Owner UUI.</param>
        void CheckSystemEstateInfo(int estateID, string estateName, UUID ownerUUID)
        {
            // these should have already been checked but just make sure...
            if (m_estateConnector == null)
            {
                return;
            }

            if (m_estateConnector.RemoteCalls())
            {
                return;
            }

            ISystemAccountService sysAccounts = m_registry.RequestModuleInterface <ISystemAccountService> ();
            EstateSettings        ES;

            // check for existing estate name in case of estate ID change
            ES = m_estateConnector.GetEstateSettings(estateName);
            if (ES != null)
            {
                // ensure correct ID
                if (ES.EstateID != estateID)
                {
                    UpdateSystemEstates(m_estateConnector, ES, estateID);
                }
            }

            ES = m_estateConnector.GetEstateIDSettings(estateID);
            if ((ES != null) && (ES.EstateID != 0))
            {
                // ensure correct owner
                if (ES.EstateOwner != ownerUUID)
                {
                    ES.EstateOwner = ownerUUID;
                    m_estateConnector.SaveEstateSettings(ES);
                    MainConsole.Instance.Info("[EstateService]: The system Estate owner has been updated to " +
                                              sysAccounts.GetSystemEstateOwnerName(estateID));
                }


                // in case of configuration changes
                if (ES.EstateName != estateName)
                {
                    ES.EstateName = estateName;
                    m_estateConnector.SaveEstateSettings(ES);
                    MainConsole.Instance.Info("[EstateService]: The system Estate name has been updated to " + estateName);
                }

                return;
            }

            // Create a new estate

            ES             = new EstateSettings();
            ES.EstateName  = estateName;
            ES.EstateOwner = ownerUUID;

            ES.EstateID = (uint)m_estateConnector.CreateNewEstate(ES);
            if (ES.EstateID == 0)
            {
                MainConsole.Instance.Warn("There was an error in creating the system estate: " + ES.EstateName);
                //EstateName holds the error. See LocalEstateConnector for more info.
            }
            else
            {
                MainConsole.Instance.InfoFormat("[EstateService]: The estate '{0}' owned by '{1}' has been created.",
                                                ES.EstateName, sysAccounts.GetSystemEstateOwnerName(estateID));
            }
        }
Ejemplo n.º 3
0
        private void CheckSystemEstateInfo(IEstateConnector estateConnector)
        {
            // these should have already been checked but just make sure...
            if (estateConnector == null)
                return;

            if (estateConnector.RemoteCalls ())
                return;

            if (estateConnector.EstateExists (Constants.SystemEstateName))
                return;

            // Create a new estate
            EstateSettings ES = new EstateSettings();
            ES.EstateName = Constants.SystemEstateName;
            ES.EstateOwner = (UUID) Constants.RealEstateOwnerUUID;

            ES.EstateID = (uint) estateConnector.CreateNewEstate(ES);
            if (ES.EstateID == 0)
            {
                MainConsole.Instance.Warn("There was an error in creating the system estate: " + ES.EstateName);
                //EstateName holds the error. See LocalEstateConnector for more info.

            } else {
                MainConsole.Instance.InfoFormat("[EstateService]: The estate '{0}' owned by '{1}' has been created.",
                    Constants.SystemEstateName, Constants.RealEstateOwnerName);
            }
        }