aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Grid')
-rw-r--r--OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs21
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Extensions/SimpleUtils.cs44
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetFrontendPlugin.cs4
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryFrontendPlugin.cs (renamed from OpenSim/Grid/AssetInventoryServer/Extensions/OpenSimInventoryFrontend.cs)45
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/Resources/AssetInventoryServerOpenSimPlugins.addin.xml3
5 files changed, 60 insertions, 57 deletions
diff --git a/OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs b/OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs
index e100377..012c4ea 100644
--- a/OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs
+++ b/OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs
@@ -55,7 +55,7 @@ namespace OpenSim.Grid.AssetInventoryServer
55 public IAuthorizationProvider AuthorizationProvider; 55 public IAuthorizationProvider AuthorizationProvider;
56 public IMetricsProvider MetricsProvider; 56 public IMetricsProvider MetricsProvider;
57 57
58 private IAssetInventoryServerPlugin frontend; 58 private List<IAssetInventoryServerPlugin> frontends = new List<IAssetInventoryServerPlugin>();
59 59
60 public AssetInventoryServer() 60 public AssetInventoryServer()
61 { 61 {
@@ -107,7 +107,7 @@ namespace OpenSim.Grid.AssetInventoryServer
107 } 107 }
108 108
109 StorageProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/StorageProvider", "OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim.dll") as IAssetStorageProvider; 109 StorageProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/StorageProvider", "OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim.dll") as IAssetStorageProvider;
110 InventoryProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/InventoryProvider", "OpenSim.Grid.AssetInventoryServer.Plugins.Simple.dll") as IInventoryStorageProvider; 110 InventoryProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/InventoryProvider", "OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim.dll") as IInventoryStorageProvider;
111 MetricsProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/MetricsProvider", String.Empty) as IMetricsProvider; 111 MetricsProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/MetricsProvider", String.Empty) as IMetricsProvider;
112 112
113 try 113 try
@@ -121,7 +121,7 @@ namespace OpenSim.Grid.AssetInventoryServer
121 return false; 121 return false;
122 } 122 }
123 123
124 frontend = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/Frontend", String.Empty); 124 frontends.AddRange(LoadAssetInventoryServerPlugins("/OpenSim/AssetInventoryServer/Frontend", String.Empty));
125 125
126 return true; 126 return true;
127 } 127 }
@@ -194,6 +194,21 @@ namespace OpenSim.Grid.AssetInventoryServer
194 194
195 return loader.Plugin; 195 return loader.Plugin;
196 } 196 }
197
198 private List<IAssetInventoryServerPlugin> LoadAssetInventoryServerPlugins(string addinPath, string provider)
199 {
200 PluginLoader<IAssetInventoryServerPlugin> loader = new PluginLoader<IAssetInventoryServerPlugin>(new AssetInventoryServerPluginInitialiser(this));
201
202 if (provider == String.Empty)
203 loader.Add(addinPath);
204 else
205 loader.Add(addinPath, new PluginProviderFilter(provider));
206 //loader.Add(addinPath, new PluginCountConstraint(1));
207
208 loader.Load();
209
210 return loader.Plugins;
211 }
197 } 212 }
198 213
199 public class log4netLogWriter : ILogWriter 214 public class log4netLogWriter : ILogWriter
diff --git a/OpenSim/Grid/AssetInventoryServer/Extensions/SimpleUtils.cs b/OpenSim/Grid/AssetInventoryServer/Extensions/SimpleUtils.cs
deleted file mode 100644
index b3edf59..0000000
--- a/OpenSim/Grid/AssetInventoryServer/Extensions/SimpleUtils.cs
+++ /dev/null
@@ -1,44 +0,0 @@
1using System;
2using System.IO;
3using OpenMetaverse;
4
5namespace OpenSim.Grid.AssetInventoryServer.Extensions
6{
7 public static class SimpleUtils
8 {
9 public static string ParseNameFromFilename(string filename)
10 {
11 filename = Path.GetFileName(filename);
12
13 int dot = filename.LastIndexOf('.');
14 int firstDash = filename.IndexOf('-');
15
16 if (dot - 37 > 0 && firstDash > 0)
17 return filename.Substring(0, firstDash);
18 else
19 return String.Empty;
20 }
21
22 public static UUID ParseUUIDFromFilename(string filename)
23 {
24 int dot = filename.LastIndexOf('.');
25
26 if (dot > 35)
27 {
28 // Grab the last 36 characters of the filename
29 string uuidString = filename.Substring(dot - 36, 36);
30 UUID uuid;
31 UUID.TryParse(uuidString, out uuid);
32 return uuid;
33 }
34 else
35 {
36 UUID uuid;
37 if (UUID.TryParse(Path.GetFileName(filename), out uuid))
38 return uuid;
39 else
40 return UUID.Zero;
41 }
42 }
43 }
44}
diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetFrontendPlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetFrontendPlugin.cs
index f0ad3cf..ebab557 100644
--- a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetFrontendPlugin.cs
+++ b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetFrontendPlugin.cs
@@ -43,7 +43,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
43{ 43{
44 public class OpenSimAssetFrontendPlugin : IAssetInventoryServerPlugin 44 public class OpenSimAssetFrontendPlugin : IAssetInventoryServerPlugin
45 { 45 {
46 AssetInventoryServer server; 46 private AssetInventoryServer server;
47 47
48 public OpenSimAssetFrontendPlugin() 48 public OpenSimAssetFrontendPlugin()
49 { 49 {
@@ -60,6 +60,8 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
60 60
61 // Asset creation 61 // Asset creation
62 server.HttpServer.AddHandler("post", null, @"^/assets/", AssetPostHandler); 62 server.HttpServer.AddHandler("post", null, @"^/assets/", AssetPostHandler);
63
64 Logger.Log.Info("[ASSET] OpenSim Asset Frontend loaded.");
63 } 65 }
64 66
65 /// <summary> 67 /// <summary>
diff --git a/OpenSim/Grid/AssetInventoryServer/Extensions/OpenSimInventoryFrontend.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryFrontendPlugin.cs
index 340e00c..6e33cdf 100644
--- a/OpenSim/Grid/AssetInventoryServer/Extensions/OpenSimInventoryFrontend.cs
+++ b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryFrontendPlugin.cs
@@ -36,21 +36,24 @@ using ExtensionLoader;
36using OpenMetaverse; 36using OpenMetaverse;
37using OpenMetaverse.StructuredData; 37using OpenMetaverse.StructuredData;
38using HttpServer; 38using HttpServer;
39using OpenSim.Framework;
39 40
40namespace OpenSim.Grid.AssetInventoryServer.Extensions 41namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
41{ 42{
42 public class OpenSimInventoryFrontend : IExtension<AssetInventoryServer> 43 public class OpenSimInventoryFrontendPlugin : IAssetInventoryServerPlugin
43 { 44 {
44 AssetInventoryServer server; 45 private AssetInventoryServer server;
45 Utils.InventoryItemSerializer itemSerializer = new Utils.InventoryItemSerializer(); 46 private Utils.InventoryItemSerializer itemSerializer = new Utils.InventoryItemSerializer();
46 Utils.InventoryFolderSerializer folderSerializer = new Utils.InventoryFolderSerializer(); 47 private Utils.InventoryFolderSerializer folderSerializer = new Utils.InventoryFolderSerializer();
47 Utils.InventoryCollectionSerializer collectionSerializer = new Utils.InventoryCollectionSerializer(); 48 private Utils.InventoryCollectionSerializer collectionSerializer = new Utils.InventoryCollectionSerializer();
48 49
49 public OpenSimInventoryFrontend() 50 public OpenSimInventoryFrontendPlugin()
50 { 51 {
51 } 52 }
52 53
53 public void Start(AssetInventoryServer server) 54 #region IPlugin implementation
55
56 public void Initialise(AssetInventoryServer server)
54 { 57 {
55 this.server = server; 58 this.server = server;
56 59
@@ -64,12 +67,36 @@ namespace OpenSim.Grid.AssetInventoryServer.Extensions
64 server.HttpServer.AddHandler("post", null, @"^/DeleteItem/", DeleteItemHandler); 67 server.HttpServer.AddHandler("post", null, @"^/DeleteItem/", DeleteItemHandler);
65 server.HttpServer.AddHandler("post", null, @"^/RootFolders/", RootFoldersHandler); 68 server.HttpServer.AddHandler("post", null, @"^/RootFolders/", RootFoldersHandler);
66 server.HttpServer.AddHandler("post", null, @"^/ActiveGestures/", ActiveGesturesHandler); 69 server.HttpServer.AddHandler("post", null, @"^/ActiveGestures/", ActiveGesturesHandler);
70
71 Logger.Log.Info("[INVENTORY] OpenSim Inventory Frontend loaded.");
72 }
73
74 /// <summary>
75 /// <para>Initialises asset interface</para>
76 /// </summary>
77 public void Initialise()
78 {
79 Logger.Log.InfoFormat("[INVENTORY]: {0} cannot be default-initialized!", Name);
80 throw new PluginNotInitialisedException(Name);
81 }
82
83 public void Dispose()
84 {
85 }
86
87 public string Version
88 {
89 // TODO: this should be something meaningful and not hardcoded?
90 get { return "0.1"; }
67 } 91 }
68 92
69 public void Stop() 93 public string Name
70 { 94 {
95 get { return "AssetInventoryServer OpenSim asset frontend"; }
71 } 96 }
72 97
98 #endregion IPlugin implementation
99
73 bool GetInventoryHandler(IHttpClientContext client, IHttpRequest request, IHttpResponse response) 100 bool GetInventoryHandler(IHttpClientContext client, IHttpRequest request, IHttpResponse response)
74 { 101 {
75 UUID sessionID, agentID; 102 UUID sessionID, agentID;
diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/Resources/AssetInventoryServerOpenSimPlugins.addin.xml b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/Resources/AssetInventoryServerOpenSimPlugins.addin.xml
index 6d21327..cfdfdb5 100644
--- a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/Resources/AssetInventoryServerOpenSimPlugins.addin.xml
+++ b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/Resources/AssetInventoryServerOpenSimPlugins.addin.xml
@@ -21,4 +21,7 @@
21 <Extension path="/OpenSim/AssetInventoryServer/Frontend"> 21 <Extension path="/OpenSim/AssetInventoryServer/Frontend">
22 <Plugin id="OpenSimAssetFrontend" provider="OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim.dll" type="OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim.OpenSimAssetFrontendPlugin" /> 22 <Plugin id="OpenSimAssetFrontend" provider="OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim.dll" type="OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim.OpenSimAssetFrontendPlugin" />
23 </Extension> 23 </Extension>
24 <Extension path="/OpenSim/AssetInventoryServer/Frontend">
25 <Plugin id="OpenSimInventoryFrontend" provider="OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim.dll" type="OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim.OpenSimInventoryFrontendPlugin" />
26 </Extension>
24</Addin> 27</Addin>