aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Grid/AssetServer/Main.cs37
-rw-r--r--OpenSim/Grid/AssetServer/RestService.cs8
-rw-r--r--OpenSim/Grid/GridServer/GridManager.cs7
3 files changed, 16 insertions, 36 deletions
diff --git a/OpenSim/Grid/AssetServer/Main.cs b/OpenSim/Grid/AssetServer/Main.cs
index 7053f72..7c7e39b 100644
--- a/OpenSim/Grid/AssetServer/Main.cs
+++ b/OpenSim/Grid/AssetServer/Main.cs
@@ -53,7 +53,7 @@ namespace OpenSim.Grid.AssetServer
53 // Temporarily hardcoded - should be a plugin 53 // Temporarily hardcoded - should be a plugin
54 protected IAssetLoader assetLoader = new AssetLoaderFileSystem(); 54 protected IAssetLoader assetLoader = new AssetLoaderFileSystem();
55 55
56 private IAssetProvider m_assetProvider; 56 private IAssetProviderPlugin m_assetProvider;
57 57
58 [STAThread] 58 [STAThread]
59 public static void Main(string[] args) 59 public static void Main(string[] args)
@@ -116,36 +116,19 @@ namespace OpenSim.Grid.AssetServer
116 return null; 116 return null;
117 } 117 }
118 118
119 public IAssetProvider LoadDatabasePlugin(string FileName, string connect) 119 public IAssetProviderPlugin LoadDatabasePlugin(string provider, string connect)
120 { 120 {
121 m_log.Info("[ASSET SERVER]: LoadDatabasePlugin: Attempting to load " + FileName); 121 PluginLoader<IAssetProviderPlugin> loader =
122 Assembly pluginAssembly = Assembly.LoadFrom(FileName); 122 new PluginLoader<IAssetProviderPlugin> (new AssetDataInitialiser (connect));
123 IAssetProvider assetPlugin = null;
124 foreach (Type pluginType in pluginAssembly.GetTypes())
125 {
126 if (!pluginType.IsAbstract)
127 {
128 Type typeInterface = pluginType.GetInterface("IAssetProvider", true);
129 123
130 if (typeInterface != null) 124 // loader will try to load all providers (MySQL, MSSQL, etc)
131 { 125 // unless it is constrainted to the correct "Provider" entry in the addin.xml
132 IAssetProvider plug = 126 loader.Add ("/OpenSim/AssetData", new PluginProviderFilter (provider));
133 (IAssetProvider) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 127 loader.Load();
134 assetPlugin = plug;
135 assetPlugin.Initialise(connect);
136 128
137 m_log.Info("[ASSET SERVER]: Added " + assetPlugin.Name + " " + assetPlugin.Version); 129 return loader.Plugin;
138 break;
139 }
140
141 typeInterface = null;
142 }
143 }
144
145 pluginAssembly = null;
146 return assetPlugin;
147 } 130 }
148 131
149 public void setupDB(AssetConfig config) 132 public void setupDB(AssetConfig config)
150 { 133 {
151 try 134 try
diff --git a/OpenSim/Grid/AssetServer/RestService.cs b/OpenSim/Grid/AssetServer/RestService.cs
index 372f5f8..f63b78b 100644
--- a/OpenSim/Grid/AssetServer/RestService.cs
+++ b/OpenSim/Grid/AssetServer/RestService.cs
@@ -45,14 +45,14 @@ namespace OpenSim.Grid.AssetServer
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 46
47 // private OpenAsset_Main m_assetManager; 47 // private OpenAsset_Main m_assetManager;
48 private IAssetProvider m_assetProvider; 48 private IAssetProviderPlugin m_assetProvider;
49 49
50 /// <summary> 50 /// <summary>
51 /// Constructor. 51 /// Constructor.
52 /// </summary> 52 /// </summary>
53 /// <param name="assetManager"></param> 53 /// <param name="assetManager"></param>
54 /// <param name="assetProvider"></param> 54 /// <param name="assetProvider"></param>
55 public GetAssetStreamHandler(OpenAsset_Main assetManager, IAssetProvider assetProvider) 55 public GetAssetStreamHandler(OpenAsset_Main assetManager, IAssetProviderPlugin assetProvider)
56 : base("GET", "/assets") 56 : base("GET", "/assets")
57 { 57 {
58 m_log.Info("[REST]: In Get Request"); 58 m_log.Info("[REST]: In Get Request");
@@ -121,7 +121,7 @@ namespace OpenSim.Grid.AssetServer
121 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 121 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
122 122
123 // private OpenAsset_Main m_assetManager; 123 // private OpenAsset_Main m_assetManager;
124 private IAssetProvider m_assetProvider; 124 private IAssetProviderPlugin m_assetProvider;
125 125
126 public override byte[] Handle(string path, Stream request, 126 public override byte[] Handle(string path, Stream request,
127 OSHttpRequest httpRequest, OSHttpResponse httpResponse) 127 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
@@ -142,7 +142,7 @@ namespace OpenSim.Grid.AssetServer
142 return new byte[] {}; 142 return new byte[] {};
143 } 143 }
144 144
145 public PostAssetStreamHandler(OpenAsset_Main assetManager, IAssetProvider assetProvider) 145 public PostAssetStreamHandler(OpenAsset_Main assetManager, IAssetProviderPlugin assetProvider)
146 : base("POST", "/assets") 146 : base("POST", "/assets")
147 { 147 {
148 // m_assetManager = assetManager; 148 // m_assetManager = assetManager;
diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs
index 98e670f..3101a38 100644
--- a/OpenSim/Grid/GridServer/GridManager.cs
+++ b/OpenSim/Grid/GridServer/GridManager.cs
@@ -67,13 +67,10 @@ namespace OpenSim.Grid.GridServer
67 PluginLoader<ILogDataPlugin> logloader = 67 PluginLoader<ILogDataPlugin> logloader =
68 new PluginLoader<ILogDataPlugin> (new LogDataInitialiser (connect)); 68 new PluginLoader<ILogDataPlugin> (new LogDataInitialiser (connect));
69 69
70 gridloader.AddExtensionPoint ("/OpenSim/GridData");
71 logloader.AddExtensionPoint ("/OpenSim/LogData");
72
73 // loader will try to load all providers (MySQL, MSSQL, etc) 70 // loader will try to load all providers (MySQL, MSSQL, etc)
74 // unless it is constrainted to the correct "Provider" entry in the addin.xml 71 // unless it is constrainted to the correct "Provider" entry in the addin.xml
75 gridloader.AddFilter ("/OpenSim/GridData", new PluginProviderFilter (provider)); 72 gridloader.Add ("/OpenSim/GridData", new PluginProviderFilter (provider));
76 logloader.AddFilter ("/OpenSim/LogData", new PluginProviderFilter (provider)); 73 logloader.Add ("/OpenSim/LogData", new PluginProviderFilter (provider));
77 74
78 gridloader.Load(); 75 gridloader.Load();
79 logloader.Load(); 76 logloader.Load();