1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- using System;
- using Nini.Config;
- using OpenSim.Server.Base;
- using OpenSim.Services.Interfaces;
- using OpenSim.Framework.Servers.HttpServer;
- using OpenSim.Server.Handlers.Base;
- namespace OpenSim.Server.Handlers.Hypergrid
- {
- public class HGFriendsServerConnector : ServiceConnector
- {
- private IUserAgentService m_UserAgentService;
- private IHGFriendsService m_TheService;
- private string m_ConfigName = "HGFriendsService";
-
- public HGFriendsServerConnector(IConfigSource config, IHttpServer server, string configName) :
- this(config, server, configName, null)
- {
- }
-
- public HGFriendsServerConnector(IConfigSource config, IHttpServer server, string configName, IFriendsSimConnector localConn)
- : base(config, server, configName)
- {
- if (configName != string.Empty)
- m_ConfigName = configName;
- Object[] args = new Object[] { config, m_ConfigName, localConn };
- IConfig serverConfig = config.Configs[m_ConfigName];
- if (serverConfig == null)
- throw new Exception(String.Format("No section {0} in config file", m_ConfigName));
- string theService = serverConfig.GetString("LocalServiceModule",
- String.Empty);
- if (theService == String.Empty)
- throw new Exception("No LocalServiceModule in config file");
- m_TheService = ServerUtils.LoadPlugin<IHGFriendsService>(theService, args);
- theService = serverConfig.GetString("UserAgentService", string.Empty);
- if (theService == String.Empty)
- throw new Exception("No UserAgentService in " + m_ConfigName);
- m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(theService, new Object[] { config, localConn });
- server.AddStreamHandler(new HGFriendsServerPostHandler(m_TheService, m_UserAgentService, localConn));
- }
- }
- }
|