aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs
diff options
context:
space:
mode:
authorMelanie2009-08-20 21:45:49 +0100
committerMelanie2009-08-20 21:45:49 +0100
commitb23160a871fe6a28105d39c9602c35cda75efe4a (patch)
tree43c8d839a3bf6016a1d621d814cfd9d670b068b2 /OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs
parentRemove a load-order dependency in inventory transfer that was biting (diff)
downloadopensim-SC_OLD-b23160a871fe6a28105d39c9602c35cda75efe4a.zip
opensim-SC_OLD-b23160a871fe6a28105d39c9602c35cda75efe4a.tar.gz
opensim-SC_OLD-b23160a871fe6a28105d39c9602c35cda75efe4a.tar.bz2
opensim-SC_OLD-b23160a871fe6a28105d39c9602c35cda75efe4a.tar.xz
Remove the AssetInventory server from core. It has fallen behind both
upstream and the reference implementation to the point where it is no longer usable. It has no known users, and sinnce it doesn't work anymore, it is safe to assume that no one has used it in a long time.
Diffstat (limited to 'OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs')
-rw-r--r--OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs216
1 files changed, 0 insertions, 216 deletions
diff --git a/OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs b/OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs
deleted file mode 100644
index 16b9d9e..0000000
--- a/OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs
+++ /dev/null
@@ -1,216 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using OpenSim.Framework;
32using OpenSim.Framework.Servers;
33using OpenSim.Framework.Servers.HttpServer;
34using OpenSim.Framework.Console;
35using OpenSim.Framework.AssetLoader.Filesystem;
36using Nini.Config;
37using log4net;
38
39namespace OpenSim.Grid.AssetInventoryServer
40{
41 public class AssetInventoryServer : BaseOpenSimServer
42 {
43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 public IConfigSource ConfigFile;
45
46 public IAssetStorageProvider StorageProvider;
47 public IInventoryStorageProvider InventoryProvider;
48 public IAuthenticationProvider AuthenticationProvider;
49 public IAuthorizationProvider AuthorizationProvider;
50 public IMetricsProvider MetricsProvider;
51
52 private List<IAssetInventoryServerPlugin> m_frontends = new List<IAssetInventoryServerPlugin>();
53 private List<IAssetInventoryServerPlugin> m_backends = new List<IAssetInventoryServerPlugin>();
54
55 public AssetInventoryServer(IConfigSource config)
56 {
57 ConfigFile = config;
58
59 m_console = new LocalConsole("AssetInventory");
60 MainConsole.Instance = m_console;
61 }
62
63 public bool Start()
64 {
65 Startup();
66 m_log.Info("[ASSETINVENTORY]: Starting AssetInventory Server");
67
68 try
69 {
70 ConfigFile = AssetInventoryConfig.LoadConfig(ConfigFile);
71 }
72 catch (Exception)
73 {
74 m_log.Error("[ASSETINVENTORY]: Failed to load the config.");
75 return false;
76 }
77
78 StorageProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/AssetStorageProvider",
79 "asset_storage_provider", false) as IAssetStorageProvider;
80 m_backends.Add(StorageProvider);
81
82 InventoryProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/InventoryStorageProvider",
83 "inventory_storage_provider", false) as IInventoryStorageProvider;
84 m_backends.Add(InventoryProvider);
85
86 MetricsProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/MetricsProvider",
87 "metrics_provider", false) as IMetricsProvider;
88 m_backends.Add(MetricsProvider);
89
90 try
91 {
92 InitHttpServer((uint) ConfigFile.Configs["Config"].GetInt("listen_port"));
93 }
94 catch (Exception ex)
95 {
96 m_log.Error("[ASSETINVENTORY]: Initializing the HTTP server failed, shutting down: " + ex.Message);
97 Shutdown();
98 return false;
99 }
100
101 LoadDefaultAssets();
102
103 AuthenticationProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/AuthenticationProvider",
104 "authentication_provider", false) as IAuthenticationProvider;
105 m_backends.Add(AuthenticationProvider);
106
107 AuthorizationProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/AuthorizationProvider",
108 "authorization_provider", false) as IAuthorizationProvider;
109 m_backends.Add(AuthorizationProvider);
110
111 m_frontends.AddRange(LoadAssetInventoryServerPlugins("/OpenSim/AssetInventoryServer/Frontend", "frontends"));
112
113 // Inform the user if we don't have any frontends at this point.
114 if (m_frontends.Count == 0)
115 m_log.Info("[ASSETINVENTORY]: Starting with no frontends loaded, which isn't extremely useful. Did you set the 'frontends' configuration parameter?");
116
117 return true;
118 }
119
120 public void Work()
121 {
122 m_console.Output("Enter help for a list of commands");
123
124 while (true)
125 {
126 m_console.Prompt();
127 }
128 }
129
130 public override void ShutdownSpecific()
131 {
132 foreach (IAssetInventoryServerPlugin plugin in m_frontends)
133 {
134 m_log.Debug("[ASSETINVENTORY]: Disposing plugin " + plugin.Name);
135 try { plugin.Dispose(); }
136 catch (Exception ex)
137 { m_log.ErrorFormat("[ASSETINVENTORY]: Failure shutting down plugin {0}: {1}", plugin.Name, ex.Message); }
138 }
139
140 foreach (IAssetInventoryServerPlugin plugin in m_backends)
141 {
142 m_log.Debug("[ASSETINVENTORY]: Disposing plugin " + plugin.Name);
143 try { plugin.Dispose(); }
144 catch (Exception ex)
145 { m_log.ErrorFormat("[ASSETINVENTORY]: Failure shutting down plugin {0}: {1}", plugin.Name, ex.Message); }
146 }
147
148 if (HttpServer != null)
149 HttpServer.Stop();
150 }
151
152 void InitHttpServer(uint port)
153 {
154 m_httpServer = new BaseHttpServer(port);
155 m_httpServer.Start();
156
157 m_log.Info("[ASSETINVENTORY]: AssetInventory server is listening on port " + port);
158 }
159
160 private IAssetInventoryServerPlugin LoadAssetInventoryServerPlugin(string addinPath, string configParam, bool optional)
161 {
162 IAssetInventoryServerPlugin result = null;
163 List<IAssetInventoryServerPlugin> plugins = LoadAssetInventoryServerPlugins(addinPath, configParam);
164
165 if (plugins.Count == 1)
166 {
167 result = plugins[0];
168 }
169 else if (plugins.Count > 1)
170 {
171 m_log.ErrorFormat("[ASSETINVENTORY]: Only 1 plugin expected for extension point '{0}', {1} plugins loaded. Check the '{2}' parameter in the config file.",
172 addinPath, plugins.Count, configParam);
173 Shutdown();
174 Environment.Exit(0);
175 }
176 else if (!optional)
177 {
178 m_log.ErrorFormat("[ASSETINVENTORY]: The extension point '{0}' is not optional. Check the '{1}' parameter in the config file.", addinPath, configParam);
179 Shutdown();
180 Environment.Exit(0);
181 }
182
183 return result;
184 }
185
186 private List<IAssetInventoryServerPlugin> LoadAssetInventoryServerPlugins(string addinPath, string configParam)
187 {
188 PluginLoader<IAssetInventoryServerPlugin> loader = new PluginLoader<IAssetInventoryServerPlugin>(new AssetInventoryServerPluginInitialiser(this));
189 loader.Add(addinPath, new PluginIdFilter(ConfigFile.Configs["Plugins"].GetString(configParam)));
190
191 try
192 {
193 loader.Load();
194 }
195 catch (PluginNotInitialisedException e)
196 {
197 m_log.ErrorFormat("[ASSETINVENTORY]: Error initialising plugin '{0}' for extension point '{1}'.", e.Message, addinPath);
198 Shutdown();
199 Environment.Exit(0);
200 }
201
202 return loader.Plugins;
203 }
204
205 private void LoadDefaultAssets()
206 {
207 AssetLoaderFileSystem assetLoader = new AssetLoaderFileSystem();
208 assetLoader.ForEachDefaultXmlAsset(ConfigFile.Configs["Config"].GetString("assetset_location"), StoreAsset);
209 }
210
211 private void StoreAsset(AssetBase asset)
212 {
213 StorageProvider.TryCreateAsset(asset);
214 }
215 }
216}