From 7a686ef124669501da848baa1671a22de36f7bd7 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Sat, 7 Apr 2012 14:52:02 -0400 Subject: [PATCH] Some work on web interface Adding some web handlers to manage plugins. Returns json for integration into external processing. --- .../Integration/IntegrationServerHandler.cs | 20 ++++++++++++++++--- .../IntegrationService/IntegrationService.cs | 16 +++++++++++++-- .../IntegrationService/PluginManager.cs | 14 ------------- .../Interfaces/IIntegrationService.cs | 2 ++ 4 files changed, 33 insertions(+), 19 deletions(-) diff --git a/OpenSim/Server/Handlers/Integration/IntegrationServerHandler.cs b/OpenSim/Server/Handlers/Integration/IntegrationServerHandler.cs index 812d2ce65e..6e514928c3 100644 --- a/OpenSim/Server/Handlers/Integration/IntegrationServerHandler.cs +++ b/OpenSim/Server/Handlers/Integration/IntegrationServerHandler.cs @@ -78,10 +78,11 @@ namespace OpenSim.Server.Handlers.Integration switch (command) { // agent - case "foo": - break; + case "list_plugins": + return HandleListPlugins(request); - case "bar": + case "plugin_info": + return HandlePluginInfo(request); break; default: @@ -97,7 +98,20 @@ namespace OpenSim.Server.Handlers.Integration return FailureResult(); } + #region web handlers + private byte[] HandleListPlugins(OSDMap request) + { + return m_IntegrationService.HandleWebListPlugins(request); + } + + private byte[] HandlePluginInfo(OSDMap request) + { + return m_IntegrationService.HandleWebPluginInfo(request); + } + #endregion web handlers + #region utility + // These are in IntegrationUtils.cs for plugins private byte[] FailureResult() { return FailureResult(String.Empty); diff --git a/OpenSim/Services/IntegrationService/IntegrationService.cs b/OpenSim/Services/IntegrationService/IntegrationService.cs index 4cce38f5f8..42f88ce318 100644 --- a/OpenSim/Services/IntegrationService/IntegrationService.cs +++ b/OpenSim/Services/IntegrationService/IntegrationService.cs @@ -35,10 +35,12 @@ using OpenSim.Framework; using OpenSim.Framework.Servers.HttpServer; using GridRegion = OpenSim.Services.Interfaces.GridRegion; using OpenMetaverse; +using OpenMetaverse.StructuredData; using Nini.Config; using log4net; using Mono.Addins; +using Ux = OpenSim.Services.IntegrationService.IUtils; namespace OpenSim.Services.IntegrationService { @@ -115,7 +117,6 @@ namespace OpenSim.Services.IntegrationService MainConsole.Instance.Commands.AddCommand("Integration", true, "show info", "show info \"plugin name\"","Show detailed information for plugin", HandleConsoleShowAddinInfo); - } #region console handlers @@ -173,7 +174,6 @@ namespace OpenSim.Services.IntegrationService { m_PluginManager.AddRepository(cmd); } - return; } @@ -219,5 +219,17 @@ namespace OpenSim.Services.IntegrationService } } #endregion + + #region web handlers + public byte[] HandleWebListPlugins(OSDMap request) + { + return Ux.FailureResult("Not Implemented"); + } + + public byte[] HandleWebPluginInfo(OSDMap request) + { + return Ux.FailureResult("Not Implemented"); + } + #endregion } } \ No newline at end of file diff --git a/OpenSim/Services/IntegrationService/PluginManager.cs b/OpenSim/Services/IntegrationService/PluginManager.cs index 56875aa009..be6533ba10 100644 --- a/OpenSim/Services/IntegrationService/PluginManager.cs +++ b/OpenSim/Services/IntegrationService/PluginManager.cs @@ -49,12 +49,6 @@ namespace OpenSim.Services.IntegrationService m_Registry.Update(); } -// public PluginManager(string registry_path) -// { -// m_Registry = new AddinRegistry(registry_path); -// m_Service = new SetupService(m_Registry); -// } -// public string InstallPlugin(string[] args) { PackageCollection pack = new PackageCollection(); @@ -76,10 +70,8 @@ namespace OpenSim.Services.IntegrationService pack.Add(p); } - ResolveDependencies(ps, pack, out toUninstall, out unresolved); - if(Install(ps, pack) == true) { m_Registry.Update(ps); @@ -112,7 +104,6 @@ namespace OpenSim.Services.IntegrationService { MainConsole.Instance.OutputFormat("* {0} rev. {1}", addin.Name, addin.Version); } - return; } @@ -174,10 +165,8 @@ namespace OpenSim.Services.IntegrationService } AddinRepository rep = reps[n]; - //return "TEST"; Repositories.SetRepositoryEnabled(rep.Url, true); return; - //return DisableRepository(); } public void DisableRepository(string[] args) @@ -198,10 +187,8 @@ namespace OpenSim.Services.IntegrationService } AddinRepository rep = reps[n]; - //return "TEST"; Repositories.SetRepositoryEnabled(rep.Url, false); return; - //return DisableRepository(); } public ArrayList ListRepositories() @@ -231,7 +218,6 @@ namespace OpenSim.Services.IntegrationService list.Add(sb.ToString()); n++; } - return list; } diff --git a/OpenSim/Services/Interfaces/IIntegrationService.cs b/OpenSim/Services/Interfaces/IIntegrationService.cs index 0e080b941b..6dbaf52eb0 100644 --- a/OpenSim/Services/Interfaces/IIntegrationService.cs +++ b/OpenSim/Services/Interfaces/IIntegrationService.cs @@ -36,6 +36,8 @@ namespace OpenSim.Services.Interfaces { public interface IIntegrationService { + byte[] HandleWebListPlugins(OSDMap request); + byte[] HandleWebPluginInfo(OSDMap request); } }