OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.LocalPresenceServicesConnector.Initialise C# (CSharp) Method

Initialise() public method

public Initialise ( IConfigSource source ) : void
source IConfigSource
return void
        public void Initialise(IConfigSource source)
        {
            IConfig moduleConfig = source.Configs["Modules"];
            if (moduleConfig != null)
            {
                string name = moduleConfig.GetString("PresenceServices", "");
                if (name == Name)
                {
                    IConfig inventoryConfig = source.Configs["PresenceService"];
                    if (inventoryConfig == null)
                    {
                        m_log.Error("[LOCAL PRESENCE CONNECTOR]: PresenceService missing from OpenSim.ini");
                        return;
                    }

                    string serviceDll = inventoryConfig.GetString("LocalServiceModule", String.Empty);

                    if (serviceDll == String.Empty)
                    {
                        m_log.Error("[LOCAL PRESENCE CONNECTOR]: No LocalServiceModule named in section PresenceService");
                        return;
                    }

                    Object[] args = new Object[] { source };
                    m_log.DebugFormat("[LOCAL PRESENCE CONNECTOR]: Service dll = {0}", serviceDll);

                    m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(serviceDll, args);

                    if (m_PresenceService == null)
                    {
                        m_log.Error("[LOCAL PRESENCE CONNECTOR]: Can't load presence service");
                        //return;
                        throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's");
                    }

                    //Init(source);

                    m_PresenceDetector = new PresenceDetector(this);

                    m_Enabled = true;
                    m_log.Info("[LOCAL PRESENCE CONNECTOR]: Local presence connector enabled");
                }
            }
        }

Usage Example

        public override void SetUp()
        {
            base.SetUp();

            IConfigSource config = new IniConfigSource();
            config.AddConfig("Modules");
            config.AddConfig("PresenceService");
            config.Configs["Modules"].Set("PresenceServices", "LocalPresenceServicesConnector");
            config.Configs["PresenceService"].Set("LocalServiceModule", "OpenSim.Services.PresenceService.dll:PresenceService");
            config.Configs["PresenceService"].Set("StorageProvider", "OpenSim.Data.Null.dll");

            m_LocalConnector = new LocalPresenceServicesConnector();
            m_LocalConnector.Initialise(config);

            // Let's stick in a test presence
            m_LocalConnector.m_PresenceService.LoginAgent(UUID.Zero.ToString(), UUID.Zero, UUID.Zero);
        }
All Usage Examples Of OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.LocalPresenceServicesConnector::Initialise