Some formatting changes

integration
BlueWall 2012-07-13 23:15:11 -04:00
parent 1352a38680
commit afa2d7eea3
4 changed files with 39 additions and 49 deletions

View File

@ -95,7 +95,7 @@ namespace OpenSim.Server.Handlers.Integration
return HandleUnInstallPlugin(request); return HandleUnInstallPlugin(request);
case "enable_plugin": case "enable_plugin":
return HandleEnablePlugin (request); return HandleEnablePlugin(request);
case "disable_plugin": case "disable_plugin":
return HandleDisblePlugin(request); return HandleDisblePlugin(request);
@ -104,7 +104,7 @@ namespace OpenSim.Server.Handlers.Integration
return HandlePluginInfo(request); return HandlePluginInfo(request);
case "list_repos": case "list_repos":
return HandleListRepositories (request); return HandleListRepositories(request);
case "add_repo": case "add_repo":
return HandleAddRepository(request); return HandleAddRepository(request);
@ -124,7 +124,7 @@ namespace OpenSim.Server.Handlers.Integration
command.Length, command.Length,
command command
); );
return FailureResult ("IntegrationHandler: Unrecognized method requested!"); return FailureResult("IntegrationHandler: Unrecognized method requested!");
} }
} }
catch (Exception e) catch (Exception e)

View File

@ -29,20 +29,13 @@ using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using System.Linq;
using OpenSim.Server.Base;
using OpenSim.Services.Interfaces;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Services.Interfaces;
using GridRegion = OpenSim.Services.Interfaces.GridRegion; using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
using Nini.Config;
using log4net;
using Mono.Addins;
using Ux = OpenSim.Services.IntegrationService.IntegrationUtils; using Ux = OpenSim.Services.IntegrationService.IntegrationUtils;
namespace OpenSim.Services.IntegrationService namespace OpenSim.Services.IntegrationService
{ {
public class IntegrationService : IntegrationServiceBase, IIntegrationService public class IntegrationService : IntegrationServiceBase, IIntegrationService
@ -358,22 +351,22 @@ namespace OpenSim.Services.IntegrationService
return Ux.DocToBytes(json); return Ux.DocToBytes(json);
} }
public byte[] HandleWebAddRepository (OSDMap request) public byte[] HandleWebAddRepository(OSDMap request)
{ {
return Ux.FailureResult("Not Implemented"); return Ux.FailureResult("Not Implemented");
} }
public byte[] HandleWebRemoveRepositroy (OSDMap request) public byte[] HandleWebRemoveRepositroy(OSDMap request)
{ {
return Ux.FailureResult("Not Implemented"); return Ux.FailureResult("Not Implemented");
} }
public byte[] HandleEnableRepository (OSDMap request) public byte[] HandleEnableRepository(OSDMap request)
{ {
return Ux.FailureResult("Not Implemented"); return Ux.FailureResult("Not Implemented");
} }
public byte[] HandleWebDisableRepository (OSDMap request) public byte[] HandleWebDisableRepository(OSDMap request)
{ {
return Ux.FailureResult("Not Implemented"); return Ux.FailureResult("Not Implemented");
} }
@ -426,17 +419,17 @@ namespace OpenSim.Services.IntegrationService
} }
} }
public byte[] HandleWebUnInstallPlugin (OSDMap request) public byte[] HandleWebUnInstallPlugin(OSDMap request)
{ {
return Ux.FailureResult("Not Implemented"); return Ux.FailureResult("Not Implemented");
} }
public byte[] HandleWebEnablePlugin (OSDMap request) public byte[] HandleWebEnablePlugin(OSDMap request)
{ {
return Ux.FailureResult("Not Implemented"); return Ux.FailureResult("Not Implemented");
} }
public byte[] HandleWebDisablePlugin (OSDMap request) public byte[] HandleWebDisablePlugin(OSDMap request)
{ {
return Ux.FailureResult("Not Implemented"); return Ux.FailureResult("Not Implemented");
} }

View File

@ -27,22 +27,19 @@
using System; using System;
using System.IO; using System.IO;
using OpenSim.Services.Interfaces;
using OpenSim.Services.Base;
using OpenSim.Framework.Servers.HttpServer;
using System.Reflection; using System.Reflection;
using Nini.Config;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Services.Base;
using OpenSim.Services.Interfaces;
using GridRegion = OpenSim.Services.Interfaces.GridRegion; using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using Mono.Addins;
using log4net;
using Ux = OpenSim.Services.IntegrationService.IntegrationUtils; using Ux = OpenSim.Services.IntegrationService.IntegrationUtils;
[assembly:AddinRoot ("IntegrationService", "2.1")]
[assembly:AddinRoot("IntegrationService", "2.1")]
namespace OpenSim.Services.IntegrationService namespace OpenSim.Services.IntegrationService
{ {
[TypeExtensionPoint (Path="/OpenSim/IntegrationService", Name="IntegrationService")] [TypeExtensionPoint(Path="/OpenSim/IntegrationService", Name="IntegrationService")]
public interface IntegrationPlugin public interface IntegrationPlugin
{ {
void Init(IConfigSource MainConfig, IConfigSource PluginConfig, IHttpServer server, ServiceBase service); void Init(IConfigSource MainConfig, IConfigSource PluginConfig, IHttpServer server, ServiceBase service);
@ -90,16 +87,16 @@ namespace OpenSim.Services.IntegrationService
// be able to use the repo/registry commands ... // be able to use the repo/registry commands ...
if (DEVELOPMENT == true) if (DEVELOPMENT == true)
{ {
AddinManager.Initialize ("."); AddinManager.Initialize(".");
registry = new AddinRegistry(".", "."); registry = new AddinRegistry(".", ".");
registry.Update (); registry.Update();
AddinManager.AddinLoaded += on_addinloaded_; AddinManager.AddinLoaded += on_addinloaded_;
AddinManager.AddinLoadError += on_addinloaderror_; AddinManager.AddinLoadError += on_addinloaderror_;
AddinManager.AddinUnloaded += HandleAddinManagerAddinUnloaded; AddinManager.AddinUnloaded += HandleAddinManagerAddinUnloaded;
AddinManager.AddinEngine.ExtensionChanged += HandleAddinManagerAddinEngineExtensionChanged; AddinManager.AddinEngine.ExtensionChanged += HandleAddinManagerAddinEngineExtensionChanged;
registry.Update (); registry.Update();
foreach (IntegrationPlugin cmd in AddinManager.GetExtensionObjects("/OpenSim/IntegrationService")) foreach (IntegrationPlugin cmd in AddinManager.GetExtensionObjects("/OpenSim/IntegrationService"))
{ {
m_log.DebugFormat("[INTEGRATION SERVICE]: Processing _Addin {0}", cmd.PluginName); m_log.DebugFormat("[INTEGRATION SERVICE]: Processing _Addin {0}", cmd.PluginName);
@ -140,20 +137,20 @@ namespace OpenSim.Services.IntegrationService
return; return;
} }
AddinManager.Initialize (RegistryLocation); AddinManager.Initialize(RegistryLocation);
AddinManager.Registry.Update (); AddinManager.Registry.Update();
AddinManager.AddinLoaded += on_addinloaded_; AddinManager.AddinLoaded += on_addinloaded_;
AddinManager.AddinLoadError += on_addinloaderror_; AddinManager.AddinLoadError += on_addinloaderror_;
AddinManager.AddinUnloaded += HandleAddinManagerAddinUnloaded; AddinManager.AddinUnloaded += HandleAddinManagerAddinUnloaded;
AddinManager.AddExtensionNodeHandler ("/OpenSim/IntegrationService", OnExtensionChanged); AddinManager.AddExtensionNodeHandler("/OpenSim/IntegrationService", OnExtensionChanged);
} }
} }
#region addin event handlers #region addin event handlers
void HandleAddinManagerAddinEngineExtensionChanged (object sender, ExtensionEventArgs args) void HandleAddinManagerAddinEngineExtensionChanged(object sender, ExtensionEventArgs args)
{ {
MainConsole.Instance.Output(String.Format ("Plugin Extension Change Path:{0}", args.Path)); MainConsole.Instance.Output(String.Format("Plugin Extension Change Path:{0}", args.Path));
} }
private IConfigSource GetConfig(string configName) private IConfigSource GetConfig(string configName)
@ -161,7 +158,7 @@ namespace OpenSim.Services.IntegrationService
return new IniConfigSource(); return new IniConfigSource();
} }
void HandleAddinManagerAddinUnloaded (object sender, AddinEventArgs args) void HandleAddinManagerAddinUnloaded(object sender, AddinEventArgs args)
{ {
MainConsole.Instance.Output("Plugin Unloaded"); MainConsole.Instance.Output("Plugin Unloaded");
} }
@ -169,20 +166,20 @@ namespace OpenSim.Services.IntegrationService
private void on_addinloaderror_(object sender, AddinErrorEventArgs args) private void on_addinloaderror_(object sender, AddinErrorEventArgs args)
{ {
if (args.Exception == null) if (args.Exception == null)
m_log.Error ("[INTEGRATION SERVICE]: Plugin Error: " m_log.Error("[INTEGRATION SERVICE]: Plugin Error: "
+ args.Message); + args.Message);
else else
m_log.Error ("[INTEGRATION SERVICE]: Plugin Error: " m_log.Error("[INTEGRATION SERVICE]: Plugin Error: "
+ args.Exception.Message + "\n" + args.Exception.Message + "\n"
+ args.Exception.StackTrace); + args.Exception.StackTrace);
} }
// This is our init // This is our init
// We can do build-up and tear-down of our plugin // We can do build-up and tear-down of our plugin
void OnExtensionChanged (object s, ExtensionNodeEventArgs args) void OnExtensionChanged(object s, ExtensionNodeEventArgs args)
{ {
IntegrationPlugin ip = (IntegrationPlugin) args.ExtensionObject; IntegrationPlugin ip = (IntegrationPlugin) args.ExtensionObject;
m_log.Info ("[INTEGRATION SERVICE]: Plugin Change"); m_log.Info("[INTEGRATION SERVICE]: Plugin Change");
switch (args.Change) switch (args.Change)
{ {
@ -204,7 +201,7 @@ namespace OpenSim.Services.IntegrationService
private void on_addinloaded_(object sender, AddinEventArgs args) private void on_addinloaded_(object sender, AddinEventArgs args)
{ {
m_log.Info ("[INTEGRATION SERVICE]: Plugin Loaded: " + args.AddinId); m_log.Info("[INTEGRATION SERVICE]: Plugin Loaded: " + args.AddinId);
} }
#endregion addin-event handlers #endregion addin-event handlers
@ -228,7 +225,7 @@ namespace OpenSim.Services.IntegrationService
IniConfigSource source = new IniConfigSource(); IniConfigSource source = new IniConfigSource();
IConfig Init = source.AddConfig("DatabaseService"); IConfig Init = source.AddConfig("DatabaseService");
Init.Set("StorageProvider",(string)DataService.GetString("StorageProvider")); Init.Set("StorageProvider",(string)DataService.GetString("StorageProvider"));
Init.Set("ConnectionString", String.Format ("\"{0}\"",DataService.GetString("ConnectionString"))); Init.Set("ConnectionString", String.Format("\"{0}\"",DataService.GetString("ConnectionString")));
PlugConfig = Ux.LoadInitialConfig(plugin.DefaultConfig); PlugConfig = Ux.LoadInitialConfig(plugin.DefaultConfig);
source.Merge(PlugConfig); source.Merge(PlugConfig);

View File

@ -50,7 +50,7 @@ namespace OpenSim.Services.IntegrationService
/// <param name='r'> /// <param name='r'>
/// R. /// R.
/// </param> /// </param>
internal PluginManager( AddinRegistry r): base (r) internal PluginManager(AddinRegistry r): base (r)
{ {
m_Registry = r; m_Registry = r;
m_Registry.Update(); m_Registry.Update();
@ -228,7 +228,7 @@ namespace OpenSim.Services.IntegrationService
public string Update() public string Update()
{ {
IProgressStatus ps = new ConsoleProgressStatus(true); IProgressStatus ps = new ConsoleProgressStatus(true);
Repositories.UpdateAllRepositories (ps); Repositories.UpdateAllRepositories(ps);
return "Update"; return "Update";
} }
@ -266,7 +266,7 @@ namespace OpenSim.Services.IntegrationService
public void RemoveRepository(string[] args) public void RemoveRepository(string[] args)
{ {
AddinRepository[] reps = Repositories.GetRepositories(); AddinRepository[] reps = Repositories.GetRepositories();
Array.Sort (reps, (r1,r2) => r1.Title.CompareTo(r2.Title)); Array.Sort(reps, (r1,r2) => r1.Title.CompareTo(r2.Title));
if (reps.Length == 0) if (reps.Length == 0)
{ {
MainConsole.Instance.Output("No repositories have been registered."); MainConsole.Instance.Output("No repositories have been registered.");
@ -281,7 +281,7 @@ namespace OpenSim.Services.IntegrationService
} }
AddinRepository rep = reps[n]; AddinRepository rep = reps[n];
Repositories.RemoveRepository (rep.Url); Repositories.RemoveRepository(rep.Url);
return; return;
} }
@ -295,7 +295,7 @@ namespace OpenSim.Services.IntegrationService
public void EnableRepository(string[] args) public void EnableRepository(string[] args)
{ {
AddinRepository[] reps = Repositories.GetRepositories(); AddinRepository[] reps = Repositories.GetRepositories();
Array.Sort (reps, (r1,r2) => r1.Title.CompareTo(r2.Title)); Array.Sort(reps, (r1,r2) => r1.Title.CompareTo(r2.Title));
if (reps.Length == 0) if (reps.Length == 0)
{ {
MainConsole.Instance.Output("No repositories have been registered."); MainConsole.Instance.Output("No repositories have been registered.");
@ -324,7 +324,7 @@ namespace OpenSim.Services.IntegrationService
public void DisableRepository(string[] args) public void DisableRepository(string[] args)
{ {
AddinRepository[] reps = Repositories.GetRepositories(); AddinRepository[] reps = Repositories.GetRepositories();
Array.Sort (reps, (r1,r2) => r1.Title.CompareTo(r2.Title)); Array.Sort(reps, (r1,r2) => r1.Title.CompareTo(r2.Title));
if (reps.Length == 0) if (reps.Length == 0)
{ {
MainConsole.Instance.Output("No repositories have been registered."); MainConsole.Instance.Output("No repositories have been registered.");