Migrate OpenSim inventory frontend to load with Mono.Addins. Everything
should compile and it seems even creating users works somehow.0.6.3-post-fixes
parent
74a2bd237a
commit
af64c1ee9e
|
@ -55,7 +55,7 @@ namespace OpenSim.Grid.AssetInventoryServer
|
|||
public IAuthorizationProvider AuthorizationProvider;
|
||||
public IMetricsProvider MetricsProvider;
|
||||
|
||||
private IAssetInventoryServerPlugin frontend;
|
||||
private List<IAssetInventoryServerPlugin> frontends = new List<IAssetInventoryServerPlugin>();
|
||||
|
||||
public AssetInventoryServer()
|
||||
{
|
||||
|
@ -107,7 +107,7 @@ namespace OpenSim.Grid.AssetInventoryServer
|
|||
}
|
||||
|
||||
StorageProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/StorageProvider", "OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim.dll") as IAssetStorageProvider;
|
||||
InventoryProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/InventoryProvider", "OpenSim.Grid.AssetInventoryServer.Plugins.Simple.dll") as IInventoryStorageProvider;
|
||||
InventoryProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/InventoryProvider", "OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim.dll") as IInventoryStorageProvider;
|
||||
MetricsProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/MetricsProvider", String.Empty) as IMetricsProvider;
|
||||
|
||||
try
|
||||
|
@ -121,7 +121,7 @@ namespace OpenSim.Grid.AssetInventoryServer
|
|||
return false;
|
||||
}
|
||||
|
||||
frontend = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/Frontend", String.Empty);
|
||||
frontends.AddRange(LoadAssetInventoryServerPlugins("/OpenSim/AssetInventoryServer/Frontend", String.Empty));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -194,6 +194,21 @@ namespace OpenSim.Grid.AssetInventoryServer
|
|||
|
||||
return loader.Plugin;
|
||||
}
|
||||
|
||||
private List<IAssetInventoryServerPlugin> LoadAssetInventoryServerPlugins(string addinPath, string provider)
|
||||
{
|
||||
PluginLoader<IAssetInventoryServerPlugin> loader = new PluginLoader<IAssetInventoryServerPlugin>(new AssetInventoryServerPluginInitialiser(this));
|
||||
|
||||
if (provider == String.Empty)
|
||||
loader.Add(addinPath);
|
||||
else
|
||||
loader.Add(addinPath, new PluginProviderFilter(provider));
|
||||
//loader.Add(addinPath, new PluginCountConstraint(1));
|
||||
|
||||
loader.Load();
|
||||
|
||||
return loader.Plugins;
|
||||
}
|
||||
}
|
||||
|
||||
public class log4netLogWriter : ILogWriter
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Grid.AssetInventoryServer.Extensions
|
||||
{
|
||||
public static class SimpleUtils
|
||||
{
|
||||
public static string ParseNameFromFilename(string filename)
|
||||
{
|
||||
filename = Path.GetFileName(filename);
|
||||
|
||||
int dot = filename.LastIndexOf('.');
|
||||
int firstDash = filename.IndexOf('-');
|
||||
|
||||
if (dot - 37 > 0 && firstDash > 0)
|
||||
return filename.Substring(0, firstDash);
|
||||
else
|
||||
return String.Empty;
|
||||
}
|
||||
|
||||
public static UUID ParseUUIDFromFilename(string filename)
|
||||
{
|
||||
int dot = filename.LastIndexOf('.');
|
||||
|
||||
if (dot > 35)
|
||||
{
|
||||
// Grab the last 36 characters of the filename
|
||||
string uuidString = filename.Substring(dot - 36, 36);
|
||||
UUID uuid;
|
||||
UUID.TryParse(uuidString, out uuid);
|
||||
return uuid;
|
||||
}
|
||||
else
|
||||
{
|
||||
UUID uuid;
|
||||
if (UUID.TryParse(Path.GetFileName(filename), out uuid))
|
||||
return uuid;
|
||||
else
|
||||
return UUID.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -43,7 +43,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
|
|||
{
|
||||
public class OpenSimAssetFrontendPlugin : IAssetInventoryServerPlugin
|
||||
{
|
||||
AssetInventoryServer server;
|
||||
private AssetInventoryServer server;
|
||||
|
||||
public OpenSimAssetFrontendPlugin()
|
||||
{
|
||||
|
@ -60,6 +60,8 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
|
|||
|
||||
// Asset creation
|
||||
server.HttpServer.AddHandler("post", null, @"^/assets/", AssetPostHandler);
|
||||
|
||||
Logger.Log.Info("[ASSET] OpenSim Asset Frontend loaded.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -36,21 +36,24 @@ using ExtensionLoader;
|
|||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using HttpServer;
|
||||
using OpenSim.Framework;
|
||||
|
||||
namespace OpenSim.Grid.AssetInventoryServer.Extensions
|
||||
namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
|
||||
{
|
||||
public class OpenSimInventoryFrontend : IExtension<AssetInventoryServer>
|
||||
public class OpenSimInventoryFrontendPlugin : IAssetInventoryServerPlugin
|
||||
{
|
||||
AssetInventoryServer server;
|
||||
Utils.InventoryItemSerializer itemSerializer = new Utils.InventoryItemSerializer();
|
||||
Utils.InventoryFolderSerializer folderSerializer = new Utils.InventoryFolderSerializer();
|
||||
Utils.InventoryCollectionSerializer collectionSerializer = new Utils.InventoryCollectionSerializer();
|
||||
private AssetInventoryServer server;
|
||||
private Utils.InventoryItemSerializer itemSerializer = new Utils.InventoryItemSerializer();
|
||||
private Utils.InventoryFolderSerializer folderSerializer = new Utils.InventoryFolderSerializer();
|
||||
private Utils.InventoryCollectionSerializer collectionSerializer = new Utils.InventoryCollectionSerializer();
|
||||
|
||||
public OpenSimInventoryFrontend()
|
||||
public OpenSimInventoryFrontendPlugin()
|
||||
{
|
||||
}
|
||||
|
||||
public void Start(AssetInventoryServer server)
|
||||
#region IPlugin implementation
|
||||
|
||||
public void Initialise(AssetInventoryServer server)
|
||||
{
|
||||
this.server = server;
|
||||
|
||||
|
@ -64,12 +67,36 @@ namespace OpenSim.Grid.AssetInventoryServer.Extensions
|
|||
server.HttpServer.AddHandler("post", null, @"^/DeleteItem/", DeleteItemHandler);
|
||||
server.HttpServer.AddHandler("post", null, @"^/RootFolders/", RootFoldersHandler);
|
||||
server.HttpServer.AddHandler("post", null, @"^/ActiveGestures/", ActiveGesturesHandler);
|
||||
|
||||
Logger.Log.Info("[INVENTORY] OpenSim Inventory Frontend loaded.");
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
/// <summary>
|
||||
/// <para>Initialises asset interface</para>
|
||||
/// </summary>
|
||||
public void Initialise()
|
||||
{
|
||||
Logger.Log.InfoFormat("[INVENTORY]: {0} cannot be default-initialized!", Name);
|
||||
throw new PluginNotInitialisedException(Name);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
public string Version
|
||||
{
|
||||
// TODO: this should be something meaningful and not hardcoded?
|
||||
get { return "0.1"; }
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "AssetInventoryServer OpenSim asset frontend"; }
|
||||
}
|
||||
|
||||
#endregion IPlugin implementation
|
||||
|
||||
bool GetInventoryHandler(IHttpClientContext client, IHttpRequest request, IHttpResponse response)
|
||||
{
|
||||
UUID sessionID, agentID;
|
|
@ -21,4 +21,7 @@
|
|||
<Extension path="/OpenSim/AssetInventoryServer/Frontend">
|
||||
<Plugin id="OpenSimAssetFrontend" provider="OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim.dll" type="OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim.OpenSimAssetFrontendPlugin" />
|
||||
</Extension>
|
||||
<Extension path="/OpenSim/AssetInventoryServer/Frontend">
|
||||
<Plugin id="OpenSimInventoryFrontend" provider="OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim.dll" type="OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim.OpenSimInventoryFrontendPlugin" />
|
||||
</Extension>
|
||||
</Addin>
|
||||
|
|
Loading…
Reference in New Issue