12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- using System;
- using Nini.Config;
- using OpenSim.Server.Base;
- using OpenSim.Services.Interfaces;
- using OpenSim.Framework.Servers.HttpServer;
- using OpenSim.Server.Handlers.Base;
- using OpenMetaverse;
- namespace OpenSim.Capabilities.Handlers
- {
- public class FetchInvDescServerConnector : ServiceConnector
- {
- private IInventoryService m_InventoryService;
- private ILibraryService m_LibraryService;
- private string m_ConfigName = "CapsService";
- public FetchInvDescServerConnector(IConfigSource config, IHttpServer server, string configName) :
- base(config, server, configName)
- {
- if (configName != String.Empty)
- m_ConfigName = configName;
- IConfig serverConfig = config.Configs[m_ConfigName];
- if (serverConfig == null)
- throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
- string invService = serverConfig.GetString("InventoryService", String.Empty);
- if (invService == String.Empty)
- throw new Exception("No InventoryService in config file");
- Object[] args = new Object[] { config };
- m_InventoryService =
- ServerUtils.LoadPlugin<IInventoryService>(invService, args);
- if (m_InventoryService == null)
- throw new Exception(String.Format("Failed to load InventoryService from {0}; config is {1}", invService, m_ConfigName));
- string libService = serverConfig.GetString("LibraryService", String.Empty);
- m_LibraryService =
- ServerUtils.LoadPlugin<ILibraryService>(libService, args);
- FetchInvDescHandler webFetchHandler = new FetchInvDescHandler(m_InventoryService, m_LibraryService, null);
- IRequestHandler reqHandler
- = new RestStreamHandler(
- "POST",
- "/CAPS/WebFetchInvDesc/" ,
- webFetchHandler.FetchInventoryDescendentsRequest,
- "FetchInvDescendents",
- null);
- server.AddStreamHandler(reqHandler);
- }
- }
- }
|