Filling in some more web handlers

integration
BlueWall 2012-04-22 22:47:29 -04:00
parent e8909703ae
commit 6a69c3ac04
3 changed files with 170 additions and 20 deletions

View File

@ -66,27 +66,61 @@ namespace OpenSim.Server.Handlers.Integration
{ {
OSDMap request = null; OSDMap request = null;
if (ServerUtils.ParseStringToOSDMap(body, out request) == false) if (ServerUtils.ParseStringToOSDMap(body, out request) == false)
{
return FailureResult(); return FailureResult();
}
// Dictionary<string, object> request = ServerUtils.ParseQueryString(body);
if (!request.ContainsKey("command")) if (!request.ContainsKey("command"))
{
return FailureResult("Error, no command defined!"); return FailureResult("Error, no command defined!");
}
string command = request["command"].AsString (); string command = request["command"].AsString ();
// command...
switch (command) switch (command)
{ {
// agent
case "list_plugins": case "list_plugins":
return HandleListPlugins(request); return HandleListPlugins(request);
case "list_available":
return HandleListAvailablePlugins(request);
case "install_plugin":
return HandleInstallPlugin(request);
case "uninstall_plugin":
return HandleUnInstallPlugin(request);
case "enable_plugin":
return HandleEnablePlugin (request);
case "disable_plugin":
return HandleDisblePlugin(request);
case "plugin_info": case "plugin_info":
return HandlePluginInfo(request); return HandlePluginInfo(request);
break;
case "list_repos":
return HandleListRepositories (request);
case "add_repo":
return HandleAddRepository(request);
case "remove_repo":
return HandleRemoveRepository(request);
case "enable_repo":
return HandleEnablePlugin(request);
case "disable_repo":
return HandleDisableRepository(request);
default: default:
m_log.DebugFormat("[INTEGRATION HANDLER]: unknown method {0} request {1}", command.Length, command); m_log.DebugFormat(
"[INTEGRATION HANDLER]: unknown method {0} request {1}",
command.Length,
command
);
return FailureResult ("IntegrationHandler: Unrecognized method requested!"); return FailureResult ("IntegrationHandler: Unrecognized method requested!");
} }
} }
@ -99,30 +133,77 @@ namespace OpenSim.Server.Handlers.Integration
} }
#region web handlers #region web handlers
// List installed plugins
private byte[] HandleListPlugins(OSDMap request) private byte[] HandleListPlugins(OSDMap request)
{ {
return m_IntegrationService.HandleWebListPlugins(request); return m_IntegrationService.HandleWebListPlugins(request);
} }
// Show plugin info
private byte[] HandlePluginInfo(OSDMap request) private byte[] HandlePluginInfo(OSDMap request)
{ {
return m_IntegrationService.HandleWebPluginInfo(request); return m_IntegrationService.HandleWebPluginInfo(request);
} }
public byte[] HandleWebListAvailablePlugins(OSDMap request) // Enable plugin
private byte[] HandleEnablePlugin(OSDMap request)
{ {
return m_IntegrationService.HandleWebListAvailablePlugins(request); return m_IntegrationService.HandleWebEnablePlugin(request);
} }
public byte[] HandleWebInstallPlugin(OSDMap request) // Disable plugin
private byte[] HandleDisblePlugin(OSDMap request)
{
return m_IntegrationService.HandleWebDisablePlugin(request);
}
// Install plugin
public byte[] HandleInstallPlugin(OSDMap request)
{ {
return m_IntegrationService.HandleWebInstallPlugin(request); return m_IntegrationService.HandleWebInstallPlugin(request);
} }
public byte[] HnadleWebUnInstallPlugin(OSDMap request) // Uninstall plugin
public byte[] HandleUnInstallPlugin(OSDMap request)
{ {
return m_IntegrationService.HandleWebUnInstallPlugin(request); return m_IntegrationService.HandleWebUnInstallPlugin(request);
} }
// List available plugins
public byte[] HandleListAvailablePlugins(OSDMap request)
{
return m_IntegrationService.HandleWebListAvailablePlugins(request);
}
// List repositories
public byte[] HandleListRepositories(OSDMap request)
{
return m_IntegrationService.HandleWebListRepositories(request);
}
// Add repository
public byte[] HandleAddRepository(OSDMap request)
{
return m_IntegrationService.HandleWebAddRepository(request);
}
// Remove repository
public byte[] HandleRemoveRepository(OSDMap request)
{
return m_IntegrationService.HandleWebRemoveRepositroy(request);
}
// Enable repository
public byte[] HandleEnableRepository(OSDMap request)
{
return m_IntegrationService.HandleEnableRepository(request);
}
// Disable repository
public byte[] HandleDisableRepository(OSDMap request)
{
return m_IntegrationService.HandleWebDisableRepository(request);
}
#endregion web handlers #endregion web handlers
#region utility #region utility

View File

@ -249,7 +249,59 @@ namespace OpenSim.Services.IntegrationService
} }
#endregion #endregion
#region web handlers // #region web handlers
// public byte[] HandleWebListPlugins(OSDMap request)
// {
// return Ux.FailureResult("Not Implemented");
// }
//
// public byte[] HandleWebPluginInfo(OSDMap request)
// {
// return Ux.FailureResult("Not Implemented");
// }
//
// public byte[] HandleWebListAvailablePlugins(OSDMap request)
// {
// return Ux.FailureResult("Not Implemented");
// }
//
// public byte[] HandleWebInstallPlugin(OSDMap request)
// {
// return Ux.FailureResult("Not Implemented");
// }
//
// public byte[] HandleWebUnInstallPlugin(OSDMap request)
// {
// return Ux.FailureResult("Not Implemented");
// }
// #endregion
#region IIntegrationService implementation
public byte[] HandleWebListRepositories (OSDMap request)
{
return Ux.FailureResult("Not Implemented");
}
public byte[] HandleWebAddRepository (OSDMap request)
{
return Ux.FailureResult("Not Implemented");
}
public byte[] HandleWebRemoveRepositroy (OSDMap request)
{
return Ux.FailureResult("Not Implemented");
}
public byte[] HandleEnableRepository (OSDMap request)
{
return Ux.FailureResult("Not Implemented");
}
public byte[] HandleWebDisableRepository (OSDMap request)
{
return Ux.FailureResult("Not Implemented");
}
public byte[] HandleWebListPlugins (OSDMap request) public byte[] HandleWebListPlugins (OSDMap request)
{ {
return Ux.FailureResult("Not Implemented"); return Ux.FailureResult("Not Implemented");
@ -274,6 +326,16 @@ namespace OpenSim.Services.IntegrationService
{ {
return Ux.FailureResult("Not Implemented"); return Ux.FailureResult("Not Implemented");
} }
public byte[] HandleWebEnablePlugin (OSDMap request)
{
return Ux.FailureResult("Not Implemented");
}
public byte[] HandleWebDisablePlugin (OSDMap request)
{
return Ux.FailureResult("Not Implemented");
}
#endregion #endregion
} }
} }

View File

@ -37,11 +37,18 @@ namespace OpenSim.Services.Interfaces
public interface IIntegrationService public interface IIntegrationService
{ {
#region Web handlers #region Web handlers
byte[] HandleWebListRepositories(OSDMap request);
byte[] HandleWebAddRepository(OSDMap request);
byte[] HandleWebRemoveRepositroy(OSDMap request);
byte[] HandleEnableRepository(OSDMap request);
byte[] HandleWebDisableRepository(OSDMap request);
byte[] HandleWebListPlugins(OSDMap request); byte[] HandleWebListPlugins(OSDMap request);
byte[] HandleWebPluginInfo(OSDMap request); byte[] HandleWebPluginInfo(OSDMap request);
byte[] HandleWebListAvailablePlugins(OSDMap request); byte[] HandleWebListAvailablePlugins(OSDMap request);
byte[] HandleWebInstallPlugin(OSDMap request); byte[] HandleWebInstallPlugin(OSDMap request);
byte[] HandleWebUnInstallPlugin(OSDMap request); byte[] HandleWebUnInstallPlugin(OSDMap request);
byte[] HandleWebEnablePlugin(OSDMap request);
byte[] HandleWebDisablePlugin(OSDMap request);
#endregion #endregion
} }
} }