コード例 #1
0
        public void Initialise(OpenSimBase openSim)
        {
            //将opensim的引用记为内部成员变量
            m_log.Info("[MapDataAdapter]: initialized!");
            m_openSim  = openSim;
            m_server   = openSim.HttpServer;
            m_regions  = new List <MapRegion>();
            m_scales   = new HashSet <float>();
            m_sections = new Dictionary <float, int>();
            m_config   = m_config = new IniConfigSource("WebMapService.ini");
            try
            {
                IConfig config = m_config.Configs["Map"];
                m_remoteConnectionString = config.GetString("RemoteConnectionString");
                m_texUpdateInterval      = config.GetInt("TexUpdateInterval");
                m_mapUpdateInterval      = config.GetInt("MapUpdateInterval");
                m_minMapSize             = config.GetInt("MinMapSize");
                m_zoomLevel          = config.GetInt("ZoomLevels");
                m_maxRenderElevation = config.GetInt("MaxRenderElevation");
                m_minTileSize        = config.GetInt("MinTileSize");
            }
            catch (Exception e)
            {
                m_log.Error("Read WebMapService.ini failed with " + e.Message);
            }
            ThreadStart GetTextureDataStart  = new ThreadStart(GetTextureData);
            Thread      GetTextureDataThread = new Thread(GetTextureDataStart);

            GetTextureDataThread.Start();
        }
コード例 #2
0
ファイル: ScriptEnginePlugin.cs プロジェクト: ChrisD/opensim
        public void Initialise(OpenSimBase openSim)
        {

            // Our objective: Load component .dll's
            m_OpenSim = openSim;
            //m_OpenSim.Shutdown();
        }
コード例 #3
0
        public void LoadRegionFromConfig(OpenSimBase openSim, ulong regionhandle)
        {
            m_log.Info("[LOADREGIONS]: Load Regions addin being initialised");

            IRegionLoader regionLoader;

            if (openSim.ConfigSource.Source.Configs["Startup"].GetString("region_info_source", "filesystem") == "filesystem")
            {
                m_log.Info("[LOADREGIONS]: Loading Region Info from filesystem");
                regionLoader = new RegionLoaderFileSystem();
            }
            else
            {
                m_log.Info("[LOADREGIONS]: Loading Region Info from web");
                regionLoader = new RegionLoaderWebServer();
            }

            regionLoader.SetIniConfigSource(openSim.ConfigSource.Source);
            RegionInfo[] regionsToLoad = regionLoader.LoadRegions();
            for (int i = 0; i < regionsToLoad.Length; i++)
            {
                if (regionhandle == regionsToLoad[i].RegionHandle)
                {
                    IScene scene;
                    m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " +
                                Thread.CurrentThread.ManagedThreadId.ToString() + ")");
                    openSim.CreateRegion(regionsToLoad[i], true, out scene);
                }
            }
        }
コード例 #4
0
 public void Initialise(OpenSimBase openSim)
 {
     //将opensim的引用记为内部成员变量
     m_log.Info("[MapDataAdapter]: initialized!");
     m_openSim = openSim;
     m_server  = openSim.HttpServer;
     m_regions = new List <MapRegion>();
 }
コード例 #5
0
        protected void InitializeCommsManager(OpenSimBase openSim)
        {
            LibraryRootFolder libraryRootFolder = new LibraryRootFolder(m_openSim.ConfigurationSettings.LibrariesXMLFile, m_openSim.ConfigurationSettings.LibraryName);

            InitializeStandardServices(libraryRootFolder);

            openSim.CommunicationsManager = m_commsManager;
        }
コード例 #6
0
 public void Initialise(OpenSimBase openSim)
 {
     //将opensim的引用记为内部成员变量
     m_log.Info("[MapDataAdapter]: initialized!");
     m_openSim = openSim;
     m_server = openSim.HttpServer;
     m_regions = new List<MapRegion>();
 }
コード例 #7
0
        public void Initialize(OpenSimBase openSim)
        {
            m_openSim    = openSim;
            m_httpServer = openSim.HttpServer;

            InitializeCommsManager(openSim);
            if (m_commsManager != null)
            {
                m_openSim.ApplicationRegistry.RegisterInterface <IUserService>(m_commsManager.UserService);
            }
        }
コード例 #8
0
        public void Initialise(OpenSimBase openSim)
        {
            m_log.DebugFormat("[REGIONMODULES]: Initializing...");
            m_openSim = openSim;
            openSim.ApplicationRegistry.RegisterInterface <IRegionModulesController>(this);

            string id  = AddinManager.CurrentAddin.Id;
            int    pos = id.LastIndexOf(".");

            if (pos == -1)
            {
                m_name = id;
            }
            else
            {
                m_name = id.Substring(pos + 1);
            }

            //ExtensionNodeList list = AddinManager.GetExtensionNodes("/OpenSim/RegionModules");
            // load all the (new) region-module classes
            foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes("/OpenSim/RegionModules"))
            {
                // TODO why does node.Type.isSubclassOf(typeof(ISharedRegionModule)) not work?
                if (node.Type.GetInterface(typeof(ISharedRegionModule).ToString()) != null)
                {
                    m_log.DebugFormat("[REGIONMODULES]: Found shared region module {0}, class {1}", node.Id, node.Type);
                    m_sharedModules.Add(node.Type);
                }
                else if (node.Type.GetInterface(typeof(INonSharedRegionModule).ToString()) != null)
                {
                    m_log.DebugFormat("[REGIONMODULES]: Found non-shared region module {0}, class {1}", node.Id, node.Type);
                    m_nonSharedModules.Add(node.Type);
                }
                else
                {
                    m_log.DebugFormat("[REGIONMODULES]: Found unknown type of module {0}, class {1}", node.Id, node.Type);
                }
            }

            // now we've got all the region-module classes loaded, create one instance of every ISharedRegionModule,
            // initialize and postinitialize it. This Initialise we are in is called before LoadRegion.PostInitialise
            // is called (which loads the regions), so we don't have any regions in the server yet.
            foreach (Type type in m_sharedModules)
            {
                ISharedRegionModule module = (ISharedRegionModule)Activator.CreateInstance(type);
                m_sharedInstances.Add(module);
                module.Initialise(openSim.ConfigSource.Source);
            }

            foreach (ISharedRegionModule module in m_sharedInstances)
            {
                module.PostInitialise();
            }
        }
コード例 #9
0
 public void Initialise(IConfigSource configSource, IRegionCreator creator, IOpenSimBase openSim)
 {
     m_configSource = configSource;
     m_openSim = (OpenSimBase)openSim;
     IConfig config = configSource.Configs["RegionStartup"];
     if (config != null)
     {
         m_default = config.GetString("Default", Name) == Name; //.ini loader defaults
         m_regionConfigPath = config.GetString("RegionsDirectory", m_regionConfigPath).Trim();
     }
 }
コード例 #10
0
        public void Initialise(IConfigSource configSource, IRegionCreator creator, IOpenSimBase openSim)
        {
            m_configSource = configSource;
            m_creator = creator;
            m_openSim = (OpenSimBase)openSim;
            MainConsole.Instance.Commands.AddCommand("base", false, "export database regions", "export database regions", "Exports regions in the database to an .ini file", Export);

            IConfig config = configSource.Configs["RegionStartup"];
            if (config != null)
                m_default = config.GetString("Default") == Name;
        }
コード例 #11
0
        public void Initialise(OpenSimBase openSim)
        {
            m_openSim = openSim;
            m_httpServer = openSim.HttpServer;
            MainServer.Instance = m_httpServer;

            InitialiseCommsManager(openSim);
            if (m_commsManager != null)
            {
                m_openSim.ApplicationRegistry.RegisterInterface<IUserService>(m_commsManager.UserService);
            }
        }
コード例 #12
0
        /// <summary>
        /// This method is called by OpenSimMain immediately after loading the
        /// plugin and after basic server setup,  but before running any server commands.
        /// </summary>
        /// <remarks>
        /// Note that entries MUST be added to the active configuration files before
        /// the plugin can be enabled.
        /// </remarks>
        public virtual void Initialise(OpenSimBase openSim)
        {
            RequestID = "0";
            MsgID     = RequestID;

            try
            {
                if ((_config = openSim.ConfigSource.Source.Configs["RestPlugins"]) == null)
                {
                    m_log.WarnFormat("{0} Rest Plugins not configured", MsgID);
                    return;
                }

                if (!_config.GetBoolean("enabled", false))
                {
                    m_log.WarnFormat("{0} Rest Plugins are disabled", MsgID);
                    return;
                }

                _app   = openSim;
                _httpd = openSim.HttpServer;

                // Retrieve GOD key value, if any.
                _godkey = _config.GetString("god_key", String.Empty);

                // Retrive prefix if any.
                _prefix = _config.GetString("prefix", "/admin");

                // Get plugin specific config
                _pluginConfig = openSim.ConfigSource.Source.Configs[ConfigName];

                m_log.InfoFormat("{0} Rest Plugins Enabled", MsgID);
            }
            catch (Exception e)
            {
                // we can safely ignore this, as it just means that
                // the key lookup in Configs failed, which signals to
                // us that noone is interested in our services...they
                // don't know what they are missing out on...
                // NOTE: Under the present OpenSim implementation it is
                // not possible for the openSim pointer to be null. However
                // were the implementation to be changed, this could
                // result in a silent initialization failure. Harmless
                // except for lack of function and lack of any
                // diagnostic indication as to why. The same is true if
                // the HTTP server reference is bad.
                // We should at least issue a message...
                m_log.WarnFormat("{0} Initialization failed: {1}", MsgID, e.Message);
                m_log.DebugFormat("{0} Initialization failed: {1}", MsgID, e.ToString());
            }
        }
コード例 #13
0
 protected void InitialiseHGServices(OpenSimBase openSim, LibraryRootFolder libraryRootFolder)
 {
     // Standalone mode is determined by !startupConfig.GetBoolean("gridmode", false)
     if (m_openSim.ConfigurationSettings.Standalone)
     {
         InitialiseHGStandaloneServices(libraryRootFolder);
     }
     else
     {
         // We are in grid mode
         InitialiseHGGridServices(libraryRootFolder);
     }
     HGCommands.HGServices = HGServices;
 }
コード例 #14
0
        protected void InitialiseCommsManager(OpenSimBase openSim)
        {
            LibraryRootFolder libraryRootFolder = new LibraryRootFolder(m_openSim.ConfigurationSettings.LibrariesXMLFile);

            bool hgrid = m_openSim.ConfigSource.Source.Configs["Startup"].GetBoolean("hypergrid", false);

            if (hgrid)
            {
                InitialiseHGServices(openSim, libraryRootFolder);
            }
            else
            {
                InitialiseStandardServices(libraryRootFolder);
            }

            openSim.CommunicationsManager = m_commsManager;
        }
コード例 #15
0
        // List of shared module instances, for adding to Scenes
        //private List<ISharedRegionModule> m_sharedInstances =
        //        new List<ISharedRegionModule>();

        #region IApplicationPlugin implementation

        public void Initialise(OpenSimBase openSim)
        {
            m_openSim = openSim;
            m_openSim.ApplicationRegistry.RegisterInterface <IRegionModulesController>(this);
            m_log.DebugFormat("[REGIONMODULES]: Initializing...");

            // The [Modules] section in the ini file
            IConfig modulesConfig = m_openSim.ConfigSource.Source.Configs["Modules"];

            if (modulesConfig == null)
            {
                modulesConfig = m_openSim.ConfigSource.Source.AddConfig("Modules");
            }

            CompositionContainer moduleContainer = openSim.ModuleContainer;
            IEnumerable <Lazy <object, object> > exportEnumerable = moduleContainer.GetExports(typeof(IRegionModuleBase), null, null);

            foreach (Lazy <object, object> lazyExport in exportEnumerable)
            {
                IDictionary <string, object> metadata = (IDictionary <string, object>)lazyExport.Metadata;
                object nameObj;
                if (metadata.TryGetValue("Name", out nameObj))
                {
                    string name = (string)nameObj;

                    // TODO: Whitelist before we call lazyExport.Value, which instantiates
                    if (lazyExport.Value is ISharedRegionModule)
                    {
                        m_log.DebugFormat("[REGIONMODULES]: Found shared region module {0}", name);
                        m_sharedModules.Add((ISharedRegionModule)lazyExport.Value);
                    }
                    else if (lazyExport.Value is INonSharedRegionModule)
                    {
                        m_log.DebugFormat("[REGIONMODULES]: Found non-shared region module {0}", name);
                        m_nonSharedModules.Add((INonSharedRegionModule)lazyExport.Value);
                    }
                }
            }

            foreach (ISharedRegionModule node in m_sharedModules)
            {
                // OK, we're up and running
                node.Initialise(m_openSim.ConfigSource.Source);
            }
        }
コード例 #16
0
        public void Initialize(OpenSimBase openSim)
        {
            IConfig config = openSim.ConfigSource.Source.Configs["ChatLogModule"];

            if (config == null)
            {
                return;
            }

            m_enabled  = config.GetString("Backend", String.Empty) == "FileBackend";
            m_fileName = config.GetString("File", m_fileName);

            if (m_enabled)
            {
                m_fileWriter = TextWriter.Synchronized(new StreamWriter(m_fileName, true));
                ProviderRegistry.Instance.RegisterInterface <IChatMessageLogBackend>(this);
            }
        }
コード例 #17
0
        private int m_ttl = 2592000; //1 month

        #endregion

        #region IApplicationPlugin Members

        public void Initialize(OpenSimBase openSim)
        {
            IConfig config = openSim.ConfigSource.Source.Configs["ChatLogModule"];

            if (config == null)
            {
                return;
            }

            m_enabled = config.GetBoolean("Enabled", false) && config.GetString("Backend", "") == "Cassandra12Backend";
            m_debug   = config.GetBoolean("Debug", m_debug);
            m_ttl     = config.GetInt("TTL", m_ttl);

            Q_INS_TTL = Q_INSERT + m_ttl.ToString() + ";";

            if (m_enabled)
            {
                ExtractSeedNodesFromConfig(config);

                var clusterb = Cluster.Builder();

                foreach (string node in m_seedNodes)
                {
                    if (m_debug)
                    {
                        m_log.DebugFormat("[CHATLOG.Cassandra]: Adding seed node {0}", node);
                    }
                    clusterb.AddContactPoint(node);
                }

                clusterb.WithDefaultKeyspace(KEYSPACE);

                m_cluster = clusterb.Build();
                m_session = m_cluster.Connect();

                ProviderRegistry.Instance.RegisterInterface <IChatMessageLogBackend>(this);
            }
        }
コード例 #18
0
        /// <summary>
        /// This method is called by OpenSimMain immediately after loading the
        /// plugin and after basic server setup,  but before running any server commands.
        /// </summary>
        /// <remarks>
        /// Note that entries MUST be added to the active configuration files before
        /// the plugin can be enabled.
        /// </remarks>
        public override void Initialise(OpenSimBase openSim)
        {
            try
            {
                base.Initialise(openSim);
                if (!IsEnabled)
                {
                    m_log.WarnFormat("{0} Rest Plugins are disabled", MsgID);
                    return;
                }
                m_log.InfoFormat("{0} REST region plugin enabled", MsgID);

                // add REST method handlers
                AddRestStreamHandler("GET", "/regions/", GetHandler);
                AddRestStreamHandler("POST", "/regions/", PostHandler);
                AddRestStreamHandler("GET", "/regioninfo/", GetRegionInfoHandler);
            }
            catch (Exception e)
            {
                m_log.WarnFormat("{0} Initialization failed: {1}", MsgID, e.Message);
                m_log.DebugFormat("{0} Initialization failed: {1}", MsgID, e.ToString());
            }
        }
コード例 #19
0
ファイル: RestRegionPlugin.cs プロジェクト: ChrisD/opensim
        /// <summary>
        /// This method is called by OpenSimMain immediately after loading the
        /// plugin and after basic server setup,  but before running any server commands.
        /// </summary>
        /// <remarks>
        /// Note that entries MUST be added to the active configuration files before
        /// the plugin can be enabled.
        /// </remarks>
        public override void Initialise(OpenSimBase openSim)
        {
            try
            {
                base.Initialise(openSim);
                if (!IsEnabled)
                {
                    m_log.WarnFormat("{0} Rest Plugins are disabled", MsgID);
                    return;
                }
                m_log.InfoFormat("{0} REST region plugin enabled", MsgID);

                // add REST method handlers
                AddRestStreamHandler("GET", "/regions/", GetHandler);
                AddRestStreamHandler("POST", "/regions/", PostHandler);
                AddRestStreamHandler("GET", "/regioninfo/", GetRegionInfoHandler);
            }
            catch (Exception e)
            {
                m_log.WarnFormat("{0} Initialization failed: {1}", MsgID, e.Message);
                m_log.DebugFormat("{0} Initialization failed: {1}", MsgID, e.ToString());
            }
        }
コード例 #20
0
        public void Initialise (OpenSimBase openSim)
        {
            m_openSim = openSim;
            m_openSim.ApplicationRegistry.RegisterInterface<IRegionModulesController>(this);
            m_log.DebugFormat("[REGIONMODULES]: Initializing...");

            // Who we are
            string id = AddinManager.CurrentAddin.Id;

            // Make friendly name
            int pos = id.LastIndexOf(".");
            if (pos == -1)
                m_name = id;
            else
                m_name = id.Substring(pos + 1);

            // The [Modules] section in the ini file
            IConfig modulesConfig =
                    m_openSim.ConfigSource.Source.Configs["Modules"];
            if (modulesConfig == null)
                modulesConfig = m_openSim.ConfigSource.Source.AddConfig("Modules");

            Dictionary<RuntimeAddin, IList<int>> loadedModules = new Dictionary<RuntimeAddin, IList<int>>();

            // Scan modules and load all that aren't disabled
            foreach (TypeExtensionNode node in
                    AddinManager.GetExtensionNodes("/OpenSim/RegionModules"))
            {
                IList<int> loadedModuleData;

                if (!loadedModules.ContainsKey(node.Addin))
                    loadedModules.Add(node.Addin, new List<int> { 0, 0, 0 });

                loadedModuleData = loadedModules[node.Addin];
                      
                if (node.Type.GetInterface(typeof(ISharedRegionModule).ToString()) != null)
                {
                    if (CheckModuleEnabled(node, modulesConfig))
                    {
                        m_log.DebugFormat("[REGIONMODULES]: Found shared region module {0}, class {1}", node.Id, node.Type);
                        m_sharedModules.Add(node);
                        loadedModuleData[0]++;
                    }
                }
                else if (node.Type.GetInterface(typeof(INonSharedRegionModule).ToString()) != null)
                {
                    if (CheckModuleEnabled(node, modulesConfig))
                    {
                        m_log.DebugFormat("[REGIONMODULES]: Found non-shared region module {0}, class {1}", node.Id, node.Type);
                        m_nonSharedModules.Add(node);
                        loadedModuleData[1]++;
                    }
                }
                else
                {
                    m_log.WarnFormat("[REGIONMODULES]: Found unknown type of module {0}, class {1}", node.Id, node.Type);
                    loadedModuleData[2]++;
                }
            }

            foreach (KeyValuePair<RuntimeAddin, IList<int>> loadedModuleData in loadedModules)
            {
                m_log.InfoFormat(
                    "[REGIONMODULES]: From plugin {0}, (version {1}), loaded {2} modules, {3} shared, {4} non-shared {5} unknown",
                    loadedModuleData.Key.Id, 
                    loadedModuleData.Key.Version,
                    loadedModuleData.Value[0] + loadedModuleData.Value[1] + loadedModuleData.Value[2],
                    loadedModuleData.Value[0], loadedModuleData.Value[1], loadedModuleData.Value[2]);
            }

            // Load and init the module. We try a constructor with a port
            // if a port was given, fall back to one without if there is
            // no port or the more specific constructor fails.
            // This will be removed, so that any module capable of using a port
            // must provide a constructor with a port in the future.
            // For now, we do this so migration is easy.
            //
            foreach (TypeExtensionNode node in m_sharedModules)
            {
                Object[] ctorArgs = new Object[] { (uint)0 };

                // Read the config again
                string moduleString =
                        modulesConfig.GetString("Setup_" + node.Id, String.Empty);

                // Get the port number, if there is one
                if (moduleString != String.Empty)
                {
                    // Get the port number from the string
                    string[] moduleParts = moduleString.Split(new char[] { '/' },
                            2);
                    if (moduleParts.Length > 1)
                        ctorArgs[0] = Convert.ToUInt32(moduleParts[0]);
                }

                // Try loading and initilaizing the module, using the
                // port if appropriate
                ISharedRegionModule module = null;

                try
                {
                    module = (ISharedRegionModule)Activator.CreateInstance(
                            node.Type, ctorArgs);
                }
                catch
                {
                    module = (ISharedRegionModule)Activator.CreateInstance(
                            node.Type);
                }

                // OK, we're up and running
                m_sharedInstances.Add(module);
                module.Initialise(m_openSim.ConfigSource.Source);
            }
        }
コード例 #21
0
 public void Initialise(OpenSimBase openSim)
 {
     // Our objective: Load component .dll's
     m_OpenSim = openSim;
 }
コード例 #22
0
 public UXSimStatusHandler(OpenSimBase sim)
 {
     m_opensim    = sim;
     osUXStatsURI = sim.userStatsURI;
 }
コード例 #23
0
 public void Initialize(OpenSimBase openSim)
 {
     m_app   = openSim;
     m_admin = new RemoteAdmin();
 }
コード例 #24
0
ファイル: MapService.cs プロジェクト: dynaturtle/opensim-map
        public void Initialise(OpenSimBase openSim)
        {
            m_log.Info("[MapService]: initialized!");
            _app = openSim;
            _httpd = openSim.HttpServer;
            layerDict = new Dictionary<string, BaseLayer>();

            // read app config from OpenSim.MapService.ini
            LayerParams objLayerParams = new LayerParams();
            LayerParams terrainLayerParams = new LayerParams();
            LayerParams agentLayerParams = new LayerParams();
            try
            {
                m_config = new IniConfigSource("OpenSim.MapService.ini");
                getLayerParams(m_config.Configs["Object"], ref objLayerParams);
                getLayerParams(m_config.Configs["Terrain"], ref terrainLayerParams);
                getLayerParams(m_config.Configs["Agent"], ref agentLayerParams);
            }
            catch (Exception e)
            {
                Console.WriteLine("Read Map Service config failure");
                Console.WriteLine(e.ToString());
            }

            // initailize new feature layers and register them
            m_objectLayer = new ObjectLayer(_app.SceneManager,  objLayerParams);
            m_terrainLayer = new TerrainLayer(_app.SceneManager, terrainLayerParams);
            m_agentLayer = new AgentLayer(_app.SceneManager, agentLayerParams);
            layerDict.Add(m_objectLayer.Name, m_objectLayer);
            layerDict.Add(m_terrainLayer.Name, m_terrainLayer);
            layerDict.Add(m_agentLayer.Name, m_agentLayer);

            // register ows handler
            string httpMethod = "GET";
            string path = "/ows";
            OWSStreamHandler h = new OWSStreamHandler(httpMethod, path, owsHandler);
            _httpd.AddStreamHandler(h);
        }
コード例 #25
0
ファイル: LoadRegionsPlugin.cs プロジェクト: 4U2NV/opensim
 public void Initialise(OpenSimBase openSim)
 {
     m_openSim = openSim;
     m_openSim.ApplicationRegistry.RegisterInterface<IRegionCreator>(this);
 }
コード例 #26
0
        public void Initialise(OpenSimBase openSim)
        {
            m_openSim = openSim;
            m_openSim.ApplicationRegistry.RegisterInterface <IRegionModulesController>(this);
            m_log.DebugFormat("[REGIONMODULES]: Initializing...");

            if (!LoadModulesFromAddins)
            {
                return;
            }

            // Who we are
            string id = AddinManager.CurrentAddin.Id;

            // Make friendly name
            int pos = id.LastIndexOf(".");

            if (pos == -1)
            {
                m_name = id;
            }
            else
            {
                m_name = id.Substring(pos + 1);
            }

            // The [Modules] section in the ini file
            IConfig modulesConfig =
                m_openSim.ConfigSource.Source.Configs["Modules"];

            if (modulesConfig == null)
            {
                modulesConfig = m_openSim.ConfigSource.Source.AddConfig("Modules");
            }

            Dictionary <RuntimeAddin, IList <int> > loadedModules = new Dictionary <RuntimeAddin, IList <int> >();

            // Scan modules and load all that aren't disabled
            foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes("/OpenSim/RegionModules"))
            {
                AddNode(node, modulesConfig, loadedModules);
            }

            foreach (KeyValuePair <RuntimeAddin, IList <int> > loadedModuleData in loadedModules)
            {
                m_log.InfoFormat(
                    "[REGIONMODULES]: From plugin {0}, (version {1}), loaded {2} modules, {3} shared, {4} non-shared {5} unknown",
                    loadedModuleData.Key.Id,
                    loadedModuleData.Key.Version,
                    loadedModuleData.Value[0] + loadedModuleData.Value[1] + loadedModuleData.Value[2],
                    loadedModuleData.Value[0], loadedModuleData.Value[1], loadedModuleData.Value[2]);
            }

            // Load and init the module. We try a constructor with a port
            // if a port was given, fall back to one without if there is
            // no port or the more specific constructor fails.
            // This will be removed, so that any module capable of using a port
            // must provide a constructor with a port in the future.
            // For now, we do this so migration is easy.
            //
            foreach (TypeExtensionNode node in m_sharedModules)
            {
                Object[] ctorArgs = new Object[] { (uint)0 };

                // Read the config again
                string moduleString =
                    modulesConfig.GetString("Setup_" + node.Id, String.Empty);

                // Get the port number, if there is one
                if (moduleString != String.Empty)
                {
                    // Get the port number from the string
                    string[] moduleParts = moduleString.Split(new char[] { '/' },
                                                              2);
                    if (moduleParts.Length > 1)
                    {
                        ctorArgs[0] = Convert.ToUInt32(moduleParts[0]);
                    }
                }

                // Try loading and initilaizing the module, using the
                // port if appropriate
                ISharedRegionModule module = null;

                try
                {
                    module = (ISharedRegionModule)Activator.CreateInstance(
                        node.Type, ctorArgs);
                }
                catch
                {
                    module = (ISharedRegionModule)Activator.CreateInstance(
                        node.Type);
                }

                // OK, we're up and running
                m_sharedInstances.Add(module);
                module.Initialise(m_openSim.ConfigSource.Source);
            }
        }
コード例 #27
0
 public void Initialise(OpenSimBase openSim)
 {
     //将opensim的引用记为内部成员变量
     m_log.Info("[MapDataAdapter]: initialized!");
     m_openSim = openSim;
     m_server = openSim.HttpServer;
     m_regions = new List<MapRegion>();
     m_scales = new HashSet<float>();
     m_sections = new Dictionary<float, int>();
     m_config = m_config = new IniConfigSource("WebMapService.ini");
     try
     {
         IConfig config              = m_config.Configs["Map"];
         m_remoteConnectionString    = config.GetString("RemoteConnectionString");
         m_texUpdateInterval         = config.GetInt("TexUpdateInterval");
         m_mapUpdateInterval         = config.GetInt("MapUpdateInterval");
         m_minMapSize                = config.GetInt("MinMapSize");
         m_zoomLevel                = config.GetInt("ZoomLevels");
         m_maxRenderElevation        = config.GetInt("MaxRenderElevation");
         m_minTileSize               = config.GetInt("MinTileSize");
     }
     catch (Exception e)
     {
         m_log.Error("Read WebMapService.ini failed with " + e.Message);
     }
     ThreadStart GetTextureDataStart = new ThreadStart(GetTextureData);
     Thread GetTextureDataThread = new Thread(GetTextureDataStart);
     GetTextureDataThread.Start();
 }
コード例 #28
0
 public UXAgentStatusHandler(OpenSimBase sim)
     : base("GET", "/" + sim.agentStatsURI, "UXAgentStatus", "Agent UXStatus")
 {
     // Save reference to OpenSim region server interface
     m_opensim = sim;
 }
コード例 #29
0
ファイル: OpenSimBase.cs プロジェクト: lbgrid/arribasim-dev
 public UXSimStatusHandler(OpenSimBase sim)
     : base("GET", "/" + sim.userStatsURI, "UXSimStatus", "Simulator UXStatus")
 {
     m_opensim = sim;
 }
コード例 #30
0
ファイル: OpenSimBase.cs プロジェクト: lbgrid/arribasim-dev
 public XSimStatusHandler(OpenSimBase sim)
     : base("GET", "/" + Util.SHA1Hash(sim.osSecret), "XSimStatus", "Simulator XStatus")
 {
     m_opensim = sim;
 }
コード例 #31
0
ファイル: RestHandler.cs プロジェクト: p07r0457/opensim
        /// <summary>
        /// This method is called by OpenSimMain immediately after loading the
        /// plugin and after basic server setup,  but before running any server commands.
        /// </summary>
        /// <remarks>
        /// Note that entries MUST be added to the active configuration files before
        /// the plugin can be enabled.
        /// </remarks>

        public override void Initialise(OpenSimBase openSim)
        {
            try
            {
                // This plugin will only be enabled if the broader
                // REST plugin mechanism is enabled.

                //Rest.Log.InfoFormat("{0}  Plugin is initializing", MsgId);

                base.Initialise(openSim);

                // IsEnabled is implemented by the base class and
                // reflects an overall RestPlugin status

                if (!IsEnabled)
                {
                    //Rest.Log.WarnFormat("{0} Plugins are disabled", MsgId);
                    return;
                }

                Rest.Log.InfoFormat("{0} Rest <{1}> plugin will be enabled", MsgId, Name);
                Rest.Log.InfoFormat("{0} Configuration parameters read from <{1}>", MsgId, ConfigName);

                // These are stored in static variables to make
                // them easy to reach from anywhere in the assembly.

                Rest.main              = openSim;
                if (Rest.main == null)
                    throw new Exception("OpenSim base pointer is null");

                Rest.Plugin            = this;
                Rest.Config            = Config;
                Rest.Prefix            = Prefix;
                Rest.GodKey            = GodKey;
                Rest.Authenticate      = Rest.Config.GetBoolean("authenticate", Rest.Authenticate);
                Rest.Scheme            = Rest.Config.GetString("auth-scheme", Rest.Scheme);
                Rest.Secure            = Rest.Config.GetBoolean("secured", Rest.Secure);
                Rest.ExtendedEscape    = Rest.Config.GetBoolean("extended-escape", Rest.ExtendedEscape);
                Rest.Realm             = Rest.Config.GetString("realm", Rest.Realm);
                Rest.DumpAsset         = Rest.Config.GetBoolean("dump-asset", Rest.DumpAsset);
                Rest.Fill              = Rest.Config.GetBoolean("path-fill", Rest.Fill);
                Rest.DumpLineSize      = Rest.Config.GetInt("dump-line-size", Rest.DumpLineSize);
                Rest.FlushEnabled      = Rest.Config.GetBoolean("flush-on-error", Rest.FlushEnabled);

                // Note: Odd spacing is required in the following strings

                Rest.Log.InfoFormat("{0} Authentication is {1}required", MsgId,
                                    (Rest.Authenticate ? "" : "not "));

                Rest.Log.InfoFormat("{0} Security is {1}enabled", MsgId,
                                    (Rest.Secure ? "" : "not "));

                Rest.Log.InfoFormat("{0} Extended URI escape processing is {1}enabled", MsgId,
                                    (Rest.ExtendedEscape ? "" : "not "));

                Rest.Log.InfoFormat("{0} Dumping of asset data is {1}enabled", MsgId,
                                    (Rest.DumpAsset ? "" : "not "));

                // The supplied prefix MUST be absolute

                if (Rest.Prefix.Substring(0,1) != Rest.UrlPathSeparator)
                {
                    Rest.Log.WarnFormat("{0} Prefix <{1}> is not absolute and must be", MsgId, Rest.Prefix);
                    Rest.Log.InfoFormat("{0} Prefix changed to </{1}>", MsgId, Rest.Prefix);
                    Rest.Prefix = String.Format("{0}{1}", Rest.UrlPathSeparator, Rest.Prefix);
                }

                // If data dumping is requested, report on the chosen line
                // length.

                if (Rest.DumpAsset)
                {
                    Rest.Log.InfoFormat("{0} Dump {1} bytes per line", MsgId, Rest.DumpLineSize);
                }

                // Load all of the handlers present in the
                // assembly

                // In principle, as we're an application plug-in,
                // most of what needs to be done could be done using
                // static resources, however the Open Sim plug-in
                // model makes this an instance, so that's what we
                // need to be.
                // There is only one Communications manager per
                // server, and by inference, only one each of the
                // user, asset, and inventory servers. So we can cache
                // those using a static initializer.
                // We move all of this processing off to another
                // services class to minimize overlap between function
                // and infrastructure.

                LoadHandlers();

                // The intention of a post construction initializer
                // is to allow for setup that is dependent upon other
                // activities outside of the agency.

                foreach (IRest handler in handlers)
                {
                    try
                    {
                        handler.Initialize();
                    }
                    catch (Exception e)
                    {
                        Rest.Log.ErrorFormat("{0} initialization error: {1}", MsgId, e.Message);
                    }
                }

                // Now that everything is setup we can proceed to
                // add THIS agent to the HTTP server's handler list

                // FIXME: If this code is ever to be re-enabled (most of it is disabled already) then this will
                // have to be handled through the AddHttpHandler interface.
//                if (!AddAgentHandler(Rest.Name,this))
//                {
//                    Rest.Log.ErrorFormat("{0} Unable to activate handler interface", MsgId);
//                    foreach (IRest handler in handlers)
//                    {
//                        handler.Close();
//                    }
//                }

            }
            catch (Exception e)
            {
                Rest.Log.ErrorFormat("{0} Plugin initialization has failed: {1}", MsgId, e.Message);
            }
        }
コード例 #32
0
 public void Initialize(OpenSimBase openSim)
 {
     // Our objective: Load component .dll's
     m_OpenSim = openSim;
     //m_OpenSim.Shutdown();
 }
コード例 #33
0
 public void Initialize(OpenSimBase openSim)
 {
 }
コード例 #34
0
ファイル: RestPlugin.cs プロジェクト: BackupTheBerlios/seleon
        /// <summary>
        /// This method is called by OpenSimMain immediately after loading the
        /// plugin and after basic server setup,  but before running any server commands.
        /// </summary>
        /// <remarks>
        /// Note that entries MUST be added to the active configuration files before
        /// the plugin can be enabled.
        /// </remarks>
        public virtual void Initialise(OpenSimBase openSim)
        {
            RequestID = "0";
            MsgID = RequestID;

            try
            {
                if ((_config = openSim.ConfigSource.Source.Configs["RestPlugins"]) == null)
                {
                    m_log.WarnFormat("{0} Rest Plugins not configured", MsgID);
                    return;
                }

                if (!_config.GetBoolean("enabled", false))
                {
                    //m_log.WarnFormat("{0} Rest Plugins are disabled", MsgID);
                    return;
                }

                _app = openSim;
                _httpd = openSim.HttpServer;

                // Retrieve GOD key value, if any.
                _godkey = _config.GetString("god_key", String.Empty);

                // Retrive prefix if any.
                _prefix = _config.GetString("prefix", "/admin");

                // Get plugin specific config
                _pluginConfig = openSim.ConfigSource.Source.Configs[ConfigName];

                m_log.InfoFormat("{0} Rest Plugins Enabled", MsgID);
            }
            catch (Exception e)
            {
                // we can safely ignore this, as it just means that
                // the key lookup in Configs failed, which signals to
                // us that noone is interested in our services...they
                // don't know what they are missing out on...
                // NOTE: Under the present OpenSimulator implementation it is
                // not possible for the openSimulator pointer to be null. However
                // were the implementation to be changed, this could
                // result in a silent initialization failure. Harmless
                // except for lack of function and lack of any
                // diagnostic indication as to why. The same is true if
                // the HTTP server reference is bad.
                // We should at least issue a message...
                m_log.WarnFormat("{0} Initialization failed: {1}", MsgID, e.Message);
                m_log.DebugFormat("{0} Initialization failed: {1}", MsgID, e.ToString());
            }
        }
コード例 #35
0
        public void Initialise(OpenSimBase openSim)
        {
            m_configSource = openSim.ConfigSource.Source;
            try
            {
                if (m_configSource.Configs["RemoteAdmin"] == null ||
                    !m_configSource.Configs["RemoteAdmin"].GetBoolean("enabled", false))
                {
                    // No config or disabled
                }
                else
                {
                    m_config = m_configSource.Configs["RemoteAdmin"];
                    m_log.Debug("[RADMIN]: Remote Admin Plugin Enabled");
                    m_requiredPassword = m_config.GetString("access_password", String.Empty);
                    int port = m_config.GetInt("port", 0);

                    string accessIP = m_config.GetString("access_ip_addresses", String.Empty);
                    m_accessIP = new HashSet<string>();
                    if (accessIP != String.Empty)
                    {
                        string[] ips = accessIP.Split(new char[] { ',' });
                        foreach (string ip in ips)
                        {
                            string current = ip.Trim();

                            if (current != String.Empty)
                                m_accessIP.Add(current);
                        }
                    }

                    m_application = openSim;
                    string bind_ip_address = m_config.GetString("bind_ip_address", "0.0.0.0");
                    IPAddress ipaddr = IPAddress.Parse(bind_ip_address);
                    m_httpServer = MainServer.GetHttpServer((uint)port,ipaddr);

                    Dictionary<string, XmlRpcMethod> availableMethods = new Dictionary<string, XmlRpcMethod>();
                    availableMethods["admin_create_region"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcCreateRegionMethod);
                    availableMethods["admin_load_region"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcLoadRegionMethod);
                    availableMethods["admin_delete_region"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcDeleteRegionMethod);
                    availableMethods["admin_close_region"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcCloseRegionMethod);
                    availableMethods["admin_modify_region"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcModifyRegionMethod);
                    availableMethods["admin_region_query"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcRegionQueryMethod);
                    availableMethods["admin_shutdown"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcShutdownMethod);
                    availableMethods["admin_broadcast"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcAlertMethod);
                    availableMethods["admin_restart"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcRestartMethod);
                    availableMethods["admin_load_heightmap"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcLoadHeightmapMethod);
                    availableMethods["admin_save_heightmap"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcSaveHeightmapMethod);

                    // Agent management
                    availableMethods["admin_get_agents"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcGetAgentsMethod);
                    availableMethods["admin_teleport_agent"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcTeleportAgentMethod);

                    // User management
                    availableMethods["admin_create_user"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcCreateUserMethod);
                    availableMethods["admin_create_user_email"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcCreateUserMethod);
                    availableMethods["admin_exists_user"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcUserExistsMethod);
                    availableMethods["admin_update_user"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcUpdateUserAccountMethod);
                    availableMethods["admin_authenticate_user"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcAuthenticateUserMethod);

                    // Region state management
                    availableMethods["admin_load_xml"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcLoadXMLMethod);
                    availableMethods["admin_save_xml"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcSaveXMLMethod);
                    availableMethods["admin_load_oar"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcLoadOARMethod);
                    availableMethods["admin_save_oar"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcSaveOARMethod);

                    // Estate access list management
                    availableMethods["admin_acl_clear"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcAccessListClear);
                    availableMethods["admin_acl_add"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcAccessListAdd);
                    availableMethods["admin_acl_remove"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcAccessListRemove);
                    availableMethods["admin_acl_list"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcAccessListList);
                    availableMethods["admin_estate_reload"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcEstateReload);

                    // Either enable full remote functionality or just selected features
                    string enabledMethods = m_config.GetString("enabled_methods", "all");

                    // To get this, you must explicitly specify "all" or
                    // mention it in a whitelist. It won't be available
                    // If you just leave the option out!
                    //
                    if (!String.IsNullOrEmpty(enabledMethods))
                        availableMethods["admin_console_command"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcConsoleCommandMethod);

                    // The assumption here is that simply enabling Remote Admin as before will produce the same
                    // behavior - enable all methods unless the whitelist is in place for backward-compatibility.
                    if (enabledMethods.ToLower() == "all" || String.IsNullOrEmpty(enabledMethods))
                    {
                        foreach (string method in availableMethods.Keys)
                        {
                            m_httpServer.AddXmlRPCHandler(method, availableMethods[method], false);
                        }
                    }
                    else
                    {
                        foreach (string enabledMethod in enabledMethods.Split('|'))
                        {
                            m_httpServer.AddXmlRPCHandler(enabledMethod, availableMethods[enabledMethod], false);
                        }
                    }
                }
            }
            catch (NullReferenceException)
            {
                // Ignore.
            }
        }
コード例 #36
0
        public void Initialize(OpenSimBase openSim)
        {
            m_openSim = openSim;
            m_openSim.ApplicationRegistry.RegisterInterface <IRegionModulesController>(this);
            m_log.DebugFormat("[REGIONMODULES]: Initializing...");

            // Who we are
            string id = AddinManager.CurrentAddin.Id;

            // Make friendly name
            int pos = id.LastIndexOf(".");

            if (pos == -1)
            {
                m_name = id;
            }
            else
            {
                m_name = id.Substring(pos + 1);
            }

            // The [Modules] section in the ini file
            IConfig modulesConfig =
                m_openSim.ConfigSource.Source.Configs["Modules"];

            if (modulesConfig == null)
            {
                modulesConfig = m_openSim.ConfigSource.Source.AddConfig("Modules");
            }

            // Scan modules and load all that aren't disabled
            foreach (TypeExtensionNode node in
                     AddinManager.GetExtensionNodes("/OpenSim/RegionModules"))
            {
                if (node.Type.GetInterface(typeof(ISharedRegionModule).ToString()) != null)
                {
                    if (CheckModuleEnabled(node, modulesConfig))
                    {
                        m_log.DebugFormat("[REGIONMODULES]: Found shared region module {0}, class {1}", node.Id, node.Type);
                        m_sharedModules.Add(node);
                    }
                }
                else if (node.Type.GetInterface(typeof(INonSharedRegionModule).ToString()) != null)
                {
                    if (CheckModuleEnabled(node, modulesConfig))
                    {
                        m_log.DebugFormat("[REGIONMODULES]: Found non-shared region module {0}, class {1}", node.Id, node.Type);
                        m_nonSharedModules.Add(node);
                    }
                }
                else
                {
                    m_log.DebugFormat("[REGIONMODULES]: Found unknown type of module {0}, class {1}", node.Id, node.Type);
                }
            }

            // Load and init the module. We try a constructor with a port
            // if a port was given, fall back to one without if there is
            // no port or the more specific constructor fails.
            // This will be removed, so that any module capable of using a port
            // must provide a constructor with a port in the future.
            // For now, we do this so migration is easy.
            //
            foreach (TypeExtensionNode node in m_sharedModules)
            {
                Object[] ctorArgs = new Object[] { (uint)0 };

                // Read the config again
                string moduleString =
                    modulesConfig.GetString("Setup_" + node.Id, String.Empty);

                // Get the port number, if there is one
                if (moduleString != String.Empty)
                {
                    // Get the port number from the string
                    string[] moduleParts = moduleString.Split(new char[] { '/' },
                                                              2);
                    if (moduleParts.Length > 1)
                    {
                        ctorArgs[0] = Convert.ToUInt32(moduleParts[0]);
                    }
                }

                // Try loading and initilaizing the module, using the
                // port if appropriate
                ISharedRegionModule module = null;

                try
                {
                    module = (ISharedRegionModule)Activator.CreateInstance(
                        node.Type, ctorArgs);
                }
                catch
                {
                    module = (ISharedRegionModule)Activator.CreateInstance(
                        node.Type);
                }

                // OK, we're up and running
                m_sharedInstances.Add(module);
                module.Initialize(m_openSim.ConfigSource.Source);
            }
        }
コード例 #37
0
 public void Initialise(OpenSimBase sim)
 {
     m_openSim = sim;
 }
コード例 #38
0
 protected void InitialiseHGServices(OpenSimBase openSim, LibraryRootFolder libraryRootFolder)
 {
     // Standalone mode is determined by !startupConfig.GetBoolean("gridmode", false)
     if (m_openSim.ConfigurationSettings.Standalone)
     {
         InitialiseHGStandaloneServices(libraryRootFolder);
     }
     else
     {
         // We are in grid mode
         InitialiseHGGridServices(libraryRootFolder);
     }
 }
コード例 #39
0
        protected void InitializeCommsManager(OpenSimBase openSim)
        {
            LibraryRootFolder libraryRootFolder = new LibraryRootFolder(m_openSim.ConfigurationSettings.LibrariesXMLFile);

            InitializeStandardServices(libraryRootFolder);

            openSim.CommunicationsManager = m_commsManager;
        }
コード例 #40
0
 public XSimStatusHandler(OpenSimBase sim)
 {
     m_opensim   = sim;
     osXStatsURI = Util.SHA1Hash(sim.osSecret);
 }
コード例 #41
0
 public void Initialise(OpenSimBase openSim)
 {
     m_openSim = openSim;
     m_openSim.ApplicationRegistry.RegisterInterface <IRegionCreator>(this);
 }
コード例 #42
0
 public EstateLoaderFileSystem(OpenSimBase openSim)
 {
     m_application = openSim;
 }
コード例 #43
0
 public void Initialize(OpenSimBase openSim)
 {
     m_app   = openSim;
     m_admin = new RemoteAdmin(openSim.ConfigSource.Source.Configs["Network"]?.GetString("SSLCertFile", null));
 }
コード例 #44
0
        /// <summary>
        /// This method is called by OpenSimMain immediately after loading the
        /// plugin and after basic server setup,  but before running any server commands.
        /// </summary>
        /// <remarks>
        /// Note that entries MUST be added to the active configuration files before
        /// the plugin can be enabled.
        /// </remarks>

        public override void Initialise(OpenSimBase openSim)
        {
            try
            {
                // This plugin will only be enabled if the broader
                // REST plugin mechanism is enabled.

                //Rest.Log.InfoFormat("{0}  Plugin is initializing", MsgId);

                base.Initialise(openSim);

                // IsEnabled is implemented by the base class and
                // reflects an overall RestPlugin status

                if (!IsEnabled)
                {
                    //Rest.Log.WarnFormat("{0} Plugins are disabled", MsgId);
                    return;
                }

                Rest.Log.InfoFormat("{0} Rest <{1}> plugin will be enabled", MsgId, Name);
                Rest.Log.InfoFormat("{0} Configuration parameters read from <{1}>", MsgId, ConfigName);

                // These are stored in static variables to make
                // them easy to reach from anywhere in the assembly.

                Rest.main = openSim;
                if (Rest.main == null)
                {
                    throw new Exception("OpenSim base pointer is null");
                }

                Rest.Plugin         = this;
                Rest.Config         = Config;
                Rest.Prefix         = Prefix;
                Rest.GodKey         = GodKey;
                Rest.Authenticate   = Rest.Config.GetBoolean("authenticate", Rest.Authenticate);
                Rest.Scheme         = Rest.Config.GetString("auth-scheme", Rest.Scheme);
                Rest.Secure         = Rest.Config.GetBoolean("secured", Rest.Secure);
                Rest.ExtendedEscape = Rest.Config.GetBoolean("extended-escape", Rest.ExtendedEscape);
                Rest.Realm          = Rest.Config.GetString("realm", Rest.Realm);
                Rest.DumpAsset      = Rest.Config.GetBoolean("dump-asset", Rest.DumpAsset);
                Rest.Fill           = Rest.Config.GetBoolean("path-fill", Rest.Fill);
                Rest.DumpLineSize   = Rest.Config.GetInt("dump-line-size", Rest.DumpLineSize);
                Rest.FlushEnabled   = Rest.Config.GetBoolean("flush-on-error", Rest.FlushEnabled);

                // Note: Odd spacing is required in the following strings

                Rest.Log.InfoFormat("{0} Authentication is {1}required", MsgId,
                                    (Rest.Authenticate ? "" : "not "));

                Rest.Log.InfoFormat("{0} Security is {1}enabled", MsgId,
                                    (Rest.Secure ? "" : "not "));

                Rest.Log.InfoFormat("{0} Extended URI escape processing is {1}enabled", MsgId,
                                    (Rest.ExtendedEscape ? "" : "not "));

                Rest.Log.InfoFormat("{0} Dumping of asset data is {1}enabled", MsgId,
                                    (Rest.DumpAsset ? "" : "not "));

                // The supplied prefix MUST be absolute

                if (Rest.Prefix.Substring(0, 1) != Rest.UrlPathSeparator)
                {
                    Rest.Log.WarnFormat("{0} Prefix <{1}> is not absolute and must be", MsgId, Rest.Prefix);
                    Rest.Log.InfoFormat("{0} Prefix changed to </{1}>", MsgId, Rest.Prefix);
                    Rest.Prefix = String.Format("{0}{1}", Rest.UrlPathSeparator, Rest.Prefix);
                }

                // If data dumping is requested, report on the chosen line
                // length.

                if (Rest.DumpAsset)
                {
                    Rest.Log.InfoFormat("{0} Dump {1} bytes per line", MsgId, Rest.DumpLineSize);
                }

                // Load all of the handlers present in the
                // assembly

                // In principle, as we're an application plug-in,
                // most of what needs to be done could be done using
                // static resources, however the Open Sim plug-in
                // model makes this an instance, so that's what we
                // need to be.
                // There is only one Communications manager per
                // server, and by inference, only one each of the
                // user, asset, and inventory servers. So we can cache
                // those using a static initializer.
                // We move all of this processing off to another
                // services class to minimize overlap between function
                // and infrastructure.

                LoadHandlers();

                // The intention of a post construction initializer
                // is to allow for setup that is dependent upon other
                // activities outside of the agency.

                foreach (IRest handler in handlers)
                {
                    try
                    {
                        handler.Initialize();
                    }
                    catch (Exception e)
                    {
                        Rest.Log.ErrorFormat("{0} initialization error: {1}", MsgId, e.Message);
                    }
                }

                // Now that everything is setup we can proceed to
                // add THIS agent to the HTTP server's handler list

                if (!AddAgentHandler(Rest.Name, this))
                {
                    Rest.Log.ErrorFormat("{0} Unable to activate handler interface", MsgId);
                    foreach (IRest handler in handlers)
                    {
                        handler.Close();
                    }
                }
            }
            catch (Exception e)
            {
                Rest.Log.ErrorFormat("{0} Plugin initialization has failed: {1}", MsgId, e.Message);
            }
        }
コード例 #45
0
ファイル: LoadRegionsPlugin.cs プロジェクト: ChrisD/opensim
        public void LoadRegionFromConfig(OpenSimBase openSim, ulong regionhandle)
        {
            m_log.Info("[LOADREGIONS]: Load Regions addin being initialised");

            IRegionLoader regionLoader;
            if (openSim.ConfigSource.Source.Configs["Startup"].GetString("region_info_source", "filesystem") == "filesystem")
            {
                m_log.Info("[LOADREGIONS]: Loading Region Info from filesystem");
                regionLoader = new RegionLoaderFileSystem();
            }
            else
            {
                m_log.Info("[LOADREGIONS]: Loading Region Info from web");
                regionLoader = new RegionLoaderWebServer();
            }

            regionLoader.SetIniConfigSource(openSim.ConfigSource.Source);
            RegionInfo[] regionsToLoad = regionLoader.LoadRegions();
            for (int i = 0; i < regionsToLoad.Length; i++)
            {
                if (regionhandle == regionsToLoad[i].RegionHandle)
                {
                    IScene scene;
                    m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " +
                                Thread.CurrentThread.ManagedThreadId.ToString() + ")");
                    openSim.CreateRegion(regionsToLoad[i], true, out scene);
                }
            }
        }
コード例 #46
0
        protected void InitialiseCommsManager(OpenSimBase openSim)
        {
            LibraryRootFolder libraryRootFolder = new LibraryRootFolder(m_openSim.ConfigurationSettings.LibrariesXMLFile);

            bool hgrid = m_openSim.ConfigSource.Source.Configs["Startup"].GetBoolean("hypergrid", false);

            if (hgrid)
            {
                InitialiseHGServices(openSim, libraryRootFolder);
            }
            else
            {
                InitialiseStandardServices(libraryRootFolder);
            }

            openSim.CommunicationsManager = m_commsManager;
        }